aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/tests/functest
diff options
context:
space:
mode:
Diffstat (limited to 'sfc/tests/functest')
-rw-r--r--sfc/tests/functest/config.yaml3
-rw-r--r--sfc/tests/functest/run_sfc_tests.py22
-rw-r--r--sfc/tests/functest/setup_scripts/delete.sh23
-rw-r--r--sfc/tests/functest/sfc_one_chain_two_service_functions.py94
-rw-r--r--sfc/tests/functest/sfc_symmetric_chain.py104
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py92
6 files changed, 139 insertions, 199 deletions
diff --git a/sfc/tests/functest/config.yaml b/sfc/tests/functest/config.yaml
index 294ba7c7..be37e626 100644
--- a/sfc/tests/functest/config.yaml
+++ b/sfc/tests/functest/config.yaml
@@ -6,7 +6,6 @@ defaults:
disk_size_in_gb: 10
vcpu_count: 1
image_name: sfc_nsh_euphrates
- image_file_name: sfc_nsh_euphrates.qcow2
installer:
fuel:
user: root
@@ -19,7 +18,7 @@ defaults:
user: root
pkey_file: "/root/.ssh/id_rsa"
image_format: qcow2
- url: "http://artifacts.opnfv.org/sfc/images"
+ image_url: "http://artifacts.opnfv.org/sfc/images/sfc_nsh_euphrates.qcow2"
vnfd-dir: "vnfd-templates"
vnfd-default-params-file: "test-vnfd-default-params.yaml"
diff --git a/sfc/tests/functest/run_sfc_tests.py b/sfc/tests/functest/run_sfc_tests.py
index 49bf6c20..a1e73040 100644
--- a/sfc/tests/functest/run_sfc_tests.py
+++ b/sfc/tests/functest/run_sfc_tests.py
@@ -14,13 +14,12 @@ import time
import sys
import yaml
-from functest.utils import openstack_utils as os_utils
from functest.core import testcase
from opnfv.utils import ovs_logger as ovs_log
from opnfv.deployment.factory import Factory as DeploymentFactory
from sfc.lib import cleanup as sfc_cleanup
from sfc.lib import config as sfc_config
-from sfc.lib import utils as sfc_utils
+from sfc.lib import odl_utils as odl_utils
from collections import OrderedDict
import logging
@@ -127,20 +126,7 @@ class SfcFunctest(testcase.TestCase):
self.__disable_heat_resource_finder_cache(nodes,
COMMON_CONFIG.installer_type)
- if COMMON_CONFIG.installer_type == 'fuel':
- a_controller = [node for node in nodes
- if node.is_controller()][0]
-
- rc_file = self.__fetch_tackerc_file(a_controller)
- os_utils.source_credentials(rc_file)
-
- logger.info("Updating env with {0}".format(rc_file))
- logger.info("OS credentials:")
- for var, value in os.environ.items():
- if var.startswith("OS_"):
- logger.info("\t{0}={1}".format(var, value))
-
- odl_ip, odl_port = sfc_utils.get_odl_ip_port(nodes)
+ odl_ip, odl_port = odl_utils.get_odl_ip_port(nodes)
ovs_logger = ovs_log.OVSLogger(
os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'),
@@ -168,7 +154,7 @@ class SfcFunctest(testcase.TestCase):
package=None)
start_time = time.time()
try:
- result = t.main()
+ result, creators = t.main()
except Exception as e:
logger.error("Exception when executing: %s" % test_name)
logger.error(e)
@@ -190,7 +176,7 @@ class SfcFunctest(testcase.TestCase):
dic = {"duration": duration, "status": status}
self.details.update({test_name: dic})
- sfc_cleanup.cleanup(odl_ip=odl_ip, odl_port=odl_port)
+ sfc_cleanup.cleanup(creators, odl_ip=odl_ip, odl_port=odl_port)
self.stop_time = time.time()
diff --git a/sfc/tests/functest/setup_scripts/delete.sh b/sfc/tests/functest/setup_scripts/delete.sh
index 908d81fc..3333c52b 100644
--- a/sfc/tests/functest/setup_scripts/delete.sh
+++ b/sfc/tests/functest/setup_scripts/delete.sh
@@ -1,17 +1,8 @@
# Remember to source the env variables $creds before
-tacker sfc-classifier-delete red_http
-tacker sfc-classifier-delete blue_ssh
-tacker sfc-classifier-delete red_ssh
-tacker sfc-classifier-delete blue_http
-tacker sfc-delete red
-tacker sfc-delete blue
-tacker vnf-delete testVNF1
-tacker vnf-delete testVNF2
-tacker vnfd-delete test-vnfd1
-tacker vnfd-delete test-vnfd2
-openstack stack delete sfc --y
-openstack stack delete sfc_test1 --y
-openstack stack delete sfc_test2 --y
-nova delete client
-nova delete server
-for line in $(neutron floatingip-list | cut -d" " -f2);do neutron floatingip-delete $line;done
+FILE=$(readlink -f $0)
+FILE_PATH=$(dirname $FILE)
+cd $FILE_PATH
+python ../../../lib/cleanup.py $1 $2
+openstack server delete client
+openstack server delete server
+for line in $(openstack floating ip list);do openstack floating ip delete $line;done
diff --git a/sfc/tests/functest/sfc_one_chain_two_service_functions.py b/sfc/tests/functest/sfc_one_chain_two_service_functions.py
index 86fab534..043b5a6a 100644
--- a/sfc/tests/functest/sfc_one_chain_two_service_functions.py
+++ b/sfc/tests/functest/sfc_one_chain_two_service_functions.py
@@ -14,7 +14,6 @@ import logging
import sfc.lib.openstack_utils as os_sfc_utils
import sfc.lib.odl_utils as odl_utils
-import functest.utils.openstack_utils as os_utils
import opnfv.utils.ovs_logger as ovs_log
import sfc.lib.config as sfc_config
@@ -80,21 +79,17 @@ def main():
results.add_to_summary(2, "STATUS", "SUBTEST")
results.add_to_summary(0, "=")
- test_utils.download_image(COMMON_CONFIG.url,
- COMMON_CONFIG.image_path)
- _, custom_flv_id = os_utils.get_or_create_flavor(
+ openstack_sfc = os_sfc_utils.OpenStackSFC()
+
+ custom_flv = openstack_sfc.create_flavor(
COMMON_CONFIG.flavor,
COMMON_CONFIG.ram_size_in_mb,
COMMON_CONFIG.disk_size_in_gb,
- COMMON_CONFIG.vcpu_count,
- public=True)
- if not custom_flv_id:
+ COMMON_CONFIG.vcpu_count)
+ if not custom_flv:
logger.error("Failed to create custom flavor")
sys.exit(1)
- glance_client = os_utils.get_glance_client()
- neutron_client = os_utils.get_neutron_client()
- nova_client = os_utils.get_nova_client()
tacker_client = os_sfc_utils.get_tacker_client()
controller_clients = test_utils.get_ssh_clients(controller_nodes)
@@ -104,43 +99,39 @@ def main():
os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'),
COMMON_CONFIG.functest_results_dir)
- image_id = os_utils.create_glance_image(glance_client,
- COMMON_CONFIG.image_name,
- COMMON_CONFIG.image_path,
- COMMON_CONFIG.image_format,
- public='public')
+ image_creator = openstack_sfc.register_glance_image(
+ COMMON_CONFIG.image_name,
+ COMMON_CONFIG.image_url,
+ COMMON_CONFIG.image_format,
+ 'public')
- network_id = os_sfc_utils.setup_neutron(neutron_client,
- TESTCASE_CONFIG.net_name,
- TESTCASE_CONFIG.subnet_name,
- TESTCASE_CONFIG.router_name,
- TESTCASE_CONFIG.subnet_cidr)
+ network, router = openstack_sfc.create_network_infrastructure(
+ TESTCASE_CONFIG.net_name,
+ TESTCASE_CONFIG.subnet_name,
+ TESTCASE_CONFIG.subnet_cidr,
+ TESTCASE_CONFIG.router_name)
- sg_id = os_sfc_utils.create_security_groups(neutron_client,
- TESTCASE_CONFIG.secgroup_name,
- TESTCASE_CONFIG.secgroup_descr)
+ sg = openstack_sfc.create_security_group(TESTCASE_CONFIG.secgroup_name)
vnfs = ['testVNF1', 'testVNF2']
topo_seed = topo_shuffler.get_seed()
- testTopology = topo_shuffler.topology(vnfs, seed=topo_seed)
+ testTopology = topo_shuffler.topology(vnfs, openstack_sfc, seed=topo_seed)
logger.info('This test is run with the topology {0}'
.format(testTopology['id']))
logger.info('Topology description: {0}'
.format(testTopology['description']))
- client_instance = os_sfc_utils.create_instance(
- nova_client, CLIENT, COMMON_CONFIG.flavor, image_id,
- network_id, sg_id, av_zone=testTopology['client'])
+ client_instance, client_creator = openstack_sfc.create_instance(
+ CLIENT, COMMON_CONFIG.flavor, image_creator, network, sg,
+ av_zone=testTopology['client'])
- server_instance = os_sfc_utils.create_instance(
- nova_client, SERVER, COMMON_CONFIG.flavor, image_id,
- network_id, sg_id, av_zone=testTopology['server'])
+ server_instance, server_creator = openstack_sfc.create_instance(
+ SERVER, COMMON_CONFIG.flavor, image_creator, network, sg,
+ av_zone=testTopology['server'])
- client_ip = client_instance.networks.get(TESTCASE_CONFIG.net_name)[0]
- logger.info("Client instance received private ip [{}]".format(client_ip))
- server_ip = server_instance.networks.get(TESTCASE_CONFIG.net_name)[0]
+ server_ip = server_instance.ports[0].ips[0]['ip_address']
logger.info("Server instance received private ip [{}]".format(server_ip))
os_sfc_utils.register_vim(tacker_client, vim_file=COMMON_CONFIG.vim_file)
@@ -178,10 +169,6 @@ def main():
logger.error('ERROR while booting vnfs')
sys.exit(1)
- vnf1_instance_id = os_sfc_utils.get_nova_id(tacker_client, 'VDU1', vnf1_id)
-
- vnf2_instance_id = os_sfc_utils.get_nova_id(tacker_client, 'VDU1', vnf2_id)
-
tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir,
COMMON_CONFIG.vnffgd_dir,
TESTCASE_CONFIG.test_vnffgd_red)
@@ -190,11 +177,11 @@ def main():
tosca_file=tosca_file,
vnffgd_name='red')
- neutron_port = os_sfc_utils.get_client_port_id(client_instance)
+ neutron_port = openstack_sfc.get_client_port_id(client_instance)
os_sfc_utils.create_vnffg_with_param_file(tacker_client, 'red',
'red_http',
default_param_file,
- neutron_port)
+ neutron_port.id)
# Start measuring the time it takes to implement the classification rules
t1 = threading.Thread(target=odl_utils.wait_for_classification_rules,
@@ -205,19 +192,20 @@ def main():
logger.error("Unable to start the thread that counts time %s" % e)
logger.info("Assigning floating IPs to instances")
- server_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, server_instance.id)
- client_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, client_instance.id)
- sf1_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, vnf1_instance_id)
- sf2_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, vnf2_instance_id)
-
- for ip in (server_floating_ip,
- client_floating_ip,
- sf1_floating_ip,
- sf2_floating_ip):
+ client_floating_ip = openstack_sfc.assign_floating_ip(router,
+ client_instance,
+ client_creator)
+ server_floating_ip = openstack_sfc.assign_floating_ip(router,
+ server_instance,
+ server_creator)
+ fips_sfs = openstack_sfc.assign_floating_ip_vnfs(router)
+ sf1_floating_ip = fips_sfs[0]
+ sf2_floating_ip = fips_sfs[1]
+
+ fips = [client_floating_ip, server_floating_ip, sf1_floating_ip,
+ sf2_floating_ip]
+
+ for ip in fips:
logger.info("Checking connectivity towards floating IP [%s]" % ip)
if not test_utils.ping(ip, retries=50, retry_timeout=3):
logger.error("Cannot ping floating IP [%s]" % ip)
@@ -287,7 +275,7 @@ def main():
ovs_logger, controller_clients, compute_clients, error)
results.add_to_summary(2, "FAIL", "HTTP not blocked")
- return results.compile_summary()
+ return results.compile_summary(), openstack_sfc.creators
if __name__ == '__main__':
diff --git a/sfc/tests/functest/sfc_symmetric_chain.py b/sfc/tests/functest/sfc_symmetric_chain.py
index 75ea43f1..b8d35514 100644
--- a/sfc/tests/functest/sfc_symmetric_chain.py
+++ b/sfc/tests/functest/sfc_symmetric_chain.py
@@ -14,8 +14,8 @@ import sys
import threading
import logging
-import sfc.lib.openstack_utils as os_tacker
-import functest.utils.openstack_utils as os_utils
+import sfc.lib.openstack_utils as os_sfc_utils
+import sfc.lib.odl_utils as odl_utils
import opnfv.utils.ovs_logger as ovs_log
from opnfv.deployment.factory import Factory as DeploymentFactory
@@ -49,26 +49,23 @@ def main():
controller_nodes = [node for node in all_nodes if node.is_controller()]
compute_nodes = [node for node in all_nodes if node.is_compute()]
- odl_ip, odl_port = test_utils.get_odl_ip_port(all_nodes)
+ odl_ip, odl_port = odl_utils.get_odl_ip_port(all_nodes)
results = Results(COMMON_CONFIG.line_length)
results.add_to_summary(0, "=")
results.add_to_summary(2, "STATUS", "SUBTEST")
results.add_to_summary(0, "=")
- test_utils.download_image(COMMON_CONFIG.url, COMMON_CONFIG.image_path)
+ openstack_sfc = os_sfc_utils.OpenStackSFC()
- neutron_client = os_utils.get_neutron_client()
- nova_client = os_utils.get_nova_client()
- tacker_client = os_tacker.get_tacker_client()
+ tacker_client = os_sfc_utils.get_tacker_client()
- _, custom_flavor_id = os_utils.get_or_create_flavor(
+ _, custom_flavor = openstack_sfc.get_or_create_flavor(
COMMON_CONFIG.flavor,
COMMON_CONFIG.ram_size_in_mb,
COMMON_CONFIG.disk_size_in_gb,
- COMMON_CONFIG.vcpu_count,
- public=True)
- if custom_flavor_id is None:
+ COMMON_CONFIG.vcpu_count)
+ if custom_flavor is None:
logger.error("Failed to create custom flavor")
sys.exit(1)
@@ -79,52 +76,38 @@ def main():
os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'),
COMMON_CONFIG.functest_results_dir)
- image_id = os_utils.create_glance_image(
- os_utils.get_glance_client(),
+ image_creator = openstack_sfc.register_glance_image(
COMMON_CONFIG.image_name,
- COMMON_CONFIG.image_path,
+ COMMON_CONFIG.image_url,
COMMON_CONFIG.image_format,
- public='public')
+ 'public')
- network_id = test_utils.setup_neutron(
- neutron_client,
+ network, router = openstack_sfc.create_network_infrastructure(
TESTCASE_CONFIG.net_name,
TESTCASE_CONFIG.subnet_name,
- TESTCASE_CONFIG.router_name,
- TESTCASE_CONFIG.subnet_cidr)
+ TESTCASE_CONFIG.subnet_cidr,
+ TESTCASE_CONFIG.router_name)
- sg_id = test_utils.create_security_groups(
- neutron_client,
- TESTCASE_CONFIG.secgroup_name,
- TESTCASE_CONFIG.secgroup_descr)
+ sg = openstack_sfc.create_security_group(TESTCASE_CONFIG.secgroup_name)
vnf_name = 'testVNF1'
# Using seed=0 uses the baseline topology: everything in the same host
- testTopology = topo_shuffler.topology([vnf_name], seed=0)
+ testTopology = topo_shuffler.topology([vnf_name], openstack_sfc, seed=0)
logger.info('This test is run with the topology {0}'
.format(testTopology['id']))
logger.info('Topology description: {0}'
.format(testTopology['description']))
- client_instance = test_utils.create_instance(
- nova_client,
- CLIENT,
- COMMON_CONFIG.flavor,
- image_id,
- network_id,
- sg_id,
- av_zone=testTopology[CLIENT])
-
- server_instance = test_utils.create_instance(
- nova_client,
- SERVER,
- COMMON_CONFIG.flavor,
- image_id,
- network_id,
- sg_id,
- av_zone=testTopology[SERVER])
+ client_instance, client_creator = openstack_sfc.create_instance(
+ CLIENT, COMMON_CONFIG.flavor, image_creator, network, sg,
+ av_zone=testTopology['client'])
- server_ip = server_instance.networks.get(TESTCASE_CONFIG.net_name)[0]
+ server_instance, server_creator = openstack_sfc.create_instance(
+ SERVER, COMMON_CONFIG.flavor, image_creator, network, sg,
+ av_zone=testTopology['server'])
+
+ server_ip = server_instance.ports[0].ips[0]['ip_address']
+ logger.info("Server instance received private ip [{}]".format(server_ip))
tosca_file = os.path.join(
COMMON_CONFIG.sfc_test_dir,
@@ -136,7 +119,7 @@ def main():
COMMON_CONFIG.vnfd_dir,
COMMON_CONFIG.vnfd_default_params_file)
- os_tacker.create_vnfd(tacker_client, tosca_file=tosca_file)
+ os_sfc_utils.create_vnfd(tacker_client, tosca_file=tosca_file)
test_utils.create_vnf_in_av_zone(
tacker_client,
vnf_name,
@@ -144,21 +127,18 @@ def main():
default_param_file,
testTopology[vnf_name])
- vnf_id = os_tacker.wait_for_vnf(tacker_client, vnf_name=vnf_name)
+ vnf_id = os_sfc_utils.wait_for_vnf(tacker_client, vnf_name=vnf_name)
if vnf_id is None:
logger.error('ERROR while booting VNF')
sys.exit(1)
- vnf_instance_id = test_utils.get_nova_id(tacker_client, 'vdu1', vnf_id)
- os_utils.add_secgroup_to_instance(nova_client, vnf_instance_id, sg_id)
-
- os_tacker.create_sfc(
+ os_sfc_utils.create_sfc(
tacker_client,
sfc_name='red',
chain_vnf_names=[vnf_name],
symmetrical=True)
- os_tacker.create_sfc_classifier(
+ os_sfc_utils.create_sfc_classifier(
tacker_client, 'red_http', sfc_name='red',
match={
'source_port': 0,
@@ -169,7 +149,7 @@ def main():
# FIXME: JIRA SFC-86
# Tacker does not allow to specify the direction of the chain to be used,
# only references the SFP (which for symmetric chains results in two RSPs)
- os_tacker.create_sfc_classifier(
+ os_sfc_utils.create_sfc_classifier(
tacker_client, 'red_http_reverse', sfc_name='red',
match={
'source_port': 80,
@@ -181,7 +161,7 @@ def main():
logger.info(test_utils.run_cmd('tacker sfc-classifier-list'))
# Start measuring the time it takes to implement the classification rules
- t1 = threading.Thread(target=test_utils.wait_for_classification_rules,
+ t1 = threading.Thread(target=odl_utils.wait_for_classification_rules,
args=(ovs_logger, compute_nodes, odl_ip, odl_port,))
try:
@@ -190,14 +170,18 @@ def main():
logger.error("Unable to start the thread that counts time %s" % e)
logger.info("Assigning floating IPs to instances")
- server_floating_ip = test_utils.assign_floating_ip(
- nova_client, neutron_client, server_instance.id)
- client_floating_ip = test_utils.assign_floating_ip(
- nova_client, neutron_client, client_instance.id)
- sf_floating_ip = test_utils.assign_floating_ip(
- nova_client, neutron_client, vnf_instance_id)
-
- for ip in (server_floating_ip, client_floating_ip, sf_floating_ip):
+ client_floating_ip = openstack_sfc.assign_floating_ip(router,
+ client_instance,
+ client_creator)
+ server_floating_ip = openstack_sfc.assign_floating_ip(router,
+ server_instance,
+ server_creator)
+ fips_sfs = openstack_sfc.assign_floating_ip_vnfs(router)
+ sf_floating_ip = fips_sfs[0]
+
+ fips = [client_floating_ip, server_floating_ip, fips_sfs[0]]
+
+ for ip in fips:
logger.info("Checking connectivity towards floating IP [%s]" % ip)
if not test_utils.ping(ip, retries=50, retry_timeout=3):
logger.error("Cannot ping floating IP [%s]" % ip)
@@ -243,7 +227,7 @@ def main():
ovs_logger, controller_clients, compute_clients, error)
results.add_to_summary(2, "FAIL", "HTTP Blocked")
- return results.compile_summary()
+ return results.compile_summary(), openstack_sfc.creators
if __name__ == '__main__':
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 5a5645df..d7eb2994 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -15,7 +15,6 @@ import logging
import sfc.lib.openstack_utils as os_sfc_utils
import sfc.lib.odl_utils as odl_utils
-import functest.utils.openstack_utils as os_utils
import opnfv.utils.ovs_logger as ovs_log
import sfc.lib.config as sfc_config
@@ -78,20 +77,17 @@ def main():
results.add_to_summary(2, "STATUS", "SUBTEST")
results.add_to_summary(0, "=")
- test_utils.download_image(COMMON_CONFIG.url,
- COMMON_CONFIG.image_path)
- _, custom_flv_id = os_utils.get_or_create_flavor(
+ openstack_sfc = os_sfc_utils.OpenStackSFC()
+
+ custom_flv = openstack_sfc.create_flavor(
COMMON_CONFIG.flavor,
COMMON_CONFIG.ram_size_in_mb,
COMMON_CONFIG.disk_size_in_gb,
- COMMON_CONFIG.vcpu_count, public=True)
- if not custom_flv_id:
+ COMMON_CONFIG.vcpu_count)
+ if not custom_flv:
logger.error("Failed to create custom flavor")
sys.exit(1)
- glance_client = os_utils.get_glance_client()
- neutron_client = os_utils.get_neutron_client()
- nova_client = os_utils.get_nova_client()
tacker_client = os_sfc_utils.get_tacker_client()
controller_clients = test_utils.get_ssh_clients(controller_nodes)
@@ -101,41 +97,40 @@ def main():
os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'),
COMMON_CONFIG.functest_results_dir)
- image_id = os_utils.create_glance_image(glance_client,
- COMMON_CONFIG.image_name,
- COMMON_CONFIG.image_path,
- COMMON_CONFIG.image_format,
- public='public')
+ image_creator = openstack_sfc.register_glance_image(
+ COMMON_CONFIG.image_name,
+ COMMON_CONFIG.image_url,
+ COMMON_CONFIG.image_format,
+ 'public')
- network_id = os_sfc_utils.setup_neutron(neutron_client,
- TESTCASE_CONFIG.net_name,
- TESTCASE_CONFIG.subnet_name,
- TESTCASE_CONFIG.router_name,
- TESTCASE_CONFIG.subnet_cidr)
+ network, router = openstack_sfc.create_network_infrastructure(
+ TESTCASE_CONFIG.net_name,
+ TESTCASE_CONFIG.subnet_name,
+ TESTCASE_CONFIG.subnet_cidr,
+ TESTCASE_CONFIG.router_name)
- sg_id = os_sfc_utils.create_security_groups(neutron_client,
- TESTCASE_CONFIG.secgroup_name,
- TESTCASE_CONFIG.secgroup_descr)
+ sg = openstack_sfc.create_security_group(TESTCASE_CONFIG.secgroup_name)
vnf_names = ['testVNF1', 'testVNF2']
topo_seed = topo_shuffler.get_seed() # change to None for nova av zone
- testTopology = topo_shuffler.topology(vnf_names, seed=topo_seed)
+ testTopology = topo_shuffler.topology(vnf_names, openstack_sfc,
+ seed=topo_seed)
logger.info('This test is run with the topology {0}'
.format(testTopology['id']))
logger.info('Topology description: {0}'
.format(testTopology['description']))
- client_instance = os_sfc_utils.create_instance(
- nova_client, CLIENT, COMMON_CONFIG.flavor, image_id,
- network_id, sg_id, av_zone=testTopology['client'])
+ client_instance, client_creator = openstack_sfc.create_instance(
+ CLIENT, COMMON_CONFIG.flavor, image_creator, network, sg,
+ av_zone=testTopology['client'])
- server_instance = os_sfc_utils.create_instance(
- nova_client, SERVER, COMMON_CONFIG.flavor, image_id,
- network_id, sg_id, av_zone=testTopology['server'])
+ server_instance, server_creator = openstack_sfc.create_instance(
+ SERVER, COMMON_CONFIG.flavor, image_creator, network, sg,
+ av_zone=testTopology['server'])
- server_ip = server_instance.networks.get(TESTCASE_CONFIG.net_name)[0]
+ server_ip = server_instance.ports[0].ips[0]['ip_address']
os_sfc_utils.register_vim(tacker_client, vim_file=COMMON_CONFIG.vim_file)
@@ -172,10 +167,6 @@ def main():
logger.error('ERROR while booting vnfs')
sys.exit(1)
- vnf1_instance_id = os_sfc_utils.get_nova_id(tacker_client, 'VDU1', vnf1_id)
-
- vnf2_instance_id = os_sfc_utils.get_nova_id(tacker_client, 'VDU1', vnf2_id)
-
tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir,
COMMON_CONFIG.vnffgd_dir,
TESTCASE_CONFIG.test_vnffgd_red)
@@ -184,11 +175,11 @@ def main():
tosca_file=tosca_file,
vnffgd_name='red')
- neutron_port = os_sfc_utils.get_client_port_id(client_instance)
+ neutron_port = openstack_sfc.get_client_port_id(client_instance)
os_sfc_utils.create_vnffg_with_param_file(tacker_client, 'red',
'red_http',
default_param_file,
- neutron_port)
+ neutron_port.id)
# Start measuring the time it takes to implement the classification rules
t1 = threading.Thread(target=odl_utils.wait_for_classification_rules,
@@ -200,19 +191,20 @@ def main():
logger.error("Unable to start the thread that counts time %s" % e)
logger.info("Assigning floating IPs to instances")
- server_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, server_instance.id)
- client_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, client_instance.id)
- sf1_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, vnf1_instance_id)
- sf2_floating_ip = os_sfc_utils.assign_floating_ip(
- nova_client, neutron_client, vnf2_instance_id)
-
- for ip in (server_floating_ip,
- client_floating_ip,
- sf1_floating_ip,
- sf2_floating_ip):
+ client_floating_ip = openstack_sfc.assign_floating_ip(router,
+ client_instance,
+ client_creator)
+ server_floating_ip = openstack_sfc.assign_floating_ip(router,
+ server_instance,
+ server_creator)
+ fips_sfs = openstack_sfc.assign_floating_ip_vnfs(router)
+ sf1_floating_ip = fips_sfs[0]
+ sf2_floating_ip = fips_sfs[1]
+
+ fips = [client_floating_ip, server_floating_ip, sf1_floating_ip,
+ sf2_floating_ip]
+
+ for ip in fips:
logger.info("Checking connectivity towards floating IP [%s]" % ip)
if not test_utils.ping(ip, retries=50, retry_timeout=3):
logger.error("Cannot ping floating IP [%s]" % ip)
@@ -309,7 +301,7 @@ def main():
ovs_logger, controller_clients, compute_clients, error)
results.add_to_summary(2, "FAIL", "SSH works")
- return results.compile_summary()
+ return results.compile_summary(), openstack_sfc.creators
if __name__ == '__main__':