Browse Source

Fix requirements for Queens branch

Change-Id: Ifff24bcf1c8fffbb37fb6efbaea0d8316fe5934c
changes/84/766784/10
Salvatore Orlando 4 months ago
committed by asarfaty
parent
commit
a064a02fba
31 changed files with 232 additions and 344 deletions
  1. +2
    -1
      .pylintrc
  2. +0
    -17
      .zuul.yaml
  3. +4
    -4
      devstack/tools/nsxv_cleanup.py
  4. +5
    -3
      doc/requirements.txt
  5. +19
    -123
      lower-constraints.txt
  6. +10
    -10
      requirements.txt
  7. +4
    -4
      test-requirements.txt
  8. +4
    -1
      tox.ini
  9. +1
    -0
      vmware_nsx/api_client/eventlet_client.py
  10. +2
    -2
      vmware_nsx/dhcp_meta/combined.py
  11. +1
    -0
      vmware_nsx/extensions/networkgw.py
  12. +1
    -0
      vmware_nsx/extensions/qos_queue.py
  13. +2
    -2
      vmware_nsx/nsxlib/mh/__init__.py
  14. +8
    -8
      vmware_nsx/plugins/nsx_v/housekeeper/error_dhcp_edge.py
  15. +9
    -9
      vmware_nsx/plugins/nsx_v/plugin.py
  16. +3
    -3
      vmware_nsx/plugins/nsx_v3/plugin.py
  17. +1
    -1
      vmware_nsx/services/lbaas/nsx_v/v2/listener_mgr.py
  18. +1
    -0
      vmware_nsx/shell/admin/plugins/nsxv/resources/backup_edges.py
  19. +7
    -7
      vmware_nsx/shell/admin/plugins/nsxv/resources/edges.py
  20. +2
    -2
      vmware_nsx/shell/nsxadmin.py
  21. +1
    -0
      vmware_nsx/shell/resources.py
  22. +10
    -10
      vmware_nsx/tests/unit/extensions/test_networkgw.py
  23. +1
    -1
      vmware_nsx/tests/unit/extensions/test_portsecurity.py
  24. +6
    -6
      vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py
  25. +0
    -1
      vmware_nsx/tests/unit/nsx_mh/test_opts.py
  26. +76
    -76
      vmware_nsx/tests/unit/nsx_v/test_plugin.py
  27. +2
    -2
      vmware_nsx/tests/unit/nsx_v/vshield/fake_vcns.py
  28. +23
    -24
      vmware_nsx/tests/unit/nsx_v3/test_plugin.py
  29. +8
    -8
      vmware_nsx/tests/unit/services/dynamic_routing/test_nsxv_bgp_driver.py
  30. +4
    -4
      vmware_nsx/tests/unit/services/qos/test_nsxv3_notification.py
  31. +15
    -15
      vmware_nsx/tests/unit/services/vpnaas/test_nsxv3_vpnaas.py

+ 2
- 1
.pylintrc View File

@ -94,7 +94,8 @@ disable=
too-many-statements,
cyclic-import,
no-name-in-module,
bad-super-call
bad-super-call,
inconsistent-return-statements
[BASIC]
# Variable names can be 1 to 31 characters long, with lowercase and underscores


+ 0
- 17
.zuul.yaml View File

@ -5,7 +5,6 @@
- openstack-python35-jobs-neutron
check:
jobs:
- vmware-tox-lower-constraints
- openstack-tox-pep8:
required-projects:
- openstack/neutron
@ -44,7 +43,6 @@
gate:
queue: vmware-nsx
jobs:
- vmware-tox-lower-constraints
- openstack-tox-pep8:
required-projects:
- openstack/neutron
@ -80,18 +78,3 @@
- openstack/neutron-dynamic-routing
- openstack/neutron-vpnaas
- x/tap-as-a-service
- job:
name: vmware-tox-lower-constraints
parent: openstack-tox-lower-constraints
timeout: 5400
required-projects:
- openstack/neutron
- x/networking-l2gw
- openstack/networking-sfc
- openstack/neutron-lbaas
- x/vmware-nsxlib
- openstack/neutron-fwaas
- openstack/neutron-dynamic-routing
- openstack/neutron-vpnaas
- x/tap-as-a-service

+ 4
- 4
devstack/tools/nsxv_cleanup.py View File

@ -253,7 +253,7 @@ class VSMClient(object):
# Query all firewall sections
response = self.get()
# Get layer3 sections related to security group
if response.status_code is 200:
if response.status_code == 200:
l3_sections = response.json()['layer3Sections']['layer3Sections']
# do not delete the default section, or sections created by the
# service composer
@ -289,7 +289,7 @@ class VSMClient(object):
self.__set_endpoint("/services/securitygroup/scope/globalroot-0")
# Query all security groups
response = self.get()
if response.status_code is 200:
if response.status_code == 200:
sg_all = response.json()
else:
print("ERROR: wrong response status code! Exiting...")
@ -323,7 +323,7 @@ class VSMClient(object):
self.__set_endpoint("/services/spoofguard/policies/")
# Query all spoofguard policies
response = self.get()
if response.status_code is not 200:
if response.status_code == 200:
print("ERROR: Faield to get spoofguard policies")
return
sgp_all = response.json()
@ -395,7 +395,7 @@ def ceil(a, b):
if b == 0:
return 0
div = a / b
mod = 0 if a % b is 0 else 1
mod = 0 if a % b == 0 else 1
return int(div + mod)


+ 5
- 3
doc/requirements.txt View File

@ -1,11 +1,13 @@
# 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.
sphinx!=1.6.6,>=1.6.2 # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
oslosphinx>=4.7.0 # Apache-2.0
openstackdocstheme>=1.18.1 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
testresources>=2.0.0 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD

+ 19
- 123
lower-constraints.txt View File

@ -1,154 +1,50 @@
alabaster==0.7.10
alembic==0.8.10
amqp==2.1.1
appdirs==1.4.3
asn1crypto==0.23.0
Babel==2.3.4
beautifulsoup4==4.6.0
cachetools==2.0.0
cffi==1.8.2
cliff==2.8.0
cmd2==0.8.0
contextlib2==0.4.0
amqp==2.5.0
coverage==4.0
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==2.5.5
flake8-import-order==0.12
future==0.16.0
futurist==1.2.0
greenlet==0.4.10
hacking==0.12.0
flake8-import-order==0.15
hacking==2.0.0
httplib2==0.9.1
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
keystonemiddleware==4.17.0
kombu==4.0.0
linecache2==1.0.0
logilab-common==1.4.1
logutils==0.3.5
Mako==0.4.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
neutron-lib==1.13.0
neutron-lbaas===12.0.0
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
os-xenapi==0.3.1
osc-lib==1.8.0
oslo.cache==1.26.0
oslo.concurrency==3.26.0
oslo.config==5.2.0
oslo.concurrency==3.25.0
oslo.config==5.1.0
oslo.context==2.19.2
oslo.db==4.27.0
oslo.i18n==3.15.3
oslo.log==3.36.0
oslo.messaging==5.29.0
oslo.middleware==3.31.0
oslo.policy==1.30.0
oslo.privsep==1.23.0
oslo.reports==1.18.0
oslo.rootwrap==5.8.0
oslo.serialization==2.18.0
oslo.service==1.24.0
oslo.utils==3.33.0
oslo.versionedobjects==1.31.2
oslo.vmware==2.17.0
oslotest==3.2.0
osprofiler==1.4.0
ovs==2.8.0
ovsdbapp==0.10.0
paramiko==2.0.0
Paste==2.0.2
PasteDeploy==1.5.0
paramiko==2.4.3
pbr==2.0.0
pecan==1.0.0
pep8==1.5.7
pika==0.10.0
pika-pool==0.1.3
positional==1.2.1
prettytable==0.7.1
psycopg2==2.6.2
psutil==3.2.2
pycadf==1.1.0
pycodestyle==2.3.1
pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0
pyinotify==0.9.6
pylint==1.7.1
pyparsing==2.1.0
pyperclip==1.5.27
python-dateutil==2.5.3
python-designateclient==2.7.0
python-editor==1.0.3
python-keystoneclient==3.8.0
python-mimeparse==1.6.0
python-neutronclient==6.7.0
python-novaclient==9.1.0
python-openstackclient==3.12.0
python-subunit==1.0.0
pytz==2013.6
PyMySQL==0.7.6
PyYAML==3.12
prettytable==0.7.2
psycopg2==2.8
PyMySQL==0.7.10
reno==2.5.0
repoze.lru==0.7
requests==2.14.2
requests-mock==1.2.0
requestsexceptions==1.2.0
rfc3986==0.3.1
Routes==2.3.1
ryu==4.14
simplejson==3.5.1
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.6.5
sphinxcontrib-websupport==1.0.1
SQLAlchemy==1.0.10
sqlalchemy-migrate==0.11.0
sqlparse==0.2.2
statsd==3.2.1
Sphinx==1.6.2
SQLAlchemy==1.0.19
stestr==1.0.0
stevedore==1.20.0
tempest==17.1.0
Tempita==0.5.2
tenacity==4.4.0
testrepository==0.0.18
testresources==2.0.0
testscenarios==0.4
testtools==2.2.0
tinyrpc==0.6
traceback2==1.4.0
tooz==1.58.0
unittest2==1.1.0
urllib3==1.21.1
vine==1.1.4
vmware-nsxlib==13.1.0
waitress==1.1.0
WebOb==1.7.1
WebTest==2.0.27
wrapt==1.7.0
# Neutron related projects
vmware-nsxlib==12.0.4
neutron==12.0.6
networking-l2gw==12.0.1
networking-sfc==6.0.0
neutron-fwaas==12.0.2
neutron-vpnaas==12.0.1
neutron-dynamic-routing==12.0.1

+ 10
- 10
requirements.txt View File

@ -7,7 +7,7 @@ enum34>=1.0.4;python_version=='2.7' or python_version=='2.6' or python_version==
eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2 # MIT
httplib2>=0.9.1 # MIT
netaddr>=0.7.18 # BSD
tenacity>=3.2.1 # Apache-2.0
tenacity>=4.4.0 # Apache-2.0
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
six>=1.10.0 # MIT
stevedore>=1.20.0 # Apache-2.0
@ -24,7 +24,7 @@ oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
oslo.vmware>=2.17.0 # Apache-2.0
PrettyTable<0.8,>=0.7.1 # BSD
PrettyTable<0.8,>=0.7.2 # BSD
tooz>=1.58.0 # Apache-2.0
decorator>=3.4.0 # BSD
mock>=2.0.0 # BSD
@ -32,11 +32,11 @@ mock>=2.0.0 # BSD
# These repos are installed from git in OpenStack CI if the job
# configures them as required-projects
neutron<13.0.0 # Apache-2.0
networking-l2gw<13.0.0 # Apache-2.0
networking-sfc<7.0.0 # Apache-2.0
neutron-lbaas<13.0.0 # Apache-2.0
neutron-fwaas<13.0.0 # Apache-2.0
neutron-vpnaas<13.0.0 # Apache-2.0
neutron-dynamic-routing<13.0.0 # Apache-2.0
vmware-nsxlib<14.0.0 # Apache-2.0
neutron>=12.0.6,<13.0.0 # Apache-2.0
networking-l2gw>=12.0.1,<13.0.0 # Apache-2.0
networking-sfc>=6.0.0,<7.0.0 # Apache-2.0
neutron-lbaas>=12.0.0,<13.0.0 # Apache-2.0
neutron-fwaas>=12.0.2,<13.0.0 # Apache-2.0
neutron-vpnaas>=12.0.1,<13.0.0 # Apache-2.0
neutron-dynamic-routing>=12.0.1,<13.0.0 # Apache-2.0
vmware-nsxlib>=12.0.4,<14.0.0 # Apache-2.0

+ 4
- 4
test-requirements.txt View File

@ -1,11 +1,11 @@
# 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.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=2.0.0,<3.0.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
flake8-import-order==0.15,<0.17.1 # LGPLv3
mock>=2.0.0 # BSD
psycopg2>=2.6.2 # LGPL/ZPL
@ -18,8 +18,8 @@ testresources>=2.0.0 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
testscenarios>=0.4 # Apache-2.0/BSD
WebTest>=2.0.27 # MIT
bandit>=1.1.0 # Apache-2.0
tempest>=17.1.0 # Apache-2.0
pylint==1.7.6 # GPLv2
pylint==1.9.2 # GPLv2
isort>=4.2.5,<=4.3.0
python-openstackclient>=3.12.0 # Apache-2.0
requests-mock>=1.1.0 # Apache-2.0

+ 4
- 1
tox.ini View File

@ -5,6 +5,7 @@ skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
EDITOR=vi
PYTHONWARNINGS=default::DeprecationWarning
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
usedevelop = True
@ -144,11 +145,13 @@ commands = sphinx-build -b html doc/source doc/build/html
# H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line
# H904 Wrap long lines in parentheses instead of a backslash
# I202 Additional newline in a group of imports
# W504 line break after binary operator
# TODO(dougwig) -- uncomment this to test for remaining linkages
# N530 direct neutron imports not allowed
# N531 translations hints
# TODO(boden): fix warnings for W503,E731,E266,E402
ignore = E125,E126,E128,E129,E265,H305,H307,H404,H405,H904,N530,N531,W503,E731,E266,E402
ignore = E125,E126,E128,E129,E265,H305,H307,H404,H405,H904,N530,N531,W503,E731,E266,E402,I202,W504
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject


+ 1
- 0
vmware_nsx/api_client/eventlet_client.py View File

@ -151,5 +151,6 @@ class EventletApiClient(base.ApiClientBase):
return cookie
# Register as subclass.
base.ApiClientBase.register(EventletApiClient)

+ 2
- 2
vmware_nsx/dhcp_meta/combined.py View File

@ -48,8 +48,8 @@ class DhcpAgentNotifyAPI(dhcp_rpc_agent_api.DhcpAgentNotifyAPI):
const.DEVICE_OWNER_DHCP not in plugin.port_special_owners):
# network/subnet provisioned in the new model have a plain
# nsx lswitch port, no vif attachment
plugin.port_special_owners.append(const.DEVICE_OWNER_DHCP)
treat_dhcp_owner_specially = True
plugin.port_special_owners.append(const.DEVICE_OWNER_DHCP)
treat_dhcp_owner_specially = True
if (resource == 'port' and action == 'update' or
resource == 'subnet'):
self.agentless_notifier.notify(context, data, methodname)


+ 1
- 0
vmware_nsx/extensions/networkgw.py View File

