NSX|P: Handle update of dhcp port
Since dhcp port is created as neutron port, it is automatically updated by neutron when subnet is added/deleted. This patch fixes regular port flows in policy plugin with regard to dhcp port: dhcp port is non-policy entity for now and should not be considered backend port on policy level. Change-Id: I9c0849f6f288cafac37d599e240975acf38b136c
This commit is contained in:
parent
d753ec6945
commit
9bdbc90be1
|
@ -2478,7 +2478,7 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||
# Check if there is only one DHCP-enabled subnet in the network.
|
||||
count = 0
|
||||
for subnet in network.subnets:
|
||||
if subnet.enable_dhcp:
|
||||
if subnet.enable_dhcp and subnet.ip_version == 4:
|
||||
count += 1
|
||||
if count > 1:
|
||||
return False
|
||||
|
|
|
@ -1051,8 +1051,11 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||
|
||||
device_owner = port_data.get('device_owner')
|
||||
is_router_interface = (device_owner == l3_db.DEVICE_OWNER_ROUTER_INTF)
|
||||
is_dhcp_port = (device_owner == const.DEVICE_OWNER_DHCP)
|
||||
|
||||
if is_external_net or is_router_interface:
|
||||
if is_external_net or is_router_interface or is_dhcp_port:
|
||||
# DHCP is handled on MP level so far
|
||||
# Router is connected automatically in policy
|
||||
return False
|
||||
|
||||
return True
|
||||
|
|
|
@ -1557,6 +1557,49 @@ class NsxPTestL3NatTestCase(NsxPTestL3NatTest,
|
|||
r['router']['id'],
|
||||
ipv6_ndra_profile_id='default')
|
||||
|
||||
def test_slaac_profile_dual_stack(self):
|
||||
with mock.patch("vmware_nsxlib.v3.policy.core_resources."
|
||||
"NsxPolicyTier1Api.update") as t1_update:
|
||||
|
||||
with self.router() as r,\
|
||||
self.network() as n:
|
||||
with self.subnet(network=n, cidr='2.3.3.0/24') as s1,\
|
||||
self.subnet(network=n, cidr='fd10::0/64',
|
||||
gateway_ip='fd10::1', ip_version=6,
|
||||
ipv6_address_mode='slaac',
|
||||
ipv6_ra_mode='slaac') as s2:
|
||||
|
||||
self._router_interface_action('add',
|
||||
r['router']['id'],
|
||||
s1['subnet']['id'],
|
||||
None)
|
||||
self._router_interface_action('add',
|
||||
r['router']['id'],
|
||||
s2['subnet']['id'],
|
||||
None)
|
||||
# Validate T1 was updated with slaac profile
|
||||
t1_update.assert_called_with(
|
||||
r['router']['id'],
|
||||
ipv6_ndra_profile_id='neutron-slaac-profile')
|
||||
|
||||
# Remove non-slaac subnets first
|
||||
self._router_interface_action('remove',
|
||||
r['router']['id'],
|
||||
s1['subnet']['id'],
|
||||
None)
|
||||
self._router_interface_action('remove',
|
||||
r['router']['id'],
|
||||
s2['subnet']['id'],
|
||||
None)
|
||||
|
||||
# Validate T1 was updated with default profile
|
||||
t1_update.assert_called_with(
|
||||
r['router']['id'],
|
||||
ipv6_ndra_profile_id='default')
|
||||
|
||||
self._delete('subnets', s1['subnet']['id'])
|
||||
self._delete('subnets', s2['subnet']['id'])
|
||||
|
||||
def test_slaac_profile_multi_net(self):
|
||||
with mock.patch("vmware_nsxlib.v3.policy.core_resources."
|
||||
"NsxPolicyTier1Api.update") as t1_update:
|
||||
|
|
Loading…
Reference in New Issue