summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-01-11 01:53:37 +0000
committerGerrit Code Review <review@openstack.org>2022-01-11 01:53:37 +0000
commitcf18c3e2e55a8a2d41b040c25a62279fb87e7457 (patch)
tree62273a46f8f8bf2312b7ec6c406135a63db79f2b
parente051bc6e11986f239bc13732aaf675309ba1fb6a (diff)
parentcff314f92e158c8142dcd238a072fe2a7ca04d87 (diff)
downloadneutron-17.3.0.tar.gz
Merge "[stable only][ovn]Update get datapath id to network from Port_Binding" into stable/victoria17.3.0
-rw-r--r--neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/impl_idl_ovn.py5
-rw-r--r--neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_impl_idl.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/impl_idl_ovn.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/impl_idl_ovn.py
index c0673864c4..822a3b7d6d 100644
--- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/impl_idl_ovn.py
+++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/impl_idl_ovn.py
@@ -935,6 +935,7 @@ class OvsdbSbOvnIdl(sb_impl_idl.OvnSbApiIdlImpl, Backend):
def get_logical_port_chassis_and_datapath(self, name):
for port in self._tables['Port_Binding'].rows.values():
if port.logical_port == name:
- datapath = str(port.datapath.uuid)
+ network_id = utils.get_network_name_from_datapath(
+ port.datapath)
chassis = port.chassis[0].name if port.chassis else None
- return chassis, datapath
+ return chassis, network_id
diff --git a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_impl_idl.py b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_impl_idl.py
index ad3cbe9f32..18b35232ed 100644
--- a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_impl_idl.py
+++ b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_impl_idl.py
@@ -158,8 +158,10 @@ class TestSbApi(BaseOvnIdlTest):
chassis, switch, port, binding = self._add_switch_port(
self.data['chassis'][0]['name'])
self.api.lsp_bind(port.name, chassis.name).execute(check_error=True)
+ network_id = binding.datapath.external_ids['name'].replace(
+ 'neutron-', '')
self.assertEqual(
- (chassis.name, str(binding.datapath.uuid)),
+ (chassis.name, network_id),
self.api.get_logical_port_chassis_and_datapath(port.name))