@ -49,6 +49,7 @@ class NetworkTypes(object):
VLAN = 'vlan'
BRIDGE = 'bridge'
# Attribute Map for Network Gateway Resource
# TODO(salvatore-orlando): add admin state as other neutron resources
RESOURCE_ATTRIBUTE_MAP = {


+ 1
- 0
vmware_nsx/extensions/qos_queue.py View File

@ -108,6 +108,7 @@ def convert_to_unsigned_int_or_none_max_63(val):
# compatibility perspective to change the default value for DSCP in order to
# avoid this peculiar behaviour
RESOURCE_ATTRIBUTE_MAP = {
'qos_queues': {
'id': {'allow_post': False, 'allow_put': False,


+ 2
- 2
vmware_nsx/nsxlib/mh/__init__.py View File

@ -84,9 +84,9 @@ def format_exception(etype, e, exception_locals):
"""
msg = [_("Error. %(type)s exception: %(exc)s.") %
{'type': etype, 'exc': e}]
l = dict((k, v) for k, v in six.iteritems(exception_locals)
data = dict((k, v) for k, v in six.iteritems(exception_locals)
if k != 'request')
msg.append(_("locals=[%s]") % str(l))
msg.append(_("locals=[%s]") % str(data))
return ' '.join(msg)


+ 8
- 8
vmware_nsx/plugins/nsx_v/housekeeper/error_dhcp_edge.py View File

@ -254,14 +254,14 @@ class ErrorDhcpEdgeJob(base_job.BaseJob):
if vnic['type'] != 'trunk':
# reinitialize the interface as it is missing config
vnic['name'] = (vcns_const.INTERNAL_VNIC_NAME +
str(vnic['index']))
vnic['type'] = 'trunk'
vnic['portgroupId'] = port_group_id
vnic['mtu'] = 1500
vnic['enableProxyArp'] = False
vnic['enableSendRedirects'] = True
vnic['isConnected'] = True
vnic['name'] = (vcns_const.INTERNAL_VNIC_NAME +
str(vnic['index']))
vnic['type'] = 'trunk'
vnic['portgroupId'] = port_group_id
vnic['mtu'] = 1500
vnic['enableProxyArp'] = False
vnic['enableSendRedirects'] = True
vnic['isConnected'] = True
def _update_router_bindings(self, context, edge_id):
edge_router_binds = nsxv_db.get_nsxv_router_bindings_by_edge(


+ 9
- 9
vmware_nsx/plugins/nsx_v/plugin.py View File

@ -933,7 +933,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
if self._vcm:
try:
h, switch = self.nsx_v.vcns.get_vdn_switch(dvs_id)
except Exception as e:
except Exception:
LOG.warning('DVS %s not registered on NSX. Unable to '
'update teaming for network %s',
dvs_id, net_id)
@ -1767,10 +1767,10 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
self._update_vnic_assigned_addresses(context.session, port,
vnic_id)
except Exception as e:
msg = _('Unable to add port to spoofguard policy error '
'%s') % e
raise n_exc.BadRequest(resource='spoofguard policy',
msg=msg)
msg = _('Unable to add port to spoofguard policy error '
'%s') % e
raise n_exc.BadRequest(resource='spoofguard policy',
msg=msg)
def update_network(self, context, id, network):
net_attrs = network['network']
@ -1969,10 +1969,10 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
# Check that the MAC address is the same as the port
for ap in attrs[addr_apidef.ADDRESS_PAIRS]:
if ('mac_address' in ap and
ap['mac_address'] != db_port['mac_address']):
msg = _('Address pairs should have same MAC as the '
'port')
raise n_exc.BadRequest(resource='address_pairs', msg=msg)
ap['mac_address'] != db_port['mac_address']):
msg = _('Address pairs should have same MAC as the '
'port')
raise n_exc.BadRequest(resource='address_pairs', msg=msg)
def _is_mac_in_use(self, context, network_id, mac_address):
# Override this method as the backed doesn't support using the same


+ 3
- 3
vmware_nsx/plugins/nsx_v3/plugin.py View File

@ -4776,9 +4776,9 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
if self.nsxlib.feature_supported(
nsxlib_consts.FEATURE_DYNAMIC_CRITERIA):
tag_expression = (
self.nsxlib.ns_group.get_port_tag_expression(
security.PORT_SG_SCOPE, secgroup['id']))
tag_expression = (
self.nsxlib.ns_group.get_port_tag_expression(
security.PORT_SG_SCOPE, secgroup['id']))
else:
tag_expression = None


+ 1
- 1
vmware_nsx/services/lbaas/nsx_v/v2/listener_mgr.py View File

@ -294,7 +294,7 @@ class EdgeListenerManager(base_mgr.EdgeLoadbalancerBaseManager):
with locking.LockManager.get_lock(edge_id):
self.vcns.delete_app_profile(edge_id, app_profile_id)
except (vcns_exc.ResourceNotFound, vcns_exc.RequestBad):
LOG.error('app profile not found on edge: %s', edge_id)
LOG.error('app profile not found on edge: %s', edge_id)
except vcns_exc.VcnsApiException:
LOG.error('Failed to delete app profile on Edge: %s', edge_id)


+ 1
- 0
vmware_nsx/shell/admin/plugins/nsxv/resources/backup_edges.py View File

@ -343,6 +343,7 @@ def nsx_fix_name_mismatch(resource, event, trigger, **kwargs):
'Edge %s has no backup prefix on NSX', edge_id)
return
registry.subscribe(nsx_list_backup_edges,
constants.BACKUP_EDGES,
shell.Operations.LIST.value)


+ 7
- 7
vmware_nsx/shell/admin/plugins/nsxv/resources/edges.py View File

@ -327,7 +327,7 @@ def change_edge_ha(ha, edge_id):
'enabled': ha}
try:
nsxv.enable_ha(edge_id, request)
except nsxv_exceptions.ResourceNotFound as e:
except nsxv_exceptions.ResourceNotFound:
LOG.error("Edge %s not found", edge_id)
except exceptions.NeutronException as e:
LOG.error("%s", str(e))
@ -353,7 +353,7 @@ def change_edge_syslog(properties):
edge_id = properties.get('edge-id')
try:
nsxv.update_edge_syslog(edge_id, request)
except nsxv_exceptions.ResourceNotFound as e:
except nsxv_exceptions.ResourceNotFound:
LOG.error("Edge %s not found", edge_id)
except exceptions.NeutronException as e:
LOG.error("%s", str(e))
@ -362,7 +362,7 @@ def change_edge_syslog(properties):
def delete_edge_syslog(edge_id):
try:
nsxv.delete_edge_syslog(edge_id)
except nsxv_exceptions.ResourceNotFound as e:
except nsxv_exceptions.ResourceNotFound:
LOG.error("Edge %s not found", edge_id)
except exceptions.NeutronException as e:
LOG.error("%s", str(e))
@ -404,7 +404,7 @@ def change_edge_loglevel(properties):
try:
edge_utils.update_edge_loglevel(nsxv, edge_id, module, level)
except nsxv_exceptions.ResourceNotFound as e:
except nsxv_exceptions.ResourceNotFound:
LOG.error("Edge %s not found", edge_id)
except exceptions.NeutronException as e:
LOG.error("%s", str(e))
@ -422,7 +422,7 @@ def change_edge_appliance_size(properties):
try:
nsxv.change_edge_appliance_size(
properties.get('edge-id'), size)
except nsxv_exceptions.ResourceNotFound as e:
except nsxv_exceptions.ResourceNotFound:
LOG.error("Edge %s not found", properties.get('edge-id'))
except exceptions.NeutronException as e:
LOG.error("%s", str(e))
@ -462,7 +462,7 @@ def change_edge_appliance(edge_id):
request = {'appliances': appliances, 'applianceSize': size}
try:
nsxv.change_edge_appliance(edge_id, request)
except nsxv_exceptions.ResourceNotFound as e:
except nsxv_exceptions.ResourceNotFound:
LOG.error("Edge %s not found", edge_id)
except exceptions.NeutronException as e:
LOG.error("%s", str(e))
@ -503,7 +503,7 @@ def change_edge_appliance_reservations(properties):
request = {'appliances': appliances}
try:
nsxv.change_edge_appliance(edge_id, request)
except nsxv_exceptions.ResourceNotFound as e:
except nsxv_exceptions.ResourceNotFound:
LOG.error("Edge %s not found", edge_id)
except exceptions.NeutronException as e:
LOG.error("%s", str(e))


+ 2
- 2
vmware_nsx/shell/nsxadmin.py View File

@ -74,11 +74,11 @@ def _validate_resource_choice(resource, nsx_plugin):
LOG.error('Supported list of NSX-V resources: %s',
resources.nsxv_resources_names)
sys.exit(1)
elif nsx_plugin == 'nsxv3'and resource not in resources.nsxv3_resources:
elif nsx_plugin == 'nsxv3' and resource not in resources.nsxv3_resources:
LOG.error('Supported list of NSX-V3 resources: %s',
resources.nsxv3_resources_names)
sys.exit(1)
elif nsx_plugin == 'nsxtvd'and resource not in resources.nsxtvd_resources:
elif nsx_plugin == 'nsxtvd' and resource not in resources.nsxtvd_resources:
LOG.error('Supported list of NSX-TVD resources: %s',
resources.nsxtvd_resources_names)
sys.exit(1)


+ 1
- 0
vmware_nsx/shell/resources.py View File

@ -67,6 +67,7 @@ class Operations(enum.Enum):
SHOW = 'show'
VALIDATE = 'validate'
ops = [op.value for op in Operations]


+ 10
- 10
vmware_nsx/tests/unit/extensions/test_networkgw.py View File

@ -743,19 +743,19 @@ class NetworkGatewayDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
def test_connect_invalid_network_returns_400(self):
with self._network_gateway() as gw:
self._gateway_action('connect',
gw[self.gw_resource]['id'],
'hohoho',
'vlan', 555,
expected_status=exc.HTTPBadRequest.code)
self._gateway_action('connect',
gw[self.gw_resource]['id'],
'hohoho',
'vlan', 555,
expected_status=exc.HTTPBadRequest.code)
def test_connect_unspecified_network_returns_400(self):
with self._network_gateway() as gw:
self._gateway_action('connect',
gw[self.gw_resource]['id'],
None,
'vlan', 555,
expected_status=exc.HTTPBadRequest.code)
self._gateway_action('connect',
gw[self.gw_resource]['id'],
None,
'vlan', 555,
expected_status=exc.HTTPBadRequest.code)
def test_disconnect_network_ambiguous_returns_409(self):
with self._network_gateway() as gw:


+ 1
- 1
vmware_nsx/tests/unit/extensions/test_portsecurity.py View File

@ -45,7 +45,7 @@ class PortSecurityTestCaseNSXv2(psec.PortSecurityDBTestCase):
class TestPortSecurityNSXv2(PortSecurityTestCaseNSXv2, psec.TestPortSecurity):
pass
pass
class TestPortSecurityNSXv3(psec.TestPortSecurity,


+ 6
- 6
vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py View File

@ -354,9 +354,9 @@ class LsnManagerTestCase(base.BaseTestCase):
def _test_lsn_delete_by_network_with_exc(self, exc):
self.mock_lsn_api.lsn_for_network_get.side_effect = exc
with mock.patch.object(lsn_man.LOG, 'warning') as l:
with mock.patch.object(lsn_man.LOG, 'warning') as log_mock:
self.manager.lsn_delete_by_network(mock.ANY, self.net_id)
self.assertEqual(1, l.call_count)
self.assertEqual(1, log_mock.call_count)
def test_lsn_delete_by_network_with_not_found(self):
self._test_lsn_delete_by_network_with_exc(n_exc.NotFound)
@ -430,10 +430,10 @@ class LsnManagerTestCase(base.BaseTestCase):
def _test_lsn_port_delete_with_exc(self, exc):
self.mock_lsn_api.lsn_port_delete.side_effect = exc
with mock.patch.object(lsn_man.LOG, 'warning') as l:
with mock.patch.object(lsn_man.LOG, 'warning') as log_mock:
self.manager.lsn_port_delete(mock.ANY, mock.ANY, mock.ANY)
self.assertEqual(1, self.mock_lsn_api.lsn_port_delete.call_count)
self.assertEqual(1, l.call_count)
self.assertEqual(1, log_mock.call_count)
def test_lsn_port_delete_with_not_found(self):
self._test_lsn_port_delete_with_exc(n_exc.NotFound)
@ -658,9 +658,9 @@ class LsnManagerTestCase(base.BaseTestCase):
def test_lsn_port_dispose_api_error(self):
self.mock_lsn_api.lsn_port_delete.side_effect = (
exception.NsxApiException)
with mock.patch.object(lsn_man.LOG, 'warning') as l:
with mock.patch.object(lsn_man.LOG, 'warning') as log_mock:
self.manager.lsn_port_dispose(mock.ANY, self.net_id, self.mac)
self.assertEqual(1, l.call_count)
self.assertEqual(1, log_mock.call_count)
def test_lsn_port_host_conf(self):
with mock.patch.object(self.manager,


+ 0
- 1
vmware_nsx/tests/unit/nsx_mh/test_opts.py View File

@ -40,7 +40,6 @@ NVP_INI_DEPR_PATH = vmware.get_fake_conf('nvp.ini.full.test')
class NSXClusterTest(base.BaseTestCase):
cluster_opts = {'default_tz_uuid': uuidutils.generate_uuid(),
'default_l2_gw_service_uuid': uuidutils.generate_uuid(),
'default_l2_gw_service_uuid': uuidutils.generate_uuid(),
'nsx_user': 'foo',
'nsx_password': 'bar',


+ 76
- 76
vmware_nsx/tests/unit/nsx_v/test_plugin.py View File

@ -2004,31 +2004,31 @@ class TestSubnetsV2(NsxVPluginV2TestCase,
return self._create_bulk(fmt, number, 'subnet', base_data, **kwargs)
def test_create_subnet_nonzero_cidr(self):
awkward_cidrs = [{'nonezero': '10.129.122.5/8',
'corrected': '10.0.0.0/8'},
{'nonezero': '11.129.122.5/15',
'corrected': '11.128.0.0/15'},
{'nonezero': '12.129.122.5/16',
'corrected': '12.129.0.0/16'},
{'nonezero': '13.129.122.5/18',
'corrected': '13.129.64.0/18'},
{'nonezero': '14.129.122.5/22',
'corrected': '14.129.120.0/22'},
{'nonezero': '15.129.122.5/24',
'corrected': '15.129.122.0/24'},
{'nonezero': '16.129.122.5/28',
'corrected': '16.129.122.0/28'}, ]
for cidr in awkward_cidrs:
with self.subnet(enable_dhcp=False,
cidr=cidr['nonezero']) as subnet:
# the API should accept and correct these cidrs for users
self.assertEqual(cidr['corrected'],
subnet['subnet']['cidr'])
with self.subnet(enable_dhcp=False, cidr='17.129.122.5/32',
gateway_ip=None) as subnet:
self.assertEqual('17.129.122.5/32', subnet['subnet']['cidr'])
awkward_cidrs = [{'nonezero': '10.129.122.5/8',
'corrected': '10.0.0.0/8'},
{'nonezero': '11.129.122.5/15',
'corrected': '11.128.0.0/15'},
{'nonezero': '12.129.122.5/16',
'corrected': '12.129.0.0/16'},
{'nonezero': '13.129.122.5/18',
'corrected': '13.129.64.0/18'},
{'nonezero': '14.129.122.5/22',
'corrected': '14.129.120.0/22'},
{'nonezero': '15.129.122.5/24',
'corrected': '15.129.122.0/24'},
{'nonezero': '16.129.122.5/28',
'corrected': '16.129.122.0/28'}, ]
for cidr in awkward_cidrs:
with self.subnet(enable_dhcp=False,
cidr=cidr['nonezero']) as subnet:
# the API should accept and correct these cidrs for users
self.assertEqual(cidr['corrected'],
subnet['subnet']['cidr'])
with self.subnet(enable_dhcp=False, cidr='17.129.122.5/32',
gateway_ip=None) as subnet:
self.assertEqual('17.129.122.5/32', subnet['subnet']['cidr'])
def test_create_subnet_ipv6_attributes(self):
# Expected to fail for now as we don't support IPv6 for NSXv
@ -2678,27 +2678,27 @@ class L3NatTestCaseBase(test_l3_plugin.L3NatTestCaseMixin):
enable_dhcp=False, ip_version=6)
) as s1, self.subnet(network=n, cidr='fd01::1/64',
ip_version=6, enable_dhcp=False) as s2:
body = self._router_interface_action('add',
r['router']['id'],
s1['subnet']['id'],
None)
pid1 = body['port_id']
body = self._router_interface_action('add',
r['router']['id'],
s2['subnet']['id'],
None)
pid2 = body['port_id']
self.assertEqual(pid1, pid2)
port = self._show('ports', pid1)
self.assertEqual(2, len(port['port']['fixed_ips']))
port_subnet_ids = [fip['subnet_id'] for fip in
port['port']['fixed_ips']]
self.assertIn(s1['subnet']['id'], port_subnet_ids)
self.assertIn(s2['subnet']['id'], port_subnet_ids)
self._router_interface_action('remove', r['router']['id'],
s1['subnet']['id'], None)
self._router_interface_action('remove', r['router']['id'],
s2['subnet']['id'], None)
body = self._router_interface_action('add',
r['router']['id'],
s1['subnet']['id'],
None)
pid1 = body['port_id']
body = self._router_interface_action('add',
r['router']['id'],
s2['subnet']['id'],
None)
pid2 = body['port_id']
self.assertEqual(pid1, pid2)
port = self._show('ports', pid1)
self.assertEqual(2, len(port['port']['fixed_ips']))
port_subnet_ids = [fip['subnet_id'] for fip in
port['port']['fixed_ips']]
self.assertIn(s1['subnet']['id'], port_subnet_ids)
self.assertIn(s2['subnet']['id'], port_subnet_ids)
self._router_interface_action('remove', r['router']['id'],
s1['subnet']['id'], None)
self._router_interface_action('remove', r['router']['id'],
s2['subnet']['id'], None)
def test_router_add_interface_ipv6_port_existing_network_returns_400(self):
"""Ensure unique IPv6 router ports per network id.
@ -5304,36 +5304,36 @@ class TestSharedRouterTestCase(L3NatTest, L3NatTestCaseBase,
ext_subnet['subnet']['network_id'])
def test_routers_with_interface_on_same_edge(self):
with self.router() as r1, self.router() as r2,\
self.subnet(cidr='11.0.0.0/24') as s11,\
self.subnet(cidr='12.0.0.0/24') as s12:
self._router_interface_action('add',
r1['router']['id'],
s11['subnet']['id'],
None)
self._router_interface_action('add',
r2['router']['id'],
s12['subnet']['id'],
None)
routers_expected = [r1['router']['id'], r2['router']['id']]
routers_1 = (self.plugin_instance.edge_manager.
get_routers_on_same_edge(
context.get_admin_context(),
r1['router']['id']))
self.assertEqual(set(routers_expected), set(routers_1))
routers_2 = (self.plugin_instance.edge_manager.
get_routers_on_same_edge(
context.get_admin_context(),
r2['router']['id']))
self.assertEqual(set(routers_expected), set(routers_2))
self._router_interface_action('remove',
r1['router']['id'],
s11['subnet']['id'],
None)
self._router_interface_action('remove',
r2['router']['id'],
s12['subnet']['id'],
None)
with self.router() as r1, self.router() as r2,\
self.subnet(cidr='11.0.0.0/24') as s11,\
self.subnet(cidr='12.0.0.0/24') as s12:
self._router_interface_action('add',
r1['router']['id'],
s11['subnet']['id'],
None)
self._router_interface_action('add',
r2['router']['id'],
s12['subnet']['id'],
None)
routers_expected = [r1['router']['id'], r2['router']['id']]
routers_1 = (self.plugin_instance.edge_manager.
get_routers_on_same_edge(
context.get_admin_context(),
r1['router']['id']))
self.assertEqual(set(routers_expected), set(routers_1))
routers_2 = (self.plugin_instance.edge_manager.
get_routers_on_same_edge(
context.get_admin_context(),
r2['router']['id']))
self.assertEqual(set(routers_expected), set(routers_2))
self._router_interface_action('remove',
r1['router']['id'],
s11['subnet']['id'],
None)
self._router_interface_action('remove',
r2['router']['id'],
s12['subnet']['id'],
None)
def test_routers_with_overlap_interfaces(self):
with self.router() as r1, self.router() as r2,\


+ 2
- 2
vmware_nsx/tests/unit/nsx_v/vshield/fake_vcns.py View File

@ -991,8 +991,8 @@ class FakeVcns(object):
_section = self._sections[section_id]
if (_section['name'] != section_name and
section_name in self._sections['names']):
# Theres a section with this name already
headers, response = self._unknown_error()
# Theres a section with this name already
headers, response = self._unknown_error()
else:
# Different Etag every successful update
_section['etag'] = ('Etag-1' if _section['etag'] == 'Etag-0'


+ 23
- 24
vmware_nsx/tests/unit/nsx_v3/test_plugin.py View File

@ -527,9 +527,9 @@ class TestNetworksV2(test_plugin.TestNetworksV2, NsxV3PluginTestCaseMixin):
'port_security_enabled': False}}
with mock_ens, mock_tz, mock_tt,\
mock.patch.object(self.plugin, '_validate_qos_policy_id'):
self.assertRaises(n_exc.InvalidInput,
self.plugin.create_network,
context.get_admin_context(), data)
self.assertRaises(n_exc.InvalidInput,
self.plugin.create_network,
context.get_admin_context(), data)
def test_update_ens_network_with_qos(self):
cfg.CONF.set_override('ens_support', True, 'nsx_v3')
@ -639,7 +639,7 @@ class TestNetworksV2(test_plugin.TestNetworksV2, NsxV3PluginTestCaseMixin):
arg_list=(pnet.NETWORK_TYPE,
pnet.PHYSICAL_NETWORK)) as net:
for k, v in expected:
self.assertEqual(net['network'][k], v)
self.assertEqual(net['network'][k], v)
def test_create_phys_vlan_generate(self):
cfg.CONF.set_override('network_vlan_ranges',
@ -937,26 +937,25 @@ class TestPortsV2(test_plugin.TestPortsV2, NsxV3PluginTestCaseMixin,
def test_fail_create_allowed_address_pairs_over_limit(self):
with self.network() as network,\
self.subnet(network=network, enable_dhcp=True) as s1:
data = {'port': {
'network_id': network['network']['id'],
'tenant_id': self._tenant_id,
'name': 'pair_port',
'admin_state_up': True,
'device_id': 'fake_device',
'device_owner': 'fake_owner',
'fixed_ips': [{'subnet_id': s1['subnet']['id']}]
}
}
count = 1
address_pairs = []
while count < 129:
address_pairs.append({'ip_address': '10.0.0.%s' %
count})
count += 1
data['port']['allowed_address_pairs'] = address_pairs
self.assertRaises(n_exc.InvalidInput,
self.plugin.create_port, self.ctx, data)
self.subnet(network=network, enable_dhcp=True) as s1:
data = {'port': {
'network_id': network['network']['id'],
'tenant_id': self._tenant_id,
'name': 'pair_port',
'admin_state_up': True,
'device_id': 'fake_device',
'device_owner': 'fake_owner',
'fixed_ips': [{'subnet_id': s1['subnet']['id']}]
}}
count = 1
address_pairs = []
while count < 129:
address_pairs.append({'ip_address': '10.0.0.%s' %
count})
count += 1
data['port']['allowed_address_pairs'] = address_pairs
self.assertRaises(n_exc.InvalidInput,
self.plugin.create_port, self.ctx, data)
def test_fail_update_lb_port_with_fixed_ip(self):
with self.network() as network:


+ 8
- 8
vmware_nsx/tests/unit/services/dynamic_routing/test_nsxv_bgp_driver.py View File

@ -297,11 +297,11 @@ class TestNSXvBgpPlugin(test_plugin.NsxVPluginV2TestCase,
self.skipTest('Not supported')
def test_add_bgp_peer_with_bad_id(self):
with self.subnetpool_with_address_scope(
4, prefixes=['8.0.0.0/8']) as sp:
with self.bgp_speaker(sp['ip_version'], 1234) as speaker:
self.assertRaises(ext_bgp.BgpPeerNotFound,
self.bgp_plugin.add_bgp_peer,
self.context,
speaker['id'],
{'bgp_peer_id': 'aaa'})
with self.subnetpool_with_address_scope(
4, prefixes=['8.0.0.0/8']) as sp:
with self.bgp_speaker(sp['ip_version'], 1234) as speaker:
self.assertRaises(ext_bgp.BgpPeerNotFound,
self.bgp_plugin.add_bgp_peer,
self.context,
speaker['id'],
{'bgp_peer_id': 'aaa'})

+ 4
- 4
vmware_nsx/tests/unit/services/qos/test_nsxv3_notification.py View File

@ -271,10 +271,10 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
return_value=_policy),\
mock.patch('neutron.objects.db.api.update_object',
return_value=rule_data):
self.assertRaises(
exceptions.DriverCallError,
self.qos_plugin.update_policy_bandwidth_limit_rule,
self.ctxt, rule.id, _policy.id, rule_data)
self.assertRaises(
exceptions.DriverCallError,
self.qos_plugin.update_policy_bandwidth_limit_rule,
self.ctxt, rule.id, _policy.id, rule_data)
@mock.patch.object(policy_object.QosPolicy, '_reload_rules')
def test_dscp_rule_create_profile(self, *mocks):


+ 15
- 15
vmware_nsx/tests/unit/services/vpnaas/test_nsxv3_vpnaas.py View File

@ -226,21 +226,21 @@ class TestDriverValidation(base.BaseTestCase):
mock.patch.object(self.validator.vpn_plugin,
'get_ipsec_site_connections',
side_effect=mock_get_connections):
ipsec_sitecon = {'id': '1',
'vpnservice_id': '1',
'mtu': 1500,
'peer_address': self.peer_address,
'peer_cidrs': [self.peer_cidr]}
if conn_params:
ipsec_sitecon.update(conn_params)
if success:
self.validator.validate_ipsec_site_connection(
self.context, ipsec_sitecon)
else:
self.assertRaises(
nsx_exc.NsxVpnValidationError,
self.validator.validate_ipsec_site_connection,
self.context, ipsec_sitecon)
ipsec_sitecon = {'id': '1',
'vpnservice_id': '1',
'mtu': 1500,
'peer_address': self.peer_address,
'peer_cidrs': [self.peer_cidr]}
if conn_params:
ipsec_sitecon.update(conn_params)
if success:
self.validator.validate_ipsec_site_connection(
self.context, ipsec_sitecon)
else:
self.assertRaises(
nsx_exc.NsxVpnValidationError,
self.validator.validate_ipsec_site_connection,
self.context, ipsec_sitecon)
def test_dpd_validation(self):
params = {'dpd': {'action': 'hold',


Loading…
Cancel
Save