summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--requirements.txt1
-rw-r--r--setup.cfg6
-rw-r--r--sfc/lib/config.py1
-rw-r--r--sfc/lib/openstack_utils.py33
-rw-r--r--sfc/tests/functest/run_sfc_tests.py10
-rw-r--r--sfc/tests/functest/sfc_chain_deletion.py3
-rw-r--r--sfc/tests/functest/sfc_one_chain_two_service_functions.py3
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py3
8 files changed, 36 insertions, 24 deletions
diff --git a/requirements.txt b/requirements.txt
index dce5e2e0..93511b97 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,3 +12,4 @@ python-tackerclient>=0.8.0 # Apache-2.0
PyYAML>=3.10.0 # MIT
opnfv
snaps
+xtesting # Apache-2.0
diff --git a/setup.cfg b/setup.cfg
index 8e5f6230..51ea1095 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,5 +5,7 @@ home-page = https://wiki.opnfv.org/display/sfc/Service+Function+Chaining+Home
[files]
packages = sfc
-scripts =
- sfc/tests/functest/run_sfc_tests.py
+
+[entry_points]
+console_scripts =
+ run_sfc_tests = sfc.tests.functest.run_sfc_tests:main
diff --git a/sfc/lib/config.py b/sfc/lib/config.py
index 6ced2763..5ee3077a 100644
--- a/sfc/lib/config.py
+++ b/sfc/lib/config.py
@@ -31,7 +31,6 @@ class CommonConfig(object):
def __init__(self):
self.line_length = 30
- self.test_db = os.environ['TEST_DB_URL']
self.functest_repo_path = os.path.dirname(functest.__file__)
self.functest_logging_api = os.path.join(self.functest_repo_path,
"ci", "logging.ini")
diff --git a/sfc/lib/openstack_utils.py b/sfc/lib/openstack_utils.py
index 535870da..e127e8d2 100644
--- a/sfc/lib/openstack_utils.py
+++ b/sfc/lib/openstack_utils.py
@@ -30,7 +30,7 @@ import snaps.openstack.create_instance as cr_inst
from snaps.config.vm_inst import VmInstanceConfig, FloatingIpConfig
from snaps.openstack.utils import (
- nova_utils, neutron_utils, glance_utils, heat_utils, keystone_utils)
+ nova_utils, neutron_utils, heat_utils, keystone_utils)
logger = logging.getLogger(__name__)
DEFAULT_TACKER_API_VERSION = '1.0'
@@ -44,8 +44,8 @@ class OpenStackSFC:
self.creators = []
self.nova = nova_utils.nova_client(self.os_creds)
self.neutron = neutron_utils.neutron_client(self.os_creds)
- self.glance = glance_utils.glance_client(self.os_creds)
self.heat = heat_utils.heat_client(self.os_creds)
+ self.keystone = keystone_utils.keystone_client(self.os_creds)
def register_glance_image(self, name, url, img_format, public):
image_settings = ImageConfig(name=name, img_format=img_format, url=url,
@@ -159,11 +159,10 @@ class OpenStackSFC:
'''
for creator in self.creators:
# We want to filter the vm creators
- if hasattr(creator, 'get_vm_info'):
- vm_info = creator.get_vm_info()
+ if hasattr(creator, 'get_vm_inst'):
# We want to fetch only the client
- if vm_info['name'] == 'client':
- return vm_info['OS-EXT-SRV-ATTR:host']
+ if creator.get_vm_inst().name == 'client':
+ return creator.get_vm_inst().compute_host
raise Exception("There is no client VM!!")
@@ -187,14 +186,18 @@ class OpenStackSFC:
'''
stacks = self.heat.stacks.list()
fips = []
+ project_name = 'admin'
for stack in stacks:
servers = heat_utils.get_stack_servers(self.heat,
self.nova,
self.neutron,
- stack)
+ self.keystone,
+ stack,
+ project_name)
sf_creator = cr_inst.generate_creator(self.os_creds,
servers[0],
- self.image_settings)
+ self.image_settings,
+ project_name)
port_name = servers[0].ports[0].name
name = servers[0].name + "-float"
float_ip = FloatingIpConfig(name=name,
@@ -206,13 +209,19 @@ class OpenStackSFC:
return fips
- def get_client_port_id(self, vm):
+ def get_client_port(self, vm, vm_creator):
'''
Get the neutron port id of the client
'''
- port_id = neutron_utils.get_port(self.neutron,
- port_name=vm.name + "-port")
- return port_id
+ port_name = vm.name + "-port"
+ port = vm_creator.get_port_by_name(port_name)
+ if port is not None:
+ return port
+ else:
+ logger.error("The VM {0} does not have any port"
+ " with name {1}".format(vm_name, port_name))
+ raise Exception("Client VM does not have the desired port")
+
# TACKER SECTION #
diff --git a/sfc/tests/functest/run_sfc_tests.py b/sfc/tests/functest/run_sfc_tests.py
index 2767c870..6c4a86d3 100644
--- a/sfc/tests/functest/run_sfc_tests.py
+++ b/sfc/tests/functest/run_sfc_tests.py
@@ -11,10 +11,10 @@
import importlib
import os
import time
-import sys
import yaml
+import sys
-from functest.core import testcase
+from xtesting.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
@@ -186,9 +186,7 @@ class SfcFunctest(testcase.TestCase):
return testcase.TestCase.EX_RUN_ERROR
-
-if __name__ == '__main__':
- logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s'
- '- %(levelname)s - %(message)s')
+def main():
+ logging.basicConfig(level=logging.INFO)
SFC = SfcFunctest()
sys.exit(SFC.run())
diff --git a/sfc/tests/functest/sfc_chain_deletion.py b/sfc/tests/functest/sfc_chain_deletion.py
index 51c47c42..cef56761 100644
--- a/sfc/tests/functest/sfc_chain_deletion.py
+++ b/sfc/tests/functest/sfc_chain_deletion.py
@@ -155,7 +155,8 @@ def main():
logger.error('ERROR while booting vnfs')
sys.exit(1)
- neutron_port = openstack_sfc.get_client_port_id(client_instance)
+ neutron_port = openstack_sfc.get_client_port(client_instance,
+ client_creator)
odl_utils.create_chain(tacker_client, default_param_file, neutron_port,
COMMON_CONFIG, TESTCASE_CONFIG)
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 11b67691..58323bf3 100644
--- a/sfc/tests/functest/sfc_one_chain_two_service_functions.py
+++ b/sfc/tests/functest/sfc_one_chain_two_service_functions.py
@@ -177,7 +177,8 @@ def main():
tosca_file=tosca_file,
vnffgd_name='red')
- neutron_port = openstack_sfc.get_client_port_id(client_instance)
+ neutron_port = openstack_sfc.get_client_port(client_instance,
+ client_creator)
os_sfc_utils.create_vnffg_with_param_file(tacker_client, 'red',
'red_http',
default_param_file,
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 9b7d011a..5c5abb33 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -175,7 +175,8 @@ def main():
tosca_file=tosca_file,
vnffgd_name='red')
- neutron_port = openstack_sfc.get_client_port_id(client_instance)
+ neutron_port = openstack_sfc.get_client_port(client_instance,
+ client_creator)
os_sfc_utils.create_vnffg_with_param_file(tacker_client, 'red',
'red_http',
default_param_file,