aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/tests/test_impl_ifcfg.py
diff options
context:
space:
mode:
authorSarath Kumar <sarath.kutty@bigswitch.com>2016-07-21 11:14:39 -0700
committerSarath Kumar <sarath.kutty@bigswitch.com>2016-08-02 11:45:46 -0700
commit15974244f6212905540e1daf9ca596c83f510bdd (patch)
tree26bcd9086d93e4501e9387a126725a847ce3f9bb /os_net_config/tests/test_impl_ifcfg.py
parent311df0c3828fe7571079fad9763bca9e2414b51a (diff)
Enable os-net-config to support and configure NFVSwitch
These changes are to generate /etc/sysconf/network-scripts/ifcfg-* and /etc/sysconfig/nfvswitch configuration files for nfvswitch and its interfaces. NFVSwitch is a virtual switch implementation based on DPDK for datacenter workloads with very high throughput needs. Change-Id: If02edb9c4c54c014f67290fe0c34e2fc73cb95bd
Diffstat (limited to 'os_net_config/tests/test_impl_ifcfg.py')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index b8a8402..467db65 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -292,6 +292,34 @@ NETMASK=255.255.255.0
_IVS_CONFIG = ('DAEMON_ARGS=\"--hitless --certificate /etc/ivs '
'--inband-vlan 4092 -u em1 --internal-port=storage5\"')
+_NFVSWITCH_INTERFACE = """# This file is autogenerated by os-net-config
+DEVICE=em1
+ONBOOT=yes
+HOTPLUG=no
+NM_CONTROLLED=no
+PEERDNS=no
+DEVICETYPE=nfvswitch
+NFVSWITCH_BRIDGE=nfvswitch
+BOOTPROTO=none
+"""
+
+_NFVSWITCH_INTERNAL = """# This file is autogenerated by os-net-config
+DEVICE=storage5
+ONBOOT=yes
+HOTPLUG=no
+NM_CONTROLLED=no
+PEERDNS=no
+TYPE=NFVSWITCHIntPort
+DEVICETYPE=nfvswitch
+NFVSWITCH_BRIDGE=nfvswitch
+MTU=1500
+BOOTPROTO=static
+IPADDR=172.16.2.7
+NETMASK=255.255.255.0
+"""
+
+_NFVSWITCH_CONFIG = ('SETUP_ARGS=\" -c 2,3,4,5 -u em1 -m storage5\"')
+
_OVS_IFCFG_PATCH_PORT = """# This file is autogenerated by os-net-config
DEVICE=br-pub-patch
ONBOOT=yes
@@ -553,6 +581,25 @@ class TestIfcfgNetConfig(base.TestCase):
data = self.provider.generate_ivs_config(['em1'], ['storage5'])
self.assertEqual(_IVS_CONFIG, data)
+ def test_network_nfvswitch_with_interfaces_and_internal_interfaces(self):
+ interface = objects.Interface('em1')
+ v4_addr = objects.Address('172.16.2.7/24')
+ nfvswitch_internal = objects.NfvswitchInternal(vlan_id=5,
+ name='storage',
+ addresses=[v4_addr])
+ iface_name = nfvswitch_internal.name
+ bridge = objects.NfvswitchBridge(members=[interface,
+ nfvswitch_internal],
+ cpus="2,3,4,5")
+ self.provider.add_interface(interface)
+ self.provider.add_nfvswitch_internal(nfvswitch_internal)
+ self.provider.add_nfvswitch_bridge(bridge)
+ self.assertEqual(_NFVSWITCH_INTERFACE, self.get_interface_config())
+ self.assertEqual(_NFVSWITCH_INTERNAL,
+ self.provider.nfvswitch_intiface_data[iface_name])
+ data = self.provider.generate_nfvswitch_config(['em1'], ['storage5'])
+ self.assertEqual(_NFVSWITCH_CONFIG, data)
+
def test_add_ib_interface_with_v4_multiple(self):
addresses = [objects.Address('192.168.1.2/24'),
objects.Address('192.168.1.3/32'),