diff options
-rw-r--r-- | docs/release/configguide/feature.configuration.rst (renamed from docs/release/installation/feature.configuration.rst) | 0 | ||||
-rw-r--r-- | docs/release/configguide/featureconfig.rst | 24 | ||||
-rw-r--r-- | docs/release/configguide/index.rst (renamed from docs/release/installation/index.rst) | 0 | ||||
-rw-r--r-- | docs/release/configguide/postinstall.rst | 26 | ||||
-rw-r--r-- | sfc/lib/config.py | 37 | ||||
-rw-r--r-- | sfc/lib/utils.py | 154 | ||||
-rw-r--r-- | sfc/tests/functest/config.yaml | 10 | ||||
-rw-r--r-- | sfc/tests/functest/run_tests.py | 43 | ||||
-rw-r--r-- | sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py | 45 | ||||
-rw-r--r-- | sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py | 46 | ||||
-rw-r--r-- | sfc/tests/functest/vnfd-templates/test-vnfd-default-params.yaml | 5 | ||||
-rw-r--r-- | sfc/tests/functest/vnfd-templates/test-vnfd1.yaml | 2 | ||||
-rw-r--r-- | sfc/tests/functest/vnfd-templates/test-vnfd2.yaml | 2 | ||||
-rw-r--r-- | sfc/tests/functest/vnfd-templates/test2-vnfd1.yaml | 2 | ||||
-rw-r--r-- | sfc/tests/functest/vnfd-templates/test2-vnfd2.yaml | 2 |
15 files changed, 166 insertions, 232 deletions
diff --git a/docs/release/installation/feature.configuration.rst b/docs/release/configguide/feature.configuration.rst index e2fcbbb0..e2fcbbb0 100644 --- a/docs/release/installation/feature.configuration.rst +++ b/docs/release/configguide/feature.configuration.rst diff --git a/docs/release/configguide/featureconfig.rst b/docs/release/configguide/featureconfig.rst deleted file mode 100644 index 9189902c..00000000 --- a/docs/release/configguide/featureconfig.rst +++ /dev/null @@ -1,24 +0,0 @@ -<Project> configuration -======================= -Add a brief introduction to configure OPNFV with this specific feature including -dependancies on platform components, this description should be at a level that -will apply to any installer providing the pre-requisite components. - -Pre-configuration activities ----------------------------- -Describe specific pre-configuration activities. This should include ensuring the -right components are installed by the installation tools as required for your -feature to function. Refer to the previous installer configuration chapters, -installations guide and release notes - -Hardware configuration ----------------------- -Describe the hardware configuration needed for this specific feature - -Feature configuration ---------------------- -Describe the procedures to configure your feature on the platform in order -that it is ready to use according to the feature instructions in the platform -user guide. Where applicable you should add content in the postinstall.rst -to validate the feature is configured for use. -(checking components are installed correctly etc...) diff --git a/docs/release/installation/index.rst b/docs/release/configguide/index.rst index 53279035..53279035 100644 --- a/docs/release/installation/index.rst +++ b/docs/release/configguide/index.rst diff --git a/docs/release/configguide/postinstall.rst b/docs/release/configguide/postinstall.rst deleted file mode 100644 index 1702cea5..00000000 --- a/docs/release/configguide/postinstall.rst +++ /dev/null @@ -1,26 +0,0 @@ -<Project> post installation procedures -====================================== -Add a brief introduction to the methods of validating the installation -according to this specific installer or feature. - -Automated post installation activities --------------------------------------- -Describe specific post installation activities performed by the OPNFV -deployment pipeline including testing activities and reports. Refer to -the relevant testing guides, results, and release notes. - -note: this section should be singular and derived from the test projects -once we have one test suite to run for all deploy tools. This is not the -case yet so each deploy tool will need to provide (hopefully very simillar) -documentation of this. - -<Project> post configuration procedures --------------------------------------- -Describe any deploy tool or feature specific scripts, tests or procedures -that should be carried out on the deployment post install and configuration -in this section. - -Platform components validation ---------------------------------- -Describe any component specific validation procedures necessary for your -deployment tool in this section. diff --git a/sfc/lib/config.py b/sfc/lib/config.py index e9fcd582..f5a07013 100644 --- a/sfc/lib/config.py +++ b/sfc/lib/config.py @@ -34,22 +34,31 @@ class CommonConfig(object): self.functest_results_dir = os.path.join( CONST.dir_results, "odl-sfc") self.config_file = os.path.join(self.sfc_test_dir, "config.yaml") - self.fuel_master_ip = ft_utils.get_parameter_from_yaml( - "defaults.fuel_master_ip", self.config_file) - self.fuel_master_uname = ft_utils.get_parameter_from_yaml( - "defaults.fuel_master_uname", self.config_file) - self.fuel_master_passwd = ft_utils.get_parameter_from_yaml( - "defaults.fuel_master_passwd", self.config_file) - self.fuel_proxy = { - 'ip': self.fuel_master_ip, - 'username': self.fuel_master_uname, - 'password': self.fuel_master_passwd - } + self.installer_type = ft_utils.get_parameter_from_yaml( + "defaults.installer.type", self.config_file) + self.installer_ip = ft_utils.get_parameter_from_yaml( + "defaults.installer.ip", self.config_file) + self.installer_user = ft_utils.get_parameter_from_yaml( + "defaults.installer.user", self.config_file) + + try: + self.installer_password = ft_utils.get_parameter_from_yaml( + "defaults.installer.password", self.config_file) + except: + self.installer_password = None + try: - self.fuel_environment = ft_utils.get_parameter_from_yaml( - "defaults.fuel_environment", self.config_file) + self.installer_key_file = ft_utils.get_parameter_from_yaml( + "defaults.installer.key_file", self.config_file) except: - self.fuel_environment = None + self.installer_key_file = None + + try: + self.installer_cluster = ft_utils.get_parameter_from_yaml( + "defaults.installer.cluster", self.config_file) + except: + self.installer_cluster = None + self.flavor = ft_utils.get_parameter_from_yaml( "defaults.flavor", self.config_file) self.ram_size_in_mb = ft_utils.get_parameter_from_yaml( diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py index 02782765..4289ee0a 100644 --- a/sfc/lib/utils.py +++ b/sfc/lib/utils.py @@ -8,17 +8,16 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import json import os import re import subprocess import time +import yaml import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils -import opnfv.utils.SSHUtils as ssh_utils -import sfc.lib.config as sfc_config +import functest.utils.openstack_tacker as os_tacker logger = ft_logger.Logger("sfc_test_utils").getLogger() @@ -28,46 +27,23 @@ FUNCTEST_RESULTS_DIR = os.path.join("home", "opnfv", def run_cmd(cmd): - """run given command locally and return commands output if success""" + """ + Run given command locally + Return a tuple with the return code, stdout, and stderr of the command + """ pipe = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (output, errors) = pipe.communicate() + output, errors = pipe.communicate() logger.debug("running [%s] returns: <%s> - %s " "" % (cmd, pipe.returncode, output)) - if output: - output = output.strip() + if pipe.returncode != 0 or len(errors) > 0: logger.error('FAILED to execute {0}'.format(cmd)) logger.error(errors) - return None - - return output - - -def run_cmd_on_controller(cmd): - """run given command on OpenStack controller""" - ip_controllers = get_openstack_node_ips("controller") - if not ip_controllers: - return None - - ssh_cmd = "ssh %s %s %s" % (SSH_OPTIONS, ip_controllers[0], cmd) - return run_cmd_on_fm(ssh_cmd) - -def run_cmd_on_compute(cmd, ip_compute): - """run given command on OpenStack Compute node""" - ssh_cmd = "ssh %s %s %s" % (SSH_OPTIONS, ip_compute, cmd) - return run_cmd_on_fm(ssh_cmd) - - -def run_cmd_on_fm(cmd, username="root", passwd="r00tme"): - """run given command on Fuel Master""" - ip = os.environ.get("INSTALLER_IP") - ssh_cmd = "sshpass -p %s ssh %s %s@%s %s" % ( - passwd, SSH_OPTIONS, username, ip, cmd) - return run_cmd(ssh_cmd) + return pipe.returncode, output.strip(), errors.strip() def run_cmd_remote(ip, cmd, username="root", passwd="opnfv"): @@ -78,25 +54,7 @@ def run_cmd_remote(ip, cmd, username="root", passwd="opnfv"): return run_cmd(ssh_cmd) -def get_openstack_node_ips(role): - """Get OpenStack Nodes IP Address""" - fuel_env = sfc_config.CommonConfig().fuel_environment - if fuel_env is not None: - cmd = "fuel2 node list -f json -e %s" % fuel_env - else: - cmd = "fuel2 node list -f json" - - nodes = run_cmd_on_fm(cmd) - ips = [] - nodes = json.loads(nodes) - for node in nodes: - if role in node["roles"]: - ips.append(node["ip"]) - - return ips - - -def configure_iptables(): +def configure_iptables(controller_nodes): """Configures IPTABLES on OpenStack Controller""" iptable_cmds = ["iptables -P INPUT ACCEPT", "iptables -t nat -P INPUT ACCEPT", @@ -105,7 +63,8 @@ def configure_iptables(): for cmd in iptable_cmds: logger.info("Configuring %s on contoller" % cmd) - run_cmd_on_controller(cmd) + for controller in controller_nodes: + controller.run_cmd(cmd) def download_image(url, image_path): @@ -119,6 +78,22 @@ def download_image(url, image_path): logger.info("Using old image") +def create_vnf_in_av_zone(tacker_client, vnf_name, vnfd_name, av_zone=None): + param_file = os.path.join(os.getcwd(), + 'vnfd-templates', + 'test-vnfd-default-params.yaml') + if av_zone is not None: + param_file = os.path.join('/tmp', 'param_{0}.yaml'.format(av_zone)) + data = {'zone': av_zone} + with open(param_file) as f: + yaml.dump(data, f) + + os_tacker.create_vnf(tacker_client, + vnf_name, + vnfd_name=vnfd_name, + param_file=param_file) + + def setup_neutron(neutron_client, net, subnet, router, subnet_cidr): n_dict = os_utils.create_network_full(neutron_client, net, @@ -207,7 +182,7 @@ def ping(remote, pkt_cnt=1, iface=None, retries=100, timeout=None): cmd = ping_cmd + '|' + grep_cmd while retries > 0: - output = run_cmd(cmd) + _, output, _ = run_cmd(cmd) if not output: return False @@ -257,7 +232,7 @@ def start_http_server(ip): cmd = "\'python -m SimpleHTTPServer 80" cmd = cmd + " > /dev/null 2>&1 &\'" run_cmd_remote(ip, cmd) - output = run_cmd_remote(ip, "ps aux|grep SimpleHTTPServer") + _, output, _ = run_cmd_remote(ip, "ps aux | grep SimpleHTTPServer") if not output: logger.error("Failed to start http server") return False @@ -281,32 +256,28 @@ def vxlan_tool_stop(sf): run_cmd_remote(sf, cmd) -def netcat(s_ip, c_ip, port="80", timeout=5): - """Run netcat on a give machine, Can be VM""" - cmd = "nc -zv " - cmd = cmd + " -w %s %s %s" % (timeout, s_ip, port) - cmd = cmd + " 2>&1" - output = run_cmd_remote(c_ip, cmd) +def netcat(source_ip, destination_ip, port, timeout=5): + """ + SSH into source_ip, and check the connectivity from there to destination_ip + on the specified port, using the netcat command. + Returns 0 on successful execution, != 0 on failure + """ + cmd = "nc -zv -w %s %s %s 2>&1" % (timeout, destination_ip, port) + rc, output, _ = run_cmd_remote(source_ip, cmd) + logger.info("Running netcat from [%s] - connecting to [%s] on port [%s]" % + (source_ip, destination_ip, port)) logger.info("%s" % output) - return output + return rc -def is_ssh_blocked(srv_prv_ip, client_ip): - res = netcat(srv_prv_ip, client_ip, port="22") - match = re.search("nc:.*timed out:.*", res, re.M) - if match: - return True +def is_ssh_blocked(source_ip, destination_ip): + rc = netcat(source_ip, destination_ip, port="22") + return rc != 0 - return False - - -def is_http_blocked(srv_prv_ip, client_ip): - res = netcat(srv_prv_ip, client_ip, port="80") - match = re.search(".* 80 port.* succeeded!", res, re.M) - if match: - return False - return True +def is_http_blocked(source_ip, destination_ip): + rc = netcat(source_ip, destination_ip, port="80") + return rc != 0 def capture_ovs_logs(ovs_logger, controller_clients, compute_clients, error): @@ -317,13 +288,8 @@ def capture_ovs_logs(ovs_logger, controller_clients, compute_clients, error): timestamp=timestamp) -def get_ssh_clients(role, proxy): - clients = [] - for ip in get_openstack_node_ips(role): - s_client = ssh_utils.get_ssh_client(ip, 'root', proxy=proxy) - clients.append(s_client) - - return clients +def get_ssh_clients(nodes): + return [n.ssh_client for n in nodes] def check_ssh(ips, retries=100): @@ -332,7 +298,8 @@ def check_ssh(ips, retries=100): logger.info("Checking SSH connectivity to the SFs with ips %s" % str(ips)) while retries and not all(check): for index, ip in enumerate(ips): - check[index] = run_cmd_remote(ip, "exit") + rc, _, _ = run_cmd_remote(ip, "exit") + check[index] = True if rc == 0 else False if all(check): logger.info("SSH connectivity to the SFs established") @@ -396,15 +363,14 @@ def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200): logger.info("classification rules updated") -def setup_compute_node(cidr): +def setup_compute_node(cidr, compute_nodes): logger.info("bringing up br-int iface") - # 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 || true" % cidr, ip_compute): - logger.info("adding route %s in %s" % (cidr, ip_compute)) - run_cmd_on_compute("ip route add %s dev br-int" % cidr, ip_compute) + grep_cidr_routes = ("ip route | grep -o {0} || true".format(cidr)).strip() + add_cidr = "ip route add {0} dev br-int".format(cidr) + for compute in compute_nodes: + compute.run_cmd("ifconfig br-int up") + if not compute.run_cmd(grep_cidr_routes): + logger.info("adding route %s in %s" % (cidr, compute.ip)) + compute.run_cmd(add_cidr) else: - logger.info("route %s exists" % cidr) + logger.info("route %s already exists" % cidr) diff --git a/sfc/tests/functest/config.yaml b/sfc/tests/functest/config.yaml index b6f9c138..9cc4c5f4 100644 --- a/sfc/tests/functest/config.yaml +++ b/sfc/tests/functest/config.yaml @@ -6,10 +6,12 @@ defaults: vcpu_count: 1 image_name: sfc_nsh_danube image_file_name: sfc_nsh_danube.qcow2 - fuel_master_ip: 10.20.0.2 - fuel_master_uname: root - fuel_master_passwd: r00tme - fuel_environment: # Change this to the id of the desired fuel env (1, 2, 3...) + installer: + type: fuel + ip: 10.20.0.2 + user: root + password: r00tme + cluster: 1 # Change this to the id of the desired fuel env (1, 2, 3...) image_format: qcow2 url: "http://artifacts.opnfv.org/sfc/images" vnfd-dir: "vnfd-templates" diff --git a/sfc/tests/functest/run_tests.py b/sfc/tests/functest/run_tests.py index d0ed35f4..7214dd94 100644 --- a/sfc/tests/functest/run_tests.py +++ b/sfc/tests/functest/run_tests.py @@ -17,10 +17,10 @@ import yaml import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils +import functest.utils.openstack_utils as os_utils import opnfv.utils.ovs_logger as ovs_log -import opnfv.utils.SSHUtils as ssh_utils import sfc.lib.config as sfc_config -import sfc.lib.utils as utils +from opnfv.deployment.factory import Factory as DeploymentFactory parser = argparse.ArgumentParser() @@ -43,33 +43,34 @@ def push_results(testname, start_time, end_time, criteria, details): details) -def get_tackerc_file(): +def fetch_tackerc_file(controller_node): rc_file = os.path.join(COMMON_CONFIG.sfc_test_dir, 'tackerc') if not os.path.exists(rc_file): - logger.info("tackerc file not found, getting it from controller") - ip = utils.get_openstack_node_ips("controller") - ssh_conn = ssh_utils.get_ssh_client(ip[0], 'root', - proxy=COMMON_CONFIG.fuel_proxy) - ssh_utils.get_file(ssh_conn, "tackerc", rc_file) + logger.info("tackerc file not found, fetching it from controller") + controller_node.get_file("~/tackerc", rc_file) else: logger.info("found tackerc file") - return rc_file -def set_tacker_rc_file_env(): - rc_file = get_tackerc_file() - with open(rc_file) as f: - for line in f.readlines(): - if not (line.startswith('#') or len(line) == 1): - filtered = line.strip().split(' ') - kv = filtered[1].split('=') - logger.info("Set shell env %s=%s" % (kv[0], kv[1])) - os.environ[kv[0]] = kv[1].strip("'") - - def main(): - set_tacker_rc_file_env() + deploymentHandler = DeploymentFactory.get_handler( + COMMON_CONFIG.installer_type, + COMMON_CONFIG.installer_ip, + COMMON_CONFIG.installer_user, + installer_pwd=COMMON_CONFIG.installer_password) + + cluster = COMMON_CONFIG.installer_cluster + nodes = (deploymentHandler.get_nodes({'cluster': cluster}) + if cluster is not None + else deploymentHandler.get_nodes()) + + a_controller = [node for node in nodes + if node.is_controller()][0] + rc_file = fetch_tackerc_file(a_controller) + + creds = os_utils.source_credentials(rc_file) + logger.info("Updating env with {0}".format(creds)) ovs_logger = ovs_log.OVSLogger( os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'), COMMON_CONFIG.functest_results_dir) diff --git a/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py b/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py index 9661ee09..8ec4dffb 100644 --- a/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py +++ b/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py @@ -10,7 +10,6 @@ import argparse import os -import re import sys import time @@ -69,26 +68,6 @@ def setup_availability_zones(nova_client): return az -# JIRA: SFC-52 new function -def modify_vnfd(tacker_vnfd, az): - try: - with open(tacker_vnfd, 'r') as stream: - lines = stream.readlines() - with open(tacker_vnfd, 'w') as stream: - for line in lines: - stream.write(re.sub('nova$', az, line)) - - except Exception, e: - logger.error("Problem when changing vnfd %s" % e) - - -# JIRA: SFC-52 new function -def prepare_tacker_vnfd(nova_client): - azs = setup_availability_zones(nova_client) - modify_vnfd(TACKER_VNFD1, azs[0]) - modify_vnfd(TACKER_VNFD2, azs[1]) - - def main(): installer_type = os.environ.get("INSTALLER_TYPE") if installer_type != "fuel": @@ -143,7 +122,7 @@ def main(): TESTCASE_CONFIG.secgroup_name, TESTCASE_CONFIG.secgroup_descr) - prepare_tacker_vnfd(nova_client) + availability_zones = setup_availability_zones(nova_client) test_utils.create_instance( nova_client, CLIENT, COMMON_CONFIG.flavor, @@ -170,10 +149,16 @@ def main(): 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') + test_utils.create_vnf_in_av_zone( + tacker_client, + 'testVNF1', + 'test-vnfd1', + av_zone=availability_zones[0]) + test_utils.create_vnf_in_av_zone( + tacker_client, + 'testVNF2', + 'test-vnfd2', + av_zone=availability_zones[1]) try: os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF1') @@ -193,8 +178,8 @@ def main(): 'protocol': 6 }) - logger.info(test_utils.run_cmd('tacker sfc-list')) - logger.info(test_utils.run_cmd('tacker sfc-classifier-list')) + logger.info(test_utils.run_cmd('tacker sfc-list')[1]) + logger.info(test_utils.run_cmd('tacker sfc-classifier-list')[1]) server_ip, client_ip, sf1, sf2 = test_utils.get_floating_ips( nova_client, neutron_client) @@ -218,7 +203,7 @@ def main(): time.sleep(100) logger.info("Test HTTP") - if not test_utils.is_http_blocked(srv_prv_ip, client_ip): + if not test_utils.is_http_blocked(client_ip, srv_prv_ip): logger.info('\033[92mTEST 1 [PASSED] ==> HTTP WORKS\033[0m') update_json_results("Test 1: HTTP works", "Passed") else: @@ -235,7 +220,7 @@ def main(): test_utils.vxlan_firewall(sf1, port="80") logger.info("Test HTTP again") - if test_utils.is_http_blocked(srv_prv_ip, client_ip): + if test_utils.is_http_blocked(client_ip, srv_prv_ip): logger.info('\033[92mTEST 2 [PASSED] ==> HTTP Blocked\033[0m') update_json_results("Test 2: HTTP Blocked", "Passed") else: 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 e112e07b..a91b457b 100644 --- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py +++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py @@ -20,6 +20,7 @@ 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 +from opnfv.deployment.factory import Factory as DeploymentFactory """ logging configuration """ @@ -32,6 +33,22 @@ TESTCASE_CONFIG = sfc_config.TestcaseConfig('sfc_two_chains_SSH_and_HTTP') def main(): + deploymentHandler = DeploymentFactory.get_handler( + COMMON_CONFIG.installer_type, + COMMON_CONFIG.installer_ip, + COMMON_CONFIG.installer_user, + installer_pwd=COMMON_CONFIG.installer_password) + + cluster = COMMON_CONFIG.installer_cluster + openstack_nodes = (deploymentHandler.get_nodes({'cluster': cluster}) + if cluster is not None + else deploymentHandler.get_nodes()) + + controller_nodes = [node for node in openstack_nodes + if node.is_controller()] + compute_nodes = [node for node in openstack_nodes + if node.is_compute()] + results = Results(COMMON_CONFIG.line_length) results.add_to_summary(0, "=") results.add_to_summary(2, "STATUS", "SUBTEST") @@ -51,8 +68,9 @@ def main(): '\033[91mexport INSTALLER_IP=<ip>\033[0m') sys.exit(1) - test_utils.setup_compute_node(TESTCASE_CONFIG.subnet_cidr) - test_utils.configure_iptables() + test_utils.setup_compute_node(TESTCASE_CONFIG.subnet_cidr, compute_nodes) + test_utils.configure_iptables(controller_nodes) + test_utils.download_image(COMMON_CONFIG.url, COMMON_CONFIG.image_path) _, custom_flv_id = os_utils.get_or_create_flavor( @@ -69,10 +87,8 @@ def main(): nova_client = os_utils.get_nova_client() tacker_client = os_tacker.get_tacker_client() - controller_clients = test_utils.get_ssh_clients("controller", - COMMON_CONFIG.fuel_proxy) - compute_clients = test_utils.get_ssh_clients("compute", - COMMON_CONFIG.fuel_proxy) + controller_clients = test_utils.get_ssh_clients(controller_nodes) + compute_clients = test_utils.get_ssh_clients(compute_nodes) ovs_logger = ovs_log.OVSLogger( os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'), @@ -112,8 +128,8 @@ def main(): COMMON_CONFIG.vnfd_dir, TESTCASE_CONFIG.test_vnfd_blue) 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') + test_utils.create_vnf_in_av_zone(tacker_client, 'testVNF1', 'test-vnfd1') + test_utils.create_vnf_in_av_zone(tacker_client, 'testVNF2', 'test-vnfd2') try: os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF1') @@ -141,8 +157,8 @@ def main(): 'protocol': 6 }) - logger.info(test_utils.run_cmd('tacker sfc-list')) - logger.info(test_utils.run_cmd('tacker sfc-classifier-list')) + logger.info(test_utils.run_cmd('tacker sfc-list')[1]) + logger.info(test_utils.run_cmd('tacker sfc-classifier-list')[1]) # Start measuring the time it takes to implement the classification rules t1 = threading.Thread(target=test_utils.wait_for_classification_rules, @@ -174,7 +190,7 @@ def main(): t1.join() logger.info("Test SSH") - if test_utils.is_ssh_blocked(srv_prv_ip, client_ip): + if test_utils.is_ssh_blocked(client_ip, srv_prv_ip): results.add_to_summary(2, "PASS", "SSH Blocked") else: error = ('\033[91mTEST 1 [FAILED] ==> SSH NOT BLOCKED\033[0m') @@ -184,7 +200,7 @@ def main(): results.add_to_summary(2, "FAIL", "SSH Blocked") logger.info("Test HTTP") - if not test_utils.is_http_blocked(srv_prv_ip, client_ip): + if not test_utils.is_http_blocked(client_ip, srv_prv_ip): results.add_to_summary(2, "PASS", "HTTP works") else: error = ('\033[91mTEST 2 [FAILED] ==> HTTP BLOCKED\033[0m') @@ -213,7 +229,7 @@ def main(): 'protocol': 6 }) - logger.info(test_utils.run_cmd('tacker sfc-classifier-list')) + logger.info(test_utils.run_cmd('tacker sfc-classifier-list')[1]) # Start measuring the time it takes to implement the classification rules t2 = threading.Thread(target=test_utils.wait_for_classification_rules, @@ -227,7 +243,7 @@ def main(): t2.join() logger.info("Test HTTP") - if test_utils.is_http_blocked(srv_prv_ip, client_ip): + if test_utils.is_http_blocked(client_ip, srv_prv_ip): results.add_to_summary(2, "PASS", "HTTP Blocked") else: error = ('\033[91mTEST 3 [FAILED] ==> HTTP WORKS\033[0m') @@ -237,7 +253,7 @@ def main(): results.add_to_summary(2, "FAIL", "HTTP Blocked") logger.info("Test SSH") - if not test_utils.is_ssh_blocked(srv_prv_ip, client_ip): + if not test_utils.is_ssh_blocked(client_ip, srv_prv_ip): results.add_to_summary(2, "PASS", "SSH works") else: error = ('\033[91mTEST 4 [FAILED] ==> SSH BLOCKED\033[0m') diff --git a/sfc/tests/functest/vnfd-templates/test-vnfd-default-params.yaml b/sfc/tests/functest/vnfd-templates/test-vnfd-default-params.yaml new file mode 100644 index 00000000..bf9bd868 --- /dev/null +++ b/sfc/tests/functest/vnfd-templates/test-vnfd-default-params.yaml @@ -0,0 +1,5 @@ +vdus: + vdu1: + param: + zone: nova + diff --git a/sfc/tests/functest/vnfd-templates/test-vnfd1.yaml b/sfc/tests/functest/vnfd-templates/test-vnfd1.yaml index fd862ea0..79a625fa 100644 --- a/sfc/tests/functest/vnfd-templates/test-vnfd1.yaml +++ b/sfc/tests/functest/vnfd-templates/test-vnfd1.yaml @@ -20,7 +20,7 @@ vdus: management: true placement_policy: - availability_zone: nova + availability_zone: { get_input: zone } auto-scaling: noop monitoring_policy: noop diff --git a/sfc/tests/functest/vnfd-templates/test-vnfd2.yaml b/sfc/tests/functest/vnfd-templates/test-vnfd2.yaml index 5451358d..64f799e4 100644 --- a/sfc/tests/functest/vnfd-templates/test-vnfd2.yaml +++ b/sfc/tests/functest/vnfd-templates/test-vnfd2.yaml @@ -20,7 +20,7 @@ vdus: management: true placement_policy: - availability_zone: nova + availability_zone: { get_input: zone } auto-scaling: noop monitoring_policy: noop diff --git a/sfc/tests/functest/vnfd-templates/test2-vnfd1.yaml b/sfc/tests/functest/vnfd-templates/test2-vnfd1.yaml index 1d8da125..e8e0626b 100644 --- a/sfc/tests/functest/vnfd-templates/test2-vnfd1.yaml +++ b/sfc/tests/functest/vnfd-templates/test2-vnfd1.yaml @@ -22,7 +22,7 @@ vdus: placement_policy: # TODO: This availability zone is changed by the test case on the fly. # See JIRA SFC-73 for more info - availability_zone: nova + availability_zone: { get_input: zone } auto-scaling: noop monitoring_policy: noop diff --git a/sfc/tests/functest/vnfd-templates/test2-vnfd2.yaml b/sfc/tests/functest/vnfd-templates/test2-vnfd2.yaml index 280fc9e5..93a38acb 100644 --- a/sfc/tests/functest/vnfd-templates/test2-vnfd2.yaml +++ b/sfc/tests/functest/vnfd-templates/test2-vnfd2.yaml @@ -22,7 +22,7 @@ vdus: placement_policy: # TODO: This availability zone is changed by the test case on the fly. # See JIRA SFC-73 for more info - availability_zone: nova + availability_zone: { get_input: zone } auto-scaling: noop monitoring_policy: noop |