diff options
author | 2018-07-31 13:01:14 +0200 | |
---|---|---|
committer | 2018-08-01 10:17:14 +0200 | |
commit | 4a4db3cdb7749db4d61862c466f178e6bad33232 (patch) | |
tree | 59a8cac9ec48d4385e507854694be09e3a4f86a8 | |
parent | a4bbcd895a0fbf29cb7c2dc396fefb4229573225 (diff) |
Add fallback mechanism if vlan
private_v4 and public_v4 are incorrectly set when vlan is used as
overlay.
JIRA: FUNCTEST-996
Change-Id: I120a247e92e0fd295769b2a0eeb15ce82a0eabc8
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit 5522ecd302ee54b494714cb2e1af0fe2381e5c37)
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_ssh.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_userdata.py | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index a8a6fd9a6..6420013a0 100644 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -45,7 +45,9 @@ class VPingSSH(singlevm.SingleVm2): """ assert self.ssh (_, stdout, stderr) = self.ssh.exec_command( - 'ping -c 1 ' + self.vm2.private_v4) + 'ping -c 1 {}'.format( + self.vm2.private_v4 or self.vm2.addresses[ + self.network.name][0].addr)) self.__logger.info("output:\n%s", stdout.read()) self.__logger.info("error:\n%s", stderr.read()) return stdout.channel.recv_exit_status() diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py index 421ea6a2c..f9d0bdbf0 100644 --- a/functest/opnfv_tests/openstack/vping/vping_userdata.py +++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py @@ -62,7 +62,8 @@ class VPingUserdata(singlevm.VmReady2): """ Override from super """ - if not self.vm1.private_v4: + if not (self.vm1.private_v4 or self.vm1.addresses[ + self.network.name][0].addr): self.logger.error("vm1: IP addr missing") return testcase.TestCase.EX_TESTCASE_FAILED @@ -94,7 +95,8 @@ class VPingUserdata(singlevm.VmReady2): else: self.logger.debug( "Pinging %s. Waiting for response...", - self.vm1.private_v4) + self.vm1.private_v4 or self.vm1.addresses[ + self.network.name][0].addr) sec += 1 return exit_code @@ -105,7 +107,8 @@ class VPingUserdata(singlevm.VmReady2): :param test_ip: the IP value to substitute into the script :return: the bash script contents """ - if self.vm1.private_v4: + if self.vm1.private_v4 or self.vm1.addresses[ + self.network.name][0].addr: return ("#!/bin/sh\n\n" "while true; do\n" " ping -c 1 %s 2>&1 >/dev/null\n" @@ -117,7 +120,9 @@ class VPingUserdata(singlevm.VmReady2): " echo 'vPing KO'\n" " fi\n" " sleep 1\n" - "done\n" % str(self.vm1.private_v4)) + "done\n" % str( + self.vm1.private_v4 or self.vm1.addresses[ + self.network.name][0].addr)) return None def clean(self): |