Fix port id vs uuid in ValidateInterfacesHook

follow-up to Icd3de82877c6a53d32b4c9fd3e500d3cd9d7fb17

Use id attribute instead of uuid. This caused an exception when an unexpected
port was being deleted.

Story: 2008698
Task: 42007
Change-Id: Ib4978f5e3e4f1b64faa1bfae3cdcf46199bb2f21
(cherry picked from commit 22853a74b5)
This commit is contained in:
Francois Rigault 2021-03-06 16:21:03 +01:00 committed by Dmitry Tantsur
parent abe6eb4754
commit 6a668c65aa
2 changed files with 2 additions and 2 deletions

View File

@ -294,7 +294,7 @@ class ValidateInterfacesHook(base.ProcessingHook):
if port.address not in expected_macs: if port.address not in expected_macs:
LOG.info("Deleting port %(port)s as its MAC %(mac)s is " LOG.info("Deleting port %(port)s as its MAC %(mac)s is "
"not in expected MAC list %(expected)s", "not in expected MAC list %(expected)s",
{'port': port.uuid, {'port': port.id,
'mac': port.address, 'mac': port.address,
'expected': list(sorted(expected_macs))}, 'expected': list(sorted(expected_macs))},
node_info=node_info, data=introspection_data) node_info=node_info, data=introspection_data)

View File

@ -256,7 +256,7 @@ class TestValidateInterfacesHookBeforeUpdateDeletion(test_base.NodeTest):
self.hook = std_plugins.ValidateInterfacesHook() self.hook = std_plugins.ValidateInterfacesHook()
self.interfaces_to_create = sorted(self.valid_interfaces.values(), self.interfaces_to_create = sorted(self.valid_interfaces.values(),
key=lambda i: i['mac']) key=lambda i: i['mac'])
self.existing_ports = [mock.Mock(spec=['address', 'uuid'], self.existing_ports = [mock.Mock(spec=['address', 'id'],
address=a) address=a)
for a in (self.macs[1], for a in (self.macs[1],
'44:44:44:44:44:44')] '44:44:44:44:44:44')]