summaryrefslogtreecommitdiffstats
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.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index d68a96e..f4701a0 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -76,6 +76,19 @@ _V6_IFCFG_MULTIPLE = (_V6_IFCFG + "IPV6ADDR_SECONDARIES=\"2001:abc:b::1/64 " +
_OVS_IFCFG = _BASE_IFCFG + "DEVICETYPE=ovs\nBOOTPROTO=none\n"
+_OVS_IFCFG_TUNNEL = """# This file is autogenerated by os-net-config
+DEVICE=tun0
+ONBOOT=yes
+HOTPLUG=no
+NM_CONTROLLED=no
+PEERDNS=no
+DEVICETYPE=ovs
+TYPE=OVSTunnel
+OVS_BRIDGE=br-ctlplane
+OVS_TUNNEL_TYPE=gre
+OVS_TUNNEL_OPTIONS="options:remote_ip=192.168.1.1"
+"""
+
_OVS_BRIDGE_IFCFG = _BASE_IFCFG + "DEVICETYPE=ovs\n"
@@ -287,6 +300,15 @@ class TestIfcfgNetConfig(base.TestCase):
self.provider.add_interface(interface)
self.assertEqual(_OVS_IFCFG, self.get_interface_config())
+ def test_add_ovs_tunnel(self):
+ interface = objects.OvsTunnel('tun0')
+ interface.type = 'ovs_tunnel'
+ interface.tunnel_type = 'gre'
+ interface.ovs_options = ['options:remote_ip=192.168.1.1']
+ interface.bridge_name = 'br-ctlplane'
+ self.provider.add_interface(interface)
+ self.assertEqual(_OVS_IFCFG_TUNNEL, self.get_interface_config('tun0'))
+
def test_add_interface_with_v4(self):
v4_addr = objects.Address('192.168.1.2/24')
interface = objects.Interface('em1', addresses=[v4_addr])
@@ -389,6 +411,22 @@ class TestIfcfgNetConfig(base.TestCase):
self.assertEqual(_OVS_BRIDGE_STATIC,
self.provider.bridge_data['br-ctlplane'])
+ def test_network_ovs_bridge_with_tunnel(self):
+ interface = objects.OvsTunnel('tun0')
+ interface.type = 'ovs_tunnel'
+ interface.tunnel_type = 'gre'
+ interface.ovs_options = ['options:remote_ip=192.168.1.1']
+ interface.bridge_name = 'br-ctlplane'
+ self.provider.add_interface(interface)
+ v4_addr = objects.Address('192.168.1.2/24')
+ bridge = objects.OvsBridge('br-ctlplane', members=[interface],
+ addresses=[v4_addr])
+ self.provider.add_bridge(bridge)
+ self.provider.add_interface(interface)
+ self.assertEqual(_OVS_IFCFG_TUNNEL, self.get_interface_config('tun0'))
+ self.assertEqual(_OVS_BRIDGE_STATIC,
+ self.provider.bridge_data['br-ctlplane'])
+
def test_network_linux_bridge_static(self):
v4_addr = objects.Address('192.168.1.2/24')
interface = objects.Interface('em1')