diff --git a/ovn_bgp_agent/config.py b/ovn_bgp_agent/config.py index 63a04f65..d704ecb0 100644 --- a/ovn_bgp_agent/config.py +++ b/ovn_bgp_agent/config.py @@ -231,13 +231,13 @@ local_ovn_cluster_opts = [ cfg.ListOpt('provider_networks_pool_prefixes', default=['192.168.0.0/16'], help='List of prefixes for provider networks'), - cfg.ListOpt('bgp_chassis_id', - default='bgp', - help='The chassis_id used for the ovn-controller instance' - ' related to the node-local OVN instance. Used as a' - ' suffix for getting instance-specific options' - ' from OVSDB. This option has effect only when the OVN' - ' NB driver is used.'), + cfg.StrOpt('bgp_chassis_id', + default='bgp', + help='The chassis_id used for the ovn-controller instance' + ' related to the node-local OVN instance. Used as a' + ' suffix for getting instance-specific options' + ' from OVSDB. This option has effect only when the OVN' + ' NB driver is used.'), ] CONF = cfg.CONF diff --git a/ovn_bgp_agent/tests/unit/drivers/openstack/utils/test_ovs.py b/ovn_bgp_agent/tests/unit/drivers/openstack/utils/test_ovs.py index 1272d6a4..8e603fda 100644 --- a/ovn_bgp_agent/tests/unit/drivers/openstack/utils/test_ovs.py +++ b/ovn_bgp_agent/tests/unit/drivers/openstack/utils/test_ovs.py @@ -15,6 +15,7 @@ from unittest import mock +from oslo_config import cfg from ovsdbapp.schema.open_vswitch import impl_idl as idl_ovs from ovn_bgp_agent import constants @@ -24,6 +25,9 @@ from ovn_bgp_agent.tests import base as test_base from ovn_bgp_agent.utils import linux_net +CONF = cfg.CONF + + class TestOVS(test_base.TestCase): def setUp(self): @@ -484,7 +488,18 @@ class TestOvsIdl(test_base.TestCase): 'Open_vSwitch', '.', 'external_ids') def test_get_ovn_bridge_mappings_bridge(self): - bridge = 'bgp' + bridge = 'bgp1' + self.execute_ref.return_value = { + 'ovn-bridge-mappings-bgp1': + 'net0:bridge0,net1:bridge1, net2:bridge2'} + ret = self.ovs_idl.get_ovn_bridge_mappings(bridge=bridge) + self.assertEqual(['net0:bridge0', 'net1:bridge1', 'net2:bridge2'], ret) + self.ovs_idl.idl_ovs.db_get.assert_called_once_with( + 'Open_vSwitch', '.', 'external_ids') + + def test_get_ovn_bridge_mappings_default_bridge(self): + # bgp_chassis_id defaults to 'bgp' + bridge = CONF.local_ovn_cluster.bgp_chassis_id self.execute_ref.return_value = { 'ovn-bridge-mappings-bgp': 'net0:bridge0,net1:bridge1, net2:bridge2'}