aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/tests
diff options
context:
space:
mode:
authorJames Slagle <jslagle@redhat.com>2016-06-14 11:40:55 -0400
committerJames Slagle <jslagle@redhat.com>2016-06-14 17:50:56 -0400
commit789bd1ea089314b49db02ddd517809a82c380cf1 (patch)
tree828cbac57e63232bedb2910609835a5f3eed0ef9 /os_net_config/tests
parent4d88e7f349f725704c707093c8b44d7409eae481 (diff)
Add support for OVS patch ports
OVS patch ports are used to connect two OVS bridges so traffic can flow between them. This is generally useful for various cases. Specifically it could be used to connect the bridges created by TripleO networking configurations (br-ex, etc) to the bridge created by the multinode networking setup in infra's nodepool (br_pub). This allows the nodes in a multinode deployment to have connectivity across private subnets where such traffic is typically firewalled off in public clouds. Change-Id: I11404106cb3f53734f6fc9a35c22f905a0770245
Diffstat (limited to 'os_net_config/tests')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py21
-rw-r--r--os_net_config/tests/test_objects.py16
2 files changed, 37 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index f4701a0..71ad9ae 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -258,6 +258,18 @@ NETMASK=255.255.255.0
_IVS_CONFIG = ('DAEMON_ARGS=\"--hitless --certificate /etc/ivs '
'--inband-vlan 4092 -u em1 --internal-port=storage5\"')
+_OVS_IFCFG_PATCH_PORT = """# This file is autogenerated by os-net-config
+DEVICE=br-pub-patch
+ONBOOT=yes
+HOTPLUG=no
+NM_CONTROLLED=no
+PEERDNS=no
+DEVICETYPE=ovs
+TYPE=OVSPatchPort
+OVS_BRIDGE=br-ex
+OVS_PATCH_PEER=br-ex-patch
+"""
+
class TestIfcfgNetConfig(base.TestCase):
@@ -309,6 +321,15 @@ class TestIfcfgNetConfig(base.TestCase):
self.provider.add_interface(interface)
self.assertEqual(_OVS_IFCFG_TUNNEL, self.get_interface_config('tun0'))
+ def test_add_ovs_patch_port(self):
+ patch_port = objects.OvsPatchPort("br-pub-patch")
+ patch_port.type = 'ovs_patch_port'
+ patch_port.bridge_name = 'br-ex'
+ patch_port.peer = 'br-ex-patch'
+ self.provider.add_interface(patch_port)
+ self.assertEqual(_OVS_IFCFG_PATCH_PORT,
+ self.get_interface_config('br-pub-patch'))
+
def test_add_interface_with_v4(self):
v4_addr = objects.Address('192.168.1.2/24')
interface = objects.Interface('em1', addresses=[v4_addr])
diff --git a/os_net_config/tests/test_objects.py b/os_net_config/tests/test_objects.py
index 3367df0..7d8d3b3 100644
--- a/os_net_config/tests/test_objects.py
+++ b/os_net_config/tests/test_objects.py
@@ -548,6 +548,22 @@ class TestOvsTunnel(base.TestCase):
tun0.ovs_extra)
+class TestOvsPatchPort(base.TestCase):
+
+ def test_from_json(self):
+ data = """{
+"type": "ovs_patch_port",
+"name": "br-pub-patch",
+"bridge_name": "br-ex",
+"peer": "br-ex-patch"
+}
+"""
+ patch_port = objects.object_from_json(json.loads(data))
+ self.assertEqual("br-pub-patch", patch_port.name)
+ self.assertEqual("br-ex", patch_port.bridge_name)
+ self.assertEqual("br-ex-patch", patch_port.peer)
+
+
class TestNumberedNicsMapping(base.TestCase):
# We want to test the function, not the dummy..