diff options
author | James Slagle <jslagle@redhat.com> | 2016-04-11 12:19:51 -0400 |
---|---|---|
committer | James Slagle <jslagle@redhat.com> | 2016-04-13 12:32:22 -0400 |
commit | d325a1a2f8d7c815cbaa016858db053412201b9d (patch) | |
tree | 35033588fa76d32c260076229a4f5f22907406ad /os_net_config/tests/test_impl_ifcfg.py | |
parent | 1134091ff1a6a0fc9f8dc6fe4d70bf0274728fdd (diff) |
Add support for OVS tunnels
Adds support for configuring OVS Tunnels via os-net-config. Tunnels are
configured as members of ovs_bridge's where the type is set to
ovs_tunnel. The object also supports setting OVS extra and options so
that additional tunnel data can be defined, such as remote_ip.
Change-Id: I31ac1cbe8a13247a1529c0f99a0aea5807888844
Diffstat (limited to 'os_net_config/tests/test_impl_ifcfg.py')
-rw-r--r-- | os_net_config/tests/test_impl_ifcfg.py | 38 |
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') |