Commit e961fd2d authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis Committed by Christos Stavrakakis
Browse files

Strengthen NetworkTestCase assertion checks

parent 48f1b0c9
......@@ -1188,12 +1188,16 @@ class NetworkTestCase(unittest.TestCase):
for nic in nicsA:
if nic["network_id"] == self.networkid:
cls.priv_ip["A"] = nic["ipv4"]
self.result_dict["Server A private IP"] = str(cls.priv_ip["A"])
for nic in nicsB:
if nic["network_id"] == self.networkid:
cls.priv_ip["B"] = nic["ipv4"]
self.result_dict["Server B private IP"] = str(cls.priv_ip["B"])
self.assertTrue(conn_exists)
self.assertIsNot(cls.priv_ip["A"], "")
self.assertIsNot(cls.priv_ip["B"], "")
def test_002a_reboot(self):
"""Rebooting server A"""
......@@ -1320,7 +1324,7 @@ class NetworkTestCase(unittest.TestCase):
self.assertTrue(s)
def test_003a_setup_interface_A(self):
"""Set up eth1 for server A"""
"""Setup eth1 for server A"""
self._skipIf(self.is_windows, "only valid for Linux servers")
......@@ -1345,11 +1349,14 @@ class NetworkTestCase(unittest.TestCase):
myPass = self.password['A']
log.info("SSH in server A as %s/%s" % (loginname, myPass))
command = "ifconfig eth1 %s" % self.priv_ip["A"]
command = "ifconfig eth1 %s && ifconfig eth1 | " \
"grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'" \
% self.priv_ip["A"]
output, status = _ssh_execute(
hostip, loginname, myPass, command)
self.assertEquals(status, 0)
self.assertEquals(output[0].strip(), self.priv_ip["A"])
def test_003b_setup_interface_B(self):
"""Setup eth1 for server B"""
......@@ -1376,11 +1383,14 @@ class NetworkTestCase(unittest.TestCase):
myPass = self.password['B']
log.info("SSH in server B as %s/%s" % (loginname, myPass))
command = "ifconfig eth1 %s" % self.priv_ip["B"]
command = "ifconfig eth1 %s && ifconfig eth1 | " \
"grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'" \
% self.priv_ip["B"]
output, status = _ssh_execute(
hostip, loginname, myPass, command)
self.assertEquals(status, 0)
self.assertEquals(output[0].strip(), self.priv_ip["B"])
def test_003c_test_connection_exists(self):
"""Ping server B from server A to test if connection exists"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment