Change in vdsm[master]: tests: bondHwAddress, safeNetworkConfig, volatileConfig
gvallare at redhat.com
gvallare at redhat.com
Sun Aug 4 21:14:18 UTC 2013
Giuseppe Vallarelli has uploaded a new change for review.
Change subject: tests: bondHwAddress, safeNetworkConfig, volatileConfig
......................................................................
tests: bondHwAddress, safeNetworkConfig, volatileConfig
Added three functional tests:
* testBondHwAddress
* testSafeNetworkConfig
* testVolatileConfig
Change-Id: I2b035155ef715d8456d9c4658ad2cb7ee76c80d0
Signed-off-by: Giuseppe Vallarelli <gvallare at redhat.com>
---
M tests/functional/networkTests.py
M tests/functional/utils.py
2 files changed, 89 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/17640/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index f16f52e..1a8ed65 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -17,12 +17,15 @@
# Refer to the README and COPYING files for full details of the license
#
import neterrors
+from vdsm import utils
from testrunner import (VdsmTestCase as TestCaseBase,
expandPermutations, permutations)
from testValidation import RequireDummyMod, ValidateRunningAsRoot
from utils import cleanupNet, dummyIf, restoreNetConfig, SUCCESS, VdsProxy
+
+from nose import SkipTest
NETWORK_NAME = 'test-network'
@@ -643,3 +646,78 @@
dict(remove=True)},
{})
self.assertEquals(status, SUCCESS, msg)
+
+ @permutations([[True], [False]])
+ @RequireDummyMod
+ @ValidateRunningAsRoot
+ def testBondHwAddress(self, bridged=True):
+ with dummyIf(2) as nics:
+ def _getBondHwAddress(*nics):
+ status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
+ bond=BONDING_NAME,
+ nics=nics,
+ opts={'bridged':
+ bridged})
+ self.assertEquals(status, SUCCESS, msg)
+
+ status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
+ self.assertEquals(status, SUCCESS, msg)
+
+ return self.vdsm_net.netinfo.bondings[BONDING_NAME]['hwaddr']
+
+ macAddress1 = _getBondHwAddress(nics[0], nics[1])
+ macAddress2 = _getBondHwAddress(nics[1], nics[0])
+ self.assertEquals(macAddress1, macAddress2)
+
+ @permutations([[True], [False]])
+ @RequireDummyMod
+ @ValidateRunningAsRoot
+ def testSafeNetworkConfig(self, bridged):
+ """
+ Checks that setSafeNetworkConfig saves
+ the configuration between restart.
+ """
+ with dummyIf(1) as nics:
+ status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, nics=nics,
+ opts={'bridged': bridged})
+ self.assertEquals(status, SUCCESS, msg)
+
+ self.vdsm_net.networkExists(NETWORK_NAME, bridged=bridged)
+
+ self.vdsm_net.setSafeNetworkConfig()
+
+ self.vdsm_net.restartDaemon()
+ # Wait for VDSM to become responsive again
+ utils.retry(lambda: self.assertEquals(
+ SUCCESS, self.vdsm_net.ping()), tries=60)
+
+ self.vdsm_net.networkExists(NETWORK_NAME, bridged=bridged)
+
+ status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
+ self.assertEquals(status, SUCCESS, msg)
+
+ self.vdsm_net.setSafeNetworkConfig()
+
+ @SkipTest
+ @permutations([[True], [False]])
+ @RequireDummyMod
+ @ValidateRunningAsRoot
+ def testVolatileConfig(self, bridged):
+ """
+ Checks that the network doesn't persist over restart
+ """
+ with dummyIf(1) as nics:
+ status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, nics=nics,
+ opts={'bridged':
+ bridged})
+ self.assertEquals(status, SUCCESS, msg)
+
+ self.vdsm_net.networkExists(NETWORK_NAME, bridged=bridged)
+
+ restoreNetConfig()
+ # Wait for VDSM to become responsive again
+ utils.retry(lambda: self.assertEquals(
+ SUCCESS, self.vdsm_net.ping()), tries=30)
+
+ self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME,
+ bridged=bridged))
diff --git a/tests/functional/utils.py b/tests/functional/utils.py
index 1f1c7d7..88a6247 100644
--- a/tests/functional/utils.py
+++ b/tests/functional/utils.py
@@ -247,3 +247,14 @@
qos = Qos(inbound, outbound)
return qos
+
+ def setSafeNetworkConfig(self):
+ self.vdscli.setSafeNetworkConfig()
+
+ def restartDaemon(self):
+ cmd_service = [service.cmd, "vdsmd", "restart"]
+ utils.execCmd(cmd_service, sudo=True)
+
+ def ping(self):
+ result = self.vdscli.ping()
+ return result['status']['code']
--
To view, visit http://gerrit.ovirt.org/17640
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b035155ef715d8456d9c4658ad2cb7ee76c80d0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Vallarelli <gvallare at redhat.com>
More information about the vdsm-patches
mailing list