Browse Source

Set OVSBOOTPROTO to dhcp when using dhcpv6 with OVS

In order for DHCPv6 to work with OVS, OVSBOOTPROTO must be set to dhcp.

Change-Id: Ifb22c2398f13725bc6341974d0841da197659fe8
Closes-Bug: 1883967
(cherry picked from commit 247f54d71e2739649ce7fefe5fa4fc5b1dc1c5cc)
changes/58/736658/1
Bob Fournier 3 weeks ago
parent
commit
eb9942a2b2
2 changed files with 26 additions and 3 deletions
  1. +3
    -3
      os_net_config/impl_ifcfg.py
  2. +23
    -0
      os_net_config/tests/test_impl_ifcfg.py

+ 3
- 3
os_net_config/impl_ifcfg.py View File

@@ -464,7 +464,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
if isinstance(base_opt, objects.OvsBridge):
data += "DEVICETYPE=ovs\n"
data += "TYPE=OVSBridge\n"
if base_opt.use_dhcp:
if base_opt.use_dhcp or base_opt.use_dhcpv6:
data += "OVSBOOTPROTO=dhcp\n"
if base_opt.members:
members = [member.name for member in base_opt.members]
@@ -481,7 +481,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
elif isinstance(base_opt, objects.OvsUserBridge):
data += "DEVICETYPE=ovs\n"
data += "TYPE=OVSUserBridge\n"
if base_opt.use_dhcp:
if base_opt.use_dhcp or base_opt.use_dhcpv6:
data += "OVSBOOTPROTO=dhcp\n"
if base_opt.members:
members = [member.name for member in base_opt.members]
@@ -497,7 +497,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
self.bond_primary_ifaces[base_opt.name] = primary_name
data += "DEVICETYPE=ovs\n"
data += "TYPE=OVSBond\n"
if base_opt.use_dhcp:
if base_opt.use_dhcp or base_opt.use_dhcpv6:
data += "OVSBOOTPROTO=dhcp\n"
if base_opt.members:
members = [member.name for member in base_opt.members]


+ 23
- 0
os_net_config/tests/test_impl_ifcfg.py View File

@@ -283,6 +283,19 @@ OVSBOOTPROTO=dhcp
OVSDHCPINTERFACES="em1"
"""

_OVS_BRIDGE_DHCPV6 = """# This file is autogenerated by os-net-config
DEVICE=br-ctlplane
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
PEERDNS=no
DEVICETYPE=ovs
TYPE=OVSBridge
OVSBOOTPROTO=dhcp
IPV6INIT=yes
DHCPV6C=yes
"""

_NM_CONTROLLED_INTERFACE = _BASE_IFCFG_NETWORKMANAGER + """MASTER=bond1
SLAVE=yes
BOOTPROTO=none
@@ -834,6 +847,16 @@ class TestIfcfgNetConfig(base.TestCase):
self.assertEqual(_OVS_BRIDGE_DHCP,
self.provider.bridge_data['br-ctlplane'])

def test_network_ovs_bridge_with_dhcpv6(self):
interface = objects.Interface('em1')
bridge = objects.OvsBridge('br-ctlplane', use_dhcpv6=True,
members=[interface])
self.provider.add_interface(interface)
self.provider.add_bridge(bridge)
self.assertEqual(_OVS_INTERFACE, self.get_interface_config())
self.assertEqual(_OVS_BRIDGE_DHCPV6,
self.provider.bridge_data['br-ctlplane'])

def test_network_ovs_bridge_with_standalone_fail_mode(self):
interface = objects.Interface('em1')
bridge = objects.OvsBridge('br-ctlplane', use_dhcp=True,


Loading…
Cancel
Save