diff -Nru python-neutronclient-6.7.0/AUTHORS python-neutronclient-6.11.0/AUTHORS --- python-neutronclient-6.7.0/AUTHORS 2018-01-26 00:35:18.000000000 +0000 +++ python-neutronclient-6.11.0/AUTHORS 2018-11-15 14:29:19.000000000 +0000 @@ -34,6 +34,7 @@ Bradley Klein Brandon Logan Brandon Palm +Brian Haley Brian Haley Brian Waldon Cao Xuan Hoang @@ -42,6 +43,7 @@ Carlos D. Garza Carlos Goncalves Cedric Brandily +Chen Chris Krelle Chris Yeoh Christian Berendt @@ -80,6 +82,8 @@ Gal Sagie Gary Kotton Gary Kotton +German Eichberger +Gleb Zimin Gábor Antal Haim Daniel Hangdong Zhang @@ -107,6 +111,7 @@ Jason Zhang Jaspinder Jaume Devesa +Jens Harbott Jeremy Liu Jeremy Stanley Jesse Proudman @@ -124,12 +129,14 @@ Kenji Yasui Kevin Benton Kevin Benton +Kim Bao Long Koteswara Rao Kelam Kyle Mestery Kyle Mestery LIU Yulong Lokesh S Lucas H. Xu +Lucian Petrut M V P Nitesh Madhav Puri Manjeet Singh Bhatia @@ -146,10 +153,12 @@ Mitsuru Kanabuchi Mohankumar Monty Taylor +Mykola Yakovliev Na Nachi Ueno Nachi Ueno Nandini Tata +Nguyen Hai Nikola Dipanov Nikolas Hermanns Oleg Bondarev @@ -214,11 +223,15 @@ Thomas Morin Tin Lam Toshiaki Higuchi +Tovin Seven Ukesh Kumar Vasudevan Vic Howard +Vieri <15050873171@163.com> Vikash082 Vikram Hosakote +Vu Cong Tuan Wu Wenxiang +XiaojueGuan Xu Han Peng Xuhan Peng Yaguang Tang @@ -237,10 +250,10 @@ ZhiQiang Fan Zhongcheng Lao Zhongyue Luo -Zuul armando-migliaccio arosen changzhi +chenyaguang cshahani da52700 dekehn @@ -254,6 +267,7 @@ hobo.kengo huangtianhua ivan-zhu +jessegler ji-xuepeng jichenjc karthik s @@ -266,6 +280,7 @@ liuweicai llg8212 mathieu-rohon +mid_one minwang mohankumar_n nick.zhuyj @@ -290,6 +305,7 @@ watanabe.isao watsalya wengjiangang +wu.chunyang xiaosheng xiewj yong sheng gong diff -Nru python-neutronclient-6.7.0/ChangeLog python-neutronclient-6.11.0/ChangeLog --- python-neutronclient-6.7.0/ChangeLog 2018-01-26 00:35:18.000000000 +0000 +++ python-neutronclient-6.11.0/ChangeLog 2018-11-15 14:29:19.000000000 +0000 @@ -1,11 +1,85 @@ CHANGES ======= +6.11.0 +------ + +* Fix docstring in method list\_routers\_on\_l3\_agent +* Fix docstring in method list\_networks\_on\_dhcp\_agent +* Fix api version handling, which completely breaks the client +* Don't quote {posargs} in tox.ini +* Adds the destination and source fwg to fwr +* Use templates for cover and lower-constraints +* Consolidate irrelevant files added for py3 project +* Switch to stestr + +6.10.0 +------ + +* Ensure API calls for subnets are in URL length limit +* add lib-forward-testing-python3 test job +* add python 3.6 unit test job +* switch documentation job to new PTI +* import zuul job settings from project-config +* fix tox python3 overrides +* [log] Add 'firewall\_group' as a loggable resource type for logging +* Add B303 into list of skipped bandit plugins +* Fix broken unittests +* Update reno for stable/rocky +* Add release note link in README +* Add bandit to pep8 gate +* Update links in README + +6.9.0 +----- + +* Remove PyPI downloads +* Trivial: Update pypi url to new url +* Set or unset port pair group failed +* Replace insecure function eval +* Fix pep8 error +* Fix list bgp speaker by agent ID +* Add oslo.log to requirements.txt +* Follow the new PTI for document build +* Fix incompatible requirement in lower-constraints + +6.8.0 +----- + +* Remove mox3 from test-requirements.txt +* Remove mox/mox3 usage from test\_cli20.py +* Remove mox/mox3 usage from lb modules +* Remove mox/mox3 usage from fw modules +* Remove mox/mox3 usage from bgp +* Remove mox/mox3 from test\_cli20\_address\_scope.py +* Remove mox/mox3 from test\_cli20\_agentschedulers.py +* Rename python-openstacksdk to openstacksdk +* Updated from global requirements +* add lower-constraints job +* Remove mox/mox3 usage from test\_cli20\_securitygroup.py +* Remove mox/mox3 usage from test\_cli20\_subnet.py +* Remove mox/mox3 usage from test\_cli20\_subnetpool.py +* Remove mox/mox3 usage from test\_cli20\_network.py +* Updated from global requirements +* Remove mox/mox3 usage from test\_name\_or\_id.py +* Remove mox/mox3 usage from test\_cli20\_port.py +* Fix the assertion of standard error text +* Remove mox/mox3 usage from test\_cli20\_tag +* Remove mox/mox3 usage from test\_quota +* Updated from global requirements +* Remove bogus ID column from ListRoutesAdvertisedBySpeaker +* Updated from global requirements +* Drop neutronclient-specific cliff sphinx extension +* Consume column utils from osc-lib +* Update reno for stable/queens + 6.7.0 ----- * Fix broken links +* Updated from global requirements * Define IpAddressAlreadyAllocated exception +* osc, bgpvpn: add support for 'local\_pref' BGPVPN attribute * Add commands to support BGP VPN route control new API extension * Updated from global requirements * VNI support in BGPVPN CLI @@ -14,6 +88,7 @@ * Add Logging commands for OSC plugin * Add 'revision\_number' to update\_\* API * Pass headers to httpclient +* Enable VPNaaS functional tests in the neutronclient gate * Updated from global requirements * Updated from global requirements * Remove a workaround for osc-lib in FWaaS UT diff -Nru python-neutronclient-6.7.0/debian/changelog python-neutronclient-6.11.0/debian/changelog --- python-neutronclient-6.7.0/debian/changelog 2018-02-12 14:30:22.000000000 +0000 +++ python-neutronclient-6.11.0/debian/changelog 2020-02-11 14:11:58.000000000 +0000 @@ -1,3 +1,71 @@ +python-neutronclient (1:6.11.0-0ubuntu1~cloud0) bionic-stein; urgency=medium + + * New upstream release for the Ubuntu Cloud Archive. + + -- Openstack Ubuntu Testing Bot Tue, 11 Feb 2020 14:11:58 +0000 + +python-neutronclient (1:6.11.0-0ubuntu1) disco; urgency=medium + + * New upstream release for OpenStack Stein. + * d/control: Align (Build-)Depends with upstream. + + -- Corey Bryant Wed, 30 Jan 2019 10:17:58 -0500 + +python-neutronclient (1:6.9.0-0ubuntu1) cosmic; urgency=medium + + * New upstream release for OpenStack Rocky. + * d/control: Align (Build-)Depends with upstream. + + -- Corey Bryant Wed, 01 Aug 2018 14:36:21 -0400 + +python-neutronclient (1:6.8.0-0ubuntu1) cosmic; urgency=low + + * Merge from Debian unstable. Remaining changes: + - d/gbp.conf: Retain for gbp and pristine-tar config. + - d/control: Enable autopkgtest-pkg-python testsuite. + - d/control, d/compat: Bump debhelper compat to 10. + - d/watch: Get tarball from tarballs.openstack.org. + - d/p/allow-babel-2.4.0.patch: Drop blacklist of Babel 2.4.0 as the + version in Ubuntu is fixed. + * New upstream release. + * d/control: Align (Build-)Depends with upstream. + + -- Corey Bryant Tue, 12 Jun 2018 10:36:22 -0400 + +python-neutronclient (1:6.7.0-4) unstable; urgency=medium + + [ Ondřej Nový ] + * d/control: Remove XS-Testsuite field, not needed anymore + + [ Thomas Goirand ] + * Fixed Python 3 shebang. + + -- Thomas Goirand Sun, 18 Mar 2018 18:30:32 +0000 + +python-neutronclient (1:6.7.0-3) unstable; urgency=medium + + * Python 3 has now priority over Python 2. + + -- Thomas Goirand Sun, 11 Mar 2018 13:13:05 +0100 + +python-neutronclient (1:6.7.0-2) unstable; urgency=medium + + * Uploading to unstable. + + -- Thomas Goirand Sun, 25 Feb 2018 21:54:23 +0000 + +python-neutronclient (1:6.7.0-1) experimental; urgency=medium + + [ Ondřej Nový ] + * d/control: Set Vcs-* to salsa.debian.org + + [ Thomas Goirand ] + * New upstream release. + * Fixed (build-)depends for this release. + * Standards-Version is now 4.1.3. + + -- Thomas Goirand Tue, 13 Feb 2018 20:58:34 +0000 + python-neutronclient (1:6.7.0-0ubuntu1) bionic; urgency=medium * New upstream release. @@ -21,6 +89,37 @@ -- Corey Bryant Wed, 24 Jan 2018 16:07:01 -0500 +python-neutronclient (1:6.5.0-2) unstable; urgency=medium + + * Uploading to unstable. + + -- Thomas Goirand Thu, 02 Nov 2017 00:04:14 +0000 + +python-neutronclient (1:6.5.0-1) experimental; urgency=medium + + [ Ondřej Nový ] + * Standards-Version is 3.9.8 now (no change) + * d/copyright: Changed source URL to https protocol + + [ Daniel Baumann ] + * Updating vcs fields. + * Updating copyright format url. + * Running wrap-and-sort -bast. + * Updating maintainer field. + * Updating standards version to 4.0.0. + * Removing gbp.conf, not used anymore or should be specified in the + developers dotfiles. + * Correcting permissions in debian packaging files. + * Updating standards version to 4.0.1. + * Updating standards version to 4.1.0. + + [ Thomas Goirand ] + * New upstream release. + * Fixed (build-)depends for this release. + * Using pkgos-dh_auto_{install,test}. + + -- Thomas Goirand Tue, 03 Oct 2017 12:55:42 +0200 + python-neutronclient (1:6.5.0-0ubuntu1.1) artful; urgency=medium * d/rules: include neutron bash completion helper in python-neutronclient @@ -230,3 +329,4 @@ problem. -- Thomas Goirand Sat, 20 Jul 2013 20:21:03 +0800 + diff -Nru python-neutronclient-6.7.0/debian/control python-neutronclient-6.11.0/debian/control --- python-neutronclient-6.7.0/debian/control 2018-02-12 14:30:22.000000000 +0000 +++ python-neutronclient-6.11.0/debian/control 2019-01-30 15:17:58.000000000 +0000 @@ -2,77 +2,82 @@ Section: python Priority: optional Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: PKG OpenStack +XSBC-Original-Maintainer: Debian OpenStack Uploaders: Thomas Goirand , Build-Depends: - debhelper (>= 10~), + debhelper (>= 10), dh-python, openstack-pkg-tools, python-all, python-pbr (>= 2.0.0), python-setuptools, - python-sphinx (>= 1.6.2), python3-all, python3-pbr (>= 2.0.0), python3-setuptools, python3-sphinx (>= 1.6.2), Build-Depends-Indep: python-babel (>= 2.3.4), + python-bandit (>= 1.1.0), python-cliff (>= 2.8.0), python-coverage (>= 4.0), python-debtcollector (>= 1.2.0), python-fixtures (>= 3.0.0), python-hacking (>= 0.12.0), python-iso8601 (>= 0.1.11), - python-keystoneauth1 (>= 3.3.0), + python-keystoneauth1 (>= 3.4.0), python-keystoneclient (>= 1:3.8.0), python-mock (>= 2.0.0), python-mox3 (>= 0.20.0), python-netaddr (>= 0.7.18), python-openstackclient (>= 3.12.0), - python-openstackdocstheme (>= 1.17.0), python-os-client-config (>= 1.28.0), python-osc-lib (>= 1.8.0), python-oslo.i18n (>= 3.15.3), + python-oslo.log (>= 3.36.0), python-oslo.serialization (>= 2.18.0), python-oslo.utils (>= 3.33.0), python-oslotest (>= 1:3.2.0), - python-osprofiler (>= 1.4.0), + python-osprofiler (>= 2.3.0), python-requests (>= 2.14.2), - python-requests-mock (>= 1.1.0), + python-requests-mock (>= 1.2.0), python-simplejson (>= 3.5.1), python-six (>= 1.10.0), + python-stestr (>= 2.0.0), python-subunit (>= 1.0.0), python-tempest (>= 1:17.1.0), python-testrepository (>= 0.0.18), python-testscenarios (>= 0.4), python-testtools (>= 2.2.0), python3-babel (>= 2.3.4), + python3-bandit (>= 1.1.0), python3-cliff (>= 2.8.0), python3-coverage (>= 4.0), python3-debtcollector (>= 1.2.0), python3-fixtures (>= 3.0.0), python3-hacking (>= 0.12.0), python3-iso8601 (>= 0.1.11), - python3-keystoneauth1 (>= 3.3.0), + python3-keystoneauth1 (>= 3.4.0), python3-keystoneclient (>= 1:3.8.0), python3-mock (>= 2.0.0), python3-mox3 (>= 0.20.0), python3-netaddr (>= 0.7.18), python3-openstackclient (>= 3.12.0), - python3-openstackdocstheme (>= 1.17.0), + python3-openstackdocstheme (>= 1.18.1), python3-os-client-config (>= 1.28.0), python3-osc-lib (>= 1.8.0), python3-oslo.i18n (>= 3.15.3), + python3-oslo.log (>= 3.36.0), python3-oslo.serialization (>= 2.18.0), python3-oslo.utils (>= 3.33.0), python3-oslotest (>= 1:3.2.0), - python3-osprofiler (>= 1.4.0), + python3-osprofiler (>= 2.3.0), + python3-reno (>= 2.5.0), python3-requests (>= 2.14.2), - python3-requests-mock (>= 1.1.0), + python3-requests-mock (>= 1.2.0), python3-simplejson (>= 3.5.1), python3-six (>= 1.10.0), + python3-stestr (>= 2.0.0), python3-subunit (>= 1.0.0), python3-tempest (>= 1:17.1.0), python3-testrepository (>= 0.0.18), @@ -80,11 +85,11 @@ python3-testtools (>= 2.2.0), subunit, testrepository, -Standards-Version: 4.1.2 +Standards-Version: 4.1.3 Vcs-Browser: https://git.launchpad.net/~ubuntu-server-dev/ubuntu/+source/python-neutronclient -Vcs-Git: git://git.launchpad.net/~ubuntu-server-dev/ubuntu/+source/python-neutronclient +Vcs-Git: https://git.launchpad.net/~ubuntu-server-dev/ubuntu/+source/python-neutronclient Homepage: https://launchpad.net/python-neutronclient -XS-Testsuite: autopkgtest +Testsuite: autopkgtest-pkg-python Package: python-neutronclient Architecture: all @@ -93,12 +98,13 @@ python-cliff (>= 2.8.0), python-debtcollector (>= 1.2.0), python-iso8601 (>= 0.1.11), - python-keystoneauth1 (>= 3.3.0), + python-keystoneauth1 (>= 3.4.0), python-keystoneclient (>= 1:3.8.0), python-netaddr (>= 0.7.18), python-os-client-config (>= 1.28.0), python-osc-lib (>= 1.8.0), python-oslo.i18n (>= 3.15.3), + python-oslo.log (>= 3.36.0), python-oslo.serialization (>= 2.18.0), python-oslo.utils (>= 3.33.0), python-pbr (>= 2.0.0), @@ -122,12 +128,13 @@ python3-cliff (>= 2.8.0), python3-debtcollector (>= 1.2.0), python3-iso8601 (>= 0.1.11), - python3-keystoneauth1 (>= 3.3.0), + python3-keystoneauth1 (>= 3.4.0), python3-keystoneclient (>= 1:3.8.0), python3-netaddr (>= 0.7.18), python3-os-client-config (>= 1.28.0), python3-osc-lib (>= 1.8.0), python3-oslo.i18n (>= 3.15.3), + python3-oslo.log (>= 3.36.0), python3-oslo.serialization (>= 2.18.0), python3-oslo.utils (>= 3.33.0), python3-pbr (>= 2.0.0), diff -Nru python-neutronclient-6.7.0/debian/copyright python-neutronclient-6.11.0/debian/copyright --- python-neutronclient-6.7.0/debian/copyright 2018-02-12 14:30:22.000000000 +0000 +++ python-neutronclient-6.11.0/debian/copyright 2019-01-30 15:17:58.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: python-neutronclient Source: https://github.com/openstack/python-neutronclient diff -Nru python-neutronclient-6.7.0/debian/python3-neutronclient.postinst python-neutronclient-6.11.0/debian/python3-neutronclient.postinst --- python-neutronclient-6.7.0/debian/python3-neutronclient.postinst 2018-02-12 14:30:22.000000000 +0000 +++ python-neutronclient-6.11.0/debian/python3-neutronclient.postinst 2019-01-30 15:17:58.000000000 +0000 @@ -3,7 +3,7 @@ set -e if [ "$1" = "configure" ] ; then - update-alternatives --install /usr/bin/neutron neutron /usr/bin/python3-neutron 200 + update-alternatives --install /usr/bin/neutron neutron /usr/bin/python3-neutron 400 fi #DEBHELPER# diff -Nru python-neutronclient-6.7.0/debian/rules python-neutronclient-6.11.0/debian/rules --- python-neutronclient-6.7.0/debian/rules 2018-02-12 14:30:22.000000000 +0000 +++ python-neutronclient-6.11.0/debian/rules 2019-01-30 15:17:58.000000000 +0000 @@ -1,42 +1,17 @@ #!/usr/bin/make -f -PYTHONS:=$(shell pyversions -vr) -PYTHON3S:=$(shell py3versions -vr) - include /usr/share/openstack-pkg-tools/pkgos.make -export OSLO_PACKAGE_VERSION=$(VERSION) %: dh $@ --buildsystem=python_distutils --with python2,python3 override_dh_auto_install: - set -e ; for pyvers in $(PYTHONS); do \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python-neutronclient; \ - done - set -e ; for pyvers in $(PYTHON3S); do \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python3-neutronclient; \ - done - rm -f $(CURDIR)/debian/python*/usr/lib/python*/dist-packages/*.pth - install -D -m 0644 tools/neutron.bash_completion $(CURDIR)/debian/python-neutronclient/usr/share/bash-completion/completions/neutron - mv $(CURDIR)/debian/python-neutronclient/usr/bin/neutron $(CURDIR)/debian/python-neutronclient/usr/bin/python2-neutron - mv $(CURDIR)/debian/python3-neutronclient/usr/bin/neutron $(CURDIR)/debian/python3-neutronclient/usr/bin/python3-neutron + pkgos-dh_auto_install + install -D -m 0644 tools/neutron.bash_completion $(CURDIR)/debian/python-neutronclient-doc/usr/share/bash-completion/completions/neutron ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) override_dh_auto_test: - @echo "===> Running tests" - set -e ; set -x ; for i in 2.7 $(PYTHON3S) ; do \ - PYMAJOR=`echo $$i | cut -d'.' -f1` ; \ - echo "===> Testing with python$$i (python$$PYMAJOR)" ; \ - rm -rf .testrepository ; \ - testr-python$$PYMAJOR init ; \ - TEMP_REZ=`mktemp -t` ; \ - PYTHONPATH=$(CURDIR) PYTHON=python$$i testr-python$$PYMAJOR run --subunit 'neutronclient\.tests\.unit\.(?!(.*test_cli20_port\.CLITestV20PortJSON\.test_list_ports_with_fixed_ips_in_csv.*|.*test_cli20_port\.CLITestV20PortXML\.test_list_ports_with_fixed_ips_in_csv.*))' | tee $$TEMP_REZ | subunit2pyunit ; \ - cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \ - rm -f $$TEMP_REZ ; \ - testr-python$$PYMAJOR slowest ; \ - done + pkgos-dh_auto_test 'neutronclient\.tests\.unit\.(?!(.*test_cli20_port\.CLITestV20PortJSON\.test_list_ports_with_fixed_ips_in_csv.*|.*test_cli20_port\.CLITestV20PortXML\.test_list_ports_with_fixed_ips_in_csv.*|.*test_shell.*))' endif override_dh_auto_clean: @@ -49,6 +24,9 @@ # dh_installman -O--buildsystem=python_distutils #endif +override_dh_python3: + dh_python3 --shebang=/usr/bin/python3 + # Commands not to run override_dh_installcatalogs: override_dh_installemacsen override_dh_installifupdown: diff -Nru python-neutronclient-6.7.0/doc/requirements.txt python-neutronclient-6.11.0/doc/requirements.txt --- python-neutronclient-6.7.0/doc/requirements.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/doc/requirements.txt 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,6 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +openstackdocstheme>=1.18.1 # Apache-2.0 +reno>=2.5.0 # Apache-2.0 +sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD diff -Nru python-neutronclient-6.7.0/doc/source/cli/neutron-reference.rst python-neutronclient-6.11.0/doc/source/cli/neutron-reference.rst --- python-neutronclient-6.7.0/doc/source/cli/neutron-reference.rst 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/doc/source/cli/neutron-reference.rst 2018-11-15 14:27:38.000000000 +0000 @@ -36,7 +36,7 @@ neutron usage ------------- -.. cliff-app:: neutronclient.shell.NeutronShell +.. autoprogram-cliff:: neutronclient.shell.NeutronShell :application: neutron :arguments: 2.0 diff -Nru python-neutronclient-6.7.0/doc/source/conf.py python-neutronclient-6.11.0/doc/source/conf.py --- python-neutronclient-6.7.0/doc/source/conf.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/doc/source/conf.py 2018-11-15 14:27:38.000000000 +0000 @@ -9,10 +9,7 @@ 'sphinx.ext.autodoc', 'reno.sphinxext', 'openstackdocstheme', - # 'cliff.sphinxext', - # TODO(amotoki): Switch to cliff.sphinxext once cliff bug is fixed. - # https://bugs.launchpad.net/python-cliff/+bug/1692018 - 'neutronclient.cliff_sphinxext', + 'cliff.sphinxext', ] # openstackdocstheme options diff -Nru python-neutronclient-6.7.0/doc/source/contributor/transition_to_osc.rst python-neutronclient-6.11.0/doc/source/contributor/transition_to_osc.rst --- python-neutronclient-6.7.0/doc/source/contributor/transition_to_osc.rst 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/doc/source/contributor/transition_to_osc.rst 2018-11-15 14:27:38.000000000 +0000 @@ -27,7 +27,7 @@ OpenStack Networking API support, both the Python library and the ``neutron`` command-line interface (CLI), to the `OpenStack Client (OSC) `_ -and the `OpenStack Python SDK `_. +and the `OpenStack Python SDK `_. This transition is being guided by the `Deprecate individual CLIs in favour of OSC `_ OpenStack spec. See the `Neutron RFE `_, @@ -151,7 +151,7 @@ **Where does my CLI belong?** -If you are developing an API in any of the `neutron repos `_ +If you are developing an API in any of the `neutron repos `_ the client-side support must be generally located in either the openstackclient or neutronclient repos. Whether the actual code goes into one or the other repo it depends on the nature of the feature, its maturity level, and/or the depth of feedback required during the development. @@ -184,7 +184,7 @@ +-------------------------------------------------+-----------------------------------------------+ | OpenStack Project for ``openstack`` Commands | Python Library to Change | +=================================================+===============================================+ -| python-openstackclient | python-openstacksdk | +| python-openstackclient | openstacksdk | +-------------------------------------------------+-----------------------------------------------+ | python-neutronclient | python-neutronclient | +-------------------------------------------------+-----------------------------------------------+ diff -Nru python-neutronclient-6.7.0/lower-constraints.txt python-neutronclient-6.11.0/lower-constraints.txt --- python-neutronclient-6.7.0/lower-constraints.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/lower-constraints.txt 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,120 @@ +alabaster==0.7.10 +amqp==2.1.1 +appdirs==1.3.0 +asn1crypto==0.23.0 +Babel==2.3.4 +cachetools==2.0.0 +cffi==1.7.0 +cliff==2.8.0 +cmd2==0.8.0 +contextlib2==0.4.0 +coverage==4.0 +cryptography==2.1 +debtcollector==1.2.0 +decorator==3.4.0 +deprecation==1.0 +docutils==0.11 +dogpile.cache==0.6.2 +dulwich==0.15.0 +eventlet==0.18.2 +extras==1.0.0 +fasteners==0.7.0 +fixtures==3.0.0 +flake8-import-order==0.12 +flake8==2.5.5 +future==0.16.0 +futurist==1.2.0 +greenlet==0.4.10 +hacking==0.12.0 +idna==2.6 +imagesize==0.7.1 +iso8601==0.1.11 +Jinja2==2.10 +jmespath==0.9.0 +jsonpatch==1.16 +jsonpointer==1.13 +jsonschema==2.6.0 +keystoneauth1==3.4.0 +kombu==4.0.0 +linecache2==1.0.0 +MarkupSafe==1.0 +mccabe==0.2.1 +mock==2.0.0 +monotonic==0.6 +mox3==0.20.0 +msgpack-python==0.4.0 +munch==2.1.0 +netaddr==0.7.18 +netifaces==0.10.4 +openstackdocstheme==1.18.1 +openstacksdk==0.11.2 +os-client-config==1.28.0 +os-service-types==1.2.0 +os-testr==1.0.0 +osc-lib==1.8.0 +oslo.concurrency==3.25.0 +oslo.config==5.2.0 +oslo.context==2.19.2 +oslo.i18n==3.15.3 +oslo.log==3.36.0 +oslo.messaging==5.29.0 +oslo.middleware==3.31.0 +oslo.serialization==2.18.0 +oslo.service==1.24.0 +oslo.utils==3.33.0 +oslotest==3.2.0 +osprofiler==2.3.0 +paramiko==2.0.0 +Paste==2.0.2 +PasteDeploy==1.5.0 +pbr==2.0.0 +pep8==1.5.7 +pika-pool==0.1.3 +pika==0.10.0 +positional==1.2.1 +prettytable==0.7.2 +pyasn1==0.1.8 +pycodestyle==2.3.1 +pycparser==2.18 +pyflakes==0.8.1 +Pygments==2.2.0 +pyinotify==0.9.6 +pyOpenSSL==17.1.0 +pyparsing==2.1.0 +pyperclip==1.5.27 +python-cinderclient==3.3.0 +python-dateutil==2.5.3 +python-glanceclient==2.8.0 +python-keystoneclient==3.8.0 +python-mimeparse==1.6.0 +python-novaclient==9.1.0 +python-openstackclient==3.12.0 +python-subunit==1.0.0 +pytz==2013.6 +PyYAML==3.12 +reno==2.5.0 +repoze.lru==0.7 +requests-mock==1.2.0 +requests==2.14.2 +requestsexceptions==1.2.0 +rfc3986==0.3.1 +Routes==2.3.1 +simplejson==3.5.1 +six==1.10.0 +snowballstemmer==1.2.1 +Sphinx==1.6.2 +sphinxcontrib-websupport==1.0.1 +statsd==3.2.1 +stestr==2.0.0 +stevedore==1.20.0 +tempest==17.1.0 +tenacity==3.2.1 +testscenarios==0.4 +testtools==2.2.0 +traceback2==1.4.0 +unittest2==1.1.0 +urllib3==1.21.1 +vine==1.1.4 +warlock==1.2.0 +WebOb==1.7.1 +wrapt==1.7.0 diff -Nru python-neutronclient-6.7.0/neutronclient/cliff_sphinxext.py python-neutronclient-6.11.0/neutronclient/cliff_sphinxext.py --- python-neutronclient-6.7.0/neutronclient/cliff_sphinxext.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/cliff_sphinxext.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,385 +0,0 @@ -# Copyright (C) 2017, Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import argparse -import fnmatch -import re - -from docutils import nodes -from docutils.parsers import rst -from docutils.parsers.rst import directives -from docutils import statemachine -from oslo_utils import importutils - -from cliff import commandmanager - - -def _indent(text): - """Indent by four spaces.""" - prefix = ' ' * 4 - - def prefixed_lines(): - for line in text.splitlines(True): - yield (prefix + line if line.strip() else line) - - return ''.join(prefixed_lines()) - - -def _format_description(parser): - """Get parser description. - - We parse this as reStructuredText, allowing users to embed rich - information in their help messages if they so choose. - """ - for line in statemachine.string2lines( - parser.description, tab_width=4, convert_whitespace=True): - yield line - - -def _format_usage(parser): - """Get usage without a prefix.""" - fmt = argparse.HelpFormatter(parser.prog) - - optionals = parser._get_optional_actions() - positionals = parser._get_positional_actions() - groups = parser._mutually_exclusive_groups - - # hacked variant of the regex used by the actual argparse module. Unlike - # that version, this one attempts to group long and short opts with their - # optional arguments ensuring that, for example, '---format ' - # becomes ['--format '] and not ['--format', '']. - # Yes, they really do use regexes to break apart and rewrap their help - # string. Don't ask me why. - part_regexp = r'\(.*?\)+|\[.*?\]+|(?:(?:-\w|--\w+)(?:\s+<\w+>)?)|\S+' - - opt_usage = fmt._format_actions_usage(optionals, groups) - pos_usage = fmt._format_actions_usage(positionals, groups) - - opt_parts = re.findall(part_regexp, opt_usage) - pos_parts = re.findall(part_regexp, pos_usage) - parts = opt_parts + pos_parts - - if len(' '.join([parser.prog] + parts)) < 72: - return [' '.join([parser.prog] + parts)] - - return [parser.prog] + [_indent(x) for x in parts] - - -def _format_epilog(parser): - """Get parser epilog. - - We parse this as reStructuredText, allowing users to embed rich - information in their help messages if they so choose. - """ - for line in statemachine.string2lines( - parser.epilog, tab_width=4, convert_whitespace=True): - yield line - - -def _format_positional_action(action): - """Format a positional action.""" - if action.help == argparse.SUPPRESS: - return - - # NOTE(stephenfin): We strip all types of brackets from 'metavar' because - # the 'option' directive dictates that only option argument names should be - # surrounded by angle brackets - yield '.. option:: {}'.format( - (action.metavar or action.dest).strip('<>[]() ')) - if action.help: - yield '' - for line in statemachine.string2lines( - action.help, tab_width=4, convert_whitespace=True): - yield _indent(line) - - -def _format_optional_action(action): - """Format an optional action.""" - if action.help == argparse.SUPPRESS: - return - - if action.nargs == 0: - yield '.. option:: {}'.format(', '.join(action.option_strings)) - else: - # TODO(stephenfin): At some point, we may wish to provide more - # information about the options themselves, for example, if nargs is - # specified - option_strings = [' '.join( - [x, action.metavar or '<{}>'.format(action.dest.upper())]) - for x in action.option_strings] - yield '.. option:: {}'.format(', '.join(option_strings)) - - if action.help: - yield '' - for line in statemachine.string2lines( - action.help, tab_width=4, convert_whitespace=True): - yield _indent(line) - - -def _format_parser(parser): - """Format the output of an argparse 'ArgumentParser' object. - - Given the following parser:: - - >>> import argparse - >>> parser = argparse.ArgumentParser(prog='hello-world', \ - description='This is my description.', - epilog='This is my epilog') - >>> parser.add_argument('name', help='User name', metavar='') - >>> parser.add_argument('--language', action='store', dest='lang', \ - help='Greeting language') - - Returns the following:: - - This is my description. - - .. program:: hello-world - .. code:: shell - - hello-world [-h] [--language LANG] - - .. option:: name - - User name - - .. option:: --language LANG - - Greeting language - - .. option:: -h, --help - - Show this help message and exit - - This is my epilog. - """ - if parser.description: - for line in _format_description(parser): - yield line - yield '' - - yield '.. program:: {}'.format(parser.prog) - - yield '.. code-block:: shell' - yield '' - for line in _format_usage(parser): - yield _indent(line) - yield '' - - # In argparse, all arguments and parameters are known as "actions". - # Optional actions are what would be known as flags or options in other - # libraries, while positional actions would generally be known as - # arguments. We present these slightly differently. - - for action in parser._get_optional_actions(): - for line in _format_optional_action(action): - yield line - yield '' - - for action in parser._get_positional_actions(): - for line in _format_positional_action(action): - yield line - yield '' - - if parser.epilog: - for line in _format_epilog(parser): - yield line - yield '' - - -class AutoprogramCliffDirective(rst.Directive): - """Auto-document a subclass of `cliff.command.Command`.""" - - has_content = False - required_arguments = 1 - option_spec = { - 'command': directives.unchanged, - 'ignored': directives.unchanged, - 'application': directives.unchanged, - } - - def _load_command(self, manager, command_name): - """Load a command using an instance of a `CommandManager`.""" - try: - # find_command expects the value of argv so split to emulate that - return manager.find_command(command_name.split())[0] - except ValueError: - raise self.error('"{}" is not a valid command in the "{}" ' - 'namespace'.format( - command_name, manager.namespace)) - - def _generate_nodes(self, title, command_name, command_class, - ignored_opts): - """Generate the relevant Sphinx nodes. - - This is a little funky. Parts of this use raw docutils nodes while - other parts use reStructuredText and nested parsing. The reason for - this is simple: it avoids us having to reinvent the wheel. While raw - docutils nodes are helpful for the simpler elements of the output, - they don't provide an easy way to use Sphinx's own directives, such as - the 'option' directive. Refer to [1] for more information. - - [1] http://www.sphinx-doc.org/en/stable/extdev/markupapi.html - - :param title: Title of command - :param command_name: Name of command, as used on the command line - :param command_class: Subclass of :py:class:`cliff.command.Command` - :param prefix: Prefix to apply before command, if any - :param ignored_opts: A list of options to exclude from output, if any - :returns: A list of nested docutil nodes - """ - command = command_class(None, None) - parser = command.get_parser(command_name) - ignored_opts = ignored_opts or [] - - # Drop the automatically-added help action - for action in list(parser._actions): - for option_string in action.option_strings: - if option_string in ignored_opts: - del parser._actions[parser._actions.index(action)] - break - - section = nodes.section( - '', - nodes.title(text=title), - ids=[nodes.make_id(title)], - names=[nodes.fully_normalize_name(title)]) - - source_name = '<{}>'.format(command.__class__.__name__) - result = statemachine.ViewList() - - for line in _format_parser(parser): - result.append(line, source_name) - - self.state.nested_parse(result, 0, section) - - return [section] - - def run(self): - self.env = self.state.document.settings.env - - command_pattern = self.options.get('command') - application_name = (self.options.get('application') - or self.env.config.autoprogram_cliff_application) - - global_ignored = self.env.config.autoprogram_cliff_ignored - local_ignored = self.options.get('ignored', '') - local_ignored = [x.strip() for x in local_ignored.split(',') - if x.strip()] - ignored_opts = list(set(global_ignored + local_ignored)) - - # TODO(sfinucan): We should probably add this wildcarding functionality - # to the CommandManager itself to allow things like "show me the - # commands like 'foo *'" - manager = commandmanager.CommandManager(self.arguments[0]) - if command_pattern: - commands = [x for x in manager.commands - if fnmatch.fnmatch(x, command_pattern)] - else: - commands = manager.commands.keys() - - output = [] - for command_name in sorted(commands): - command_class = self._load_command(manager, command_name) - - title = command_name - if application_name: - command_name = ' '.join([application_name, command_name]) - - output.extend(self._generate_nodes( - title, command_name, command_class, ignored_opts)) - - return output - - -class CliffAppDirective(rst.Directive): - """Auto-document a `cliff.app.App`.""" - - has_content = False - required_arguments = 1 - option_spec = { - 'arguments': directives.unchanged, - 'ignored': directives.unchanged, - 'application': directives.unchanged, - } - - def _generate_nodes(self, title, app, app_name, ignored_opts): - """Generate the relevant Sphinx nodes. - - This is a little funky. Parts of this use raw docutils nodes while - other parts use reStructuredText and nested parsing. The reason for - this is simple: it avoids us having to reinvent the wheel. While raw - docutils nodes are helpful for the simpler elements of the output, - they don't provide an easy way to use Sphinx's own directives, such as - the 'option' directive. Refer to [1] for more information. - - [1] http://www.sphinx-doc.org/en/stable/extdev/markupapi.html - - :param title: Title of command - :param app: Subclass of :py:class`cliff.app.App` - :param app_name: The name of the cliff application. - This is used as the command name. - :param ignored_opts: A list of options to exclude from output, if any - :returns: A list of docutil nodes - """ - parser = app.parser - ignored_opts = ignored_opts or [] - - # Drop the automatically-added help action - for action in list(parser._actions): - for option_string in action.option_strings: - if option_string in ignored_opts: - del parser._actions[parser._actions.index(action)] - break - - parser.prog = app_name - - source_name = '<{}>'.format(app.__class__.__name__) - result = statemachine.ViewList() - for line in _format_parser(parser): - result.append(line, source_name) - - section = nodes.section() - self.state.nested_parse(result, 0, section) - return section.children - - def run(self): - self.env = self.state.document.settings.env - - cliff_app_class = importutils.import_class(self.arguments[0]) - app_arguments = self.options.get('arguments', '').split() - cliff_app = cliff_app_class(*app_arguments) - - application_name = (self.options.get('application') - or self.env.config.autoprogram_cliff_application) - - global_ignored = self.env.config.autoprogram_cliff_ignored - local_ignored = self.options.get('ignored', '') - local_ignored = [x.strip() for x in local_ignored.split(',') - if x.strip()] - ignored_opts = list(set(global_ignored + local_ignored)) - - output = [] - title = application_name - output.extend(self._generate_nodes( - title, cliff_app, application_name, ignored_opts)) - - return output - - -def setup(app): - app.add_directive('autoprogram-cliff', AutoprogramCliffDirective) - app.add_config_value('autoprogram_cliff_application', '', True) - app.add_config_value('autoprogram_cliff_ignored', ['--help'], True) - - app.add_directive('cliff-app', CliffAppDirective) diff -Nru python-neutronclient-6.7.0/neutronclient/neutron/client.py python-neutronclient-6.11.0/neutronclient/neutron/client.py --- python-neutronclient-6.7.0/neutronclient/neutron/client.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/neutron/client.py 2018-11-15 14:27:38.000000000 +0000 @@ -28,7 +28,7 @@ """Returns an neutron client.""" neutron_client = utils.get_client_class( API_NAME, - instance._api_version[API_NAME], + instance._api_version, API_VERSIONS, ) instance.initialize() diff -Nru python-neutronclient-6.7.0/neutronclient/neutron/v2_0/__init__.py python-neutronclient-6.11.0/neutronclient/neutron/v2_0/__init__.py --- python-neutronclient-6.7.0/neutronclient/neutron/v2_0/__init__.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/neutron/v2_0/__init__.py 2018-11-15 14:27:38.000000000 +0000 @@ -185,6 +185,14 @@ current_item = None # the str after 'type=' current_type_str = None + # dict of allowed types + allowed_type_dict = { + 'bool': utils.str2bool, + 'dict': utils.str2dict, + 'int': int, + 'str': str, + } + for _item in values_specs_copy: if _item.startswith('--'): # Deal with previous argument if any @@ -215,12 +223,16 @@ _("Invalid values_specs %s") % ' '.join(values_specs)) if 'type' not in current_arg: current_type_str = _item.split('=', 2)[1] - current_arg.update({'type': eval(current_type_str)}) - if current_type_str == 'bool': - current_arg.update({'type': utils.str2bool}) - elif current_type_str == 'dict': - current_arg.update({'type': utils.str2dict}) - continue + if current_type_str in allowed_type_dict: + current_arg['type'] = allowed_type_dict[current_type_str] + continue + else: + raise exceptions.CommandError( + _("Invalid value_specs {valspec}: type {curtypestr}" + " is not supported").format( + valspec=' '.join(values_specs), + curtypestr=current_type_str)) + elif _item == 'list=true': _list_flag = True continue @@ -240,7 +252,6 @@ if _item.startswith('---'): raise exceptions.CommandError( _("Invalid values_specs %s") % ' '.join(values_specs)) - _values_specs.append(_item) # Deal with last one argument @@ -720,8 +731,8 @@ if parsed_args.formatter == 'table': formatters = self._formatters - elif (parsed_args.formatter == 'csv' - and hasattr(self, '_formatters_csv')): + elif (parsed_args.formatter == 'csv' and + hasattr(self, '_formatters_csv')): formatters = self._formatters_csv else: # For other formatters, we use raw value returned from neutron diff -Nru python-neutronclient-6.7.0/neutronclient/neutron/v2_0/network.py python-neutronclient-6.11.0/neutronclient/neutron/v2_0/network.py --- python-neutronclient-6.7.0/neutronclient/neutron/v2_0/network.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/neutron/v2_0/network.py 2018-11-15 14:27:38.000000000 +0000 @@ -44,6 +44,9 @@ # Length of a query filter on subnet id # id=& (with len(uuid)=36) subnet_id_filter_len = 40 + # Length of a marker in pagination + # &marker= (with len(uuid)=36) + marker_len = 44 resource = 'network' _formatters = {'subnets': _format_subnets, } list_columns = ['id', 'name', 'subnets'] @@ -115,6 +118,8 @@ subnet_count = len(subnet_ids) max_size = ((self.subnet_id_filter_len * subnet_count) - uri_len_exc.excess) + if self.pagination_support: + max_size -= self.marker_len chunk_size = max_size // self.subnet_id_filter_len subnets = [] for i in range(0, subnet_count, chunk_size): diff -Nru python-neutronclient-6.7.0/neutronclient/osc/utils.py python-neutronclient-6.11.0/neutronclient/osc/utils.py --- python-neutronclient-6.7.0/neutronclient/osc/utils.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/utils.py 2018-11-15 14:27:38.000000000 +0000 @@ -20,8 +20,6 @@ to this module. They should go to neutronclient.osc.v2.utils. """ -import operator - from keystoneclient import exceptions as identity_exc from keystoneclient.v3 import domains from keystoneclient.v3 import projects @@ -30,79 +28,6 @@ from neutronclient._i18n import _ -LIST_BOTH = 'both' -LIST_SHORT_ONLY = 'short_only' -LIST_LONG_ONLY = 'long_only' - - -def get_column_definitions(attr_map, long_listing): - """Return table headers and column names for a listing table. - - :param attr_map: a list of table entry definitions. - Each entry should be a tuple consisting of - (API attribute name, header name, listing mode). For example: - (('id', 'ID', LIST_BOTH), - ('name', 'Name', LIST_BOTH), - ('tenant_id', 'Project', LIST_LONG_ONLY)) - The third field of each tuple must be one of LIST_BOTH, - LIST_LONG_ONLY (a corresponding column is shown only in a long mode), or - LIST_SHORT_ONLY (a corresponding column is shown only in a short mode). - :param long_listing: A boolean value which indicates a long listing - or not. In most cases, parsed_args.long is passed to this argument. - :return: A tuple of a list of table headers and a list of column names. - """ - - if long_listing: - headers = [hdr for col, hdr, listing_mode in attr_map - if listing_mode in (LIST_BOTH, LIST_LONG_ONLY)] - columns = [col for col, hdr, listing_mode in attr_map - if listing_mode in (LIST_BOTH, LIST_LONG_ONLY)] - else: - headers = [hdr for col, hdr, listing_mode in attr_map if listing_mode - if listing_mode in (LIST_BOTH, LIST_SHORT_ONLY)] - columns = [col for col, hdr, listing_mode in attr_map if listing_mode - if listing_mode in (LIST_BOTH, LIST_SHORT_ONLY)] - - return headers, columns - - -def get_columns(item, attr_map=None): - """Return pair of resource attributes and corresponding display names. - - Assume the following item and attr_map are passed. - item: {'id': 'myid', 'name': 'myname', - 'foo': 'bar', 'tenant_id': 'mytenan'} - attr_map: - (('id', 'ID', LIST_BOTH), - ('name', 'Name', LIST_BOTH), - ('tenant_id', 'Project', LIST_LONG_ONLY)) - - This method returns: - - (('id', 'name', 'tenant_id', 'foo'), # attributes - ('ID', 'Name', 'Project', 'foo') # display names - - Both tuples of attributes and display names are sorted by display names - in the alphabetical order. - Attributes not found in a given attr_map are kept as-is. - - :param item: a dictionary which represents a resource. - Keys of the dictionary are expected to be attributes of the resource. - Values are not referred to by this method. - :param attr_map: a list of mapping from attribute to display name. - The same format is used as for get_column_definitions attr_map. - :return: A pair of tuple of attributes and tuple of display names. - """ - attr_map = attr_map or tuple([]) - _attr_map_dict = dict((col, hdr) for col, hdr, listing_mode in attr_map) - - columns = [(column, _attr_map_dict.get(column, column)) - for column in item.keys()] - columns = sorted(columns, key=operator.itemgetter(1)) - return (tuple(col[0] for col in columns), - tuple(col[1] for col in columns)) - - # TODO(amotoki): Use osc-lib version once osc-lib provides this. def add_project_owner_option_to_parser(parser): """Register project and project domain options. diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/dynamic_routing/bgp_peer.py python-neutronclient-6.11.0/neutronclient/osc/v2/dynamic_routing/bgp_peer.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/dynamic_routing/bgp_peer.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/dynamic_routing/bgp_peer.py 2018-11-15 14:27:38.000000000 +0000 @@ -13,6 +13,7 @@ from osc_lib.command import command from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.common import exceptions @@ -99,7 +100,7 @@ attrs = _get_attrs(self.app.client_manager, parsed_args) body = {constants.BGP_PEER: attrs} obj = client.create_bgp_peer(body)[constants.BGP_PEER] - columns, display_columns = nc_osc_utils.get_columns(obj) + columns, display_columns = column_util.get_columns(obj) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -183,6 +184,6 @@ id = client.find_resource(constants.BGP_PEER, parsed_args.bgp_peer)['id'] obj = client.show_bgp_peer(id)[constants.BGP_PEER] - columns, display_columns = nc_osc_utils.get_columns(obj) + columns, display_columns = column_util.get_columns(obj) data = utils.get_dict_properties(obj, columns) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/dynamic_routing/bgp_speaker.py python-neutronclient-6.11.0/neutronclient/osc/v2/dynamic_routing/bgp_speaker.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/dynamic_routing/bgp_speaker.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/dynamic_routing/bgp_speaker.py 2018-11-15 14:27:38.000000000 +0000 @@ -13,6 +13,7 @@ from osc_lib.command import command from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.osc import utils as nc_osc_utils @@ -149,7 +150,7 @@ body = {} body[constants.BGP_SPEAKER] = attrs obj = client.create_bgp_speaker(body)[constants.BGP_SPEAKER] - columns, display_columns = nc_osc_utils.get_columns(obj) + columns, display_columns = column_util.get_columns(obj) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -187,7 +188,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient if parsed_args.agent is not None: - data = client.list_bgp_speaker_on_dragent(parsed_args.agent_id) + data = client.list_bgp_speaker_on_dragent(parsed_args.agent) else: data = client.list_bgp_speakers() @@ -214,8 +215,8 @@ speaker_id = client.find_resource(constants.BGP_SPEAKER, parsed_args.bgp_speaker)['id'] data = client.list_route_advertised_from_bgp_speaker(speaker_id) - headers = ('ID', 'Destination', 'Nexthop') - columns = ('id', 'destination', 'next_hop') + headers = ('Destination', 'Nexthop') + columns = ('destination', 'next_hop') return (headers, (utils.get_dict_properties(s, columns) for s in data['advertised_routes'])) @@ -315,6 +316,6 @@ id = client.find_resource(constants.BGP_SPEAKER, parsed_args.bgp_speaker)['id'] obj = client.show_bgp_speaker(id)[constants.BGP_SPEAKER] - columns, display_columns = nc_osc_utils.get_columns(obj) + columns, display_columns = column_util.get_columns(obj) data = utils.get_dict_properties(obj, columns) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/fwaas/firewallgroup.py python-neutronclient-6.11.0/neutronclient/osc/v2/fwaas/firewallgroup.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/fwaas/firewallgroup.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/fwaas/firewallgroup.py 2018-11-15 14:27:38.000000000 +0000 @@ -18,6 +18,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.osc import utils as osc_utils @@ -32,16 +33,16 @@ } _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('ingress_firewall_policy_id', 'Ingress Policy ID', osc_utils.LIST_BOTH), - ('egress_firewall_policy_id', 'Egress Policy ID', osc_utils.LIST_BOTH), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('status', 'Status', osc_utils.LIST_LONG_ONLY), - ('ports', 'Ports', osc_utils.LIST_LONG_ONLY), - ('admin_state_up', 'State', osc_utils.LIST_LONG_ONLY), - ('shared', 'Shared', osc_utils.LIST_LONG_ONLY), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('ingress_firewall_policy_id', 'Ingress Policy ID', column_util.LIST_BOTH), + ('egress_firewall_policy_id', 'Egress Policy ID', column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('status', 'Status', column_util.LIST_LONG_ONLY), + ('ports', 'Ports', column_util.LIST_LONG_ONLY), + ('admin_state_up', 'State', column_util.LIST_LONG_ONLY), + ('shared', 'Shared', column_util.LIST_LONG_ONLY), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -201,7 +202,7 @@ attrs = _get_common_attrs(self.app.client_manager, parsed_args) obj = client.create_fwaas_firewall_group( {const.FWG: attrs})[const.FWG] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return (display_columns, data) @@ -254,7 +255,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_fwaas_firewall_groups()[const.FWGS] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties( s, columns, formatters=_formatters) for s in obj)) @@ -313,7 +314,7 @@ fwg_id = client.find_resource(const.FWG, parsed_args.firewall_group, cmd_resource=const.CMD_FWG)['id'] obj = client.show_fwaas_firewall_group(fwg_id)[const.FWG] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/fwaas/firewallpolicy.py python-neutronclient-6.11.0/neutronclient/osc/v2/fwaas/firewallpolicy.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/fwaas/firewallpolicy.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/fwaas/firewallpolicy.py 2018-11-15 14:27:38.000000000 +0000 @@ -21,6 +21,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.osc import utils as osc_utils @@ -32,13 +33,13 @@ _formatters = {} _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('firewall_rules', 'Firewall Rules', osc_utils.LIST_BOTH), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('audited', 'Audited', osc_utils.LIST_LONG_ONLY), - ('shared', 'Shared', osc_utils.LIST_LONG_ONLY), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('firewall_rules', 'Firewall Rules', column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('audited', 'Audited', column_util.LIST_LONG_ONLY), + ('shared', 'Shared', column_util.LIST_LONG_ONLY), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -155,7 +156,7 @@ attrs = _get_common_attrs(self.app.client_manager, parsed_args) obj = client.create_fwaas_firewall_policy( {const.FWP: attrs})[const.FWP] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return (display_columns, data) @@ -297,7 +298,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_fwaas_firewall_policies()[const.FWPS] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties( s, columns, formatters=_formatters) for s in obj)) @@ -360,7 +361,7 @@ parsed_args.firewall_policy, cmd_resource=const.CMD_FWP)['id'] obj = client.show_fwaas_firewall_policy(fwp_id)[const.FWP] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/fwaas/firewallrule.py python-neutronclient-6.11.0/neutronclient/osc/v2/fwaas/firewallrule.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/fwaas/firewallrule.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/fwaas/firewallrule.py 2018-11-15 14:27:38.000000000 +0000 @@ -20,6 +20,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.common import utils as nc_utils @@ -31,21 +32,25 @@ _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('enabled', 'Enabled', osc_utils.LIST_BOTH), - ('summary', 'Summary', osc_utils.LIST_SHORT_ONLY), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('ip_version', 'IP Version', osc_utils.LIST_LONG_ONLY), - ('action', 'Action', osc_utils.LIST_LONG_ONLY), - ('protocol', 'Protocol', osc_utils.LIST_LONG_ONLY), - ('source_ip_address', 'Source IP Address', osc_utils.LIST_LONG_ONLY), - ('source_port', 'Source Port', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('enabled', 'Enabled', column_util.LIST_BOTH), + ('summary', 'Summary', column_util.LIST_SHORT_ONLY), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('ip_version', 'IP Version', column_util.LIST_LONG_ONLY), + ('action', 'Action', column_util.LIST_LONG_ONLY), + ('protocol', 'Protocol', column_util.LIST_LONG_ONLY), + ('source_ip_address', 'Source IP Address', column_util.LIST_LONG_ONLY), + ('source_port', 'Source Port', column_util.LIST_LONG_ONLY), ('destination_ip_address', 'Destination IP Address', - osc_utils.LIST_LONG_ONLY), - ('destination_port', 'Destination Port', osc_utils.LIST_LONG_ONLY), - ('shared', 'Shared', osc_utils.LIST_LONG_ONLY), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), + ('destination_port', 'Destination Port', column_util.LIST_LONG_ONLY), + ('shared', 'Shared', column_util.LIST_LONG_ONLY), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), + ('source_firewall_group_id', 'Source Firewall Group ID', + column_util.LIST_LONG_ONLY), + ('destination_firewall_group_id', 'Destination Firewall Group ID', + column_util.LIST_LONG_ONLY), ) @@ -144,11 +149,30 @@ '--disable-rule', action='store_true', help=_('Disable this rule')) + src_fwg_group = parser.add_mutually_exclusive_group() + src_fwg_group.add_argument( + '--source-firewall-group', + metavar='', + help=_('Source firewall group (name or ID)')) + src_fwg_group.add_argument( + '--no-source-firewall-group', + action='store_true', + help=_('No associated destination firewall group')) + dst_fwg_group = parser.add_mutually_exclusive_group() + dst_fwg_group.add_argument( + '--destination-firewall-group', + metavar='', + help=_('Destination firewall group (name or ID)')) + dst_fwg_group.add_argument( + '--no-destination-firewall-group', + action='store_true', + help=_('No associated destination firewall group')) return parser def _get_common_attrs(client_manager, parsed_args, is_create=True): attrs = {} + client = client_manager.neutronclient if is_create: if 'project' in parsed_args and parsed_args.project is not None: attrs['tenant_id'] = osc_utils.find_project( @@ -192,6 +216,18 @@ attrs['shared'] = True if parsed_args.no_share or parsed_args.private: attrs['shared'] = False + if parsed_args.source_firewall_group: + attrs['source_firewall_group_id'] = client.find_resource( + const.FWG, parsed_args.source_firewall_group, + cmd_resource=const.CMD_FWG)['id'] + if parsed_args.no_source_firewall_group: + attrs['source_firewall_group_id'] = None + if parsed_args.destination_firewall_group: + attrs['destination_firewall_group_id'] = client.find_resource( + const.FWG, parsed_args.destination_firewall_group, + cmd_resource=const.CMD_FWG)['id'] + if parsed_args.no_destination_firewall_group: + attrs['destination_firewall_group_id'] = None return attrs @@ -217,7 +253,7 @@ attrs = _get_common_attrs(self.app.client_manager, parsed_args) obj = client.create_fwaas_firewall_rule( {const.FWR: attrs})[const.FWR] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return display_columns, data @@ -294,7 +330,7 @@ client = self.app.client_manager.neutronclient obj = client.list_fwaas_firewall_rules()[const.FWRS] obj_extend = self.extend_list(obj, parsed_args) - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties( s, columns, formatters=_formatters) for s in obj_extend)) @@ -344,7 +380,7 @@ const.FWR, parsed_args.firewall_rule, cmd_resource=const.CMD_FWR)['id'] obj = client.show_fwaas_firewall_rule(fwr_id)[const.FWR] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return (display_columns, data) @@ -390,6 +426,16 @@ '--enable-rule', action='store_true', help=_('Disable this rule')) + + parser.add_argument( + '--source-firewall-group', + action='store_true', + help=_('Source firewall group (name or ID)')) + + parser.add_argument( + '--destination-firewall-group', + action='store_true', + help=_('Destination firewall group (name or ID)')) return parser def _get_attrs(self, client_manager, parsed_args): @@ -406,6 +452,10 @@ attrs['shared'] = False if parsed_args.enable_rule: attrs['enabled'] = False + if parsed_args.source_firewall_group: + attrs['source_firewall_group_id'] = None + if parsed_args.source_firewall_group: + attrs['destination_firewall_group_id'] = None return attrs def take_action(self, parsed_args): diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/logging/network_log.py python-neutronclient-6.11.0/neutronclient/osc/v2/logging/network_log.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/logging/network_log.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/logging/network_log.py 2018-11-15 14:27:38.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2017 FUJTISU LIMITED. +# Copyright 2017-2018 FUJTISU LIMITED. # All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -19,30 +19,31 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from oslo_log import log as logging from neutronclient._i18n import _ from neutronclient.common import utils as nc_utils from neutronclient.osc import utils as osc_utils - +from neutronclient.osc.v2.fwaas import constants as fwaas_const LOG = logging.getLogger(__name__) _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('enabled', 'Enabled', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('target_id', 'Target', osc_utils.LIST_LONG_ONLY), - ('project_id', 'Project', osc_utils.LIST_LONG_ONLY), - ('resource_id', 'Resource', osc_utils.LIST_LONG_ONLY), - ('resource_type', 'Type', osc_utils.LIST_BOTH), - ('event', 'Event', osc_utils.LIST_LONG_ONLY), - ('summary', 'Summary', osc_utils.LIST_SHORT_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('enabled', 'Enabled', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('target_id', 'Target', column_util.LIST_LONG_ONLY), + ('project_id', 'Project', column_util.LIST_LONG_ONLY), + ('resource_id', 'Resource', column_util.LIST_LONG_ONLY), + ('resource_type', 'Type', column_util.LIST_BOTH), + ('event', 'Event', column_util.LIST_LONG_ONLY), + ('summary', 'Summary', column_util.LIST_SHORT_ONLY), ) _attr_map_for_loggable = ( - ('type', 'Supported types', osc_utils.LIST_BOTH), + ('type', 'Supported types', column_util.LIST_BOTH), ) NET_LOG = 'network_log' @@ -76,17 +77,23 @@ parsed_args.project, parsed_args.project_domain, ).id + resource_type = parsed_args.resource_type + attrs['resource_type'] = resource_type if parsed_args.resource: + cmd_resource = None + if resource_type == fwaas_const.FWG: + cmd_resource = fwaas_const.CMD_FWG attrs['resource_id'] = client.find_resource( - 'security_group', parsed_args.resource)['id'] + resource_type, + parsed_args.resource, + cmd_resource=cmd_resource)['id'] + if parsed_args.target: # NOTE(yushiro) Currently, we're supporting only port attrs['target_id'] = client.find_resource( 'port', parsed_args.target)['id'] if parsed_args.event: attrs['event'] = parsed_args.event - if parsed_args.resource_type: - attrs['resource_type'] = parsed_args.resource_type if parsed_args.enable: attrs['enabled'] = True if parsed_args.disable: @@ -116,8 +123,8 @@ type=nc_utils.convert_to_uppercase, help=_('An event to store with log')) # NOTE(yushiro) '--resource-type' is managed by following command: - # "openstack network loggable resource list". Therefore, this option - # shouldn't have "choices" like ['security_group'] + # "openstack network loggable resources list". Therefore, this option + # shouldn't have "choices" like ['security_group', 'firewall_group'] parser.add_argument( '--resource-type', metavar='', @@ -125,12 +132,13 @@ type=nc_utils.convert_to_lowercase, help=_('Network log type(s). ' 'You can see supported type(s) with following command:\n' - '$ openstack network loggable resource list')) + '$ openstack network loggable resources list')) parser.add_argument( '--resource', metavar='', - help=_('Security group (name or ID) for logging. You can control ' - 'for logging target combination with --target option.')) + help=_('Name or ID of resource (security group or firewall group) ' + 'that used for logging. You can control for logging target ' + 'combination with --target option.')) parser.add_argument( '--target', metavar='', @@ -142,7 +150,7 @@ client = self.app.client_manager.neutronclient attrs = _get_common_attrs(self.app.client_manager, parsed_args) obj = client.create_network_log({'log': attrs})['log'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return (display_columns, data) @@ -170,13 +178,13 @@ except Exception as e: result += 1 LOG.error(_("Failed to delete network log with " - "name or ID '%(network_log)s': %(e)s"), + "name or ID '%(network_log)s': %(e)s"), {'network_log': log_res, 'e': e}) if result > 0: total = len(parsed_args.network_log) msg = (_("%(result)s of %(total)s network log(s) " - "failed to delete") % {'result': result, 'total': total}) + "failed to delete") % {'result': result, 'total': total}) raise exceptions.CommandError(msg) @@ -195,7 +203,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_network_loggable_resources()['loggable_resources'] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map_for_loggable, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties(s, columns) for s in obj)) @@ -220,10 +228,17 @@ if d['event']: event = e_prefix + d['event'].upper() port = '(port) ' + d['target_id'] if d['target_id'] else '' - sg = ('(security_group) ' + d['resource_id'] - if d['resource_id'] else '') + resource_type = d['resource_type'] + if d['resource_id']: + res = '(%s) %s' % (resource_type, d['resource_id']) + else: + res = '' t_prefix = 'Logged: ' - t = sg + ' on ' + port if port and sg else sg + port + if port and res: + t = '%s on %s' % (res, port) + else: + # Either of res and port is empty, so concatenation works fine + t = res + port target = t_prefix + t if t else t_prefix + '(None specified)' d['summary'] = ',\n'.join([event, target]) return ext_data @@ -232,7 +247,7 @@ client = self.app.client_manager.neutronclient obj = client.list_network_logs()['logs'] obj_extend = self._extend_list(obj, parsed_args) - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, ( utils.get_dict_properties(s, columns) for s in obj_extend)) @@ -284,6 +299,6 @@ log_id = client.find_resource( 'log', parsed_args.network_log, cmd_resource=NET_LOG)['id'] obj = client.show_network_log(log_id)['log'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py 2018-11-15 14:27:38.000000000 +0000 @@ -21,6 +21,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.osc import utils as nc_osc_utils @@ -29,19 +30,20 @@ LOG = logging.getLogger(__name__) _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('tenant_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), - ('name', 'Name', nc_osc_utils.LIST_BOTH), - ('type', 'Type', nc_osc_utils.LIST_BOTH), - ('route_targets', 'Route Targets', nc_osc_utils.LIST_LONG_ONLY), - ('import_targets', 'Import Targets', nc_osc_utils.LIST_LONG_ONLY), - ('export_targets', 'Export Targets', nc_osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), + ('name', 'Name', column_util.LIST_BOTH), + ('type', 'Type', column_util.LIST_BOTH), + ('route_targets', 'Route Targets', column_util.LIST_LONG_ONLY), + ('import_targets', 'Import Targets', column_util.LIST_LONG_ONLY), + ('export_targets', 'Export Targets', column_util.LIST_LONG_ONLY), ('route_distinguishers', 'Route Distinguishers', - nc_osc_utils.LIST_LONG_ONLY), - ('networks', 'Associated Networks', nc_osc_utils.LIST_LONG_ONLY), - ('routers', 'Associated Routers', nc_osc_utils.LIST_LONG_ONLY), - ('ports', 'Associated Ports', nc_osc_utils.LIST_LONG_ONLY), - ('vni', 'VNI', nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), + ('networks', 'Associated Networks', column_util.LIST_LONG_ONLY), + ('routers', 'Associated Routers', column_util.LIST_LONG_ONLY), + ('ports', 'Associated Ports', column_util.LIST_LONG_ONLY), + ('vni', 'VNI', column_util.LIST_LONG_ONLY), + ('local_pref', 'Local Pref', column_util.LIST_LONG_ONLY), ) _formatters = { 'route_targets': format_columns.ListColumn, @@ -151,6 +153,11 @@ '--vni', type=int, help=_('VXLAN Network Identifier to be used for this BGPVPN ' 'when a VXLAN encapsulation is used')) + parser.add_argument( + '--local-pref', type=int, + dest='local_pref', + help=_('Default BGP LOCAL_PREF to use in route advertisements' + 'towards this BGPVPN.')) def _args2body(client_manager, id, action, args): @@ -169,6 +176,9 @@ if 'vni' in args and args.vni is not None: attrs['vni'] = args.vni + if 'local_pref' in args and args.local_pref is not None: + attrs['local_pref'] = args.local_pref + if args.purge_route_target: attrs['route_targets'] = [] elif args.route_targets: @@ -247,6 +257,8 @@ attrs['route_distinguishers'] = parsed_args.route_distinguishers if parsed_args.vni is not None: attrs['vni'] = parsed_args.vni + if parsed_args.local_pref is not None: + attrs['local_pref'] = parsed_args.local_pref if 'project' in parsed_args and parsed_args.project is not None: project_id = nc_osc_utils.find_project( self.app.client_manager.identity, @@ -256,7 +268,7 @@ attrs['tenant_id'] = project_id body = {constants.BGPVPN: attrs} obj = client.create_bgpvpn(body)[constants.BGPVPN] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = osc_utils.get_dict_properties(obj, columns, formatters=_formatters) return display_columns, data @@ -368,7 +380,7 @@ if parsed_args.property: params.update(parsed_args.property) objs = client.list_bgpvpns(**params)[constants.BGPVPNS] - headers, columns = nc_osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (osc_utils.get_dict_properties( s, columns, formatters=_formatters) for s in objs)) @@ -390,7 +402,7 @@ client = self.app.client_manager.neutronclient id = client.find_resource(constants.BGPVPN, parsed_args.bgpvpn)['id'] obj = client.show_bgpvpn(id)[constants.BGPVPN] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = osc_utils.get_dict_properties(obj, columns, formatters=_formatters) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/network_association.py python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/network_association.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/network_association.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/network_association.py 2018-11-15 14:27:38.000000000 +0000 @@ -14,9 +14,9 @@ # under the License. # +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ -from neutronclient.osc import utils as nc_osc_utils from neutronclient.osc.v2.networking_bgpvpn import constants from neutronclient.osc.v2.networking_bgpvpn.resource_association import\ CreateBgpvpnResAssoc @@ -34,10 +34,10 @@ _resource_plural = constants.NETWORK_ASSOCS _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('tenant_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ('%s_id' % _assoc_res_name, '%s ID' % _assoc_res_name.capitalize(), - nc_osc_utils.LIST_BOTH), + column_util.LIST_BOTH), ) _formatters = {} diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/port_association.py python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/port_association.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/port_association.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/port_association.py 2018-11-15 14:27:38.000000000 +0000 @@ -18,9 +18,9 @@ from osc_lib.cli import format_columns from osc_lib.cli import parseractions +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ -from neutronclient.osc import utils as nc_osc_utils from neutronclient.osc.v2.networking_bgpvpn import constants from neutronclient.osc.v2.networking_bgpvpn import resource_association @@ -33,16 +33,16 @@ _resource_plural = constants.PORT_ASSOCS _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('tenant_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ('%s_id' % _assoc_res_name, '%s ID' % _assoc_res_name.capitalize(), - nc_osc_utils.LIST_BOTH), + column_util.LIST_BOTH), ('prefix_routes', 'Prefix Routes (BGP LOCAL_PREF)', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('bgpvpn_routes', 'BGP VPN Routes (BGP LOCAL_PREF)', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('advertise_fixed_ips', "Advertise Port's Fixed IPs", - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ) _formatters = { 'prefix_routes': format_columns.ListColumn, diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/resource_association.py python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/resource_association.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/resource_association.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/resource_association.py 2018-11-15 14:27:38.000000000 +0000 @@ -20,6 +20,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.osc import utils as nc_osc_utils @@ -83,8 +84,7 @@ transform = getattr(self, '_transform_resource', None) if callable(transform): transform(obj) - columns, display_columns = nc_osc_utils.get_columns(obj, - self._attr_map) + columns, display_columns = column_util.get_columns(obj, self._attr_map) data = osc_utils.get_dict_properties(obj, columns, formatters=self._formatters) return display_columns, data @@ -218,7 +218,7 @@ transform = getattr(self, '_transform_resource', None) if callable(transform): [transform(obj) for obj in objs] - headers, columns = nc_osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( self._attr_map, long_listing=parsed_args.long) return (headers, (osc_utils.get_dict_properties( s, columns, formatters=self._formatters) for s in objs)) @@ -256,8 +256,7 @@ transform = getattr(self, '_transform_resource', None) if callable(transform): transform(obj) - columns, display_columns = nc_osc_utils.get_columns(obj, - self._attr_map) + columns, display_columns = column_util.get_columns(obj, self._attr_map) data = osc_utils.get_dict_properties(obj, columns, formatters=self._formatters) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/router_association.py python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/router_association.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/networking_bgpvpn/router_association.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/networking_bgpvpn/router_association.py 2018-11-15 14:27:38.000000000 +0000 @@ -14,9 +14,9 @@ # under the License. # +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ -from neutronclient.osc import utils as nc_osc_utils from neutronclient.osc.v2.networking_bgpvpn import constants from neutronclient.osc.v2.networking_bgpvpn.resource_association import\ CreateBgpvpnResAssoc @@ -34,10 +34,10 @@ _resource_plural = constants.ROUTER_ASSOCS _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('tenant_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ('%s_id' % _assoc_res_name, '%s ID' % _assoc_res_name.capitalize(), - nc_osc_utils.LIST_BOTH), + column_util.LIST_BOTH), ) _formatters = {} diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_flow_classifier.py python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_flow_classifier.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_flow_classifier.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_flow_classifier.py 2018-11-15 14:27:38.000000000 +0000 @@ -19,40 +19,40 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ from neutronclient.common import exceptions as nc_exc -from neutronclient.osc import utils as nc_osc_utils LOG = logging.getLogger(__name__) resource = 'flow_classifier' _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('name', 'Name', nc_osc_utils.LIST_BOTH), - ('summary', 'Summary', nc_osc_utils.LIST_SHORT_ONLY), - ('protocol', 'Protocol', nc_osc_utils.LIST_LONG_ONLY), - ('ethertype', 'Ethertype', nc_osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('summary', 'Summary', column_util.LIST_SHORT_ONLY), + ('protocol', 'Protocol', column_util.LIST_LONG_ONLY), + ('ethertype', 'Ethertype', column_util.LIST_LONG_ONLY), ('source_ip_prefix', 'Source IP', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('destination_ip_prefix', 'Destination IP', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('logical_source_port', 'Logical Source Port', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('logical_destination_port', 'Logical Destination Port', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('source_port_range_min', 'Source Port Range Min', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('source_port_range_max', 'Source Port Range Max', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('destination_port_range_min', 'Destination Port Range Min', - nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), ('destination_port_range_max', 'Destination Port Range Max', - nc_osc_utils.LIST_LONG_ONLY), - ('l7_parameters', 'L7 Parameters', nc_osc_utils.LIST_LONG_ONLY), - ('description', 'Description', nc_osc_utils.LIST_LONG_ONLY), - ('project_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), + ('l7_parameters', 'L7 Parameters', column_util.LIST_LONG_ONLY), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('project_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -118,7 +118,7 @@ attrs = _get_common_attrs(self.app.client_manager, parsed_args) body = {resource: attrs} obj = client.create_sfc_flow_classifier(body)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -200,7 +200,7 @@ client = self.app.client_manager.neutronclient obj = client.list_sfc_flow_classifiers() obj_extend = self.extend_list(obj, parsed_args) - headers, columns = nc_osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties( s, columns) for s in obj_extend)) @@ -256,7 +256,7 @@ client = self.app.client_manager.neutronclient fc_id = _get_id(client, parsed_args.flow_classifier, resource) obj = client.show_sfc_flow_classifier(fc_id)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_port_chain.py python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_port_chain.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_port_chain.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_port_chain.py 2018-11-15 14:27:38.000000000 +0000 @@ -19,25 +19,25 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ -from neutronclient.osc import utils as nc_osc_utils LOG = logging.getLogger(__name__) resource = 'port_chain' _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('name', 'Name', nc_osc_utils.LIST_BOTH), - ('port_pair_groups', 'Port Pair Groups', nc_osc_utils.LIST_BOTH), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('port_pair_groups', 'Port Pair Groups', column_util.LIST_BOTH), ('flow_classifiers', 'Flow Classifiers', - nc_osc_utils.LIST_BOTH), + column_util.LIST_BOTH), ('chain_parameters', 'Chain Parameters', - nc_osc_utils.LIST_BOTH), - ('description', 'Description', nc_osc_utils.LIST_LONG_ONLY), - ('chain_id', 'Chain ID', nc_osc_utils.LIST_BOTH), - ('project_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('chain_id', 'Chain ID', column_util.LIST_BOTH), + ('project_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -85,7 +85,7 @@ attrs = _get_common_attrs(self.app.client_manager, parsed_args) body = {resource: attrs} obj = client.create_sfc_port_chain(body)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -131,7 +131,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient data = client.list_sfc_port_chains() - headers, columns = nc_osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties(s, columns) @@ -254,7 +254,7 @@ client = self.app.client_manager.neutronclient pc_id = _get_id(client, parsed_args.port_chain, resource) obj = client.show_sfc_port_chain(pc_id)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_port_pair_group.py python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_port_pair_group.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_port_pair_group.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_port_pair_group.py 2018-11-15 14:27:38.000000000 +0000 @@ -19,24 +19,24 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ -from neutronclient.osc import utils as nc_osc_utils LOG = logging.getLogger(__name__) resource = 'port_pair_group' _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('name', 'Name', nc_osc_utils.LIST_BOTH), - ('port_pairs', 'Port Pair', nc_osc_utils.LIST_BOTH), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('port_pairs', 'Port Pair', column_util.LIST_BOTH), ('port_pair_group_parameters', 'Port Pair Group Parameters', - nc_osc_utils.LIST_BOTH), - ('description', 'Description', nc_osc_utils.LIST_LONG_ONLY), - ('group_id', 'Loadbalance ID', nc_osc_utils.LIST_LONG_ONLY), - ('project_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), - ('tap_enabled', 'Tap Enabled', nc_osc_utils.LIST_BOTH) + column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('group_id', 'Loadbalance ID', column_util.LIST_LONG_ONLY), + ('project_id', 'Project', column_util.LIST_LONG_ONLY), + ('tap_enabled', 'Tap Enabled', column_util.LIST_BOTH) ) @@ -89,7 +89,7 @@ attrs = _get_common_attrs(self.app.client_manager, parsed_args) body = {resource: attrs} obj = client.create_sfc_port_pair_group(body)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -135,7 +135,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient data = client.list_sfc_port_pair_groups() - headers, columns = nc_osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties( @@ -188,9 +188,9 @@ if parsed_args.no_port_pair: existing = [] else: - existing = [client.find_resource( + existing = client.find_resource( resource, parsed_args.port_pair_group, - cmd_resource='sfc_port_pair_group')['port_pairs']] + cmd_resource='sfc_port_pair_group')['port_pairs'] attrs['port_pairs'] = sorted(list(set(existing) | set(added))) body = {resource: attrs} try: @@ -217,7 +217,7 @@ client = self.app.client_manager.neutronclient ppg_id = _get_id(client, parsed_args.port_pair_group, resource) obj = client.show_sfc_port_pair_group(ppg_id)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -250,12 +250,12 @@ ppg_id = _get_id(client, parsed_args.port_pair_group, resource) attrs = {} if parsed_args.port_pairs: - existing = [client.find_resource( + existing = client.find_resource( resource, parsed_args.port_pair_group, - cmd_resource='sfc_port_pair_group')['port_pairs']] - for pp in parsed_args.port_pairs: - removed = [client.find_resource( - 'port_pair', pp, cmd_resource='sfc_port_pair')['id']] + cmd_resource='sfc_port_pair_group')['port_pairs'] + removed = [client.find_resource('port_pair', pp, + cmd_resource='sfc_port_pair')['id'] + for pp in parsed_args.port_pairs] attrs['port_pairs'] = list(set(existing) - set(removed)) if parsed_args.all_port_pair: attrs['port_pairs'] = [] diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_port_pair.py python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_port_pair.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_port_pair.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_port_pair.py 2018-11-15 14:27:38.000000000 +0000 @@ -19,23 +19,23 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ -from neutronclient.osc import utils as nc_osc_utils LOG = logging.getLogger(__name__) resource = 'port_pair' _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('name', 'Name', nc_osc_utils.LIST_BOTH), - ('ingress', 'Ingress Logical Port', nc_osc_utils.LIST_BOTH), - ('egress', 'Egress Logical Port', nc_osc_utils.LIST_BOTH), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('ingress', 'Ingress Logical Port', column_util.LIST_BOTH), + ('egress', 'Egress Logical Port', column_util.LIST_BOTH), ('service_function_parameters', 'Service Function Parameters', - nc_osc_utils.LIST_LONG_ONLY), - ('description', 'Description', nc_osc_utils.LIST_LONG_ONLY), - ('project_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('project_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -80,7 +80,7 @@ attrs = _get_common_attrs(self.app.client_manager, parsed_args) body = {resource: attrs} obj = client.create_sfc_port_pair(body)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -125,7 +125,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient data = client.list_sfc_port_pairs() - headers, columns = nc_osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties( @@ -183,7 +183,7 @@ client = self.app.client_manager.neutronclient port_pair_id = _get_id(client, parsed_args.port_pair, resource) obj = client.show_sfc_port_pair(port_pair_id)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_service_graph.py python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_service_graph.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/sfc/sfc_service_graph.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/sfc/sfc_service_graph.py 2018-11-15 14:27:38.000000000 +0000 @@ -17,20 +17,20 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from neutronclient._i18n import _ -from neutronclient.osc import utils as nc_osc_utils LOG = logging.getLogger(__name__) resource = 'service_graph' _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('name', 'Name', nc_osc_utils.LIST_BOTH), - ('port_chains', 'Branching Points', nc_osc_utils.LIST_BOTH), - ('description', 'Description', nc_osc_utils.LIST_LONG_ONLY), - ('project_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('port_chains', 'Branching Points', column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('project_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -62,7 +62,7 @@ try: body = {resource: attrs} obj = client.create_sfc_service_graph(body)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data except Exception as e: @@ -140,7 +140,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient data = client.list_sfc_service_graphs() - headers, columns = nc_osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties(s, columns) @@ -163,7 +163,7 @@ client = self.app.client_manager.neutronclient sg_id = _get_id(client, parsed_args.service_graph, resource) obj = client.show_sfc_service_graph(sg_id)[resource] - columns, display_columns = nc_osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/endpoint_group.py python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/endpoint_group.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/endpoint_group.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/endpoint_group.py 2018-11-15 14:27:38.000000000 +0000 @@ -17,6 +17,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from oslo_log import log as logging from neutronclient._i18n import _ @@ -26,12 +27,12 @@ LOG = logging.getLogger(__name__) _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('type', 'Type', osc_utils.LIST_BOTH), - ('endpoints', 'Endpoints', osc_utils.LIST_BOTH), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('type', 'Type', column_util.LIST_BOTH), + ('endpoints', 'Endpoints', column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -98,7 +99,7 @@ attrs['endpoints'] = parsed_args.endpoints obj = client.create_endpoint_group( {'endpoint_group': attrs})['endpoint_group'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -154,7 +155,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_endpoint_groups()['endpoint_groups'] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties(s, columns) for s in obj)) @@ -211,6 +212,6 @@ 'endpoint_group', parsed_args.endpoint_group, cmd_resource='endpoint_group')['id'] obj = client.show_endpoint_group(endpoint_id)['endpoint_group'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/ikepolicy.py python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/ikepolicy.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/ikepolicy.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/ikepolicy.py 2018-11-15 14:27:38.000000000 +0000 @@ -17,6 +17,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from oslo_log import log as logging from neutronclient._i18n import _ @@ -28,17 +29,17 @@ LOG = logging.getLogger(__name__) _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('auth_algorithm', 'Authentication Algorithm', osc_utils.LIST_BOTH), - ('encryption_algorithm', 'Encryption Algorithm', osc_utils.LIST_BOTH), - ('ike_version', 'IKE Version', osc_utils.LIST_BOTH), - ('pfs', 'Perfect Forward Secrecy (PFS)', osc_utils.LIST_BOTH), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('auth_algorithm', 'Authentication Algorithm', column_util.LIST_BOTH), + ('encryption_algorithm', 'Encryption Algorithm', column_util.LIST_BOTH), + ('ike_version', 'IKE Version', column_util.LIST_BOTH), + ('pfs', 'Perfect Forward Secrecy (PFS)', column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), ('phase1_negotiation_mode', 'Phase1 Negotiation Mode', - osc_utils.LIST_LONG_ONLY), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), - ('lifetime', 'Lifetime', osc_utils.LIST_LONG_ONLY), + column_util.LIST_LONG_ONLY), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), + ('lifetime', 'Lifetime', column_util.LIST_LONG_ONLY), ) @@ -130,7 +131,7 @@ if parsed_args.name: attrs['name'] = str(parsed_args.name) obj = client.create_ikepolicy({'ikepolicy': attrs})['ikepolicy'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -183,7 +184,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_ikepolicies()['ikepolicies'] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties(s, columns) for s in obj)) @@ -238,6 +239,6 @@ 'ikepolicy', parsed_args.ikepolicy, cmd_resource='ikepolicy')['id'] obj = client.show_ikepolicy(ike_id)['ikepolicy'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/ipsecpolicy.py python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/ipsecpolicy.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/ipsecpolicy.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/ipsecpolicy.py 2018-11-15 14:27:38.000000000 +0000 @@ -17,6 +17,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from oslo_log import log as logging from neutronclient._i18n import _ @@ -28,16 +29,16 @@ LOG = logging.getLogger(__name__) _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('auth_algorithm', 'Authentication Algorithm', osc_utils.LIST_BOTH), - ('encapsulation_mode', 'Encapsulation Mode', osc_utils.LIST_BOTH), - ('transform_protocol', 'Transform Protocol', osc_utils.LIST_BOTH), - ('encryption_algorithm', 'Encryption Algorithm', osc_utils.LIST_BOTH), - ('pfs', 'Perfect Forward Secrecy (PFS)', osc_utils.LIST_LONG_ONLY), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), - ('lifetime', 'Lifetime', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('auth_algorithm', 'Authentication Algorithm', column_util.LIST_BOTH), + ('encapsulation_mode', 'Encapsulation Mode', column_util.LIST_BOTH), + ('transform_protocol', 'Transform Protocol', column_util.LIST_BOTH), + ('encryption_algorithm', 'Encryption Algorithm', column_util.LIST_BOTH), + ('pfs', 'Perfect Forward Secrecy (PFS)', column_util.LIST_LONG_ONLY), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), + ('lifetime', 'Lifetime', column_util.LIST_LONG_ONLY), ) @@ -128,7 +129,7 @@ if parsed_args.name: attrs['name'] = str(parsed_args.name) obj = client.create_ipsecpolicy({'ipsecpolicy': attrs})['ipsecpolicy'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -182,7 +183,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_ipsecpolicies()['ipsecpolicies'] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties(s, columns) for s in obj)) @@ -237,6 +238,6 @@ 'ipsecpolicy', parsed_args.ipsecpolicy, cmd_resource='ipsecpolicy')['id'] obj = client.show_ipsecpolicy(ipsec_id)['ipsecpolicy'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/ipsec_site_connection.py python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/ipsec_site_connection.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/ipsec_site_connection.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/ipsec_site_connection.py 2018-11-15 14:27:38.000000000 +0000 @@ -18,6 +18,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from oslo_log import log as logging from neutronclient._i18n import _ @@ -35,26 +36,27 @@ _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('peer_address', 'Peer Address', osc_utils.LIST_BOTH), - ('auth_mode', 'Authentication Algorithm', osc_utils.LIST_BOTH), - ('status', 'Status', osc_utils.LIST_BOTH), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), - ('peer_cidrs', 'Peer CIDRs', osc_utils.LIST_LONG_ONLY), - ('vpnservice_id', 'VPN Service', osc_utils.LIST_LONG_ONLY), - ('ipsecpolicy_id', 'IPSec Policy', osc_utils.LIST_LONG_ONLY), - ('ikepolicy_id', 'IKE Policy', osc_utils.LIST_LONG_ONLY), - ('mtu', 'MTU', osc_utils.LIST_LONG_ONLY), - ('initiator', 'Initiator', osc_utils.LIST_LONG_ONLY), - ('admin_state_up', 'State', osc_utils.LIST_LONG_ONLY), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('psk', 'Pre-shared Key', osc_utils.LIST_LONG_ONLY), - ('route_mode', 'Route Mode', osc_utils.LIST_LONG_ONLY), - ('local_id', 'Local ID', osc_utils.LIST_LONG_ONLY), - ('peer_id', 'Peer ID', osc_utils.LIST_LONG_ONLY), - ('local_ep_group_id', 'Local Endpoint Group ID', osc_utils.LIST_LONG_ONLY), - ('peer_ep_group_id', 'Peer Endpoint Group ID', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('peer_address', 'Peer Address', column_util.LIST_BOTH), + ('auth_mode', 'Authentication Algorithm', column_util.LIST_BOTH), + ('status', 'Status', column_util.LIST_BOTH), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), + ('peer_cidrs', 'Peer CIDRs', column_util.LIST_LONG_ONLY), + ('vpnservice_id', 'VPN Service', column_util.LIST_LONG_ONLY), + ('ipsecpolicy_id', 'IPSec Policy', column_util.LIST_LONG_ONLY), + ('ikepolicy_id', 'IKE Policy', column_util.LIST_LONG_ONLY), + ('mtu', 'MTU', column_util.LIST_LONG_ONLY), + ('initiator', 'Initiator', column_util.LIST_LONG_ONLY), + ('admin_state_up', 'State', column_util.LIST_LONG_ONLY), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('psk', 'Pre-shared Key', column_util.LIST_LONG_ONLY), + ('route_mode', 'Route Mode', column_util.LIST_LONG_ONLY), + ('local_id', 'Local ID', column_util.LIST_LONG_ONLY), + ('peer_id', 'Peer ID', column_util.LIST_LONG_ONLY), + ('local_ep_group_id', 'Local Endpoint Group ID', + column_util.LIST_LONG_ONLY), + ('peer_ep_group_id', 'Peer Endpoint Group ID', column_util.LIST_LONG_ONLY), ) @@ -239,7 +241,7 @@ raise exceptions.CommandError(message) obj = client.create_ipsec_site_connection( {'ipsec_site_connection': attrs})['ipsec_site_connection'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return display_columns, data @@ -296,7 +298,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_ipsec_site_connections()['ipsec_site_connections'] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties( s, columns, formatters=_formatters) for s in obj)) @@ -367,6 +369,6 @@ cmd_resource='ipsec_site_connection')['id'] obj = client.show_ipsec_site_connection( ipsec_site_id)['ipsec_site_connection'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns, formatters=_formatters) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/vpnservice.py python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/vpnservice.py --- python-neutronclient-6.7.0/neutronclient/osc/v2/vpnaas/vpnservice.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/osc/v2/vpnaas/vpnservice.py 2018-11-15 14:27:38.000000000 +0000 @@ -17,6 +17,7 @@ from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils +from osc_lib.utils import columns as column_util from oslo_log import log as logging from neutronclient._i18n import _ @@ -26,15 +27,15 @@ LOG = logging.getLogger(__name__) _attr_map = ( - ('id', 'ID', osc_utils.LIST_BOTH), - ('name', 'Name', osc_utils.LIST_BOTH), - ('router_id', 'Router', osc_utils.LIST_BOTH), - ('subnet_id', 'Subnet', osc_utils.LIST_BOTH), - ('flavor_id', 'Flavor', osc_utils.LIST_BOTH), - ('admin_state_up', 'State', osc_utils.LIST_BOTH), - ('status', 'Status', osc_utils.LIST_BOTH), - ('description', 'Description', osc_utils.LIST_LONG_ONLY), - ('tenant_id', 'Project', osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('name', 'Name', column_util.LIST_BOTH), + ('router_id', 'Router', column_util.LIST_BOTH), + ('subnet_id', 'Subnet', column_util.LIST_BOTH), + ('flavor_id', 'Flavor', column_util.LIST_BOTH), + ('admin_state_up', 'State', column_util.LIST_BOTH), + ('status', 'Status', column_util.LIST_BOTH), + ('description', 'Description', column_util.LIST_LONG_ONLY), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ) @@ -121,7 +122,7 @@ parsed_args.router).id attrs['router_id'] = _router_id obj = client.create_vpnservice({'vpnservice': attrs})['vpnservice'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -175,7 +176,7 @@ def take_action(self, parsed_args): client = self.app.client_manager.neutronclient obj = client.list_vpnservices()['vpnservices'] - headers, columns = osc_utils.get_column_definitions( + headers, columns = column_util.get_column_definitions( _attr_map, long_listing=parsed_args.long) return (headers, (utils.get_dict_properties(s, columns) for s in obj)) @@ -230,6 +231,6 @@ 'vpnservice', parsed_args.vpnservice, cmd_resource='vpnservice')['id'] obj = client.show_vpnservice(vpn_id)['vpnservice'] - columns, display_columns = osc_utils.get_columns(obj, _attr_map) + columns, display_columns = column_util.get_columns(obj, _attr_map) data = utils.get_dict_properties(obj, columns) return (display_columns, data) diff -Nru python-neutronclient-6.7.0/neutronclient/shell.py python-neutronclient-6.11.0/neutronclient/shell.py --- python-neutronclient-6.7.0/neutronclient/shell.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/shell.py 2018-11-15 14:27:38.000000000 +0000 @@ -596,8 +596,6 @@ super(NeutronShell, self).initialize_app(argv) - self.api_version = {'network': self.api_version} - # If the user is not asking for help, make sure they # have given us auth. cmd_name = None diff -Nru python-neutronclient-6.7.0/neutronclient/tests/functional/hooks/gate_hook.sh python-neutronclient-6.11.0/neutronclient/tests/functional/hooks/gate_hook.sh --- python-neutronclient-6.7.0/neutronclient/tests/functional/hooks/gate_hook.sh 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/functional/hooks/gate_hook.sh 2018-11-15 14:27:38.000000000 +0000 @@ -35,6 +35,7 @@ if [ "$VENV" == "functional-adv-svcs" ] then load_rc_hook fwaas + load_rc_hook vpnaas fi export DEVSTACK_LOCALCONF=$(cat $LOCAL_CONF) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/functional/hooks/post_test_hook.sh python-neutronclient-6.11.0/neutronclient/tests/functional/hooks/post_test_hook.sh --- python-neutronclient-6.7.0/neutronclient/tests/functional/hooks/post_test_hook.sh 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/functional/hooks/post_test_hook.sh 2018-11-15 14:27:38.000000000 +0000 @@ -32,11 +32,11 @@ function generate_testr_results { # Give job user rights to access tox logs sudo -H -u $USER chmod o+rw . - sudo -H -u $USER chmod o+rw -R .testrepository - if [ -f ".testrepository/0" ] ; then - .tox/$VENV/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit - $SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html - gzip -9 ./testrepository.subunit + sudo -H -u $USER chmod o+rw -R .stestr + if [ -f ".stestr/0" ] ; then + .tox/$VENV/bin/subunit-1to2 < .stestr/0 > ./stestr.subunit + $SCRIPTS_DIR/subunit2html ./stestr.subunit testr_results.html + gzip -9 ./stestr.subunit gzip -9 ./testr_results.html sudo mv ./*.gz /opt/stack/logs/ fi diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/bgp/test_cli20_speaker.py python-neutronclient-6.11.0/neutronclient/tests/unit/bgp/test_cli20_speaker.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/bgp/test_cli20_speaker.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/bgp/test_cli20_speaker.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.common import exceptions from neutronclient.neutron.v2_0.bgp import speaker as bgp_speaker @@ -155,18 +155,15 @@ None) self._test_list_resources(resources, cmd, True) - def test_list_bgp_speaker_pagination(self): + @mock.patch.object(bgp_speaker.ListSpeakers, "extend_list") + def test_list_bgp_speaker_pagination(self, mock_extend_list): # List all BGP Speakers with pagination support. cmd = bgp_speaker.ListSpeakers(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(bgp_speaker.ListSpeakers, - "extend_list") - bgp_speaker.ListSpeakers.extend_list(mox.IsA(list), - mox.IgnoreArg()) self._test_list_resources_with_pagination("bgp_speakers", cmd) - self.mox.VerifyAll() - self.mox.UnsetStubs() + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_list_bgp_speaker_sort(self): # sorted list: bgp-speaker-list --sort-key name --sort-key id diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/fw/test_cli20_firewallpolicy.py python-neutronclient-6.11.0/neutronclient/tests/unit/fw/test_cli20_firewallpolicy.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/fw/test_cli20_firewallpolicy.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/fw/test_cli20_firewallpolicy.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.neutron.v2_0.fw import firewallpolicy from neutronclient import shell @@ -166,24 +166,25 @@ 'insert_before': 'rule2', 'insert_after': 'rule1'} - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) body = extrafields path = getattr(self.client, resource + "_insert_path") - self.client.httpclient.request( + cmd_parser = cmd.get_parser(resource + "_insert_rule") + resp = (test_cli20.MyResp(204), None) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + shell.run_command(cmd, cmd_parser, args) + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), 4) + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path % myid), self.client), 'PUT', body=test_cli20.MyComparator(body, self.client), - headers=mox.ContainsKeyValue( - 'X-Auth-Token', - test_cli20.TOKEN)).AndReturn((test_cli20.MyResp(204), None)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser(resource + "_insert_rule") - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) def test_remove_firewall_rule(self): # firewall-policy-remove-rule myid ruleid @@ -195,24 +196,25 @@ args = ['myid', 'removerule'] extrafields = {'firewall_rule_id': 'removerule', } - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) body = extrafields path = getattr(self.client, resource + "_remove_path") - self.client.httpclient.request( + cmd_parser = cmd.get_parser(resource + "_remove_rule") + resp = (test_cli20.MyResp(204), None) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + shell.run_command(cmd, cmd_parser, args) + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), 2) + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path % myid), self.client), 'PUT', body=test_cli20.MyComparator(body, self.client), - headers=mox.ContainsKeyValue( - 'X-Auth-Token', - test_cli20.TOKEN)).AndReturn((test_cli20.MyResp(204), None)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser(resource + "_remove_rule") - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) def test_update_firewall_policy_name_shared_audited(self): # firewall-policy-update myid --name newname2 --shared --audited diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/lb/test_cli20_healthmonitor.py python-neutronclient-6.11.0/neutronclient/tests/unit/lb/test_cli20_healthmonitor.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/lb/test_cli20_healthmonitor.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/lb/test_cli20_healthmonitor.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.neutron.v2_0.lb import healthmonitor from neutronclient.tests.unit import test_cli20 @@ -149,10 +149,6 @@ pool_id = 'p_id' args = [health_monitor_id, pool_id] - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) - body = {resource: {'id': health_monitor_id}} result = {resource: {'id': health_monitor_id}, } result_str = self.client.serialize(result) @@ -160,17 +156,21 @@ path = getattr(self.client, "associate_pool_health_monitors_path") % pool_id return_tup = (test_cli20.MyResp(200), result_str) - self.client.httpclient.request( - test_cli20.end_url(path), 'POST', - body=test_cli20.MyComparator(body, self.client), - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() cmd_parser = cmd.get_parser('test_' + resource) parsed_args = cmd_parser.parse_args(args) - cmd.run(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=return_tup) as mock_request: + cmd.run(parsed_args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.end_url(path), 'POST', + body=test_cli20.MyComparator(body, self.client), + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) def test_disassociate_healthmonitor(self): cmd = healthmonitor.DisassociateHealthMonitor( @@ -181,22 +181,22 @@ pool_id = 'p_id' args = [health_monitor_id, pool_id] - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) - path = (getattr(self.client, "disassociate_pool_health_monitors_path") % {'pool': pool_id, 'health_monitor': health_monitor_id}) return_tup = (test_cli20.MyResp(204), None) - self.client.httpclient.request( - test_cli20.end_url(path), 'DELETE', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() cmd_parser = cmd.get_parser('test_' + resource) parsed_args = cmd_parser.parse_args(args) - cmd.run(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=return_tup) as mock_request: + cmd.run(parsed_args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.end_url(path), 'DELETE', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/lb/test_cli20_pool.py python-neutronclient-6.11.0/neutronclient/tests/unit/lb/test_cli20_pool.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/lb/test_cli20_pool.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/lb/test_cli20_pool.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.neutron.v2_0.lb import pool from neutronclient.tests.unit import test_cli20 @@ -139,27 +139,28 @@ fields = ['bytes_in', 'bytes_out'] args = ['--fields', 'bytes_in', '--fields', 'bytes_out', my_id] - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) query = "&".join(["fields=%s" % field for field in fields]) expected_res = {'stats': {'bytes_in': '1234', 'bytes_out': '4321'}} resstr = self.client.serialize(expected_res) path = getattr(self.client, "pool_path_stats") return_tup = (test_cli20.MyResp(200), resstr) - self.client.httpclient.request( - test_cli20.end_url(path % my_id, query), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() cmd_parser = cmd.get_parser("test_" + resource) parsed_args = cmd_parser.parse_args(args) - cmd.run(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=return_tup) as mock_request: + cmd.run(parsed_args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), 2) + mock_request.assert_called_once_with( + test_cli20.end_url(path % my_id, query), 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) _str = self.fake_stdout.make_string() self.assertIn('bytes_in', _str) self.assertIn('bytes_out', _str) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/lb/v2/test_cli20_loadbalancer.py python-neutronclient-6.11.0/neutronclient/tests/unit/lb/v2/test_cli20_loadbalancer.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/lb/v2/test_cli20_loadbalancer.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/lb/v2/test_cli20_loadbalancer.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.neutron.v2_0.lb.v2 import loadbalancer as lb from neutronclient.tests.unit import test_cli20 @@ -150,27 +150,27 @@ fields = ['bytes_in', 'bytes_out'] args = ['--fields', 'bytes_in', '--fields', 'bytes_out', my_id] - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) query = "&".join(["fields=%s" % field for field in fields]) expected_res = {'stats': {'bytes_in': '1234', 'bytes_out': '4321'}} resstr = self.client.serialize(expected_res) path = getattr(self.client, "lbaas_loadbalancer_path_stats") return_tup = (test_cli20.MyResp(200), resstr) - self.client.httpclient.request( - test_cli20.end_url(path % my_id, query), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() cmd_parser = cmd.get_parser("test_" + resource) parsed_args = cmd_parser.parse_args(args) - cmd.run(parsed_args) - - self.mox.VerifyAll() - self.mox.UnsetStubs() + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=return_tup) as mock_request: + cmd.run(parsed_args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), 2) + mock_request.assert_called_once_with( + test_cli20.end_url(path % my_id, query), 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) _str = self.fake_stdout.make_string() self.assertIn('bytes_in', _str) self.assertIn('1234', _str) @@ -184,10 +184,6 @@ my_id = self.test_id args = [my_id] - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) - expected_res = {'statuses': {'operating_status': 'ONLINE', 'provisioning_status': 'ACTIVE'}} @@ -195,19 +191,21 @@ path = getattr(self.client, "lbaas_loadbalancer_path_status") return_tup = (test_cli20.MyResp(200), resstr) - self.client.httpclient.request( - test_cli20.end_url(path % my_id), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() cmd_parser = cmd.get_parser("test_" + resource) parsed_args = cmd_parser.parse_args(args) - cmd.run(parsed_args) + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=return_tup) as mock_request: + cmd.run(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.end_url(path % my_id), 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) _str = self.fake_stdout.make_string() self.assertIn('operating_status', _str) self.assertIn('ONLINE', _str) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/test_utils.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/test_utils.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/test_utils.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/test_utils.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -# Copyright 2016 NEC Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import testtools - -from neutronclient.osc import utils - - -class TestUtils(testtools.TestCase): - - def test_get_column_definitions(self): - attr_map = ( - ('id', 'ID', utils.LIST_BOTH), - ('tenant_id', 'Project', utils.LIST_LONG_ONLY), - ('name', 'Name', utils.LIST_BOTH), - ('summary', 'Summary', utils.LIST_SHORT_ONLY), - ) - headers, columns = utils.get_column_definitions(attr_map, - long_listing=False) - self.assertEqual(['id', 'name', 'summary'], columns) - self.assertEqual(['ID', 'Name', 'Summary'], headers) - - def test_get_column_definitions_long(self): - attr_map = ( - ('id', 'ID', utils.LIST_BOTH), - ('tenant_id', 'Project', utils.LIST_LONG_ONLY), - ('name', 'Name', utils.LIST_BOTH), - ('summary', 'Summary', utils.LIST_SHORT_ONLY), - ) - headers, columns = utils.get_column_definitions(attr_map, - long_listing=True) - self.assertEqual(['id', 'tenant_id', 'name'], columns) - self.assertEqual(['ID', 'Project', 'Name'], headers) - - def test_get_columns(self): - item = { - 'id': 'test-id', - 'tenant_id': 'test-tenant_id', - # 'name' is not included - 'foo': 'bar', # unknown attribute - } - attr_map = ( - ('id', 'ID', utils.LIST_BOTH), - ('tenant_id', 'Project', utils.LIST_LONG_ONLY), - ('name', 'Name', utils.LIST_BOTH), - ) - columns, display_names = utils.get_columns(item, attr_map) - self.assertEqual(tuple(['id', 'tenant_id', 'foo']), columns) - self.assertEqual(tuple(['ID', 'Project', 'foo']), display_names) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/fwaas/fakes.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/fwaas/fakes.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/fwaas/fakes.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/fwaas/fakes.py 2018-11-15 14:27:38.000000000 +0000 @@ -127,4 +127,8 @@ ('shared', False), ('tenant_id', 'tenant-id-' + uuidutils.generate_uuid(dashed=False)), + ('source_firewall_group_id', 'firewall-group-id-' + + uuidutils.generate_uuid(dashed=False)), + ('destination_firewall_group_id', 'firewall-group-id-' + + uuidutils.generate_uuid(dashed=False)), )) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/fwaas/test_firewallrule.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/fwaas/test_firewallrule.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/fwaas/test_firewallrule.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/fwaas/test_firewallrule.py 2018-11-15 14:27:38.000000000 +0000 @@ -37,6 +37,10 @@ 'disable_rule': 'enabled', 'share': 'shared', 'no_share': 'shared', + 'source_firewall_group': 'source_firewall_group_id', + 'destination_firewall_group': 'destination_firewall_group_id', + 'no_source_firewall_group': 'source_firewall_group_id', + 'no_destination_firewall_group': 'destination_firewall_group_id', } @@ -114,11 +118,14 @@ 'Destination Port', 'Shared', 'Project', + 'Source Firewall Group ID', + 'Destination Firewall Group ID', ) self.data = _generate_data() self.ordered_headers = ( 'Action', 'Description', + 'Destination Firewall Group ID', 'Destination IP Address', 'Destination Port', 'Enabled', @@ -128,12 +135,14 @@ 'Project', 'Protocol', 'Shared', + 'Source Firewall Group ID', 'Source IP Address', 'Source Port', ) self.ordered_data = ( _fwr['action'], _fwr['description'], + _fwr['destination_firewall_group_id'], _fwr['destination_ip_address'], _fwr['destination_port'], _fwr['enabled'], @@ -143,12 +152,14 @@ _fwr['tenant_id'], _replace_display_columns('protocol', _fwr['protocol']), _fwr['shared'], + _fwr['source_firewall_group_id'], _fwr['source_ip_address'], _fwr['source_port'], ) self.ordered_columns = ( 'action', 'description', + 'destination_firewall_group_id', 'destination_ip_address', 'destination_port', 'enabled', @@ -158,6 +169,7 @@ 'tenant_id', 'protocol', 'shared', + 'source_firewall_group_id', 'source_ip_address', 'source_port', ) @@ -201,6 +213,10 @@ action = args.get('action') or 'deny' ip_version = args.get('ip_version') or '4' destination_port = args.get('destination_port') or '0:65535' + destination_firewall_group = args.get( + 'destination_firewall_group') or 'my-dst-fwg' + source_firewall_group = args.get( + 'source_firewall_group') or 'my-src-fwg' tenant_id = args.get('tenant_id') or 'my-tenant' arglist = [ '--description', description, @@ -215,7 +231,10 @@ '--project', tenant_id, '--disable-rule', '--share', + '--source-firewall-group', source_firewall_group, + '--destination-firewall-group', destination_firewall_group ] + verifylist = [ ('name', name), ('description', description), @@ -229,10 +248,23 @@ ('action', action), ('disable_rule', True), ('project', tenant_id), + ('source_firewall_group', source_firewall_group), + ('destination_firewall_group', destination_firewall_group) ] return arglist, verifylist def _test_create_with_all_params(self, args={}): + def _mock_fwr(*args, **kwargs): + if self.neutronclient.find_resource.call_count == 1: + self.neutronclient.find_resource.assert_called_once_with( + const.FWG, 'my-src-fwg', cmd_resource=const.CMD_FWG) + if self.neutronclient.find_resource.call_count == 2: + self.neutronclient.find_resource.assert_called_with( + const.FWG, 'my-dst-fwg', cmd_resource=const.CMD_FWG) + return {'id': args[1]} + + self.neutronclient.find_resource.side_effect = mock.Mock( + side_effect=_mock_fwr) arglist, verifylist = self._set_all_params(args) request, response = _generate_req_and_res(verifylist) self._update_expect_response(request, response) @@ -278,6 +310,34 @@ testtools.matchers._impl.MismatchError, self.check_parser, self.cmd, arglist, verifylist) + def test_create_with_src_fwg_and_no(self): + fwg = 'my-fwg' + arglist = [ + '--source-firewall-group', fwg, + '--no-source-firewall-group', + ] + verifylist = [ + ('source_firewall_group', fwg), + ('no_source_firewall_group', True), + ] + self.assertRaises( + utils.ParserException, + self.check_parser, self.cmd, arglist, verifylist) + + def test_create_with_dst_fwg_and_no(self): + fwg = 'my-fwg' + arglist = [ + '--destination-firewall-group', fwg, + '--no-destination-firewall-group', + ] + verifylist = [ + ('destination_firewall_group', fwg), + ('no_destination_firewall_group', True), + ] + self.assertRaises( + utils.ParserException, + self.check_parser, self.cmd, arglist, verifylist) + class TestListFirewallRule(TestFirewallRule): @@ -326,7 +386,8 @@ self.mocked.assert_called_once_with() self.assertEqual(list(self.headers), headers) - self.assertListItemEqual([self.data], list(data)) + m = list(data) + self.assertListItemEqual([self.data], m) def test_list_with_no_option(self): arglist = [] @@ -646,6 +707,74 @@ self.assertRaises( exceptions.CommandError, self.cmd.take_action, parsed_args) + def test_set_no_destination_fwg(self): + target = self.resource['id'] + arglist = [ + target, + '--no-destination-firewall-group', + ] + verifylist = [ + (self.res, target), + ('no_destination_firewall_group', True), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + result = self.cmd.take_action(parsed_args) + + self.mocked.assert_called_once_with( + target, {self.res: {'destination_firewall_group_id': None}}) + self.assertIsNone(result) + + def test_set_no_source_fwg(self): + target = self.resource['id'] + arglist = [ + target, + '--no-source-firewall-group', + ] + verifylist = [ + (self.res, target), + ('no_source_firewall_group', True), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + result = self.cmd.take_action(parsed_args) + + self.mocked.assert_called_once_with( + target, {self.res: {'source_firewall_group_id': None}}) + self.assertIsNone(result) + + def test_create_with_src_fwg_and_no(self): + target = self.resource['id'] + fwg = 'my-fwg' + arglist = [ + target, + '--source-firewall-group', fwg, + '--no-source-firewall-group', + ] + verifylist = [ + (self.res, target), + ('source_firewall_group', fwg), + ('no_source_firewall_group', True), + ] + self.assertRaises( + utils.ParserException, + self.check_parser, self.cmd, arglist, verifylist) + + def test_create_with_dst_fwg_and_no(self): + target = self.resource['id'] + fwg = 'my-fwg' + arglist = [ + target, + '--destination-firewall-group', fwg, + '--no-destination-firewall-group', + ] + verifylist = [ + (self.res, target), + ('destination_firewall_group', fwg), + ('no_destination_firewall_group', True), + ] + self.assertRaises( + utils.ParserException, + self.check_parser, self.cmd, arglist, verifylist) + class TestUnsetFirewallRule(TestFirewallRule, common.TestUnsetFWaaS): diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/logging/test_network_log.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/logging/test_network_log.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/logging/test_network_log.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/logging/test_network_log.py 2018-11-15 14:27:38.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2017 FUJITSU LIMITED +# Copyright 2017-2018 FUJITSU LIMITED # All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -29,6 +29,7 @@ _log = fakes.NetworkLog().create() RES_TYPE_SG = 'security_group' +RES_TYPE_FWG = 'firewall_group' CONVERT_MAP = { 'project': 'project_id', 'enable': 'enabled', @@ -137,6 +138,12 @@ return_value={'log': _log}) self.mocked = self.neutronclient.create_network_log self.cmd = network_log.CreateNetworkLog(self.app, self.namespace) + loggables = { + "loggable_resources": [{"type": RES_TYPE_SG, + "type": RES_TYPE_FWG}] + } + self.neutronclient.list_network_loggable_resources = mock.Mock( + return_value=loggables) def _update_expect_response(self, request, response): """Set expected request and response @@ -279,6 +286,90 @@ testtools.matchers._impl.MismatchError, self.check_parser, self.cmd, arglist, verifylist) + def test_create_with_valid_fwg_resource(self): + name = self.res['name'] + resource_id = 'valid_fwg_id' + resource_type = RES_TYPE_FWG + # Test with valid FWG ID + with mock.patch.object(self.neutronclient, 'find_resource', + return_value={'id': resource_id}): + arglist = [name, + '--resource-type', resource_type, + '--resource', resource_id + ] + verifylist = [ + ('name', name), + ('resource_type', resource_type), + ('resource', resource_id) + ] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + headers, data = self.cmd.take_action(parsed_args) + expect = { + 'name': self.res['name'], + 'resource_type': RES_TYPE_FWG, + 'resource_id': 'valid_fwg_id', + } + self.neutronclient.find_resource.assert_called_with( + resource_type, + resource_id, + cmd_resource='fwaas_firewall_group') + self.mocked.assert_called_once_with({'log': expect}) + self.assertEqual(self.ordered_headers, headers) + self.assertEqual(self.ordered_data, data) + + def test_create_with_invalid_fwg_resource(self): + name = self.res['name'] + resource_id = 'invalid_fwg_id' + resource_type = RES_TYPE_FWG + # Test with invalid FWG ID + with mock.patch.object(self.neutronclient, 'find_resource', + side_effect=exceptions.NotFound(code=0)): + arglist = [name, + '--resource-type', resource_type, + '--resource', resource_id + ] + verifylist = [ + ('name', name), + ('resource_type', resource_type), + ('resource', resource_id) + ] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + self.assertRaises(exceptions.NotFound, + self.cmd.take_action, + parsed_args) + self.neutronclient.find_resource.assert_called_with( + resource_type, + resource_id, + cmd_resource='fwaas_firewall_group') + self.mocked.assert_not_called() + + def test_create_with_invalid_resource_type(self): + name = self.res['name'] + resource_type = 'invalid_resource_type' + resource_id = 'valid_fwg_id' + with mock.patch.object(self.neutronclient, 'find_resource', + side_effect=exceptions.NotFound(code=0)): + arglist = [name, + '--resource-type', resource_type, + '--resource', resource_id + ] + verifylist = [ + ('name', name), + ('resource_type', resource_type), + ('resource', resource_id) + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + self.assertRaises(exceptions.NotFound, + self.cmd.take_action, + parsed_args) + self.neutronclient.find_resource.assert_called_with( + resource_type, + resource_id, + cmd_resource=None) + self.mocked.assert_not_called() + class TestListNetworkLog(TestNetworkLog): diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/fakes.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/fakes.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/fakes.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/fakes.py 2018-11-15 14:27:38.000000000 +0000 @@ -17,6 +17,7 @@ import copy import mock +from osc_lib.utils import columns as column_util from neutronclient.osc import utils as nc_osc_utils from neutronclient.osc.v2.networking_bgpvpn import constants @@ -77,6 +78,7 @@ 'routers': [], 'ports': [], 'vni': 100, + 'local_pref': 777, } # Overwrite default attributes. @@ -105,10 +107,10 @@ _resource_plural = '%ss' % _resource _attr_map = ( - ('id', 'ID', nc_osc_utils.LIST_BOTH), - ('tenant_id', 'Project', nc_osc_utils.LIST_LONG_ONLY), + ('id', 'ID', column_util.LIST_BOTH), + ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), ('%s_id' % _assoc_res_name, '%s ID' % _assoc_res_name.capitalize(), - nc_osc_utils.LIST_BOTH), + column_util.LIST_BOTH), ) _formatters = {} diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_bgpvpn.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_bgpvpn.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_bgpvpn.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_bgpvpn.py 2018-11-15 14:27:38.000000000 +0000 @@ -20,25 +20,25 @@ import mock from osc_lib import exceptions from osc_lib import utils as osc_utils +from osc_lib.utils import columns as column_util -from neutronclient.osc import utils as nc_osc_utils from neutronclient.osc.v2.networking_bgpvpn import bgpvpn from neutronclient.osc.v2.networking_bgpvpn import constants from neutronclient.tests.unit.osc.v2.networking_bgpvpn import fakes columns_short = tuple(col for col, _, listing_mode in bgpvpn._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_SHORT_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_SHORT_ONLY)) columns_long = tuple(col for col, _, listing_mode in bgpvpn._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_LONG_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_LONG_ONLY)) headers_short = tuple(head for _, head, listing_mode in bgpvpn._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_SHORT_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_SHORT_ONLY)) headers_long = tuple(head for _, head, listing_mode in bgpvpn._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_LONG_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_LONG_ONLY)) sorted_attr_map = sorted(bgpvpn._attr_map, key=operator.itemgetter(1)) sorted_columns = tuple(col for col, _, _ in sorted_attr_map) sorted_headers = tuple(head for _, head, _ in sorted_attr_map) @@ -64,6 +64,7 @@ ('name', None), ('type', 'l3'), ('vni', None), + ('local_pref', None), ('route_targets', None), ('import_targets', None), ('export_targets', None), @@ -85,6 +86,7 @@ 'name': 'fake_name', 'type': 'l2', 'vni': 100, + 'local_pref': 777, 'route_targets': ['fake_rt1', 'fake_rt2', 'fake_rt3'], 'import_targets': ['fake_irt1', 'fake_irt2', 'fake_irt3'], 'export_targets': ['fake_ert1', 'fake_ert2', 'fake_ert3'], @@ -98,6 +100,7 @@ '--name', fake_bgpvpn['name'], '--type', fake_bgpvpn['type'], '--vni', str(fake_bgpvpn['vni']), + '--local-pref', str(fake_bgpvpn['local_pref']), ] for rt in fake_bgpvpn['route_targets']: arglist.extend(['--route-target', rt]) @@ -112,6 +115,7 @@ ('name', fake_bgpvpn['name']), ('type', fake_bgpvpn['type']), ('vni', fake_bgpvpn['vni']), + ('local_pref', fake_bgpvpn['local_pref']), ('route_targets', fake_bgpvpn['route_targets']), ('import_targets', fake_bgpvpn['import_targets']), ('export_targets', fake_bgpvpn['export_targets']), diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_resource_association.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_resource_association.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_resource_association.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_resource_association.py 2018-11-15 14:27:38.000000000 +0000 @@ -20,27 +20,27 @@ import mock from osc_lib import exceptions from osc_lib import utils as osc_utils +from osc_lib.utils import columns as column_util -from neutronclient.osc import utils as nc_osc_utils from neutronclient.tests.unit.osc.v2.networking_bgpvpn import fakes columns_short = tuple(col for col, _, listing_mode in fakes.BgpvpnFakeAssoc._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_SHORT_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_SHORT_ONLY)) columns_long = tuple(col for col, _, listing_mode in fakes.BgpvpnFakeAssoc._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_LONG_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_LONG_ONLY)) headers_short = tuple(head for _, head, listing_mode in fakes.BgpvpnFakeAssoc._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_SHORT_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_SHORT_ONLY)) headers_long = tuple(head for _, head, listing_mode in fakes.BgpvpnFakeAssoc._attr_map - if listing_mode in (nc_osc_utils.LIST_BOTH, - nc_osc_utils.LIST_LONG_ONLY)) + if listing_mode in (column_util.LIST_BOTH, + column_util.LIST_LONG_ONLY)) sorted_attr_map = sorted(fakes.BgpvpnFakeAssoc._attr_map, key=operator.itemgetter(1)) sorted_columns = tuple(col for col, _, _ in sorted_attr_map) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/sfc/test_port_pair_group.py python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/sfc/test_port_pair_group.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/osc/v2/sfc/test_port_pair_group.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/osc/v2/sfc/test_port_pair_group.py 2018-11-15 14:27:38.000000000 +0000 @@ -293,7 +293,7 @@ if self.neutronclient.find_resource.call_count == 3: self.neutronclient.find_resource.assert_called_with( self.res, target, cmd_resource='sfc_port_pair_group') - return {'port_pairs': self.ppg_pp} + return {'port_pairs': [self.ppg_pp]} self.neutronclient.find_resource.side_effect = _mock_port_pair_group @@ -423,7 +423,7 @@ if self.neutronclient.find_resource.call_count == 1: self.neutronclient.find_resource.assert_called_with( self.res, target, cmd_resource='sfc_port_pair_group') - return {'port_pairs': self.ppg_pp} + return {'port_pairs': [self.ppg_pp]} if self.neutronclient.find_resource.call_count == 2: self.neutronclient.find_resource.assert_called_with( diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_casual_args.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_casual_args.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_casual_args.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_casual_args.py 2018-11-15 14:27:38.000000000 +0000 @@ -14,6 +14,7 @@ # under the License. # +import six import testtools from neutronclient.common import exceptions @@ -41,6 +42,13 @@ _mydict = neutronV20.parse_args_to_dict(_specs) self.assertFalse(_mydict['my_bool']) + def test_int_and_str(self): + _specs = ['--my-int', 'type=int', '10', + '--my-str', 'type=str', 'value1'] + _mydict = neutronV20.parse_args_to_dict(_specs) + self.assertEqual(10, _mydict['my_int']) + self.assertEqual('value1', _mydict['my_str']) + def test_nargs(self): _specs = ['--tag', 'x', 'y', '--arg1', 'value1'] _mydict = neutronV20.parse_args_to_dict(_specs) @@ -102,15 +110,25 @@ self.assertEqual('value1', arg1[0]['key1']) self.assertEqual('value2', arg1[0]['key2']) + def test_parse_args_to_dict_bad_type(self): + _specs = ['--badtypearg', 'type=badtype', 'val1'] + ex = self.assertRaises(exceptions.CommandError, + neutronV20.parse_args_to_dict, _specs) + self.assertEqual('Invalid value_specs --badtypearg type=badtype val1: ' + 'type badtype is not supported', + six.text_type(ex)) + def test_clear_action(self): _specs = ['--anyarg', 'action=clear'] args = neutronV20.parse_args_to_dict(_specs) self.assertIsNone(args['anyarg']) - def test_bad_values_str(self): + def test_bad_values_str_without_value(self): _specs = ['--strarg', 'type=str'] - self.assertRaises(exceptions.CommandError, - neutronV20.parse_args_to_dict, _specs) + ex = self.assertRaises(exceptions.CommandError, + neutronV20.parse_args_to_dict, _specs) + self.assertEqual('Invalid values_specs --strarg type=str', + six.text_type(ex)) def test_bad_values_list(self): _specs = ['--listarg', 'list=true', 'type=str'] diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_address_scope.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_address_scope.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_address_scope.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_address_scope.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.common import exceptions from neutronclient.neutron.v2_0 import address_scope @@ -127,18 +127,15 @@ None) self._test_list_resources(resources, cmd, True) - def test_list_address_scope_pagination(self): + @mock.patch.object(address_scope.ListAddressScope, "extend_list") + def test_list_address_scope_pagination(self, mock_extend_list): # address_scope-list. cmd = address_scope.ListAddressScope(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(address_scope.ListAddressScope, - "extend_list") - address_scope.ListAddressScope.extend_list(mox.IsA(list), - mox.IgnoreArg()) self._test_list_resources_with_pagination("address_scopes", cmd) - self.mox.VerifyAll() - self.mox.UnsetStubs() + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_list_address_scope_sort(self): # sorted list: diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_agentschedulers.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_agentschedulers.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_agentschedulers.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_agentschedulers.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.neutron.v2_0 import agentscheduler from neutronclient.neutron.v2_0 import network @@ -34,43 +34,43 @@ path = ((self.client.agent_path + destination) % cmd_args[0]) - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) result_str = self.client.serialize(result) return_tup = (test_cli20.MyResp(200), result_str) - self.client.httpclient.request( - test_cli20.end_url(path), 'POST', - body=test_cli20.MyComparator(body, self.client), - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() cmd_parser = cmd.get_parser('test_' + resource) parsed_args = cmd_parser.parse_args(cmd_args) - cmd.run(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=return_tup) as mock_request: + cmd.run(parsed_args) + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.end_url(path), 'POST', + body=test_cli20.MyComparator(body, self.client), + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) def _test_remove_from_agent(self, resource, cmd, cmd_args, destination): path = ((self.client.agent_path + destination + '/%s') % cmd_args) - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) return_tup = (test_cli20.MyResp(204), None) - self.client.httpclient.request( - test_cli20.end_url(path), 'DELETE', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() cmd_parser = cmd.get_parser('test_' + resource) parsed_args = cmd_parser.parse_args(cmd_args) - cmd.run(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=return_tup) as mock_request: + cmd.run(parsed_args) + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.end_url(path), 'DELETE', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) class CLITestV20DHCPAgentScheduler(CLITestV20AgentScheduler): @@ -93,17 +93,18 @@ self._test_remove_from_agent(resource, cmd, args, self.client.DHCP_NETS) - def test_list_networks_on_agent(self): + @mock.patch.object(network.ListNetwork, "extend_list") + def test_list_networks_on_agent(self, mock_extend_list): resources = 'networks' cmd = agentscheduler.ListNetworksOnDhcpAgent( test_cli20.MyApp(sys.stdout), None) agent_id = 'agent_id1' path = ((self.client.agent_path + self.client.DHCP_NETS) % agent_id) - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) self._test_list_resources(resources, cmd, base_args=[agent_id], path=path) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_list_agents_hosting_network(self): resources = 'agent' diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_network.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_network.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_network.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_network.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import itertools import sys -from mox3 import mox +import mock from oslo_serialization import jsonutils from neutronclient.common import exceptions @@ -159,31 +159,32 @@ def test_list_nets_empty_with_column(self): resources = "networks" cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) - cmd.get_client().MultipleTimes().AndReturn(self.client) reses = {resources: []} resstr = self.client.serialize(reses) + resp = (test_cli20.MyResp(200), resstr) # url method body query = "id=myfakeid" args = ['-c', 'id', '--', '--id', 'myfakeid'] path = getattr(self.client, resources + "_path") - self.client.httpclient.request( + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request, \ + mock.patch.object(network.ListNetwork, "extend_list", + return_value=None) as mock_extend_list: + cmd_parser = cmd.get_parser("list_" + resources) + shell.run_command(cmd, cmd_parser, args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( test_cli20.MyUrlComparator(test_cli20.end_url(path, query), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', - test_cli20.TOKEN)).AndReturn( - (test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("list_" + resources) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) _str = self.fake_stdout.make_string() self.assertEqual('\n', _str) @@ -192,18 +193,22 @@ sort_key=(), sort_dir=(), base_args=None, query=''): resources = "networks" - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) - self._test_list_resources(resources, cmd, detail, tags, - fields_1, fields_2, page_size=page_size, - sort_key=sort_key, sort_dir=sort_dir, - base_args=base_args, query=query) + with mock.patch.object(network.ListNetwork, "extend_list", + return_value=None) as mock_extend_list: + self._test_list_resources(resources, cmd, detail, tags, + fields_1, fields_2, page_size=page_size, + sort_key=sort_key, sort_dir=sort_dir, + base_args=base_args, query=query) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_list_nets_pagination(self): cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) - self._test_list_resources_with_pagination("networks", cmd) + with mock.patch.object(network.ListNetwork, "extend_list", + return_value=None) as mock_extend_list: + self._test_list_resources_with_pagination("networks", cmd) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_list_nets_sort(self): # list nets: @@ -250,41 +255,51 @@ self._test_list_networks(cmd, detail=True, tags=['a', 'b']) def _test_list_nets_extend_subnets(self, data, expected): - def setup_list_stub(resources, data, query): - reses = {resources: data} - resstr = self.client.serialize(reses) - resp = (test_cli20.MyResp(200), resstr) - path = getattr(self.client, resources + '_path') - self.client.httpclient.request( - test_cli20.MyUrlComparator( - test_cli20.end_url(path, query), self.client), - 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(resp) - cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(cmd, 'get_client') - self.mox.StubOutWithMock(self.client.httpclient, 'request') - cmd.get_client().MultipleTimes().AndReturn(self.client) - setup_list_stub('networks', data, '') + nets_path = getattr(self.client, 'networks_path') + subnets_path = getattr(self.client, 'subnets_path') + nets_query = '' filters = '' for n in data: for s in n['subnets']: filters = filters + "&id=%s" % s - setup_list_stub('subnets', - [{'id': 'mysubid1', 'cidr': '192.168.1.0/24'}, + subnets_query = 'fields=id&fields=cidr' + filters + with mock.patch.object(cmd, 'get_client', + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, + "request") as mock_request: + resp1 = (test_cli20.MyResp(200), + self.client.serialize({'networks': data})) + resp2 = (test_cli20.MyResp(200), + self.client.serialize({'subnets': [ + {'id': 'mysubid1', 'cidr': '192.168.1.0/24'}, {'id': 'mysubid2', 'cidr': '172.16.0.0/24'}, - {'id': 'mysubid3', 'cidr': '10.1.1.0/24'}], - query='fields=id&fields=cidr' + filters) - self.mox.ReplayAll() - - args = [] - cmd_parser = cmd.get_parser('list_networks') - parsed_args = cmd_parser.parse_args(args) - result = cmd.take_action(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + {'id': 'mysubid3', 'cidr': '10.1.1.0/24'}]})) + mock_request.side_effect = [resp1, resp2] + args = [] + cmd_parser = cmd.get_parser('list_networks') + parsed_args = cmd_parser.parse_args(args) + result = cmd.take_action(parsed_args) + + mock_get_client.assert_called_with() + self.assertEqual(2, mock_request.call_count) + mock_request.assert_has_calls([ + mock.call( + test_cli20.MyUrlComparator( + test_cli20.end_url(nets_path, nets_query), + self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})), + mock.call( + test_cli20.MyUrlComparator( + test_cli20.end_url(subnets_path, subnets_query), + self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN}))]) _result = [x for x in result[1]] self.assertEqual(len(expected), len(_result)) for res, exp in zip(_result, expected): @@ -319,9 +334,11 @@ def _test_list_nets_columns(self, cmd, returned_body, args=('-f', 'json')): resources = 'networks' - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) - self._test_list_columns(cmd, resources, returned_body, args=args) + with mock.patch.object(network.ListNetwork, "extend_list", + return_value=None) as mock_extend_list: + self._test_list_columns(cmd, resources, returned_body, args=args) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_list_nets_defined_column(self): cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) @@ -355,46 +372,43 @@ def test_list_external_nets_empty_with_column(self): resources = "networks" cmd = network.ListExternalNetwork(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) - cmd.get_client().MultipleTimes().AndReturn(self.client) reses = {resources: []} resstr = self.client.serialize(reses) # url method body query = "router%3Aexternal=True&id=myfakeid" args = ['-c', 'id', '--', '--id', 'myfakeid'] path = getattr(self.client, resources + "_path") - self.client.httpclient.request( + resp = (test_cli20.MyResp(200), resstr) + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request, \ + mock.patch.object(network.ListNetwork, "extend_list", + return_value=None) as mock_extend_list: + cmd_parser = cmd.get_parser("list_" + resources) + shell.run_command(cmd, cmd_parser, args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, query), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', - test_cli20.TOKEN)).AndReturn( - (test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("list_" + resources) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) _str = self.fake_stdout.make_string() self.assertEqual('\n', _str) def _test_list_external_nets(self, resources, cmd, detail=False, tags=(), fields_1=(), fields_2=()): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) - cmd.get_client().MultipleTimes().AndReturn(self.client) reses = {resources: [{'id': 'myid1', }, {'id': 'myid2', }, ], } resstr = self.client.serialize(reses) + resp = (test_cli20.MyResp(200), resstr) # url method body query = "" @@ -432,18 +446,25 @@ query = query and query + '&verbose=True' or 'verbose=True' path = getattr(self.client, resources + "_path") - self.client.httpclient.request( + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request, \ + mock.patch.object(network.ListNetwork, "extend_list", + return_value=None) as mock_extend_list: + cmd_parser = cmd.get_parser("list_" + resources) + shell.run_command(cmd, cmd_parser, args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, query), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("list_" + resources) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) _str = self.fake_stdout.make_string() self.assertIn('myid1', _str) @@ -589,21 +610,6 @@ class CLITestV20ExtendListNetworkJSON(test_cli20.CLITestV20Base): - def _test_extend_list(self, mox_calls): - data = [{'id': 'netid%d' % i, 'name': 'net%d' % i, - 'subnets': ['mysubid%d' % i]} - for i in range(10)] - self.mox.StubOutWithMock(self.client.httpclient, "request") - path = getattr(self.client, 'subnets_path') - cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(cmd, "get_client") - cmd.get_client().MultipleTimes().AndReturn(self.client) - mox_calls(path, data) - self.mox.ReplayAll() - known_args, _vs = cmd.get_parser('create_subnets').parse_known_args() - cmd.extend_list(data, known_args) - self.mox.VerifyAll() - def _build_test_data(self, data): subnet_ids = [] response = [] @@ -620,41 +626,73 @@ return filters, resp def test_extend_list(self): - def mox_calls(path, data): - filters, response = self._build_test_data(data) - self.client.httpclient.request( - test_cli20.MyUrlComparator(test_cli20.end_url( - path, 'fields=id&fields=cidr' + filters), self.client), - 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(response) - - self._test_extend_list(mox_calls) + data = [{'id': 'netid%d' % i, 'name': 'net%d' % i, + 'subnets': ['mysubid%d' % i]} + for i in range(10)] + filters, response = self._build_test_data(data) + path = getattr(self.client, 'subnets_path') + cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=response) as mock_request: + known_args, _vs = cmd.get_parser('create_subnets')\ + .parse_known_args() + cmd.extend_list(data, known_args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.MyUrlComparator(test_cli20.end_url( + path, 'fields=id&fields=cidr' + filters), self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) def test_extend_list_exceed_max_uri_len(self): - def mox_calls(path, data): - sub_data_lists = [data[:len(data) - 1], data[len(data) - 1:]] - filters, response = self._build_test_data(data) - + data = [{'id': 'netid%d' % i, 'name': 'net%d' % i, + 'subnets': ['mysubid%d' % i]} + for i in range(10)] + # Since in pagination we add &marker= (44 symbols), total change + # is 45 symbols. Single subnet takes 40 symbols (id=&). + # Because of it marker will take more space than single subnet filter, + # and we expect neutron to send last 2 subnets in separate response. + filters1, response1 = self._build_test_data(data[:len(data) - 2]) + filters2, response2 = self._build_test_data(data[len(data) - 2:]) + path = getattr(self.client, 'subnets_path') + cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, + "request") as mock_request, \ + mock.patch.object(self.client.httpclient, "_check_uri_length", + return_value=None) as mock_check_uri_length: # 1 char of extra URI len will cause a split in 2 requests - self.mox.StubOutWithMock(self.client.httpclient, - "_check_uri_length") - self.client.httpclient._check_uri_length(mox.IgnoreArg()).AndRaise( - exceptions.RequestURITooLong(excess=1)) - - for data in sub_data_lists: - filters, response = self._build_test_data(data) - self.client.httpclient._check_uri_length( - mox.IgnoreArg()).AndReturn(None) - self.client.httpclient.request( - test_cli20.MyUrlComparator( - test_cli20.end_url( - path, 'fields=id&fields=cidr%s' % filters), - self.client), - 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(response) - - self._test_extend_list(mox_calls) + mock_check_uri_length.side_effect = [ + exceptions.RequestURITooLong(excess=1), None, None] + mock_request.side_effect = [response1, response2] + known_args, _vs = cmd.get_parser('create_subnets')\ + .parse_known_args() + cmd.extend_list(data, known_args) + + mock_get_client.assert_called_once_with() + self.assertEqual(2, mock_request.call_count) + mock_request.assert_has_calls([ + mock.call( + test_cli20.MyUrlComparator( + test_cli20.end_url( + path, 'fields=id&fields=cidr%s' % filters1), + self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})), + mock.call( + test_cli20.MyUrlComparator( + test_cli20.end_url( + path, 'fields=id&fields=cidr%s' % filters2), + self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN}))]) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_port.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_port.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_port.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_port.py 2018-11-15 14:27:38.000000000 +0000 @@ -17,7 +17,7 @@ import itertools import sys -from mox3 import mox +import mock from neutronclient.neutron.v2_0 import port from neutronclient import shell @@ -460,14 +460,10 @@ def _test_list_router_port(self, resources, cmd, myid, detail=False, tags=(), fields_1=(), fields_2=()): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) reses = {resources: [{'id': 'myid1', }, {'id': 'myid2', }, ], } resstr = self.client.serialize(reses) - # url method body query = "" args = detail and ['-D', ] or [] @@ -503,19 +499,23 @@ query = query and query + '&verbose=True' or 'verbose=True' query = query and query + '&device_id=%s' or 'device_id=%s' path = getattr(self.client, resources + "_path") - self.client.httpclient.request( + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=(test_cli20.MyResp(200), + resstr)) as mock_request: + cmd_parser = cmd.get_parser("list_" + resources) + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), 2) + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( - test_cli20.end_url(path, query % myid), - self.client), + test_cli20.end_url(path, query % myid), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("list_" + resources) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) _str = self.fake_stdout.make_string() self.assertIn('myid1', _str) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20.py 2018-11-15 14:27:38.000000000 +0000 @@ -20,7 +20,6 @@ import sys import mock -from mox3 import mox from oslo_utils import encodeutils from oslotest import base import requests @@ -93,12 +92,12 @@ return query and _url_str + "?" + query or _url_str -class MyUrlComparator(mox.Comparator): +class MyUrlComparator(object): def __init__(self, lhs, client): self.lhs = lhs self.client = client - def equals(self, rhs): + def __eq__(self, rhs): lhsp = urlparse.urlparse(self.lhs) rhsp = urlparse.urlparse(rhs) @@ -118,7 +117,7 @@ return str(self) -class MyComparator(mox.Comparator): +class MyComparator(object): def __init__(self, lhs, client): self.lhs = lhs self.client = client @@ -159,7 +158,7 @@ return self._com_list(lhs, rhs) return lhs == rhs - def equals(self, rhs): + def __eq__(self, rhs): if self.client: rhs = self.client.deserialize(rhs, 200) return self._com(self.lhs, rhs) @@ -170,6 +169,46 @@ return str(self.lhs) +class ContainsKeyValue(object): + """Checks whether key/value pair(s) are included in a dict parameter. + + This class just checks whether specifid key/value pairs passed in + __init__() are included in a dict parameter. The comparison does not + fail even if other key/value pair(s) exists in a target dict. + """ + + def __init__(self, expected): + self._expected = expected + + def __eq__(self, other): + if not isinstance(other, dict): + return False + for key, value in self._expected.items(): + if key not in other: + return False + if other[key] != value: + return False + return True + + def __repr__(self): + return ('<%s (expected: %s)>' % + (self.__class__.__name__, self._expected)) + + +class IsA(object): + """Checks whether the parameter is of specific type.""" + + def __init__(self, expected_type): + self._expected_type = expected_type + + def __eq__(self, other): + return isinstance(other, self._expected_type) + + def __repr__(self): + return ('<%s (expected: %s)>' % + (self.__class__.__name__, self._expected_type)) + + class CLITestV20Base(base.BaseTestCase): test_id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' @@ -188,7 +227,6 @@ if plurals is not None: client.Client.EXTED_PLURALS.update(plurals) self.metadata = {'plurals': client.Client.EXTED_PLURALS} - self.mox = mox.Mox() self.endurl = ENDURL self.fake_stdout = FakeStdout() @@ -223,9 +261,6 @@ parent_id=None, no_api_call=False, expected_exception=None, **kwargs): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) if not cmd_resource: cmd_resource = resource if (resource in self.non_admin_status_resources): @@ -252,34 +287,37 @@ path = getattr(self.client, resource_plural + "_path") if parent_id: path = path % parent_id - mox_body = MyComparator(body, self.client) + mock_body = MyComparator(body, self.client) + + cmd_parser = cmd.get_parser('create_' + resource) + resp = (MyResp(200), resstr) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + if expected_exception: + self.assertRaises(expected_exception, + shell.run_command, cmd, cmd_parser, args) + else: + shell.run_command(cmd, cmd_parser, args) + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) if not no_api_call: - self.client.httpclient.request( + mock_request.assert_called_once_with( end_url(path), 'POST', - body=mox_body, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser('create_' + resource) - if expected_exception: - self.assertRaises(expected_exception, - shell.run_command, cmd, cmd_parser, args) - else: - shell.run_command(cmd, cmd_parser, args) + body=mock_body, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})) + if not expected_exception: _str = self.fake_stdout.make_string() self.assertIn(myid, _str) if name: self.assertIn(name, _str) - self.mox.VerifyAll() - self.mox.UnsetStubs() def _test_list_columns(self, cmd, resources, resources_out, args=('-f', 'json'), cmd_resources=None, parent_id=None): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) if not cmd_resources: cmd_resources = resources @@ -288,25 +326,27 @@ path = getattr(self.client, cmd_resources + "_path") if parent_id: path = path % parent_id - self.client.httpclient.request( + cmd_parser = cmd.get_parser("list_" + cmd_resources) + resp = (MyResp(200), resstr) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + mock_request.assert_called_once_with( end_url(path), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("list_" + cmd_resources) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})) def _test_list_resources(self, resources, cmd, detail=False, tags=(), fields_1=(), fields_2=(), page_size=None, sort_key=(), sort_dir=(), response_contents=None, base_args=None, path=None, cmd_resources=None, parent_id=None, output_format=None, query=""): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) if not cmd_resources: cmd_resources = resources if response_contents is None: @@ -382,18 +422,22 @@ if output_format: args.append('-f') args.append(output_format) - self.client.httpclient.request( - MyUrlComparator(end_url(path, query), - self.client), + cmd_parser = cmd.get_parser("list_" + cmd_resources) + resp = (MyResp(200), resstr) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + mock_request.assert_called_once_with( + MyUrlComparator(end_url(path, query), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("list_" + cmd_resources) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})) _str = self.fake_stdout.make_string() if response_contents is None: self.assertIn('myid1', _str) @@ -403,9 +447,6 @@ base_args=None, cmd_resources=None, parent_id=None, query=""): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) if not cmd_resources: cmd_resources = resources @@ -421,29 +462,34 @@ {'id': 'myid4', }]} resstr1 = self.client.serialize(reses1) resstr2 = self.client.serialize(reses2) - self.client.httpclient.request( - end_url(path, query), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr1)) - self.client.httpclient.request( - MyUrlComparator(end_url(path, fake_query), - self.client), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr2)) - self.mox.ReplayAll() cmd_parser = cmd.get_parser("list_" + cmd_resources) args = base_args if base_args is not None else [] - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + mock_request_calls = [ + mock.call( + end_url(path, query), 'GET', + body=None, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})), + mock.call( + MyUrlComparator(end_url(path, fake_query), + self.client), 'GET', + body=None, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN}))] + mock_request_resp = [(MyResp(200), resstr1), (MyResp(200), resstr2)] + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, + "request") as mock_request: + mock_request.side_effect = mock_request_resp + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + self.assertEqual(2, mock_request.call_count) + mock_request.assert_has_calls(mock_request_calls) def _test_update_resource(self, resource, cmd, myid, args, extrafields, cmd_resource=None, parent_id=None): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) if not cmd_resource: cmd_resource = resource @@ -453,27 +499,29 @@ path = path % (parent_id, myid) else: path = path % myid - mox_body = MyComparator(body, self.client) + mock_body = MyComparator(body, self.client) - self.client.httpclient.request( + cmd_parser = cmd.get_parser("update_" + cmd_resource) + resp = (MyResp(204), None) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + mock_request.assert_called_once_with( MyUrlComparator(end_url(path), self.client), 'PUT', - body=mox_body, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(204), None)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("update_" + cmd_resource) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + body=mock_body, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})) _str = self.fake_stdout.make_string() self.assertIn(myid, _str) def _test_show_resource(self, resource, cmd, myid, args, fields=(), cmd_resource=None, parent_id=None): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) if not cmd_resource: cmd_resource = resource @@ -487,53 +535,68 @@ path = path % (parent_id, myid) else: path = path % myid - self.client.httpclient.request( + cmd_parser = cmd.get_parser("show_" + cmd_resource) + resp = (MyResp(200), resstr) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + mock_request.assert_called_once_with( end_url(path, query), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("show_" + cmd_resource) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})) _str = self.fake_stdout.make_string() self.assertIn(myid, _str) self.assertIn('myname', _str) def _test_set_path_and_delete(self, path, parent_id, myid, + mock_request_calls, mock_request_returns, delete_fail=False): return_val = 404 if delete_fail else 204 if parent_id: path = path % (parent_id, myid) else: path = path % (myid) - self.client.httpclient.request( + mock_request_returns.append((MyResp(return_val), None)) + mock_request_calls.append(mock.call( end_url(path), 'DELETE', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp( - return_val), None)) + headers=ContainsKeyValue({'X-Auth-Token': TOKEN}))) def _test_delete_resource(self, resource, cmd, myid, args, cmd_resource=None, parent_id=None, extra_id=None, delete_fail=False): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) + mock_request_calls = [] + mock_request_returns = [] if not cmd_resource: cmd_resource = resource path = getattr(self.client, cmd_resource + "_path") - self._test_set_path_and_delete(path, parent_id, myid) + self._test_set_path_and_delete(path, parent_id, myid, + mock_request_calls, + mock_request_returns) # extra_id is used to test for bulk_delete if extra_id: self._test_set_path_and_delete(path, parent_id, extra_id, + mock_request_calls, + mock_request_returns, delete_fail) - self.mox.ReplayAll() cmd_parser = cmd.get_parser("delete_" + cmd_resource) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, + "request") as mock_request: + mock_request.side_effect = mock_request_returns + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + mock_request.assert_has_calls(mock_request_calls) _str = self.fake_stdout.make_string() self.assertIn(myid, _str) if extra_id: @@ -542,27 +605,37 @@ def _test_update_resource_action(self, resource, cmd, myid, action, args, body, expected_code=200, retval=None, cmd_resource=None): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) if not cmd_resource: cmd_resource = resource path = getattr(self.client, cmd_resource + "_path") path_action = '%s/%s' % (myid, action) - self.client.httpclient.request( + cmd_parser = cmd.get_parser("update_" + cmd_resource) + resp = (MyResp(expected_code), retval) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + shell.run_command(cmd, cmd_parser, args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + mock_request.assert_called_once_with( end_url(path % path_action), 'PUT', body=MyComparator(body, self.client), - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(expected_code), - retval)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("update_" + cmd_resource) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})) _str = self.fake_stdout.make_string() self.assertIn(myid, _str) + def assert_mock_multiple_calls_with_same_arguments( + self, mocked_method, expected_call, count): + if count is None: + self.assertLessEqual(1, mocked_method.call_count) + else: + self.assertEqual(count, mocked_method.call_count) + mocked_method.assert_has_calls( + [expected_call] * mocked_method.call_count) + class TestListCommand(neutronV2_0.ListCommand): resource = 'test_resource' @@ -592,7 +665,6 @@ query=query) def _test_list_resources_with_arg_error(self, base_args=''): - self.addCleanup(self.mox.UnsetStubs) resources = 'test_resources' cmd = TestListCommand(MyApp(sys.stdout), None) # argparse parse error leads to SystemExit @@ -641,7 +713,6 @@ class ClientV2TestJson(CLITestV20Base): def test_do_request_unicode(self): - self.mox.StubOutWithMock(self.client.httpclient, "request") unicode_text = u'\u7f51\u7edc' # url with unicode action = u'/test' @@ -656,46 +727,40 @@ unicode_text) expected_auth_token = encodeutils.safe_encode(unicode_text) resp_headers = {'x-openstack-request-id': REQUEST_ID} + resp = (MyResp(200, resp_headers), expect_body) + + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + result = self.client.do_request('PUT', action, body=body, + params=params) - self.client.httpclient.request( + mock_request.assert_called_once_with( end_url(expected_action, query=expect_query), 'PUT', body=expect_body, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', - expected_auth_token)).AndReturn((MyResp(200, resp_headers), - expect_body)) - - self.mox.ReplayAll() - result = self.client.do_request('PUT', action, body=body, - params=params) - self.mox.VerifyAll() - self.mox.UnsetStubs() - + headers=ContainsKeyValue({'X-Auth-Token': expected_auth_token})) # test response with unicode self.assertEqual(body, result) def test_do_request_error_without_response_body(self): - self.mox.StubOutWithMock(self.client.httpclient, "request") params = {'test': 'value'} expect_query = six.moves.urllib.parse.urlencode(params) self.client.httpclient.auth_token = 'token' resp_headers = {'x-openstack-request-id': REQUEST_ID} + resp = (MyResp(400, headers=resp_headers, reason='An error'), '') - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + error = self.assertRaises(exceptions.NeutronClientException, + self.client.do_request, 'PUT', '/test', + body='', params=params) + + mock_request.assert_called_once_with( MyUrlComparator(end_url('/test', query=expect_query), self.client), 'PUT', body='', - headers=mox.ContainsKeyValue('X-Auth-Token', 'token') - ).AndReturn((MyResp(400, headers=resp_headers, reason='An error'), '')) - - self.mox.ReplayAll() - error = self.assertRaises(exceptions.NeutronClientException, - self.client.do_request, 'PUT', '/test', - body='', params=params) + headers=ContainsKeyValue({'X-Auth-Token': 'token'})) expected_error = "An error\nNeutron server returns " \ "request_ids: %s" % [REQUEST_ID] self.assertEqual(expected_error, str(error)) - self.mox.VerifyAll() - self.mox.UnsetStubs() def test_do_request_with_long_uri_exception(self): long_string = 'x' * 8200 # 8200 > MAX_URI_LEN:8192 @@ -706,31 +771,28 @@ self.assertNotEqual(0, exception.excess) def test_do_request_request_ids(self): - self.mox.StubOutWithMock(self.client.httpclient, "request") params = {'test': 'value'} expect_query = six.moves.urllib.parse.urlencode(params) self.client.httpclient.auth_token = 'token' body = params expect_body = self.client.serialize(body) resp_headers = {'x-openstack-request-id': REQUEST_ID} - self.client.httpclient.request( + resp = (MyResp(200, resp_headers), expect_body) + + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + result = self.client.do_request('PUT', '/test', body=body, + params=params) + + mock_request.assert_called_once_with( MyUrlComparator(end_url('/test', query=expect_query), self.client), 'PUT', body=expect_body, - headers=mox.ContainsKeyValue('X-Auth-Token', 'token') - ).AndReturn((MyResp(200, resp_headers), expect_body)) - - self.mox.ReplayAll() - result = self.client.do_request('PUT', '/test', body=body, - params=params) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=ContainsKeyValue({'X-Auth-Token': 'token'})) self.assertEqual(body, result) self.assertEqual([REQUEST_ID], result.request_ids) def test_list_request_ids_with_retrieve_all_true(self): - self.mox.StubOutWithMock(self.client.httpclient, "request") - path = '/test' resources = 'tests' fake_query = "marker=myid2&limit=2" @@ -743,30 +805,27 @@ resstr1 = self.client.serialize(reses1) resstr2 = self.client.serialize(reses2) resp_headers = {'x-openstack-request-id': REQUEST_ID} - self.client.httpclient.request( - end_url(path, ""), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200, resp_headers), - resstr1)) - self.client.httpclient.request( - MyUrlComparator(end_url(path, fake_query), - self.client), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200, resp_headers), - resstr2)) - self.mox.ReplayAll() - result = self.client.list(resources, path) - - self.mox.VerifyAll() - self.mox.UnsetStubs() + resp = [(MyResp(200, resp_headers), resstr1), + (MyResp(200, resp_headers), resstr2)] + with mock.patch.object(self.client.httpclient, "request", + side_effect=resp) as mock_request: + result = self.client.list(resources, path) + + self.assertEqual(2, mock_request.call_count) + mock_request.assert_has_calls([ + mock.call( + end_url(path, ""), 'GET', + body=None, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})), + mock.call( + MyUrlComparator(end_url(path, fake_query), + self.client), 'GET', + body=None, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN}))]) self.assertEqual([REQUEST_ID, REQUEST_ID], result.request_ids) def test_list_request_ids_with_retrieve_all_false(self): - self.mox.StubOutWithMock(self.client.httpclient, "request") - path = '/test' resources = 'tests' fake_query = "marker=myid2&limit=2" @@ -779,26 +838,26 @@ resstr1 = self.client.serialize(reses1) resstr2 = self.client.serialize(reses2) resp_headers = {'x-openstack-request-id': REQUEST_ID} - self.client.httpclient.request( - end_url(path, ""), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200, resp_headers), - resstr1)) - self.client.httpclient.request( - MyUrlComparator(end_url(path, fake_query), self.client), 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', TOKEN)).AndReturn((MyResp(200, resp_headers), - resstr2)) - self.mox.ReplayAll() - result = self.client.list(resources, path, retrieve_all=False) - next(result) - self.assertEqual([REQUEST_ID], result.request_ids) - next(result) - self.assertEqual([REQUEST_ID, REQUEST_ID], result.request_ids) - self.mox.VerifyAll() - self.mox.UnsetStubs() + resp = [(MyResp(200, resp_headers), resstr1), + (MyResp(200, resp_headers), resstr2)] + with mock.patch.object(self.client.httpclient, "request", + side_effect=resp) as mock_request: + result = self.client.list(resources, path, retrieve_all=False) + next(result) + self.assertEqual([REQUEST_ID], result.request_ids) + next(result) + self.assertEqual([REQUEST_ID, REQUEST_ID], result.request_ids) + + self.assertEqual(2, mock_request.call_count) + mock_request.assert_has_calls([ + mock.call( + end_url(path, ""), 'GET', + body=None, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN})), + mock.call( + MyUrlComparator(end_url(path, fake_query), self.client), 'GET', + body=None, + headers=ContainsKeyValue({'X-Auth-Token': TOKEN}))]) def test_deserialize_without_data(self): data = u'' @@ -806,51 +865,48 @@ self.assertEqual(data, result) def test_update_resource(self): - self.mox.StubOutWithMock(self.client.httpclient, "request") params = {'test': 'value'} expect_query = six.moves.urllib.parse.urlencode(params) self.client.httpclient.auth_token = 'token' body = params expect_body = self.client.serialize(body) resp_headers = {'x-openstack-request-id': REQUEST_ID} - self.client.httpclient.request( + resp = (MyResp(200, resp_headers), expect_body) + + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + result = self.client._update_resource('/test', body=body, + params=params) + + mock_request.assert_called_once_with( MyUrlComparator(end_url('/test', query=expect_query), self.client), 'PUT', body=expect_body, - headers=mox.And( - mox.ContainsKeyValue('X-Auth-Token', 'token'), - mox.Not(mox.In('If-Match'))) - ).AndReturn((MyResp(200, resp_headers), expect_body)) - - self.mox.ReplayAll() - result = self.client._update_resource('/test', body=body, - params=params) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=ContainsKeyValue({'X-Auth-Token': 'token'})) + self.assertNotIn('If-Match', mock_request.call_args[1]['headers']) self.assertEqual(body, result) self.assertEqual([REQUEST_ID], result.request_ids) def test_update_resource_with_revision_number(self): - self.mox.StubOutWithMock(self.client.httpclient, "request") params = {'test': 'value'} expect_query = six.moves.urllib.parse.urlencode(params) self.client.httpclient.auth_token = 'token' body = params expect_body = self.client.serialize(body) resp_headers = {'x-openstack-request-id': REQUEST_ID} - self.client.httpclient.request( + resp = (MyResp(200, resp_headers), expect_body) + + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + result = self.client._update_resource('/test', body=body, + params=params, + revision_number=1) + + mock_request.assert_called_once_with( MyUrlComparator(end_url('/test', query=expect_query), self.client), 'PUT', body=expect_body, - headers=mox.And( - mox.ContainsKeyValue('X-Auth-Token', 'token'), - mox.ContainsKeyValue('If-Match', 'revision_number=1')) - ).AndReturn((MyResp(200, resp_headers), expect_body)) - - self.mox.ReplayAll() - result = self.client._update_resource('/test', body=body, - params=params, revision_number=1) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=ContainsKeyValue( + {'X-Auth-Token': 'token', 'If-Match': 'revision_number=1'})) self.assertEqual(body, result) self.assertEqual([REQUEST_ID], result.request_ids) @@ -1002,23 +1058,21 @@ self.assertEqual(599, e.status_code) def test_connection_failed(self): - self.mox.StubOutWithMock(self.client.httpclient, 'request') self.client.httpclient.auth_token = 'token' + excp = requests.exceptions.ConnectionError('Connection refused') - self.client.httpclient.request( - end_url('/test'), 'GET', - headers=mox.ContainsKeyValue('X-Auth-Token', 'token') - ).AndRaise(requests.exceptions.ConnectionError('Connection refused')) - - self.mox.ReplayAll() + with mock.patch.object(self.client.httpclient, "request", + side_effect=excp) as mock_request: + error = self.assertRaises(exceptions.ConnectionFailed, + self.client.get, '/test') - error = self.assertRaises(exceptions.ConnectionFailed, - self.client.get, '/test') + mock_request.assert_called_once_with( + end_url('/test'), 'GET', + body=None, + headers=ContainsKeyValue({'X-Auth-Token': 'token'})) # NB: ConnectionFailed has no explicit status_code, so this # tests that there is a fallback defined. self.assertIsNotNone(error.status_code) - self.mox.VerifyAll() - self.mox.UnsetStubs() class DictWithMetaTest(base.BaseTestCase): @@ -1134,14 +1188,14 @@ self.assertEqual('myname', data['name']) self.assertEqual('myid', data['id']) - def _test_list_resources_with_formatter(self, fmt): + @mock.patch.object(network.ListNetwork, "extend_list") + def _test_list_resources_with_formatter(self, fmt, mock_extend_list): resources = 'networks' cmd = network.ListNetwork(MyApp(sys.stdout), None) # ListNetwork has its own extend_list, so we need to stub out it # to avoid an extra API call. - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) self._test_list_resources(resources, cmd, output_format=fmt) + mock_extend_list.assert_called_once_with(IsA(list), mock.ANY) def test_list_resources_table(self): self._test_list_resources_with_formatter('table') diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_securitygroup.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_securitygroup.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_securitygroup.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_securitygroup.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from oslo_utils import uuidutils import six @@ -211,34 +211,14 @@ args = [myid] self._test_delete_resource(resource, cmd, myid, args) - def test_list_security_group_rules(self): + @mock.patch.object(securitygroup.ListSecurityGroupRule, "extend_list") + def test_list_security_group_rules(self, mock_extend_list): resources = "security_group_rules" cmd = securitygroup.ListSecurityGroupRule( test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(securitygroup.ListSecurityGroupRule, - "extend_list") - securitygroup.ListSecurityGroupRule.extend_list(mox.IsA(list), - mox.IgnoreArg()) self._test_list_resources(resources, cmd, True) - - def _test_extend_list(self, mox_calls, data): - resources = "security_groups" - - cmd = securitygroup.ListSecurityGroupRule( - test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - - cmd.get_client().MultipleTimes().AndReturn(self.client) - path = getattr(self.client, resources + '_path') - mox_calls(path, data) - self.mox.ReplayAll() - known_args, _vs = cmd.get_parser( - 'list' + resources).parse_known_args() - - cmd.extend_list(data, known_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def _build_test_data(self, data, excess=0): # Length of a query filter on security group rule id @@ -277,44 +257,37 @@ return result def test_extend_list(self): - def mox_calls(path, data): - responses = self._build_test_data(data) - self.client.httpclient.request( - test_cli20.MyUrlComparator(test_cli20.end_url( - path, responses[0]['filter']), self.client), - 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn( - responses[0]['response']) - data = [{'name': 'default', 'remote_group_id': 'remgroupid%02d' % i} for i in range(10)] data.append({'name': 'default', 'remote_group_id': None}) - self._test_extend_list(mox_calls, data) + resources = "security_groups" - def test_extend_list_exceed_max_uri_len(self): - def mox_calls(path, data): - # 1 char of extra URI len will cause a split in 2 requests - self.mox.StubOutWithMock(self.client.httpclient, - '_check_uri_length') - self.client.httpclient._check_uri_length(mox.IgnoreArg()).AndRaise( - exceptions.RequestURITooLong(excess=1)) - responses = self._build_test_data(data, excess=1) - - for item in responses: - self.client.httpclient._check_uri_length( - mox.IgnoreArg()).AndReturn(None) - self.client.httpclient.request( - test_cli20.MyUrlComparator( - test_cli20.end_url(path, item['filter']), self.client), - 'GET', - body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn( - item['response']) + cmd = securitygroup.ListSecurityGroupRule( + test_cli20.MyApp(sys.stdout), None) + path = getattr(self.client, resources + '_path') + responses = self._build_test_data(data) + known_args, _vs = cmd.get_parser( + 'list' + resources).parse_known_args() + resp = responses[0]['response'] + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + cmd.extend_list(data, known_args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.MyUrlComparator(test_cli20.end_url( + path, responses[0]['filter']), self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) + + def test_extend_list_exceed_max_uri_len(self): data = [{'name': 'default', 'security_group_id': 'secgroupid%02d' % i, 'remote_group_id': 'remgroupid%02d' % i} @@ -322,39 +295,75 @@ data.append({'name': 'default', 'security_group_id': 'secgroupid10', 'remote_group_id': None}) - self._test_extend_list(mox_calls, data) + resources = "security_groups" - def test_list_security_group_rules_pagination(self): + cmd = securitygroup.ListSecurityGroupRule( + test_cli20.MyApp(sys.stdout), None) + path = getattr(self.client, resources + '_path') + responses = self._build_test_data(data, excess=1) + + known_args, _vs = cmd.get_parser( + 'list' + resources).parse_known_args() + mock_request_side_effects = [] + mock_request_calls = [] + mock_check_uri_side_effects = [exceptions.RequestURITooLong(excess=1)] + mock_check_uri_calls = [mock.call(mock.ANY)] + for item in responses: + mock_request_side_effects.append(item['response']) + mock_request_calls.append(mock.call( + test_cli20.MyUrlComparator( + test_cli20.end_url(path, item['filter']), self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN}))) + mock_check_uri_side_effects.append(None) + mock_check_uri_calls.append(mock.call(mock.ANY)) + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, + "request") as mock_request, \ + mock.patch.object(self.client.httpclient, + "_check_uri_length") as mock_check_uri: + mock_request.side_effect = mock_request_side_effects + mock_check_uri.side_effect = mock_check_uri_side_effects + cmd.extend_list(data, known_args) + + mock_get_client.assert_called_once_with() + mock_request.assert_has_calls(mock_request_calls) + mock_check_uri.assert_has_calls(mock_check_uri_calls) + self.assertEqual(len(mock_request_calls), mock_request.call_count) + self.assertEqual(len(mock_check_uri_calls), mock_check_uri.call_count) + + @mock.patch.object(securitygroup.ListSecurityGroupRule, "extend_list") + def test_list_security_group_rules_pagination(self, mock_extend_list): resources = "security_group_rules" cmd = securitygroup.ListSecurityGroupRule( test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(securitygroup.ListSecurityGroupRule, - "extend_list") - securitygroup.ListSecurityGroupRule.extend_list(mox.IsA(list), - mox.IgnoreArg()) self._test_list_resources_with_pagination(resources, cmd) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) - def test_list_security_group_rules_sort(self): + @mock.patch.object(securitygroup.ListSecurityGroupRule, "extend_list") + def test_list_security_group_rules_sort(self, mock_extend_list): resources = "security_group_rules" cmd = securitygroup.ListSecurityGroupRule( test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(securitygroup.ListSecurityGroupRule, - "extend_list") - securitygroup.ListSecurityGroupRule.extend_list(mox.IsA(list), - mox.IgnoreArg()) self._test_list_resources(resources, cmd, sort_key=["name", "id"], sort_dir=["asc", "desc"]) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) - def test_list_security_group_rules_limit(self): + @mock.patch.object(securitygroup.ListSecurityGroupRule, "extend_list") + def test_list_security_group_rules_limit(self, mock_extend_list): resources = "security_group_rules" cmd = securitygroup.ListSecurityGroupRule( test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(securitygroup.ListSecurityGroupRule, - "extend_list") - securitygroup.ListSecurityGroupRule.extend_list(mox.IsA(list), - mox.IgnoreArg()) self._test_list_resources(resources, cmd, page_size=1000) + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_show_security_group_rule(self): resource = 'security_group_rule' @@ -367,29 +376,30 @@ def _test_list_security_group_rules_extend(self, api_data, expected, args=(), conv=True, query_fields=None): - def setup_list_stub(resources, data, query): + def setup_list_stub(resources, data, query, mock_calls, mock_returns): reses = {resources: data} resstr = self.client.serialize(reses) resp = (test_cli20.MyResp(200), resstr) path = getattr(self.client, resources + '_path') - self.client.httpclient.request( + mock_calls.append(mock.call( test_cli20.MyUrlComparator( test_cli20.end_url(path, query), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(resp) + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN}))) + mock_returns.append(resp) cmd = securitygroup.ListSecurityGroupRule( test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(cmd, 'get_client') - self.mox.StubOutWithMock(self.client.httpclient, 'request') - cmd.get_client().MultipleTimes().AndReturn(self.client) query = '' if query_fields: query = '&'.join(['fields=' + f for f in query_fields]) - setup_list_stub('security_group_rules', api_data, query) + mock_request_calls = [] + mock_request_returns = [] + setup_list_stub('security_group_rules', api_data, query, + mock_request_calls, mock_request_returns) if conv: sec_ids = set() for n in api_data: @@ -403,15 +413,24 @@ [{'id': 'myid1', 'name': 'group1'}, {'id': 'myid2', 'name': 'group2'}, {'id': 'myid3', 'name': 'group3'}], - query='fields=id&fields=name' + filters) - self.mox.ReplayAll() + 'fields=id&fields=name' + filters, + mock_request_calls, + mock_request_returns) cmd_parser = cmd.get_parser('list_security_group_rules') parsed_args = cmd_parser.parse_args(args) - result = cmd.take_action(parsed_args) - self.mox.VerifyAll() - self.mox.UnsetStubs() - # Check columns + + with mock.patch.object(cmd, "get_client", + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, + "request") as mock_request: + mock_request.side_effect = mock_request_returns + result = cmd.take_action(parsed_args) + + self.assert_mock_multiple_calls_with_same_arguments( + mock_get_client, mock.call(), None) + mock_request.assert_has_calls(mock_request_calls) + self.assertEqual(len(mock_request_calls), mock_request.call_count) self.assertEqual(expected['cols'], result[0]) # Check data _result = [x for x in result[1]] diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_subnetpool.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_subnetpool.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_subnetpool.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_subnetpool.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.common import exceptions from neutronclient.neutron.v2_0 import subnetpool @@ -135,13 +135,12 @@ cmd, name, myid, args, position_names, position_values) - def test_list_subnetpool_pagination(self): + @mock.patch.object(subnetpool.ListSubnetPool, "extend_list") + def test_list_subnetpool_pagination(self, mock_extend_list): cmd = subnetpool.ListSubnetPool(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(subnetpool.ListSubnetPool, "extend_list") - subnetpool.ListSubnetPool.extend_list(mox.IsA(list), mox.IgnoreArg()) self._test_list_resources_with_pagination("subnetpools", cmd) - self.mox.VerifyAll() - self.mox.UnsetStubs() + mock_extend_list.assert_called_once_with(test_cli20.IsA(list), + mock.ANY) def test_list_subnetpools_sort(self): # List subnetpools: diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_subnet.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_subnet.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_subnet.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_subnet.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.common import exceptions from neutronclient.neutron import v2_0 as neutronV20 @@ -418,12 +418,11 @@ args = ['--gateway', gateway, netid, cidr] position_names = ['ip_version', 'network_id', 'cidr', 'gateway_ip'] position_values = [4, netid, cidr, gateway] - self.mox.StubOutWithMock(cmd.log, 'warning') - cmd.log.warning(mox.IgnoreArg(), {'ip': 4, 'cidr': '/32'}) - self._test_create_resource(resource, cmd, name, myid, args, - position_names, position_values) - self.mox.VerifyAll() - self.mox.UnsetStubs() + with mock.patch.object(cmd.log, 'warning') as mock_warning: + self._test_create_resource(resource, cmd, name, myid, args, + position_names, position_values) + mock_warning.assert_called_once_with(mock.ANY, + {'ip': 4, 'cidr': '/32'}) def test_create_subnet_with_ipv6_ra_mode(self): resource = 'subnet' @@ -520,7 +519,9 @@ position_values, tenant_id='tenantid', no_api_call=True, expected_exception=exceptions.CommandError) - def test_create_subnet_with_subnetpool_ipv6_and_ip_ver_ignored(self): + @mock.patch.object(neutronV20, 'find_resource_by_name_or_id') + def test_create_subnet_with_subnetpool_ipv6_and_ip_ver_ignored( + self, mock_find_resource): resource = 'subnet' cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None) name = 'myname' @@ -532,17 +533,17 @@ netid] position_names = ['ip_version', 'network_id', 'subnetpool_id'] position_values = [6, netid, 'subnetpool_id'] - self.mox.StubOutWithMock(neutronV20, 'find_resource_by_name_or_id') - neutronV20.find_resource_by_name_or_id( - self.client, - 'subnetpool', - 'subnetpool_id').AndReturn({'id': 'subnetpool_id', - 'ip_version': 6}) + mock_find_resource.return_value = { + 'id': 'subnetpool_id', 'ip_version': 6} self._test_create_resource( resource, cmd, name, myid, args, position_names, position_values, tenant_id='tenantid') + mock_find_resource.assert_called_once_with( + self.client, 'subnetpool', 'subnetpool_id') - def test_create_subnet_with_subnetpool_ipv4_with_cidr_wildcard(self): + @mock.patch.object(neutronV20, 'find_resource_by_name_or_id') + def test_create_subnet_with_subnetpool_ipv4_with_cidr_wildcard( + self, mock_find_resource): resource = 'subnet' cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None) name = 'myname' @@ -557,18 +558,18 @@ position_names = ['ip_version', 'ipv6_address_mode', 'network_id', 'subnetpool_id', 'cidr'] position_values = [4, None, netid, 'subnetpool_id', cidr] - self.mox.StubOutWithMock(neutronV20, 'find_resource_by_name_or_id') - neutronV20.find_resource_by_name_or_id( - self.client, - 'subnetpool', - 'subnetpool_id').AndReturn({'id': 'subnetpool_id', - 'ip_version': 4}) + mock_find_resource.return_value = {'id': 'subnetpool_id', + 'ip_version': 4} self._test_create_resource( resource, cmd, name, myid, args, position_names, position_values, tenant_id='tenantid', no_api_call=True, expected_exception=exceptions.CommandError) + mock_find_resource.assert_called_once_with( + self.client, 'subnetpool', 'subnetpool_id') - def test_create_subnet_with_subnetpool_ipv4_with_prefixlen(self): + @mock.patch.object(neutronV20, 'find_resource_by_name_or_id') + def test_create_subnet_with_subnetpool_ipv4_with_prefixlen( + self, mock_find_resource): resource = 'subnet' cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None) name = 'myname' @@ -583,16 +584,14 @@ position_names = ['ip_version', 'ipv6_address_mode', 'network_id', 'subnetpool_id'] position_values = [4, None, netid, 'subnetpool_id'] - self.mox.StubOutWithMock(neutronV20, 'find_resource_by_name_or_id') - neutronV20.find_resource_by_name_or_id( - self.client, - 'subnetpool', - 'subnetpool_id').AndReturn({'id': 'subnetpool_id', - 'ip_version': 4}) + mock_find_resource.return_value = {'id': 'subnetpool_id', + 'ip_version': 4} self._test_create_resource( resource, cmd, name, myid, args, position_names, position_values, tenant_id='tenantid', no_api_call=True, expected_exception=exceptions.CommandError) + mock_find_resource.assert_called_once_with( + self.client, 'subnetpool', 'subnetpool_id') def test_list_subnets_detail(self): # List subnets: -D. diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_tag.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_tag.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_cli20_tag.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_cli20_tag.py 2018-11-15 14:27:38.000000000 +0000 @@ -12,7 +12,7 @@ import sys -from mox3 import mox +import mock from neutronclient.common import exceptions from neutronclient.neutron.v2_0 import network @@ -24,43 +24,43 @@ class CLITestV20Tag(test_cli20.CLITestV20Base): def _test_tag_operation(self, cmd, path, method, args, prog_name, body=None): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) - if body: - body = test_cli20.MyComparator(body, self.client) - self.client.httpclient.request( + with mock.patch.object(cmd, 'get_client', + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, 'request', + return_value=(test_cli20.MyResp(204), None) + ) as mock_request: + if body: + body = test_cli20.MyComparator(body, self.client) + cmd_parser = cmd.get_parser(prog_name) + shell.run_command(cmd, cmd_parser, args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( test_cli20.MyUrlComparator(test_cli20.end_url(path), self.client), method, body=body, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn( - (test_cli20.MyResp(204), None)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser(prog_name) - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) def _test_tags_query(self, cmd, resources, args, query): - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) path = getattr(self.client, resources + "_path") res = {resources: [{'id': 'myid'}]} resstr = self.client.serialize(res) - self.client.httpclient.request( - test_cli20.MyUrlComparator( - test_cli20.end_url(path, query), - self.client), + with mock.patch.object(cmd, 'get_client', + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, 'request', + return_value=(test_cli20.MyResp(200), resstr) + ) as mock_request: + cmd_parser = cmd.get_parser("list_networks") + shell.run_command(cmd, cmd_parser, args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( + test_cli20.MyUrlComparator(test_cli20.end_url(path, query), + self.client), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn( - (test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - cmd_parser = cmd.get_parser("list_networks") - shell.run_command(cmd, cmd_parser, args) - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) + _str = self.fake_stdout.make_string() self.assertIn('myid', _str) @@ -124,9 +124,8 @@ # is not converted to '_'. resources = 'networks' cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None) - self.mox.StubOutWithMock(network.ListNetwork, "extend_list") - network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg()) - args = ['--not-tags', 'red,blue', '--tags-any', 'green', - '--not-tags-any', 'black'] - query = "not-tags=red,blue&tags-any=green¬-tags-any=black" - self._test_tags_query(cmd, resources, args, query) + with mock.patch.object(network.ListNetwork, 'extend_list'): + args = ['--not-tags', 'red,blue', '--tags-any', 'green', + '--not-tags-any', 'black'] + query = "not-tags=red,blue&tags-any=green¬-tags-any=black" + self._test_tags_query(cmd, resources, args, query) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_http.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_http.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_http.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_http.py 2018-11-15 14:27:38.000000000 +0000 @@ -77,7 +77,7 @@ def test_osprofiler_headers_are_injected(self): osprofiler.profiler.init('SWORDFISH') - self.addCleanup(osprofiler.profiler._clean) + self.addCleanup(osprofiler.profiler.clean) headers = {'Accept': 'application/json'} headers.update(osprofiler.web.get_trace_id_headers()) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_name_or_id.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_name_or_id.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_name_or_id.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_name_or_id.py 2018-11-15 14:27:38.000000000 +0000 @@ -14,8 +14,7 @@ # under the License. # - -from mox3 import mox +import mock from oslo_utils import uuidutils import testtools @@ -30,30 +29,29 @@ def setUp(self): """Prepare the test environment.""" super(CLITestNameorID, self).setUp() - self.mox = mox.Mox() self.endurl = test_cli20.ENDURL self.client = client.Client(token=test_cli20.TOKEN, endpoint_url=self.endurl) - self.addCleanup(self.mox.VerifyAll) - self.addCleanup(self.mox.UnsetStubs) def test_get_id_from_id(self): _id = uuidutils.generate_uuid() reses = {'networks': [{'id': _id, }, ], } resstr = self.client.serialize(reses) - self.mox.StubOutWithMock(self.client.httpclient, "request") + resp = (test_cli20.MyResp(200), resstr) path = getattr(self.client, "networks_path") - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + returned_id = neutronV20.find_resourceid_by_name_or_id( + self.client, 'network', _id) + + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, "fields=id&id=" + _id), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - returned_id = neutronV20.find_resourceid_by_name_or_id( - self.client, 'network', _id) + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) self.assertEqual(_id, returned_id) def test_get_id_from_id_then_name_empty(self): @@ -61,27 +59,32 @@ reses = {'networks': [{'id': _id, }, ], } resstr = self.client.serialize(reses) resstr1 = self.client.serialize({'networks': []}) - self.mox.StubOutWithMock(self.client.httpclient, "request") path = getattr(self.client, "networks_path") - self.client.httpclient.request( - test_cli20.MyUrlComparator( - test_cli20.end_url(path, "fields=id&id=" + _id), - self.client), - 'GET', - body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr1)) - self.client.httpclient.request( - test_cli20.MyUrlComparator( - test_cli20.end_url(path, "fields=id&name=" + _id), - self.client), - 'GET', - body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - returned_id = neutronV20.find_resourceid_by_name_or_id( - self.client, 'network', _id) + with mock.patch.object(self.client.httpclient, + "request") as mock_request: + mock_request.side_effect = [(test_cli20.MyResp(200), resstr1), + (test_cli20.MyResp(200), resstr)] + returned_id = neutronV20.find_resourceid_by_name_or_id( + self.client, 'network', _id) + + self.assertEqual(2, mock_request.call_count) + mock_request.assert_has_calls([ + mock.call( + test_cli20.MyUrlComparator( + test_cli20.end_url(path, "fields=id&id=" + _id), + self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})), + mock.call( + test_cli20.MyUrlComparator( + test_cli20.end_url(path, "fields=id&name=" + _id), + self.client), + 'GET', + body=None, + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN}))]) self.assertEqual(_id, returned_id) def test_get_id_from_name(self): @@ -89,19 +92,21 @@ _id = uuidutils.generate_uuid() reses = {'networks': [{'id': _id, }, ], } resstr = self.client.serialize(reses) - self.mox.StubOutWithMock(self.client.httpclient, "request") + resp = (test_cli20.MyResp(200), resstr) path = getattr(self.client, "networks_path") - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + returned_id = neutronV20.find_resourceid_by_name_or_id( + self.client, 'network', name) + + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, "fields=id&name=" + name), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - returned_id = neutronV20.find_resourceid_by_name_or_id( - self.client, 'network', name) + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) self.assertEqual(_id, returned_id) def test_get_id_from_name_multiple(self): @@ -109,40 +114,46 @@ reses = {'networks': [{'id': uuidutils.generate_uuid()}, {'id': uuidutils.generate_uuid()}]} resstr = self.client.serialize(reses) - self.mox.StubOutWithMock(self.client.httpclient, "request") + resp = (test_cli20.MyResp(200), resstr) path = getattr(self.client, "networks_path") - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + exception = self.assertRaises( + exceptions.NeutronClientNoUniqueMatch, + neutronV20.find_resourceid_by_name_or_id, + self.client, 'network', name) + + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, "fields=id&name=" + name), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - exception = self.assertRaises(exceptions.NeutronClientNoUniqueMatch, - neutronV20.find_resourceid_by_name_or_id, - self.client, 'network', name) + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) self.assertIn('Multiple', exception.message) def test_get_id_from_name_notfound(self): name = 'myname' reses = {'networks': []} resstr = self.client.serialize(reses) - self.mox.StubOutWithMock(self.client.httpclient, "request") + resp = (test_cli20.MyResp(200), resstr) path = getattr(self.client, "networks_path") - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + exception = self.assertRaises( + exceptions.NotFound, + neutronV20.find_resourceid_by_name_or_id, + self.client, 'network', name) + + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, "fields=id&name=" + name), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - exception = self.assertRaises(exceptions.NotFound, - neutronV20.find_resourceid_by_name_or_id, - self.client, 'network', name) + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) self.assertIn('Unable to find', exception.message) self.assertEqual(404, exception.status_code) @@ -153,41 +164,44 @@ reses = {'security_groups': [{'id': expect_id, 'tenant_id': project}]} resstr = self.client.serialize(reses) - self.mox.StubOutWithMock(self.client.httpclient, "request") + resp = (test_cli20.MyResp(200), resstr) path = getattr(self.client, "security_groups_path") - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + observed_id = neutronV20.find_resourceid_by_name_or_id( + self.client, 'security_group', name, project) + + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, "fields=id&name=%s&tenant_id=%s" % (name, project)), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - - observed_id = neutronV20.find_resourceid_by_name_or_id( - self.client, 'security_group', name, project) - + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) self.assertEqual(expect_id, observed_id) def test_get_id_from_name_multiple_with_project_not_found(self): name = 'web_server' project = uuidutils.generate_uuid() resstr_notfound = self.client.serialize({'security_groups': []}) - self.mox.StubOutWithMock(self.client.httpclient, "request") + resp = (test_cli20.MyResp(200), resstr_notfound) path = getattr(self.client, "security_groups_path") - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + exc = self.assertRaises(exceptions.NotFound, + neutronV20.find_resourceid_by_name_or_id, + self.client, 'security_group', name, + project) + + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, "fields=id&name=%s&tenant_id=%s" % (name, project)), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr_notfound)) - self.mox.ReplayAll() - exc = self.assertRaises(exceptions.NotFound, - neutronV20.find_resourceid_by_name_or_id, - self.client, 'security_group', name, project) + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) self.assertIn('Unable to find', exc.message) self.assertEqual(404, exc.status_code) @@ -196,29 +210,31 @@ net = {'id': _id, 'name': 'test'} reses = {'networks': [net], } resstr = self.client.serialize(reses) - self.mox.StubOutWithMock(self.client.httpclient, "request") + resp = (test_cli20.MyResp(200), resstr) path = getattr(self.client, "networks_path") if id_only: query_params = "fields=id&id=%s" % _id else: query_params = "id=%s" % _id - self.client.httpclient.request( + with mock.patch.object(self.client.httpclient, "request", + return_value=resp) as mock_request: + if id_only: + returned_id = neutronV20.find_resourceid_by_id( + self.client, 'network', _id) + self.assertEqual(_id, returned_id) + else: + result = neutronV20.find_resource_by_id( + self.client, 'network', _id) + self.assertEqual(net, result) + + mock_request.assert_called_once_with( test_cli20.MyUrlComparator( test_cli20.end_url(path, query_params), self.client), 'GET', body=None, - headers=mox.ContainsKeyValue('X-Auth-Token', test_cli20.TOKEN) - ).AndReturn((test_cli20.MyResp(200), resstr)) - self.mox.ReplayAll() - if id_only: - returned_id = neutronV20.find_resourceid_by_id( - self.client, 'network', _id) - self.assertEqual(_id, returned_id) - else: - result = neutronV20.find_resource_by_id( - self.client, 'network', _id) - self.assertEqual(net, result) + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) def test_get_resource_by_id(self): self._test_get_resource_by_id(id_only=False) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_quota.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_quota.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_quota.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_quota.py 2018-11-15 14:27:38.000000000 +0000 @@ -16,7 +16,7 @@ import sys -from mox3 import mox +import mock from neutronclient.common import exceptions from neutronclient.neutron.v2_0 import quota as test_quota @@ -67,26 +67,24 @@ cmd = test_quota.ShowQuotaDefault( test_cli20.MyApp(sys.stdout), None) args = ['--tenant-id', self.test_id] - self.mox.StubOutWithMock(cmd, "get_client") - self.mox.StubOutWithMock(self.client.httpclient, "request") - cmd.get_client().MultipleTimes().AndReturn(self.client) expected_res = {'quota': {'port': 50, 'network': 10, 'subnet': 10}} resstr = self.client.serialize(expected_res) path = getattr(self.client, "quota_default_path") return_tup = (test_cli20.MyResp(200), resstr) - self.client.httpclient.request( + with mock.patch.object(cmd, 'get_client', + return_value=self.client) as mock_get_client, \ + mock.patch.object(self.client.httpclient, 'request', + return_value=return_tup) as mock_request: + cmd_parser = cmd.get_parser("test_" + resource) + parsed_args = cmd_parser.parse_args(args) + cmd.run(parsed_args) + + mock_get_client.assert_called_once_with() + mock_request.assert_called_once_with( test_cli20.end_url(path % self.test_id), 'GET', body=None, - headers=mox.ContainsKeyValue( - 'X-Auth-Token', test_cli20.TOKEN)).AndReturn(return_tup) - self.mox.ReplayAll() - - cmd_parser = cmd.get_parser("test_" + resource) - parsed_args = cmd_parser.parse_args(args) - cmd.run(parsed_args) - - self.mox.VerifyAll() - self.mox.UnsetStubs() + headers=test_cli20.ContainsKeyValue( + {'X-Auth-Token': test_cli20.TOKEN})) _str = self.fake_stdout.make_string() self.assertIn('network', _str) self.assertIn('subnet', _str) diff -Nru python-neutronclient-6.7.0/neutronclient/tests/unit/test_shell.py python-neutronclient-6.11.0/neutronclient/tests/unit/test_shell.py --- python-neutronclient-6.7.0/neutronclient/tests/unit/test_shell.py 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/tests/unit/test_shell.py 2018-11-15 14:27:38.000000000 +0000 @@ -95,7 +95,7 @@ self.useFixture(fixtures.FakeLogger(level=logging.DEBUG)) stdout, stderr = self.shell('fake', check=True) self.assertFalse(stdout) - self.assertEqual("Unknown command ['fake']", stderr.strip()) + self.assertIn("Unknown command ['fake']", stderr.strip()) def test_help(self): required = 'usage:' diff -Nru python-neutronclient-6.7.0/neutronclient/v2_0/client.py python-neutronclient-6.11.0/neutronclient/v2_0/client.py --- python-neutronclient-6.7.0/neutronclient/v2_0/client.py 2018-01-26 00:32:07.000000000 +0000 +++ python-neutronclient-6.11.0/neutronclient/v2_0/client.py 2018-11-15 14:27:38.000000000 +0000 @@ -1494,7 +1494,7 @@ params=_params) def list_networks_on_dhcp_agent(self, dhcp_agent, **_params): - """Fetches a list of dhcp agents hosting a network.""" + """Fetches a list of networks hosted on a DHCP agent.""" return self.get((self.agent_path + self.DHCP_NETS) % dhcp_agent, params=_params) @@ -1514,7 +1514,7 @@ params=_params) def list_routers_on_l3_agent(self, l3_agent, **_params): - """Fetches a list of L3 agents hosting a router.""" + """Fetches a list of routers hosted on an L3 agent.""" return self.get((self.agent_path + self.L3_ROUTERS) % l3_agent, params=_params) diff -Nru python-neutronclient-6.7.0/PKG-INFO python-neutronclient-6.11.0/PKG-INFO --- python-neutronclient-6.7.0/PKG-INFO 2018-01-26 00:35:20.000000000 +0000 +++ python-neutronclient-6.11.0/PKG-INFO 2018-11-15 14:29:19.000000000 +0000 @@ -1,18 +1,17 @@ Metadata-Version: 1.1 Name: python-neutronclient -Version: 6.7.0 +Version: 6.11.0 Summary: CLI and Client Library for OpenStack Networking Home-page: https://docs.openstack.org/python-neutronclient/latest/ Author: OpenStack Networking Project Author-email: openstack-dev@lists.openstack.org License: UNKNOWN -Description-Content-Type: UNKNOWN Description: ======================== Team and repository tags ======================== - .. image:: http://governance.openstack.org/badges/python-neutronclient.svg - :target: http://governance.openstack.org/reference/tags/index.html + .. image:: https://governance.openstack.org/tc/badges/python-neutronclient.svg + :target: https://governance.openstack.org/tc/reference/tags/index.html .. Change things from this point on @@ -20,13 +19,9 @@ ================================== .. image:: https://img.shields.io/pypi/v/python-neutronclient.svg - :target: https://pypi.python.org/pypi/python-neutronclient/ + :target: https://pypi.org/project/python-neutronclient/ :alt: Latest Version - .. image:: https://img.shields.io/pypi/dm/python-neutronclient.svg - :target: https://pypi.python.org/pypi/python-neutronclient/ - :alt: Downloads - This is a client library for Neutron built on the Neutron API. It provides a Python API (the ``neutronclient`` module) and a command-line tool (``neutron``). @@ -40,13 +35,14 @@ * `Source`_ * `Developer's Guide`_ - .. _PyPi: https://pypi.python.org/pypi/python-neutronclient + .. _PyPi: https://pypi.org/project/python-neutronclient .. _Online Documentation: https://docs.openstack.org/python-neutronclient/latest/ .. _Launchpad project: https://launchpad.net/python-neutronclient .. _Blueprints: https://blueprints.launchpad.net/python-neutronclient .. _Bugs: https://bugs.launchpad.net/python-neutronclient .. _Source: https://git.openstack.org/cgit/openstack/python-neutronclient .. _Developer's Guide: http://docs.openstack.org/infra/manual/developers.html + .. _Release Notes: https://docs.openstack.org/releasenotes/python-neutronclient Platform: UNKNOWN diff -Nru python-neutronclient-6.7.0/python_neutronclient.egg-info/pbr.json python-neutronclient-6.11.0/python_neutronclient.egg-info/pbr.json --- python-neutronclient-6.7.0/python_neutronclient.egg-info/pbr.json 2018-01-26 00:35:18.000000000 +0000 +++ python-neutronclient-6.11.0/python_neutronclient.egg-info/pbr.json 2018-11-15 14:29:19.000000000 +0000 @@ -1 +1 @@ -{"git_version": "95d64ce", "is_release": true} \ No newline at end of file +{"git_version": "d8cb147", "is_release": true} \ No newline at end of file diff -Nru python-neutronclient-6.7.0/python_neutronclient.egg-info/PKG-INFO python-neutronclient-6.11.0/python_neutronclient.egg-info/PKG-INFO --- python-neutronclient-6.7.0/python_neutronclient.egg-info/PKG-INFO 2018-01-26 00:35:18.000000000 +0000 +++ python-neutronclient-6.11.0/python_neutronclient.egg-info/PKG-INFO 2018-11-15 14:29:19.000000000 +0000 @@ -1,18 +1,17 @@ Metadata-Version: 1.1 Name: python-neutronclient -Version: 6.7.0 +Version: 6.11.0 Summary: CLI and Client Library for OpenStack Networking Home-page: https://docs.openstack.org/python-neutronclient/latest/ Author: OpenStack Networking Project Author-email: openstack-dev@lists.openstack.org License: UNKNOWN -Description-Content-Type: UNKNOWN Description: ======================== Team and repository tags ======================== - .. image:: http://governance.openstack.org/badges/python-neutronclient.svg - :target: http://governance.openstack.org/reference/tags/index.html + .. image:: https://governance.openstack.org/tc/badges/python-neutronclient.svg + :target: https://governance.openstack.org/tc/reference/tags/index.html .. Change things from this point on @@ -20,13 +19,9 @@ ================================== .. image:: https://img.shields.io/pypi/v/python-neutronclient.svg - :target: https://pypi.python.org/pypi/python-neutronclient/ + :target: https://pypi.org/project/python-neutronclient/ :alt: Latest Version - .. image:: https://img.shields.io/pypi/dm/python-neutronclient.svg - :target: https://pypi.python.org/pypi/python-neutronclient/ - :alt: Downloads - This is a client library for Neutron built on the Neutron API. It provides a Python API (the ``neutronclient`` module) and a command-line tool (``neutron``). @@ -40,13 +35,14 @@ * `Source`_ * `Developer's Guide`_ - .. _PyPi: https://pypi.python.org/pypi/python-neutronclient + .. _PyPi: https://pypi.org/project/python-neutronclient .. _Online Documentation: https://docs.openstack.org/python-neutronclient/latest/ .. _Launchpad project: https://launchpad.net/python-neutronclient .. _Blueprints: https://blueprints.launchpad.net/python-neutronclient .. _Bugs: https://bugs.launchpad.net/python-neutronclient .. _Source: https://git.openstack.org/cgit/openstack/python-neutronclient .. _Developer's Guide: http://docs.openstack.org/infra/manual/developers.html + .. _Release Notes: https://docs.openstack.org/releasenotes/python-neutronclient Platform: UNKNOWN diff -Nru python-neutronclient-6.7.0/python_neutronclient.egg-info/requires.txt python-neutronclient-6.11.0/python_neutronclient.egg-info/requires.txt --- python-neutronclient-6.7.0/python_neutronclient.egg-info/requires.txt 2018-01-26 00:35:18.000000000 +0000 +++ python-neutronclient-6.11.0/python_neutronclient.egg-info/requires.txt 2018-11-15 14:29:19.000000000 +0000 @@ -5,10 +5,11 @@ netaddr>=0.7.18 osc-lib>=1.8.0 oslo.i18n>=3.15.3 +oslo.log>=3.36.0 oslo.serialization!=2.19.1,>=2.18.0 oslo.utils>=3.33.0 os-client-config>=1.28.0 -keystoneauth1>=3.3.0 +keystoneauth1>=3.4.0 python-keystoneclient>=3.8.0 requests>=2.14.2 simplejson>=3.5.1 diff -Nru python-neutronclient-6.7.0/python_neutronclient.egg-info/SOURCES.txt python-neutronclient-6.11.0/python_neutronclient.egg-info/SOURCES.txt --- python-neutronclient-6.7.0/python_neutronclient.egg-info/SOURCES.txt 2018-01-26 00:35:20.000000000 +0000 +++ python-neutronclient-6.11.0/python_neutronclient.egg-info/SOURCES.txt 2018-11-15 14:29:19.000000000 +0000 @@ -1,6 +1,7 @@ .coveragerc .pylintrc -.testr.conf +.stestr.conf +.zuul.yaml AUTHORS CONTRIBUTING.rst ChangeLog @@ -8,12 +9,14 @@ LICENSE README.rst babel.cfg +lower-constraints.txt neutron_test.sh requirements.txt setup.cfg setup.py test-requirements.txt tox.ini +doc/requirements.txt doc/source/conf.py doc/source/index.rst doc/source/cli/index.rst @@ -41,7 +44,6 @@ neutronclient/__init__.py neutronclient/_i18n.py neutronclient/client.py -neutronclient/cliff_sphinxext.py neutronclient/shell.py neutronclient/version.py neutronclient/common/__init__.py @@ -228,7 +230,6 @@ neutronclient/tests/unit/lb/v2/test_cli20_member.py neutronclient/tests/unit/lb/v2/test_cli20_pool.py neutronclient/tests/unit/osc/__init__.py -neutronclient/tests/unit/osc/test_utils.py neutronclient/tests/unit/osc/v2/__init__.py neutronclient/tests/unit/osc/v2/fakes.py neutronclient/tests/unit/osc/v2/dynamic_routing/__init__.py @@ -331,6 +332,7 @@ releasenotes/notes/quota-update-for-LB-b21e7bc9e4a10f3e.yaml releasenotes/notes/quota-update-for-rbac-192a8e65bf481941.yaml releasenotes/notes/relnotes-from-3.0.0-d7306f5af5e3868d.yaml +releasenotes/notes/remote_fwg-0f5362e5be8b2e84.yaml releasenotes/notes/remove-case-dependency-773ccb3237c38e81.yaml releasenotes/notes/remove-deprecated-option-b53f5d7e6a16ce95.yaml releasenotes/notes/return-request-id-to-caller-15b1d23a4ddc27a3.yaml @@ -338,6 +340,7 @@ releasenotes/notes/show-tenant-id-admin-listing-dc13ee7eb889d418.yaml releasenotes/notes/start-using-reno-9081b3e4c1951fdb.yaml releasenotes/notes/support-bgpvpn-route-control-aeda3e698486f73b.yaml +releasenotes/notes/support-firewall-group-resource-type-5ad1b69cabcb4aa6.yaml releasenotes/notes/support-fwaasv2-cli-7f21676c551f8ae0.yaml releasenotes/notes/support-logging-cli-cd02d3bb03367106.yaml releasenotes/notes/support-networking-bgpvpn-cli-fdd0cc3a5b14983d.yaml @@ -351,6 +354,8 @@ releasenotes/source/ocata.rst releasenotes/source/old_relnotes.rst releasenotes/source/pike.rst +releasenotes/source/queens.rst +releasenotes/source/rocky.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder diff -Nru python-neutronclient-6.7.0/README.rst python-neutronclient-6.11.0/README.rst --- python-neutronclient-6.7.0/README.rst 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/README.rst 2018-11-15 14:27:38.000000000 +0000 @@ -2,8 +2,8 @@ Team and repository tags ======================== -.. image:: http://governance.openstack.org/badges/python-neutronclient.svg - :target: http://governance.openstack.org/reference/tags/index.html +.. image:: https://governance.openstack.org/tc/badges/python-neutronclient.svg + :target: https://governance.openstack.org/tc/reference/tags/index.html .. Change things from this point on @@ -11,13 +11,9 @@ ================================== .. image:: https://img.shields.io/pypi/v/python-neutronclient.svg - :target: https://pypi.python.org/pypi/python-neutronclient/ + :target: https://pypi.org/project/python-neutronclient/ :alt: Latest Version -.. image:: https://img.shields.io/pypi/dm/python-neutronclient.svg - :target: https://pypi.python.org/pypi/python-neutronclient/ - :alt: Downloads - This is a client library for Neutron built on the Neutron API. It provides a Python API (the ``neutronclient`` module) and a command-line tool (``neutron``). @@ -31,10 +27,11 @@ * `Source`_ * `Developer's Guide`_ -.. _PyPi: https://pypi.python.org/pypi/python-neutronclient +.. _PyPi: https://pypi.org/project/python-neutronclient .. _Online Documentation: https://docs.openstack.org/python-neutronclient/latest/ .. _Launchpad project: https://launchpad.net/python-neutronclient .. _Blueprints: https://blueprints.launchpad.net/python-neutronclient .. _Bugs: https://bugs.launchpad.net/python-neutronclient .. _Source: https://git.openstack.org/cgit/openstack/python-neutronclient .. _Developer's Guide: http://docs.openstack.org/infra/manual/developers.html +.. _Release Notes: https://docs.openstack.org/releasenotes/python-neutronclient diff -Nru python-neutronclient-6.7.0/releasenotes/notes/remote_fwg-0f5362e5be8b2e84.yaml python-neutronclient-6.11.0/releasenotes/notes/remote_fwg-0f5362e5be8b2e84.yaml --- python-neutronclient-6.7.0/releasenotes/notes/remote_fwg-0f5362e5be8b2e84.yaml 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/releasenotes/notes/remote_fwg-0f5362e5be8b2e84.yaml 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,5 @@ +--- +features: + - | + Adds the remote source firewall group and the remote destination + firewall group field to the firewall rules. diff -Nru python-neutronclient-6.7.0/releasenotes/notes/support-firewall-group-resource-type-5ad1b69cabcb4aa6.yaml python-neutronclient-6.11.0/releasenotes/notes/support-firewall-group-resource-type-5ad1b69cabcb4aa6.yaml --- python-neutronclient-6.7.0/releasenotes/notes/support-firewall-group-resource-type-5ad1b69cabcb4aa6.yaml 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/releasenotes/notes/support-firewall-group-resource-type-5ad1b69cabcb4aa6.yaml 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,5 @@ +--- +features: + - | + CLI support for the "firewal_group" as a loggable resource type for logging + feature, which is enhanced FWaaS functionality, as OSC plugin commands. diff -Nru python-neutronclient-6.7.0/releasenotes/source/index.rst python-neutronclient-6.11.0/releasenotes/source/index.rst --- python-neutronclient-6.7.0/releasenotes/source/index.rst 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/releasenotes/source/index.rst 2018-11-15 14:27:38.000000000 +0000 @@ -6,6 +6,8 @@ :maxdepth: 1 unreleased + rocky + queens pike ocata newton diff -Nru python-neutronclient-6.7.0/releasenotes/source/queens.rst python-neutronclient-6.11.0/releasenotes/source/queens.rst --- python-neutronclient-6.7.0/releasenotes/source/queens.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/releasenotes/source/queens.rst 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,6 @@ +=================================== + Queens Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/queens diff -Nru python-neutronclient-6.7.0/releasenotes/source/rocky.rst python-neutronclient-6.11.0/releasenotes/source/rocky.rst --- python-neutronclient-6.7.0/releasenotes/source/rocky.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/releasenotes/source/rocky.rst 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,6 @@ +=================================== + Rocky Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/rocky diff -Nru python-neutronclient-6.7.0/requirements.txt python-neutronclient-6.11.0/requirements.txt --- python-neutronclient-6.7.0/requirements.txt 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/requirements.txt 2018-11-15 14:27:38.000000000 +0000 @@ -8,10 +8,11 @@ netaddr>=0.7.18 # BSD osc-lib>=1.8.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 +oslo.log>=3.36.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 os-client-config>=1.28.0 # Apache-2.0 -keystoneauth1>=3.3.0 # Apache-2.0 +keystoneauth1>=3.4.0 # Apache-2.0 # keystoneclient is used only by neutronclient.osc.utils # TODO(amotoki): Drop this after osc.utils has no dependency on keystoneclient python-keystoneclient>=3.8.0 # Apache-2.0 diff -Nru python-neutronclient-6.7.0/setup.cfg python-neutronclient-6.11.0/setup.cfg --- python-neutronclient-6.7.0/setup.cfg 2018-01-26 00:35:20.000000000 +0000 +++ python-neutronclient-6.11.0/setup.cfg 2018-11-15 14:29:19.000000000 +0000 @@ -67,6 +67,7 @@ sfc_service_graph_set = neutronclient.osc.v2.sfc.sfc_service_graph:SetSfcServiceGraph sfc_service_graph_list = neutronclient.osc.v2.sfc.sfc_service_graph:ListSfcServiceGraph sfc_service_graph_show = neutronclient.osc.v2.sfc.sfc_service_graph:ShowSfcServiceGraph + bgp_dragent_add_speaker = neutronclient.osc.v2.dynamic_routing.bgp_dragent:AddBgpSpeakerToDRAgent bgp_dragent_remove_speaker = neutronclient.osc.v2.dynamic_routing.bgp_dragent:RemoveBgpSpeakerFromDRAgent bgp_peer_create = neutronclient.osc.v2.dynamic_routing.bgp_peer:CreateBgpPeer @@ -85,6 +86,7 @@ bgp_speaker_set = neutronclient.osc.v2.dynamic_routing.bgp_speaker:SetBgpSpeaker bgp_speaker_show = neutronclient.osc.v2.dynamic_routing.bgp_speaker:ShowBgpSpeaker bgp_speaker_show_dragents = neutronclient.osc.v2.dynamic_routing.bgp_dragent:ListDRAgentsHostingBgpSpeaker + firewall_group_create = neutronclient.osc.v2.fwaas.firewallgroup:CreateFirewallGroup firewall_group_delete = neutronclient.osc.v2.fwaas.firewallgroup:DeleteFirewallGroup firewall_group_list = neutronclient.osc.v2.fwaas.firewallgroup:ListFirewallGroup @@ -105,6 +107,7 @@ firewall_group_rule_set = neutronclient.osc.v2.fwaas.firewallrule:SetFirewallRule firewall_group_rule_show = neutronclient.osc.v2.fwaas.firewallrule:ShowFirewallRule firewall_group_rule_unset = neutronclient.osc.v2.fwaas.firewallrule:UnsetFirewallRule + bgpvpn_create = neutronclient.osc.v2.networking_bgpvpn.bgpvpn:CreateBgpvpn bgpvpn_delete = neutronclient.osc.v2.networking_bgpvpn.bgpvpn:DeleteBgpvpn bgpvpn_list = neutronclient.osc.v2.networking_bgpvpn.bgpvpn:ListBgpvpn @@ -125,32 +128,38 @@ bgpvpn_port_association_delete = neutronclient.osc.v2.networking_bgpvpn.port_association:DeleteBgpvpnPortAssoc bgpvpn_port_association_list = neutronclient.osc.v2.networking_bgpvpn.port_association:ListBgpvpnPortAssoc bgpvpn_port_association_show = neutronclient.osc.v2.networking_bgpvpn.port_association:ShowBgpvpnPortAssoc + network_loggable_resources_list = neutronclient.osc.v2.logging.network_log:ListLoggableResource network_log_create = neutronclient.osc.v2.logging.network_log:CreateNetworkLog network_log_delete = neutronclient.osc.v2.logging.network_log:DeleteNetworkLog network_log_list = neutronclient.osc.v2.logging.network_log:ListNetworkLog network_log_set = neutronclient.osc.v2.logging.network_log:SetNetworkLog network_log_show = neutronclient.osc.v2.logging.network_log:ShowNetworkLog + vpn_endpoint_group_create = neutronclient.osc.v2.vpnaas.endpoint_group:CreateEndpointGroup vpn_endpoint_group_delete = neutronclient.osc.v2.vpnaas.endpoint_group:DeleteEndpointGroup vpn_endpoint_group_list = neutronclient.osc.v2.vpnaas.endpoint_group:ListEndpointGroup vpn_endpoint_group_set = neutronclient.osc.v2.vpnaas.endpoint_group:SetEndpointGroup vpn_endpoint_group_show = neutronclient.osc.v2.vpnaas.endpoint_group:ShowEndpointGroup + vpn_ike_policy_create = neutronclient.osc.v2.vpnaas.ikepolicy:CreateIKEPolicy vpn_ike_policy_delete = neutronclient.osc.v2.vpnaas.ikepolicy:DeleteIKEPolicy vpn_ike_policy_list = neutronclient.osc.v2.vpnaas.ikepolicy:ListIKEPolicy vpn_ike_policy_set = neutronclient.osc.v2.vpnaas.ikepolicy:SetIKEPolicy vpn_ike_policy_show = neutronclient.osc.v2.vpnaas.ikepolicy:ShowIKEPolicy + vpn_ipsec_policy_create = neutronclient.osc.v2.vpnaas.ipsecpolicy:CreateIPsecPolicy vpn_ipsec_policy_delete = neutronclient.osc.v2.vpnaas.ipsecpolicy:DeleteIPsecPolicy vpn_ipsec_policy_list = neutronclient.osc.v2.vpnaas.ipsecpolicy:ListIPsecPolicy vpn_ipsec_policy_set = neutronclient.osc.v2.vpnaas.ipsecpolicy:SetIPsecPolicy vpn_ipsec_policy_show = neutronclient.osc.v2.vpnaas.ipsecpolicy:ShowIPsecPolicy + vpn_service_create = neutronclient.osc.v2.vpnaas.vpnservice:CreateVPNService vpn_service_delete = neutronclient.osc.v2.vpnaas.vpnservice:DeleteVPNService vpn_service_list = neutronclient.osc.v2.vpnaas.vpnservice:ListVPNService vpn_service_set = neutronclient.osc.v2.vpnaas.vpnservice:SetVPNSercice vpn_service_show = neutronclient.osc.v2.vpnaas.vpnservice:ShowVPNService + vpn_ipsec_site_connection_create = neutronclient.osc.v2.vpnaas.ipsec_site_connection:CreateIPsecSiteConnection vpn_ipsec_site_connection_delete = neutronclient.osc.v2.vpnaas.ipsec_site_connection:DeleteIPsecSiteConnection vpn_ipsec_site_connection_list = neutronclient.osc.v2.vpnaas.ipsec_site_connection:ListIPsecSiteConnection @@ -158,35 +167,43 @@ vpn_ipsec_site_connection_show = neutronclient.osc.v2.vpnaas.ipsec_site_connection:ShowIPsecSiteConnection neutron.cli.v2 = bash-completion = neutronclient.shell:BashCompletionCommand + net-list = neutronclient.neutron.v2_0.network:ListNetwork net-external-list = neutronclient.neutron.v2_0.network:ListExternalNetwork net-show = neutronclient.neutron.v2_0.network:ShowNetwork net-create = neutronclient.neutron.v2_0.network:CreateNetwork net-delete = neutronclient.neutron.v2_0.network:DeleteNetwork net-update = neutronclient.neutron.v2_0.network:UpdateNetwork + subnet-list = neutronclient.neutron.v2_0.subnet:ListSubnet subnet-show = neutronclient.neutron.v2_0.subnet:ShowSubnet subnet-create = neutronclient.neutron.v2_0.subnet:CreateSubnet subnet-delete = neutronclient.neutron.v2_0.subnet:DeleteSubnet subnet-update = neutronclient.neutron.v2_0.subnet:UpdateSubnet + subnetpool-list = neutronclient.neutron.v2_0.subnetpool:ListSubnetPool subnetpool-show = neutronclient.neutron.v2_0.subnetpool:ShowSubnetPool subnetpool-create = neutronclient.neutron.v2_0.subnetpool:CreateSubnetPool subnetpool-delete = neutronclient.neutron.v2_0.subnetpool:DeleteSubnetPool subnetpool-update = neutronclient.neutron.v2_0.subnetpool:UpdateSubnetPool + port-list = neutronclient.neutron.v2_0.port:ListPort port-show = neutronclient.neutron.v2_0.port:ShowPort port-create = neutronclient.neutron.v2_0.port:CreatePort port-delete = neutronclient.neutron.v2_0.port:DeletePort port-update = neutronclient.neutron.v2_0.port:UpdatePort + purge = neutronclient.neutron.v2_0.purge:Purge + quota-list = neutronclient.neutron.v2_0.quota:ListQuota quota-show = neutronclient.neutron.v2_0.quota:ShowQuota quota-default-show = neutronclient.neutron.v2_0.quota:ShowQuotaDefault quota-delete = neutronclient.neutron.v2_0.quota:DeleteQuota quota-update = neutronclient.neutron.v2_0.quota:UpdateQuota + ext-list = neutronclient.neutron.v2_0.extension:ListExt ext-show = neutronclient.neutron.v2_0.extension:ShowExt + router-list = neutronclient.neutron.v2_0.router:ListRouter router-port-list = neutronclient.neutron.v2_0.port:ListRouterPort router-show = neutronclient.neutron.v2_0.router:ShowRouter @@ -197,12 +214,14 @@ router-interface-delete = neutronclient.neutron.v2_0.router:RemoveInterfaceRouter router-gateway-set = neutronclient.neutron.v2_0.router:SetGatewayRouter router-gateway-clear = neutronclient.neutron.v2_0.router:RemoveGatewayRouter + floatingip-list = neutronclient.neutron.v2_0.floatingip:ListFloatingIP floatingip-show = neutronclient.neutron.v2_0.floatingip:ShowFloatingIP floatingip-create = neutronclient.neutron.v2_0.floatingip:CreateFloatingIP floatingip-delete = neutronclient.neutron.v2_0.floatingip:DeleteFloatingIP floatingip-associate = neutronclient.neutron.v2_0.floatingip:AssociateFloatingIP floatingip-disassociate = neutronclient.neutron.v2_0.floatingip:DisassociateFloatingIP + security-group-list = neutronclient.neutron.v2_0.securitygroup:ListSecurityGroup security-group-show = neutronclient.neutron.v2_0.securitygroup:ShowSecurityGroup security-group-create = neutronclient.neutron.v2_0.securitygroup:CreateSecurityGroup @@ -212,41 +231,54 @@ security-group-rule-show = neutronclient.neutron.v2_0.securitygroup:ShowSecurityGroupRule security-group-rule-create = neutronclient.neutron.v2_0.securitygroup:CreateSecurityGroupRule security-group-rule-delete = neutronclient.neutron.v2_0.securitygroup:DeleteSecurityGroupRule + agent-list = neutronclient.neutron.v2_0.agent:ListAgent agent-show = neutronclient.neutron.v2_0.agent:ShowAgent agent-delete = neutronclient.neutron.v2_0.agent:DeleteAgent agent-update = neutronclient.neutron.v2_0.agent:UpdateAgent + dhcp-agent-network-add = neutronclient.neutron.v2_0.agentscheduler:AddNetworkToDhcpAgent dhcp-agent-network-remove = neutronclient.neutron.v2_0.agentscheduler:RemoveNetworkFromDhcpAgent net-list-on-dhcp-agent = neutronclient.neutron.v2_0.agentscheduler:ListNetworksOnDhcpAgent dhcp-agent-list-hosting-net = neutronclient.neutron.v2_0.agentscheduler:ListDhcpAgentsHostingNetwork + l3-agent-router-add = neutronclient.neutron.v2_0.agentscheduler:AddRouterToL3Agent l3-agent-router-remove = neutronclient.neutron.v2_0.agentscheduler:RemoveRouterFromL3Agent router-list-on-l3-agent = neutronclient.neutron.v2_0.agentscheduler:ListRoutersOnL3Agent l3-agent-list-hosting-router = neutronclient.neutron.v2_0.agentscheduler:ListL3AgentsHostingRouter + lb-pool-list-on-agent = neutronclient.neutron.v2_0.agentscheduler:ListPoolsOnLbaasAgent lb-agent-hosting-pool = neutronclient.neutron.v2_0.agentscheduler:GetLbaasAgentHostingPool + lbaas-loadbalancer-list-on-agent = neutronclient.neutron.v2_0.agentscheduler:ListLoadBalancersOnLbaasAgent lbaas-agent-hosting-loadbalancer = neutronclient.neutron.v2_0.agentscheduler:GetLbaasAgentHostingLoadBalancer + service-provider-list = neutronclient.neutron.v2_0.servicetype:ListServiceProvider + rbac-create = neutronclient.neutron.v2_0.rbac:CreateRBACPolicy rbac-update = neutronclient.neutron.v2_0.rbac:UpdateRBACPolicy rbac-list = neutronclient.neutron.v2_0.rbac:ListRBACPolicy rbac-show = neutronclient.neutron.v2_0.rbac:ShowRBACPolicy rbac-delete = neutronclient.neutron.v2_0.rbac:DeleteRBACPolicy + address-scope-list = neutronclient.neutron.v2_0.address_scope:ListAddressScope address-scope-show = neutronclient.neutron.v2_0.address_scope:ShowAddressScope address-scope-create = neutronclient.neutron.v2_0.address_scope:CreateAddressScope address-scope-delete = neutronclient.neutron.v2_0.address_scope:DeleteAddressScope address-scope-update = neutronclient.neutron.v2_0.address_scope:UpdateAddressScope + availability-zone-list = neutronclient.neutron.v2_0.availability_zone:ListAvailabilityZone + auto-allocated-topology-show = neutronclient.neutron.v2_0.auto_allocated_topology:ShowAutoAllocatedTopology auto-allocated-topology-delete = neutronclient.neutron.v2_0.auto_allocated_topology:DeleteAutoAllocatedTopology + net-ip-availability-list = neutronclient.neutron.v2_0.network_ip_availability:ListIpAvailability net-ip-availability-show = neutronclient.neutron.v2_0.network_ip_availability:ShowIpAvailability + tag-add = neutronclient.neutron.v2_0.tag:AddTag tag-replace = neutronclient.neutron.v2_0.tag:ReplaceTag tag-remove = neutronclient.neutron.v2_0.tag:RemoveTag + qos-policy-list = neutronclient.neutron.v2_0.qos.policy:ListQoSPolicy qos-policy-show = neutronclient.neutron.v2_0.qos.policy:ShowQoSPolicy qos-policy-create = neutronclient.neutron.v2_0.qos.policy:CreateQoSPolicy @@ -268,6 +300,7 @@ qos-minimum-bandwidth-rule-update = neutronclient.neutron.v2_0.qos.minimum_bandwidth_rule:UpdateQoSMinimumBandwidthRule qos-minimum-bandwidth-rule-delete = neutronclient.neutron.v2_0.qos.minimum_bandwidth_rule:DeleteQoSMinimumBandwidthRule qos-available-rule-types = neutronclient.neutron.v2_0.qos.rule:ListQoSRuleTypes + flavor-list = neutronclient.neutron.v2_0.flavor.flavor:ListFlavor flavor-show = neutronclient.neutron.v2_0.flavor.flavor:ShowFlavor flavor-create = neutronclient.neutron.v2_0.flavor.flavor:CreateFlavor @@ -280,6 +313,7 @@ flavor-profile-create = neutronclient.neutron.v2_0.flavor.flavor_profile:CreateFlavorProfile flavor-profile-delete = neutronclient.neutron.v2_0.flavor.flavor_profile:DeleteFlavorProfile flavor-profile-update = neutronclient.neutron.v2_0.flavor.flavor_profile:UpdateFlavorProfile + meter-label-create = neutronclient.neutron.v2_0.metering:CreateMeteringLabel meter-label-list = neutronclient.neutron.v2_0.metering:ListMeteringLabel meter-label-show = neutronclient.neutron.v2_0.metering:ShowMeteringLabel @@ -288,6 +322,7 @@ meter-label-rule-list = neutronclient.neutron.v2_0.metering:ListMeteringLabelRule meter-label-rule-show = neutronclient.neutron.v2_0.metering:ShowMeteringLabelRule meter-label-rule-delete = neutronclient.neutron.v2_0.metering:DeleteMeteringLabelRule + firewall-rule-list = neutronclient.neutron.v2_0.fw.firewallrule:ListFirewallRule firewall-rule-show = neutronclient.neutron.v2_0.fw.firewallrule:ShowFirewallRule firewall-rule-create = neutronclient.neutron.v2_0.fw.firewallrule:CreateFirewallRule @@ -305,6 +340,7 @@ firewall-create = neutronclient.neutron.v2_0.fw.firewall:CreateFirewall firewall-update = neutronclient.neutron.v2_0.fw.firewall:UpdateFirewall firewall-delete = neutronclient.neutron.v2_0.fw.firewall:DeleteFirewall + bgp-dragent-speaker-add = neutronclient.neutron.v2_0.bgp.dragentscheduler:AddBGPSpeakerToDRAgent bgp-dragent-speaker-remove = neutronclient.neutron.v2_0.bgp.dragentscheduler:RemoveBGPSpeakerFromDRAgent bgp-speaker-list-on-dragent = neutronclient.neutron.v2_0.bgp.dragentscheduler:ListBGPSpeakersOnDRAgent @@ -324,6 +360,7 @@ bgp-peer-create = neutronclient.neutron.v2_0.bgp.peer:CreatePeer bgp-peer-update = neutronclient.neutron.v2_0.bgp.peer:UpdatePeer bgp-peer-delete = neutronclient.neutron.v2_0.bgp.peer:DeletePeer + lbaas-loadbalancer-list = neutronclient.neutron.v2_0.lb.v2.loadbalancer:ListLoadBalancer lbaas-loadbalancer-show = neutronclient.neutron.v2_0.lb.v2.loadbalancer:ShowLoadBalancer lbaas-loadbalancer-create = neutronclient.neutron.v2_0.lb.v2.loadbalancer:CreateLoadBalancer @@ -361,6 +398,7 @@ lbaas-member-create = neutronclient.neutron.v2_0.lb.v2.member:CreateMember lbaas-member-update = neutronclient.neutron.v2_0.lb.v2.member:UpdateMember lbaas-member-delete = neutronclient.neutron.v2_0.lb.v2.member:DeleteMember + lb-vip-list = neutronclient.neutron.v2_0.lb.vip:ListVip lb-vip-show = neutronclient.neutron.v2_0.lb.vip:ShowVip lb-vip-create = neutronclient.neutron.v2_0.lb.vip:CreateVip @@ -384,6 +422,7 @@ lb-healthmonitor-delete = neutronclient.neutron.v2_0.lb.healthmonitor:DeleteHealthMonitor lb-healthmonitor-associate = neutronclient.neutron.v2_0.lb.healthmonitor:AssociateHealthMonitor lb-healthmonitor-disassociate = neutronclient.neutron.v2_0.lb.healthmonitor:DisassociateHealthMonitor + ipsec-site-connection-list = neutronclient.neutron.v2_0.vpn.ipsec_site_connection:ListIPsecSiteConnection ipsec-site-connection-show = neutronclient.neutron.v2_0.vpn.ipsec_site_connection:ShowIPsecSiteConnection ipsec-site-connection-create = neutronclient.neutron.v2_0.vpn.ipsec_site_connection:CreateIPsecSiteConnection @@ -410,12 +449,6 @@ vpn-ikepolicy-update = neutronclient.neutron.v2_0.vpn.ikepolicy:UpdateIKEPolicy vpn-ikepolicy-delete = neutronclient.neutron.v2_0.vpn.ikepolicy:DeleteIKEPolicy -[build_sphinx] -all_files = 1 -build-dir = doc/build -source-dir = doc/source -warning-is-error = 1 - [wheel] universal = 1 diff -Nru python-neutronclient-6.7.0/.stestr.conf python-neutronclient-6.11.0/.stestr.conf --- python-neutronclient-6.7.0/.stestr.conf 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/.stestr.conf 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./neutronclient/tests/unit +top_dir=./ diff -Nru python-neutronclient-6.7.0/.testr.conf python-neutronclient-6.11.0/.testr.conf --- python-neutronclient-6.7.0/.testr.conf 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/.testr.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutronclient/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff -Nru python-neutronclient-6.7.0/test-requirements.txt python-neutronclient-6.11.0/test-requirements.txt --- python-neutronclient-6.7.0/test-requirements.txt 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/test-requirements.txt 2018-11-15 14:27:38.000000000 +0000 @@ -3,20 +3,17 @@ # process, which may cause wedges in the gate later. hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +bandit>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD flake8-import-order==0.12 # LGPLv3 -mox3>=0.20.0 # Apache-2.0 mock>=2.0.0 # BSD -openstackdocstheme>=1.17.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 -osprofiler>=1.4.0 # Apache-2.0 +osprofiler>=2.3.0 # Apache-2.0 python-openstackclient>=3.12.0 # Apache-2.0 python-subunit>=1.0.0 # Apache-2.0/BSD -reno>=2.5.0 # Apache-2.0 -requests-mock>=1.1.0 # Apache-2.0 -sphinx!=1.6.6,>=1.6.2 # BSD -testrepository>=0.0.18 # Apache-2.0/BSD +requests-mock>=1.2.0 # Apache-2.0 +stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT testscenarios>=0.4 # Apache-2.0/BSD tempest>=17.1.0 # Apache-2.0 diff -Nru python-neutronclient-6.7.0/tox.ini python-neutronclient-6.11.0/tox.ini --- python-neutronclient-6.7.0/tox.ini 2018-01-26 00:31:36.000000000 +0000 +++ python-neutronclient-6.11.0/tox.ini 2018-11-15 14:27:38.000000000 +0000 @@ -21,14 +21,18 @@ commands = sh -c "find . -type d -name '.?*' -prune -o \ \( -type d -name '__pycache__' -o -type f -name '*.py[co]' \) \ -print0 | xargs -0 rm -rf" - python setup.py testr --testr-args='{posargs}' + stestr run {posargs} whitelist_externals = sh [testenv:pep8] -commands = flake8 +basepython = python3 +commands = + flake8 + {[testenv:bandit]commands} distribute = false [testenv:venv] +basepython = python3 commands = {posargs} [testenv:functional] @@ -42,20 +46,45 @@ OS_NEUTRONCLIENT_EXEC_DIR = {envdir}/bin [testenv:cover] +basepython = python3 +setenv = + {[testenv]setenv} + PYTHON=coverage run --source neutronclient --parallel-mode commands = - python setup.py test --coverage --coverage-package-name=neutronclient --testr-args='{posargs}' - coverage report + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:docs] +basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -W -b html doc/source doc/build/html [testenv:releasenotes] +basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] +basepython = python3 show-source = true exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools import-order-style = pep8 # H904: Delay string interpolations at logging calls enable-extensions=H904 + +[testenv:bandit] +basepython = python3 +# B303: blacklist calls: md5, sha1 +deps = -r{toxinidir}/test-requirements.txt +commands = bandit -r neutronclient -x tests -n5 -s B303 + +[testenv:lower-constraints] +basepython = python3 +deps = + -c{toxinidir}/lower-constraints.txt + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt diff -Nru python-neutronclient-6.7.0/.zuul.yaml python-neutronclient-6.11.0/.zuul.yaml --- python-neutronclient-6.7.0/.zuul.yaml 1970-01-01 00:00:00.000000000 +0000 +++ python-neutronclient-6.11.0/.zuul.yaml 2018-11-15 14:27:38.000000000 +0000 @@ -0,0 +1,36 @@ +- project: + templates: + - openstack-cover-jobs + - openstack-lower-constraints-jobs + - openstack-python-jobs + - openstack-python35-jobs + - openstack-python36-jobs + - publish-openstack-docs-pti + - check-requirements + - lib-forward-testing + - lib-forward-testing-python3 + - release-notes-jobs-python3 + - openstackclient-plugin-jobs + check: + jobs: + - legacy-neutronclient-test-dsvm-functional: + irrelevant-files: &project-irrelevant-files + - ^.*\.rst$ + - ^doc/.*$ + - ^neutron/locale/.*$ + - ^releasenotes/.*$ + - legacy-neutronclient-test-dsvm-functional-adv-svcs: + irrelevant-files: *project-irrelevant-files + gate: + jobs: + - legacy-neutronclient-test-dsvm-functional: + irrelevant-files: *project-irrelevant-files + - legacy-neutronclient-test-dsvm-functional-adv-svcs: + irrelevant-files: *project-irrelevant-files + experimental: + jobs: + - legacy-grenade-dsvm-neutron-libs: + irrelevant-files: + - ^(test-|)requirements.txt$ + - ^setup.cfg$ +