diff options
Diffstat (limited to 'sfc')
-rw-r--r-- | sfc/lib/utils.py | 23 | ||||
-rw-r--r-- | sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py | 33 |
2 files changed, 20 insertions, 36 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py index f4412abf..13f534be 100644 --- a/sfc/lib/utils.py +++ b/sfc/lib/utils.py @@ -60,13 +60,9 @@ def run_cmd_on_controller(cmd): return run_cmd_on_fm(ssh_cmd) -def run_cmd_on_compute(cmd): +def run_cmd_on_compute(cmd, ip_compute): """run given command on OpenStack Compute node""" - ip_computes = get_openstack_node_ips("compute") - if not ip_computes: - return None - - ssh_cmd = "ssh %s %s %s" % (SSH_OPTIONS, ip_computes[0], cmd) + ssh_cmd = "ssh %s %s %s" % (SSH_OPTIONS, ip_compute, cmd) return run_cmd_on_fm(ssh_cmd) @@ -391,9 +387,12 @@ def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200): def setup_compute_node(cidr): logger.info("bringing up br-int iface") - run_cmd_on_compute("ifconfig br-int up") - if not run_cmd_on_compute("ip route|grep -o %s" % cidr): - logger.info("adding route %s" % cidr) - return run_cmd_on_compute("ip route add %s" % cidr) - else: - logger.info("route %s exists" % cidr) + # TODO: Get only the compute nodes which belong to the env. + ip_computes = get_openstack_node_ips("compute") + for ip_compute in ip_computes: + run_cmd_on_compute("ifconfig br-int up", ip_compute) + if not run_cmd_on_compute("ip route|grep -o %s" % cidr, ip_compute): + logger.info("adding route %s in %s" % (cidr, ip_compute)) + run_cmd_on_compute("ip route add %s" % cidr, ip_compute) + else: + logger.info("route %s exists" % cidr) diff --git a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py index 2383bb3e..e112e07b 100644 --- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py +++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py @@ -8,7 +8,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import argparse import os import sys import threading @@ -17,19 +16,12 @@ import functest.utils.functest_logger as ft_logger import functest.utils.openstack_tacker as os_tacker import functest.utils.openstack_utils as os_utils import opnfv.utils.ovs_logger as ovs_log + import sfc.lib.config as sfc_config import sfc.lib.utils as test_utils from sfc.lib.results import Results -parser = argparse.ArgumentParser() - -parser.add_argument("-r", "--report", - help="Create json result file", - action="store_true") - -args = parser.parse_args() - """ logging configuration """ logger = ft_logger.Logger("ODL_SFC").getLogger() @@ -111,24 +103,17 @@ def main(): srv_prv_ip = srv_instance.networks.get(TESTCASE_CONFIG.net_name)[0] - tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir, - COMMON_CONFIG.vnfd_dir, - TESTCASE_CONFIG.test_vnfd_red) - os_tacker.create_vnfd( - tacker_client, - tosca_file=tosca_file) + tosca_red = os.path.join(COMMON_CONFIG.sfc_test_dir, + COMMON_CONFIG.vnfd_dir, + TESTCASE_CONFIG.test_vnfd_red) + os_tacker.create_vnfd(tacker_client, tosca_file=tosca_red) - tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir, + tosca_blue = os.path.join(COMMON_CONFIG.sfc_test_dir, COMMON_CONFIG.vnfd_dir, TESTCASE_CONFIG.test_vnfd_blue) - os_tacker.create_vnfd( - tacker_client, - tosca_file=tosca_file) - - os_tacker.create_vnf( - tacker_client, 'testVNF1', vnfd_name='test-vnfd1') - os_tacker.create_vnf( - tacker_client, 'testVNF2', vnfd_name='test-vnfd2') + os_tacker.create_vnfd(tacker_client, tosca_file=tosca_blue) + os_tacker.create_vnf(tacker_client, 'testVNF1', vnfd_name='test-vnfd1') + os_tacker.create_vnf(tacker_client, 'testVNF2', vnfd_name='test-vnfd2') try: os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF1') |