X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Fopnfv_tests%2Fopenstack%2Fvping%2Fvping_userdata.py;h=deaacfccd6e4948cb1d81e550f369c5cbb396bed;hb=refs%2Fchanges%2F93%2F43693%2F4;hp=8ea9be84b8b2bed597fbf4e3d0905cd2d347a72a;hpb=794493f95dc235ada697f9fd7f6d983b48521b4d;p=functest.git diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py old mode 100755 new mode 100644 index 8ea9be84b..deaacfccd --- a/functest/opnfv_tests/openstack/vping/vping_userdata.py +++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Copyright (c) 2015 All rights reserved # This program and the accompanying materials @@ -7,17 +7,14 @@ # # http://www.apache.org/licenses/LICENSE-2.0 -import argparse -import sys import time -from functest.core.testcase import TestCase - from snaps.openstack.utils import deploy_utils from snaps.openstack.create_instance import VmInstanceSettings from snaps.openstack.create_network import PortSettings -import vping_base +from functest.core.testcase import TestCase +from functest.opnfv_tests.openstack.vping import vping_base class VPingUserdata(vping_base.VPingBase): @@ -91,19 +88,19 @@ class VPingUserdata(vping_base.VPingBase): Override from super """ self.logger.info("Waiting for ping...") - exit_code = -1 + exit_code = TestCase.EX_TESTCASE_FAILED sec = 0 tries = 0 while True: time.sleep(1) - p_console = vm_creator.get_vm_inst().get_console_output() + p_console = vm_creator.get_console_output() if "vPing OK" in p_console: self.logger.info("vPing detected!") exit_code = TestCase.EX_OK break elif "failed to read iid from metadata" in p_console or tries > 5: - exit_code = TestCase.EX_TESTCASE_FAILED + self.logger.info("Failed to read iid from metadata") break elif sec == self.ping_timeout: self.logger.info("Timeout reached.") @@ -140,15 +137,5 @@ def _get_userdata(test_ip): " echo 'vPing KO'\n" " fi\n" " sleep 1\n" - "done\n" % test_ip) + "done\n" % str(test_ip)) return None - - -if __name__ == '__main__': - args_parser = argparse.ArgumentParser() - args_parser.add_argument("-r", "--report", - help="Create json result file", - action="store_true") - args = vars(args_parser.parse_args()) - - sys.exit(vping_base.VPingMain(VPingUserdata).main(**args))