Merge "Add mac-size-table to all OVS bridges"

This commit is contained in:
Zuul 2022-05-31 21:26:25 +00:00 committed by Gerrit Code Review
commit 12a27f35c7
2 changed files with 20 additions and 8 deletions

View File

@ -31,6 +31,7 @@ logger = logging.getLogger(__name__)
# Import the raw NetConfig object so we can call its methods
netconfig = os_net_config.NetConfig()
MAC_TABLE_SIZE = 50000
_ROUTE_TABLE_DEFAULT = """# reserved values
#
255\tlocal
@ -472,6 +473,8 @@ class IfcfgNetConfig(os_net_config.NetConfig):
self.member_names[base_opt.name] = members
if base_opt.use_dhcp:
data += ("OVSDHCPINTERFACES=\"%s\"\n" % " ".join(members))
ovs_extra.append("set bridge %s other-config:mac-table-size=%d" %
(base_opt.name, MAC_TABLE_SIZE))
if base_opt.primary_interface_name:
mac = common.interface_mac(base_opt.primary_interface_name)
ovs_extra.append("set bridge %s other-config:hwaddr=%s" %

View File

@ -281,6 +281,7 @@ DEVICETYPE=ovs
TYPE=OVSBridge
OVSBOOTPROTO=dhcp
OVSDHCPINTERFACES="em1"
OVS_EXTRA="set bridge br-ctlplane other-config:mac-table-size=50000"
"""
_OVS_BRIDGE_DHCPV6 = """# This file is autogenerated by os-net-config
@ -294,6 +295,7 @@ TYPE=OVSBridge
OVSBOOTPROTO=dhcp
IPV6INIT=yes
DHCPV6C=yes
OVS_EXTRA="set bridge br-ctlplane other-config:mac-table-size=50000"
"""
_NM_CONTROLLED_INTERFACE = _BASE_IFCFG_NETWORKMANAGER + """MASTER=bond1
@ -309,12 +311,12 @@ NM_CONTROLLED=yes
PEERDNS=no
"""
_OVS_BRIDGE_DHCP_STANDALONE = _OVS_BRIDGE_DHCP + (
"OVS_EXTRA=\"set bridge br-ctlplane fail_mode=standalone "
_OVS_BRIDGE_DHCP_STANDALONE = _OVS_BRIDGE_DHCP[:-2] + (
" -- set bridge br-ctlplane fail_mode=standalone "
"-- del-controller br-ctlplane\"\n")
_OVS_BRIDGE_DHCP_SECURE = _OVS_BRIDGE_DHCP + \
"OVS_EXTRA=\"set bridge br-ctlplane fail_mode=secure\"\n"
_OVS_BRIDGE_DHCP_SECURE = _OVS_BRIDGE_DHCP[:-2] + \
" -- set bridge br-ctlplane fail_mode=secure\"\n"
_LINUX_BRIDGE_DHCP = """# This file is autogenerated by os-net-config
@ -338,6 +340,7 @@ TYPE=OVSBridge
BOOTPROTO=static
IPADDR=192.168.1.2
NETMASK=255.255.255.0
OVS_EXTRA="set bridge br-ctlplane other-config:mac-table-size=50000"
"""
_LINUX_BRIDGE_STATIC = """# This file is autogenerated by os-net-config
@ -353,12 +356,12 @@ IPADDR=192.168.1.2
NETMASK=255.255.255.0
"""
_OVS_BRIDGE_DHCP_PRIMARY_INTERFACE = _OVS_BRIDGE_DHCP + \
"OVS_EXTRA=\"set bridge br-ctlplane other-config:hwaddr=a1:b2:c3:d4:e5\"\n"
_OVS_BRIDGE_DHCP_PRIMARY_INTERFACE = _OVS_BRIDGE_DHCP[:-2] + \
" -- set bridge br-ctlplane other-config:hwaddr=a1:b2:c3:d4:e5\"\n"
_OVS_BRIDGE_DHCP_OVS_EXTRA = _OVS_BRIDGE_DHCP + \
"OVS_EXTRA=\"set bridge br-ctlplane other-config:hwaddr=a1:b2:c3:d4:e5" + \
_OVS_BRIDGE_DHCP_OVS_EXTRA = _OVS_BRIDGE_DHCP[:-2] + \
" -- set bridge br-ctlplane other-config:hwaddr=a1:b2:c3:d4:e5" + \
" -- br-set-external-id br-ctlplane bridge-id br-ctlplane\"\n"
@ -958,6 +961,12 @@ class TestIfcfgNetConfig(base.TestCase):
self.assertEqual(_LINUX_BRIDGE_STATIC,
self.provider.bridge_data['br-ctlplane'])
def test_network_ovs_bridge_has_mac_table_size(self):
bridge = objects.OvsBridge('br-test')
self.provider.add_bridge(bridge)
self.assertIn("set bridge br-test other-config:mac-table-size=50000",
self.provider.bridge_data['br-test'])
def test_network_ovs_bridge_with_dhcp_primary_interface(self):
def test_interface_mac(name):
return "a1:b2:c3:d4:e5"