Change in vdsm[master]: tests: ovs: mock setupNetworks in OVSNetworkTests class

phoracek at redhat.com phoracek at redhat.com
Wed Feb 17 14:34:34 UTC 2016


Petr Horáček has uploaded a new change for review.

Change subject: tests: ovs: mock setupNetworks in OVSNetworkTests class
......................................................................

tests: ovs: mock setupNetworks in OVSNetworkTests class

Until now we marked networks and bonds as OVS ones in OVSVdsProxy.
It is easier to do so on OVSNetworkTests class.

Change-Id: Ia90cee83633b12a5bb40b58fc15864a3646018b5
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M tests/functional/networkTestsOVS.py
1 file changed, 30 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/53667/1

diff --git a/tests/functional/networkTestsOVS.py b/tests/functional/networkTestsOVS.py
index ed8dcaa..89bf2d0 100644
--- a/tests/functional/networkTestsOVS.py
+++ b/tests/functional/networkTestsOVS.py
@@ -32,7 +32,6 @@
                           _get_source_route, dnsmasqDhcp, NETWORK_NAME,
                           IP_ADDRESS, IP_MASK, IP_CIDR, IP_GATEWAY,
                           IPv6_ADDRESS, IPv6_CIDR, VLAN_ID, NOCHK, SUCCESS)
-from utils import VdsProxy
 import dhcp
 
 # WARNING: because of this module changes networkTests module, we cannot run
@@ -148,6 +147,7 @@
 networkTests._waitForKnownOperstate = _fakeWaitForKnownOperstate
 
 
+<<<<<<< HEAD
 class OVSVdsProxy(VdsProxy):
 
     def setupNetworks(self, networks, bonds, options):
@@ -179,6 +179,8 @@
         return super(OVSVdsProxy, self).setupNetworks(networks, bonds, options)
 
 
+=======
+>>>>>>> 5ce5878... tests: ovs: mock setupNetworks in OVSNetworkTests class
 @expandPermutations
 class OVSNetworkTest(NetworkTest):
     __test__ = True
@@ -197,14 +199,38 @@
                 func(*args, **kwargs)
         return wrapper
 
+<<<<<<< HEAD
     def setUp(self):
         self.vdsm_net = OVSVdsProxy()
 
     def setupNetworks(self, *args, **kwargs):
+=======
+    def setupNetworks(self, nets, bonds, opts):
+>>>>>>> 5ce5878... tests: ovs: mock setupNetworks in OVSNetworkTests class
         # Do not run test_kernel_config
-        if 'test_kernel_config' in kwargs:
-            kwargs.pop('test_kernel_config')
-        return self.vdsm_net.setupNetworks(*args, **kwargs)
+        opts['test_kernel_config'] = False
+
+        # setup every network as OVS network
+        for net, attrs in nets.items():
+            if not attrs.get('bridged', True):
+                raise SkipTest('OVS does not support bridgeless networks')
+            if 'remove' not in attrs:
+                nets[net].update({'custom': {'ovs': True}})
+        for bond, attrs in bonds.items():
+            if 'remove' not in attrs:
+                bond_opts = bonds[bond].get('options', '').split()
+                modified = False
+                for i in range(len(bond_opts)):
+                    if bond_opts[i].startswith('custom='):
+                        bond_opts[i] = ('custom=%s,ovs=True' %
+                                        bond_opts[i].split('=', 1)[1])
+                        modified = True
+                        break
+                if not modified:
+                    bond_opts.append('custom=ovs=True')
+                bonds[bond]['options'] = ' '.join(bond_opts)
+
+        return self.vdsm_net.setupNetworks(nets, bonds, opts)
 
     @cleanupNet
     def test_ovirtmgmtm_to_ovs(self):


-- 
To view, visit https://gerrit.ovirt.org/53667
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia90cee83633b12a5bb40b58fc15864a3646018b5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>


More information about the vdsm-patches mailing list