Removing port dhcp binding when detaching interface
Change-Id: Ie6d41ad0dd3a26b22ecb28cbb324f47a9eafed6b
This commit is contained in:
parent
b41632c936
commit
9b46393903
@ -908,7 +908,7 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
||||
vnic_id = self._get_port_vnic_id(vnic_idx, device_id)
|
||||
curr_sgids = original_port.get(ext_sg.SECURITYGROUPS)
|
||||
if ret_port['device_id'] != device_id:
|
||||
# Update change device_id - remove port-vnic assosiation and
|
||||
# Update change device_id - remove port-vnic association and
|
||||
# delete security-groups memberships for the vnic
|
||||
self._delete_security_groups_port_mapping(
|
||||
context.session, vnic_id, curr_sgids)
|
||||
@ -916,6 +916,7 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
||||
self._remove_vnic_from_spoofguard_policy(
|
||||
context.session, original_port['network_id'], vnic_id)
|
||||
self._delete_port_vnic_index_mapping(context, id)
|
||||
self._delete_dhcp_static_binding(context, original_port)
|
||||
else:
|
||||
# Update vnic with the newest approved IP addresses
|
||||
if has_port_security and updates_fixed_ips:
|
||||
|
@ -439,7 +439,8 @@ class TestPortsV2(NsxVPluginV2TestCase,
|
||||
res = self.deserialize('json', req.get_response(self.api))
|
||||
return res
|
||||
|
||||
def test_update_port_index(self):
|
||||
@mock.patch.object(edge_utils, 'delete_dhcp_binding')
|
||||
def test_update_port_index(self, delete_dhcp_binding):
|
||||
q_context = context.Context('', 'tenant_1')
|
||||
device_id = _uuid()
|
||||
with self.subnet() as subnet:
|
||||
@ -468,6 +469,7 @@ class TestPortsV2(NsxVPluginV2TestCase,
|
||||
vnic_id = '%s.%03d' % (device_id, vnic_index)
|
||||
(self.fc2.inactivate_vnic_assigned_addresses.
|
||||
assert_called_once_with(policy_id, vnic_id))
|
||||
self.assertTrue(delete_dhcp_binding.called)
|
||||
|
||||
def test_update_port_with_compute_device_owner(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user