Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
allow vhost0 to pass list of members
Browse files Browse the repository at this point in the history
- in case of L3MH Contrail feature for kernel mode
BIND_INT might be a list

Change-Id: I2c44d86822b7bf74a10e7e7e81abcb22b5f639ae
(cherry picked from commit 178564d)
  • Loading branch information
alexey-mr committed Aug 26, 2021
1 parent 2e29b5a commit 69699cd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
6 changes: 2 additions & 4 deletions os_net_config/impl_ifcfg.py
Expand Up @@ -1048,13 +1048,11 @@ def add_contrail_vrouter(self, contrail_vrouter):
"""
logger.info('adding contrail_vrouter interface: %s'
% contrail_vrouter.name)
# Contrail vrouter will have the only member (of type interface,
# vlan or linux_bond)
ifname = contrail_vrouter.members[0].name
ifnames = ",".join([m.name for m in contrail_vrouter.members])
data = self._add_common(contrail_vrouter)
data += "DEVICETYPE=vhost\n"
data += "TYPE=kernel_mode\n"
data += "BIND_INT=%s\n" % ifname
data += "BIND_INT=%s\n" % ifnames
logger.debug('contrail data: %s' % data)
self.interface_data[contrail_vrouter.name] = data
if contrail_vrouter.routes:
Expand Down
1 change: 0 additions & 1 deletion os_net_config/schema.yaml
Expand Up @@ -985,7 +985,6 @@ definitions:
- $ref: "#/definitions/vlan"
- $ref: "#/definitions/linux_bond"
minItems: 1
maxItems: 1
# common options:
use_dhcp:
$ref: "#/definitions/bool_or_param"
Expand Down
23 changes: 23 additions & 0 deletions os_net_config/tests/test_impl_ifcfg.py
Expand Up @@ -524,6 +524,18 @@
BIND_INT=em3
"""

_CONTRAIL_VROUTER_IFACE_L3MH = """# This file is autogenerated by os-net-config
DEVICE=vhost0
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
PEERDNS=no
BOOTPROTO=none
DEVICETYPE=vhost
TYPE=kernel_mode
BIND_INT=em3,em4
"""

_CONTRAIL_VROUTER_VLAN_IFACE = """# This file is autogenerated by os-net-config
DEVICE=vhost0
ONBOOT=yes
Expand Down Expand Up @@ -1025,6 +1037,17 @@ def test_add_contrail_vrouter(self):
self.provider.interface_data['vhost0'])
self.assertEqual('', self.get_route_config('vhost0'))

def test_add_contrail_vrouter_l3mh(self):
interface1 = objects.Interface('em3')
interface2 = objects.Interface('em4')
cvi = objects.ContrailVrouter('vhost0',
members=[interface1, interface2],)
self.provider.add_contrail_vrouter(cvi)
self.assertEqual(
_CONTRAIL_VROUTER_IFACE_L3MH,
self.provider.interface_data['vhost0'])
self.assertEqual('', self.get_route_config('vhost0'))

def test_add_contrail_vrouter_vlan(self):
addresses = [objects.Address('10.0.0.30/24')]
interface1 = objects.Interface('vlan100')
Expand Down

0 comments on commit 69699cd

Please sign in to comment.