NSX|V3: upgrade NSX version in the unit tests to 2.2

Upgrading the NSX-V3 unittests to use the highest nsx version currently
available (2.2)
Using NSX version 2.1 or higher in the unittests initializes the LB
driver, so we will disable the load balancer driver callbacks since it
shouldn't be called on non-lbaas tests.

Change-Id: Ib450a683fde68fd13ee1a291d496d0d73c9fd671
This commit is contained in:
Adit Sarfaty 2017-11-29 12:59:54 +02:00
parent 5d71e0423c
commit a48f364cff
2 changed files with 11 additions and 1 deletions

View File

@ -288,12 +288,15 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
def test_dhcp_service_with_create_dhcp_subnet_in_vlan_network(self):
# Test if a DHCP-enabled subnet cannot be created in a vlan network.
# on nsx version that does not support it
povidernet_args = {pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'tzuuid',
pnet.SEGMENTATION_ID: 100}
with mock.patch(
'vmware_nsxlib.v3.core_resources.NsxLibTransportZone.'
'get_transport_type', return_value='VLAN'),\
mock.patch.object(self.plugin.nsxlib, 'feature_supported',
return_value=False),\
self.network(providernet_args=povidernet_args,
arg_list=(pnet.NETWORK_TYPE,
pnet.PHYSICAL_NETWORK,

View File

@ -160,7 +160,7 @@ def _mock_nsx_backend_calls():
mock.patch(
"vmware_nsxlib.v3.NsxLib.get_version",
return_value='1.1.0').start()
return_value='2.2.0').start()
mock.patch(
"vmware_nsxlib.v3.load_balancer.Service.get_router_lb_service",
@ -994,6 +994,11 @@ class L3NatTest(test_l3_plugin.L3BaseForIntTests, NsxV3PluginTestCaseMixin,
'is_nsx_version_2_0_0',
new=lambda v: True)
mock_nsx_version.start()
# Make sure the LB callback is not called on router deletion
self.lb_mock = mock.patch(
"vmware_nsx.services.lbaas.nsx_v3.lb_driver_v2."
"EdgeLoadbalancerDriverV2._check_lb_service_on_router")
self.lb_mock.start()
super(L3NatTest, self).setUp(
plugin=plugin, ext_mgr=ext_mgr, service_plugins=service_plugins)
@ -1079,6 +1084,7 @@ class TestL3NatTestCase(L3NatTest,
self.skipTest('not supported')
def test_router_delete_with_lb_service(self):
self.lb_mock.stop()
# Create the LB object - here the delete callback is registered
lb_driver = lb_driver_v2.EdgeLoadbalancerDriverV2()
with self.router() as router:
@ -1090,6 +1096,7 @@ class TestL3NatTestCase(L3NatTest,
router['router']['id'])
# Unregister callback
lb_driver._unsubscribe_router_delete_callback()
self.lb_mock.start()
def test_multiple_subnets_on_different_routers(self):
with self.network() as network: