diff options
Diffstat (limited to 'os_net_config/tests')
-rw-r--r-- | os_net_config/tests/test_cli.py | 17 | ||||
-rw-r--r-- | os_net_config/tests/test_impl_ifcfg.py | 30 |
2 files changed, 47 insertions, 0 deletions
diff --git a/os_net_config/tests/test_cli.py b/os_net_config/tests/test_cli.py index e598dcb..939b12e 100644 --- a/os_net_config/tests/test_cli.py +++ b/os_net_config/tests/test_cli.py @@ -164,3 +164,20 @@ class TestCli(base.TestCase): for dev in sanity_devices: self.assertIn(dev, stdout_yaml) self.assertEqual(stdout_yaml, stdout_json) + + def test_ovs_dpdk_noop_output(self): + ivs_yaml = os.path.join(SAMPLE_BASE, 'ovs_dpdk.yaml') + ivs_json = os.path.join(SAMPLE_BASE, 'ovs_dpdk.json') + stdout_yaml, stderr = self.run_cli('ARG0 --provider=ifcfg --noop ' + '-c %s' % ivs_yaml) + self.assertEqual('', stderr) + stdout_json, stderr = self.run_cli('ARG0 --provider=ifcfg --noop ' + '-c %s' % ivs_json) + self.assertEqual('', stderr) + sanity_devices = ['DEVICE=br-link', + 'TYPE=OVSUserBridge', + 'DEVICE=dpdk0', + 'TYPE=OVSDPDKPort'] + for dev in sanity_devices: + self.assertIn(dev, stdout_yaml) + self.assertEqual(stdout_yaml, stdout_json) diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py index 9b24717..ad27d83 100644 --- a/os_net_config/tests/test_impl_ifcfg.py +++ b/os_net_config/tests/test_impl_ifcfg.py @@ -758,6 +758,36 @@ DNS2=5.6.7.8 """ self.assertEqual(em1_config, self.get_interface_config('em1')) + def test_network_ovs_dpdk_bridge_and_port(self): + interface = objects.Interface(name='eth1') + dpdk_port = objects.OvsDpdkPort(name='dpdk0', members=[interface]) + bridge = objects.OvsUserBridge('br-link', members=[dpdk_port]) + self.provider.add_interface(interface) + self.provider.add_interface(dpdk_port) + self.provider.add_bridge(bridge) + br_link_config = """# This file is autogenerated by os-net-config +DEVICE=br-link +ONBOOT=yes +HOTPLUG=no +NM_CONTROLLED=no +PEERDNS=no +DEVICETYPE=ovs +TYPE=OVSUserBridge +""" + dpdk0_config = """# This file is autogenerated by os-net-config +DEVICE=dpdk0 +ONBOOT=yes +HOTPLUG=no +NM_CONTROLLED=no +PEERDNS=no +DEVICETYPE=ovs +TYPE=OVSDPDKPort +OVS_BRIDGE=br-link +""" + self.assertEqual(br_link_config, + self.provider.bridge_data['br-link']) + self.assertEqual(dpdk0_config, self.get_interface_config('dpdk0')) + class TestIfcfgNetConfigApply(base.TestCase): |