aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/tests/test_impl_ifcfg.py
diff options
context:
space:
mode:
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'),