diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 8ddfcf0693..f3373b2553 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -1467,7 +1467,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin, context, subnet) def _rollback(subnet): - if subnet['enable_dhcp'] and subnet['id'] in _subnet_dhcp_info: + if (subnet and subnet['enable_dhcp'] and + subnet['id'] in _subnet_dhcp_info): self._rollback_subnet(subnet, _subnet_dhcp_info[subnet['id']]) del _subnet_dhcp_info[subnet['id']] diff --git a/vmware_nsx/tests/unit/nsx_v/test_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py index 754ac11da8..75dfaaa5ba 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -1771,16 +1771,28 @@ class TestSubnetsV2(NsxVPluginV2TestCase, def test_create_subnet_dhcpv6_stateless_with_ip_already_allocated(self): self.skipTest('No DHCP v6 Support yet') + def test_create_subnets_bulk_native_ipv6(self): + self.skipTest('No DHCP v6 Support yet') + def _create_subnet_bulk(self, fmt, number, net_id, name, ip_version=4, **kwargs): base_data = {'subnet': {'network_id': net_id, 'ip_version': ip_version, 'enable_dhcp': False, 'tenant_id': self._tenant_id}} + + if 'ipv6_mode' in kwargs: + base_data['subnet']['ipv6_ra_mode'] = kwargs['ipv6_mode'] + base_data['subnet']['ipv6_address_mode'] = kwargs['ipv6_mode'] + # auto-generate cidrs as they should not overlap + base_cidr = "10.0.%s.0/24" + if ip_version == constants.IP_VERSION_6: + base_cidr = "fd%s::/64" + # auto-generate cidrs as they should not overlap overrides = dict((k, v) for (k, v) in zip(range(number), - [{'cidr': "10.0.%s.0/24" % num} + [{'cidr': base_cidr % num} for num in range(number)])) kwargs.update({'override': overrides}) return self._create_bulk(fmt, number, 'subnet', base_data, **kwargs) @@ -1884,6 +1896,9 @@ class TestSubnetsV2(NsxVPluginV2TestCase, def test_create_subnet_ipv6_slaac_with_port_not_found(self): self.skipTest('Currently not supported') + def test_bulk_create_subnet_ipv6_auto_addr_with_port_on_network(self): + self.skipTest('Currently not supported') + def test_create_subnet_ipv6_gw_values(self): # This test should fail with response code 400 as IPv6 subnets with # DHCP are not supported by this plugin @@ -1962,6 +1977,9 @@ class TestSubnetPoolsV2(NsxVPluginV2TestCase, test_plugin.TestSubnetsV2): def test_create_subnet_ipv6_slaac_with_port_not_found(self): self.skipTest('Not supported') + def test_bulk_create_subnet_ipv6_auto_addr_with_port_on_network(self): + self.skipTest('Currently not supported') + def test_create_subnet_ipv6_slaac_with_dhcp_port_on_network(self): self.skipTest('Not supported') @@ -2013,6 +2031,9 @@ class TestSubnetPoolsV2(NsxVPluginV2TestCase, test_plugin.TestSubnetsV2): def test_create_subnet_only_ip_version_v6_old(self): self.skipTest('Currently not supported') + def test_create_subnets_bulk_native_ipv6(self): + self.skipTest('No DHCP v6 Support yet') + class TestBasicGet(test_plugin.TestBasicGet, NsxVPluginV2TestCase): pass