Revert "Nit: Change from dict to object notation"

This reverts commit feec91cec1. Turns out
this wasn't okay, sub_ports property on Trunk objects is a list of
dictionaries.

This also fixes unit tests to account for that.

Change-Id: I17f217a6f2bfc833019ba407c248564e74b663d2
This commit is contained in:
Michał Dulko 2023-03-28 15:39:34 +02:00
parent 6b4992e585
commit 9cd15b6d37
2 changed files with 2 additions and 2 deletions

View File

@ -306,6 +306,6 @@ class NestedVlanPodVIFDriver(nested_vif.NestedPodVIFDriver):
os_net = clients.get_network_client() os_net = clients.get_network_client()
trunk = os_net.get_trunk(trunk_id) trunk = os_net.get_trunk(trunk_id)
for port in trunk.sub_ports: for port in trunk.sub_ports:
vlan_ids.add(port.segmentation_id) vlan_ids.add(port['segmentation_id'])
return vlan_ids return vlan_ids

View File

@ -644,7 +644,7 @@ class TestNestedVlanPodVIFDriver(test_base.TestCase):
trunk_id = mock.sentinel.trunk_id trunk_id = mock.sentinel.trunk_id
vlan_ids.add('100') vlan_ids.add('100')
port = os_port.Port(segmentation_id='100') port = {"segmentation_id": '100'} # Trunk.sub_ports is a list of dicts
trunk_obj = os_trunk.Trunk(sub_ports=[port]) trunk_obj = os_trunk.Trunk(sub_ports=[port])
os_net.get_trunk.return_value = trunk_obj os_net.get_trunk.return_value = trunk_obj
self.assertEqual(vlan_ids, self.assertEqual(vlan_ids,