[Kimchi-devel] [PATCH] [Kimchi 2/2] Add VEPA network tests

Lucio Correia luciojhc at linux.vnet.ibm.com
Mon Apr 25 20:10:31 UTC 2016


- Create a VEPA virtual network with 2 nics
- Update the same to have only 1 nic

Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
 tests/test_mock_network.py  | 13 +++++++++++++
 tests/test_model_network.py |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/tests/test_mock_network.py b/tests/test_mock_network.py
index 3a2ca64..b8bdc13 100644
--- a/tests/test_mock_network.py
+++ b/tests/test_mock_network.py
@@ -76,3 +76,16 @@ class MockNetworkTests(unittest.TestCase):
             _do_network_test(self, model, {'name': u'vlan-tagged-bridge',
                                            'connection': 'bridge',
                                            'interface': iface, 'vlan_id': 987})
+
+    def test_vepa_network(self):
+        # Verify the current system has at least two interfaces to create a
+        # VEPA network
+        interfaces = json.loads(
+            self.request('/plugins/kimchi/interfaces?type=nic').read()
+        )
+        if len(interfaces) > 1:
+            iface0 = interfaces[0]['name']
+            iface1 = interfaces[1]['name']
+            _do_network_test(self, model, {'name': u'vepa-network',
+                                           'connection': 'vepa',
+                                           'interfaces': [iface0, iface1]})
diff --git a/tests/test_model_network.py b/tests/test_model_network.py
index 14d7288..37d304b 100644
--- a/tests/test_model_network.py
+++ b/tests/test_model_network.py
@@ -99,6 +99,8 @@ def _do_network_test(self, model, params):
             updateParams['subnet'] = '127.0.200.0/24'
         elif connection == 'bridge' and 'vlan_id' in params:
             updateParams['vlan_id'] = 389
+        elif connection == 'vepa':
+            updateParams['interfaces'] = params['interfaces'][:1]
 
         # Test network update
         req = json.dumps(updateParams)
-- 
1.9.1




More information about the Kimchi-devel mailing list