aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile26
-rwxr-xr-xfunctest/ci/generate_report.py4
-rwxr-xr-xfunctest/ci/prepare_env.py3
-rw-r--r--functest/cli/commands/cli_os.py9
-rwxr-xr-xfunctest/opnfv_tests/features/domino.py6
-rwxr-xr-xfunctest/opnfv_tests/openstack/examples/create_instance_and_ip.py5
-rwxr-xr-xfunctest/opnfv_tests/openstack/tempest/gen_tempest_conf.py14
-rwxr-xr-xfunctest/opnfv_tests/openstack/tempest/run_tempest.py5
-rw-r--r--functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py186
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/environment.py2
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py3
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestrator.py4
-rw-r--r--functest/utils/functest_constants.py415
-rw-r--r--functest/utils/functest_vacation.py8
-rwxr-xr-xfunctest/utils/openstack_clean.py121
-rwxr-xr-xfunctest/utils/openstack_snapshot.py53
-rw-r--r--functest/utils/openstack_tacker.py2
17 files changed, 519 insertions, 347 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index cb2752bad..6bdfe5ce6 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -56,26 +56,26 @@ WORKDIR ${HOME}
# Packaged dependencies
RUN apt-get update && apt-get install -y \
-ssh \
-sshpass \
+build-essential \
+bundler \
+crudini \
curl \
-git \
gcc \
-wget \
+git \
+libffi-dev \
+libgmp3-dev \
+libpq-dev \
+libssl-dev \
+libxml2-dev \
+libxslt-dev \
python-dev \
python-mock \
python-pip \
-bundler \
postgresql \
-build-essential \
-libpq-dev \
-libxslt-dev \
-libssl-dev \
-libgmp3-dev \
-libxml2-dev \
-libffi-dev \
-crudini \
ruby1.9.1-dev \
+ssh \
+sshpass \
+wget \
--no-install-recommends
RUN pip install --upgrade pip
diff --git a/functest/ci/generate_report.py b/functest/ci/generate_report.py
index 9ae9dca5b..a90bc5553 100755
--- a/functest/ci/generate_report.py
+++ b/functest/ci/generate_report.py
@@ -41,8 +41,8 @@ def init(tiers_to_run):
def get_results_from_db():
- url = ft_utils.get_db_url() + '/results?build_tag=' \
- + GlobalVariables.BUILD_TAG
+ url = "%s/results?build_tag=%s" % (ft_utils.get_db_url(),
+ GlobalVariables.BUILD_TAG)
logger.debug("Query to rest api: %s" % url)
try:
data = json.load(urllib2.urlopen(url))
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index 246a02a85..3a99d3bac 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -124,8 +124,7 @@ def source_rc_file():
logger.warning("The environment variable 'creds' must be set and"
"pointing to the local RC file. Using default: "
"/home/opnfv/functest/conf/openstack.creds ...")
- ft_constants.OPENSTACK_CREDS = \
- "/home/opnfv/functest/conf/openstack.creds"
+ os.path.join(ft_constants.FUNCTEST_CONF_DIR, 'openstack.creds')
if not os.path.isfile(ft_constants.OPENSTACK_CREDS):
logger.info("RC file not provided. "
diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py
index 140be1917..bb8592195 100644
--- a/functest/cli/commands/cli_os.py
+++ b/functest/cli/commands/cli_os.py
@@ -68,10 +68,11 @@ class CliOpenStack:
if CI_INSTALLER_IP is None:
click.echo("The environment variable 'INSTALLER_IP' is not"
"defined. Please export it")
- cmd = ft_constants.REPOS_DIR + \
- ("/releng/utils/fetch_os_creds.sh "
- "-d %s -i %s -a %s"
- % (OPENSTACK_RC_FILE, CI_INSTALLER_TYPE, CI_INSTALLER_IP))
+ cmd = ("%s/releng/utils/fetch_os_creds.sh -d %s -i %s -a %s"
+ % (ft_constants.REPOS_DIR,
+ OPENSTACK_RC_FILE,
+ CI_INSTALLER_TYPE,
+ CI_INSTALLER_IP))
click.echo("Fetching credentials from installer node '%s' with IP=%s.."
% (CI_INSTALLER_TYPE, CI_INSTALLER_IP))
ft_utils.execute_command(cmd, verbose=False)
diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py
index 45b93e7b7..341648f4b 100755
--- a/functest/opnfv_tests/features/domino.py
+++ b/functest/opnfv_tests/features/domino.py
@@ -26,10 +26,8 @@ import functest.utils.functest_utils as ft_utils
class DominoCases(testcase_base.TestcaseBase):
- DOMINO_REPO = \
- ft_constants.DOMINO_REPO_DIR
- RESULTS_DIR = \
- ft_constants.FUNCTEST_RESULTS_DIR
+ DOMINO_REPO = ft_constants.DOMINO_REPO_DIR
+ RESULTS_DIR = ft_constants.FUNCTEST_RESULTS_DIR
logger = ft_logger.Logger("domino").getLogger()
def __init__(self):
diff --git a/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py b/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py
index 6a2abe609..b4e2e519b 100755
--- a/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py
+++ b/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py
@@ -11,7 +11,9 @@
#
import argparse
+import os
import sys
+
import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
import functest.utils.functest_constants as ft_constants
@@ -36,8 +38,7 @@ EXAMPLE_FLAVOR = ft_constants.EXAMPLE_FLAVOR
EXAMPLE_IMAGE_NAME = ft_constants.EXAMPLE_IMAGE_NAME
IMAGE_FILENAME = ft_constants.GLANCE_IMAGE_FILENAME
IMAGE_FORMAT = ft_constants.GLANCE_IMAGE_FORMAT
-IMAGE_PATH = ft_constants.FUNCTEST_DATA_DIR + \
- "/" + IMAGE_FILENAME
+IMAGE_PATH = os.path.join(ft_constants.FUNCTEST_DATA_DIR, IMAGE_FILENAME)
# NEUTRON Private Network parameters
diff --git a/functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py b/functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py
index 8e298d36e..1216a671d 100755
--- a/functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py
+++ b/functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py
@@ -50,8 +50,8 @@ def configure_tempest_multisite(deployment_dir):
config.read(tempest_conf_file)
config.set('service_available', 'kingbird', 'true')
- cmd = "openstack endpoint show kingbird | grep publicurl |\
- awk '{print $4}' | awk -F '/' '{print $4}'"
+ cmd = ("openstack endpoint show kingbird | grep publicurl |"
+ "awk '{print $4}' | awk -F '/' '{print $4}'")
kingbird_api_version = os.popen(cmd).read()
if CI_INSTALLER_TYPE == 'fuel':
# For MOS based setup, the service is accessible
@@ -66,8 +66,8 @@ def configure_tempest_multisite(deployment_dir):
"multisite." + installer_type +
"_environment.installer_password")
- ssh_options = "-o UserKnownHostsFile=/dev/null -o \
- StrictHostKeyChecking=no"
+ ssh_options = ("-o UserKnownHostsFile=/dev/null -o "
+ "StrictHostKeyChecking=no")
# Get the controller IP from the fuel node
cmd = 'sshpass -p %s ssh 2>/dev/null %s %s@%s \
@@ -76,8 +76,7 @@ def configure_tempest_multisite(deployment_dir):
ssh_options,
installer_username,
installer_ip)
- multisite_controller_ip = \
- "".join(os.popen(cmd).read().split())
+ multisite_controller_ip = "".join(os.popen(cmd).read().split())
# Login to controller and get bind host details
cmd = 'sshpass -p %s ssh 2>/dev/null %s %s@%s "ssh %s \\" \
@@ -94,8 +93,7 @@ def configure_tempest_multisite(deployment_dir):
# Extract ip address from the bind details
bind_host = re.findall(r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}",
bind_details)[0]
- kingbird_endpoint_url = "http://" + bind_host + ":" + bind_port + \
- "/"
+ kingbird_endpoint_url = "http://%s:%s/" % (bind_host, bind_port)
else:
cmd = "openstack endpoint show kingbird | grep publicurl |\
awk '{print $4}' | awk -F '/' '{print $3}'"
diff --git a/functest/opnfv_tests/openstack/tempest/run_tempest.py b/functest/opnfv_tests/openstack/tempest/run_tempest.py
index cbf92c1f6..6406cd193 100755
--- a/functest/opnfv_tests/openstack/tempest/run_tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/run_tempest.py
@@ -62,8 +62,9 @@ logger = ft_logger.Logger("run_tempest").getLogger()
GLANCE_IMAGE_NAME = ft_constants.GLANCE_IMAGE_NAME
GLANCE_IMAGE_FILENAME = ft_constants.GLANCE_IMAGE_FILENAME
GLANCE_IMAGE_FORMAT = ft_constants.GLANCE_IMAGE_FORMAT
-GLANCE_IMAGE_PATH = ft_constants.FUNCTEST_DATA_DIR + \
- "/" + GLANCE_IMAGE_FILENAME
+GLANCE_IMAGE_PATH = os.path.join(ft_constants.FUNCTEST_DATA_DIR,
+ GLANCE_IMAGE_FILENAME)
+
IMAGE_ID_ALT = None
FLAVOR_NAME = ft_constants.FLAVOR_NAME
diff --git a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
index 78bf6f4b8..8ca32e9bb 100644
--- a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
+++ b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
@@ -57,8 +57,8 @@ class SfcOnos:
self.container_format = "bare"
self.disk_format = "qcow2"
self.imagename = "TestSfcVm"
- self.createImage = "/home/root1/devstack/files/images/\
- firewall_block_image.img"
+ self.createImage = ("/home/root1/devstack/files/images/"
+ "firewall_block_image.img")
self.vm_name = "vm"
self.imageRef = "test"
@@ -107,10 +107,10 @@ class SfcOnos:
def getToken(self):
"""Get the keystone token value from Openstack ."""
- url = 'http://' + self.keystone_hostname + \
- ':5000/' + self.osver + '/tokens'
- data = '{"auth": {"tenantName": "admin", "passwordCredentials":\
- { "username": "admin", "password": "console"}}}'
+ url = 'http://%s:5000/%s/tokens' % (self.keystone_hostname,
+ self.osver)
+ data = ('{"auth": {"tenantName": "admin", "passwordCredentials":'
+ '{ "username": "admin", "password": "console"}}}')
headers = {"Accept": "application/json"}
response = requests.post(url, headers=headers, data=data)
if (response.status_code == OK):
@@ -133,8 +133,8 @@ class SfcOnos:
Dicdata['admin_state_up'] = self.admin_state_up
Dicdata = {'network': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + \
- ':9696/' + self.osver + '/networks'
+ url = 'http://%s:9696/%s/networks' % (self.neutron_hostname,
+ self.osver)
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -163,8 +163,8 @@ class SfcOnos:
Dicdata = {'subnet': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + \
- ':9696/' + self.osver + '/subnets'
+ url = 'http://%s:9696/%s/subnets' % (self.neutron_hostname,
+ self.osver)
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -196,8 +196,8 @@ class SfcOnos:
Dicdata = {'port': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + \
- ':9696/' + self.osver + '/ports'
+ url = 'http://%s:9696/%s/ports' % (self.neutron_hostname,
+ self.osver)
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -217,8 +217,8 @@ class SfcOnos:
def createVm(self):
"""Creation of Instance, using firewall image."""
- url = 'http://' + self.glance_hostname + \
- ':9292/v2/images?name=TestSfcVm'
+ url = ("http://%s:9292/v2/images?"
+ "name=TestSfcVm" % (self.glance_hostname))
headers = {"Accept": "application/json", "Content-Type": "application/\
octet-stream", "X-Auth-Token": self.token_id}
response = requests.get(url, headers=headers)
@@ -232,8 +232,10 @@ class SfcOnos:
else:
return(response.status_code)
- url = 'http://' + self.nova_hostname + \
- ':8774/v2.1/' + self.tenant_id + '/flavors?name=m1.tiny'
+ url = ("http://%s:8774//v2.1/%s/ports/"
+ "%s/flavors?name=m1.tiny" % (self.nova_hostname,
+ self.tenant_id))
+
headers = {"Accept": "application/json", "Content-Type":
"application/json", "X-Auth-Token": self.token_id}
response = requests.get(url, headers=headers)
@@ -266,9 +268,8 @@ class SfcOnos:
Dicdata['networks'] = org_nw_port
Dicdata = {'server': Dicdata}
data = json.dumps(Dicdata, indent=4)
-
- url = ('http://' + self.nova_hostname + ':8774/v2.1/' +
- self.tenant_id + '/servers')
+ url = 'http://%s:8774/v2.1/%s/servers' % (self.nova_hostname,
+ self.tenant_id)
headers = {"Accept": "application/json", "Content-Type":
"application/json", "X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -291,9 +292,8 @@ class SfcOnos:
"""Checking the Status of the Instance."""
time.sleep(10)
for y in range(0, 3):
- url = 'http://' + \
- self.nova_hostname + \
- ':8774/v2.1/servers/detail?name=vm' + str(y)
+ url = ("http://%s:8774/v2.1/servers/"
+ "detail?name=vm" + str(y)) % (self.neutron_hostname)
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.get(url, headers=headers)
@@ -304,11 +304,9 @@ class SfcOnos:
self.logger.debug(json1_data)
self.vm_active = json1_data['servers'][0]['status']
if (self.vm_active == "ACTIVE"):
- info = "VM" + str(y) + \
- " is Active : " + self.vm_active
+ info = "VM" + str(y) + " is Active : " + self.vm_active
else:
- info = "VM" + str(y) + " is NOT Active : " + \
- self.vm_active
+ info = "VM" + str(y) + " is NOT Active : " + self.vm_active
self.logger.debug(info)
else:
return(response.status_code)
@@ -329,15 +327,14 @@ class SfcOnos:
Dicdata = {'port_pair': Dicdata}
data = json.dumps(Dicdata, indent=4)
-
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_pairs'
+ url = 'http://%s:9696/%s/sfc/port_pairs' % (self.neutron_hostname,
+ self.osver)
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.post(url, headers=headers, data=data)
if (response.status_code == CREATED):
- info = "Creation of Port Pair PP" + str(p) + \
- " is successful"
+ info = ("Creation of Port Pair PP" + str(p) +
+ " is successful")
self.logger.debug(info)
else:
return(response.status_code)
@@ -347,10 +344,11 @@ class SfcOnos:
def getPortPair(self):
"""Query the Portpair id value."""
for p in range(0, 1):
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_pairs?name=PP1'
- headers = {"Accept": "application/json", "X-Auth-Token":
- self.token_id}
+ url = ("http://%s:9696/%s/ports/"
+ "sfc/port_pairs?name=PP1" % (self.neutron_hostname,
+ self.osver))
+ headers = {"Accept": "application/json",
+ "X-Auth-Token": self.token_id}
response = requests.get(url, headers=headers)
if (response.status_code == OK):
@@ -376,14 +374,15 @@ class SfcOnos:
Dicdata = {'port_pair_group': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_pair_groups'
+ url = ("http://%s:9696/%s/"
+ "sfc/port_pair_groups" % (self.neutron_hostname,
+ self.osver))
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.post(url, headers=headers, data=data)
if (response.status_code == CREATED):
- info = "Creation of Port Group PG" + str(p) + \
- "is successful"
+ info = ("Creation of Port Group PG" + str(p) +
+ "is successful")
self.logger.debug(info)
else:
return(response.status_code)
@@ -393,8 +392,9 @@ class SfcOnos:
def getPortGroup(self):
"""Query the PortGroup id."""
for p in range(0, 1):
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_pair_groups?name=PG' + str(p)
+ url = ("http://%s:9696/%s/sfc/port_pair_groups"
+ "?name=PG" + str(p)) % (self.neutron_hostname,
+ self.osver)
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.get(url, headers=headers)
@@ -425,8 +425,9 @@ class SfcOnos:
Dicdata = {'flow_classifier': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/flow_classifiers'
+ url = ("http://%s:9696/%s/"
+ "sfc/flow_classifiers" % (self.neutron_hostname,
+ self.osver))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -455,8 +456,8 @@ class SfcOnos:
Dicdata = {'port_chain': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_chains'
+ url = 'http://%s:9696/%s/sfc/port_chains' % (self.neutron_hostname,
+ self.osver)
headers = {"Accept": "application/json",
"Content-Type": "application/json",
"X-Auth-Token": self.token_id}
@@ -499,8 +500,8 @@ class SfcOnos:
Dicdata = {'router': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + \
- self.osver + '/routers.json'
+ url = 'http://%s:9696/%s/routers.json' % (self.neutron_hostname,
+ self.osver)
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -517,10 +518,10 @@ class SfcOnos:
def attachInterface(self):
"""Attachment of instance ports to the Router."""
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/networks?name=admin_floating_net'
- headers = {"Accept": "application/json",
- "X-Auth-Token": self.token_id}
+ url = ("http://%s:9696/%s/networks"
+ "?name=admin_floating_net" % (self.neutron_hostname,
+ self.osver))
+ headers = {"Accept": "application/json", "X-Auth-Token": self.token_id}
response = requests.get(url, headers=headers)
if (response.status_code == OK):
self.logger.debug(response.status_code)
@@ -540,8 +541,10 @@ class SfcOnos:
Dicdata['subnet_id'] = self.subnetId
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/routers/' + self.router_id + '/add_router_interface'
+ url = ("http://%s:9696/%s/routers"
+ "/%s/add_router_interface" % (self.neutron_hostname,
+ self.osver,
+ self.router_id))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.put(url, headers=headers, data=data)
@@ -561,8 +564,9 @@ class SfcOnos:
Dicdata1 = {'external_gateway_info': Dicdata1}
Dicdata1 = {'router': Dicdata1}
data = json.dumps(Dicdata1, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/routers/' + self.router_id
+ url = 'http://%s:9696/%s/routers/%s' % (self.neutron_hostname,
+ self.osver,
+ self.router_id)
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.put(url, headers=headers, data=data)
@@ -581,7 +585,8 @@ class SfcOnos:
Dicdata['pool'] = "admin_floating_net"
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.nova_hostname + ':8774/v2.1/os-floating-ips'
+ url = ("http://%s:8774/v2.1/"
+ "os-floating-ips" % (self.nova_hostname))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -602,8 +607,10 @@ class SfcOnos:
Dicdata1 = {'addFloatingIp': Dicdata1}
data = json.dumps(Dicdata1, indent=4)
- url = 'http://' + self.nova_hostname + ':8774/v2.1/servers/' + \
- self.vm[ip_num] + '/action'
+ url = ("http://%s:8774/v2.1/"
+ "servers/%s/action" % (self.nova_hostname,
+ self.vm[ip_num]))
+
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.post(url, headers=headers, data=data)
@@ -710,8 +717,8 @@ class SfcOnos:
def deletePortChain(self):
"""Deletion of PortChain."""
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_chains/' + self.PC_id
+ url = ('http://' + self.neutron_hostname + ':9696/' +
+ self.osver + '/sfc/port_chains/' + self.PC_id)
headers = {"Accept": "application/json", "Content-Type":
"application/json", "X-Auth-Token": self.token_id}
response = requests.delete(url, headers=headers)
@@ -724,8 +731,10 @@ class SfcOnos:
def deleteFlowClassifier(self):
"""Deletion of Flow Classifier."""
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/flow_classifiers/' + self.flow_class_if
+ url = ("http://%s:9696/%s/sfc/"
+ "flow_classifiers/%s" % (self.neutron_hostname,
+ self.osver,
+ self.flow_class_if))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.delete(url, headers=headers)
@@ -739,8 +748,10 @@ class SfcOnos:
def deletePortGroup(self):
"""Deletion of PortGroup."""
for p in range(0, 1):
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_pair_groups/' + self.port_grp_id[p]
+ url = ("http://%s:9696/%s/sfc/"
+ "port_pair_groups/%s" % (self.neutron_hostname,
+ self.osver,
+ self.port_grp_id[p]))
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.delete(url, headers=headers)
@@ -754,8 +765,10 @@ class SfcOnos:
def deletePortPair(self):
"""Deletion of Portpair."""
for p in range(1, 2):
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/sfc/port_pairs/' + self.port_pair_id[0]
+ url = ("http://%s:9696/%s/sfc/"
+ "port_pairs/%s" % (self.neutron_hostname,
+ self.osver,
+ self.port_pair_id[0]))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.delete(url, headers=headers)
@@ -770,8 +783,9 @@ class SfcOnos:
"""Cleanup."""
self.logger.info("Deleting VMs")
for y in range(0, 3):
- url = 'http://' + self.nova_hostname + \
- ':8774/v2.1/servers/' + self.vm[y]
+ url = ("http://%s:8774/v2.1/"
+ "/servers/%s" % (self.nova_hostname,
+ self.vm[y]))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.delete(url, headers=headers)
@@ -784,8 +798,8 @@ class SfcOnos:
return(response.status_code)
self.logger.info("Deleting Ports")
for x in range(self.i, self.numTerms):
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/ports/' + self.port_num[x]
+ url = ('http://' + self.neutron_hostname + ':9696/' +
+ self.osver + '/ports/' + self.port_num[x])
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.delete(url, headers=headers)
@@ -802,8 +816,10 @@ class SfcOnos:
Dicdata['external_gateway_info'] = {}
Dicdata = {'router': Dicdata}
data = json.dumps(Dicdata, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/routers/' + self.router_id
+ url = ("http://%s:9696/%s/"
+ "/routers/%s" % (self.neutron_hostname,
+ self.osver,
+ self.router_id))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.put(url, headers=headers, data=data)
@@ -814,15 +830,18 @@ class SfcOnos:
if self.subnetId != '':
Dicdata1['subnet_id'] = self.subnetId
data = json.dumps(Dicdata1, indent=4)
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/routers/' + self.router_id + \
- '/remove_router_interface.json'
+ url = ("http://%s:9696/%s/routers/%s"
+ "/remove_router_interface.json" % (self.neutron_hostname,
+ self.osver,
+ self.router_id))
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.put(url, headers=headers, data=data)
if (response.status_code == OK):
- url = ('http://' + self.neutron_hostname + ':9696/' +
- self.osver + '/routers/' + self.router_id)
+ url = ("http://%s:9696/%s/"
+ "routers/%s" % (self.neutron_hostname,
+ self.osver,
+ self.router_id))
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.delete(url, headers=headers)
@@ -837,8 +856,10 @@ class SfcOnos:
return(response.status_code)
self.logger.info("Deleting Network")
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/networks/' + self.net_id
+ url = "http://%s:9696/%s/networks/%s" % (self.neutron_hostname,
+ self.osver,
+ self.net_id)
+
headers = {"Accept": "application/json",
"X-Auth-Token": self.token_id}
response = requests.delete(url, headers=headers)
@@ -850,8 +871,11 @@ class SfcOnos:
self.logger.info("Deleting Floating ip")
for ip_num in range(0, 2):
- url = 'http://' + self.neutron_hostname + ':9696/' + self.osver + \
- '/floatingips/' + self.vm_public_id[ip_num]
+ url = ("http://%s:9696/%s/floatingips"
+ "/%s" % (self.neutron_hostname,
+ self.osver,
+ self.vm_public_id[ip_num]))
+
headers = {"Accept": "application/json", "X-Auth-Token":
self.token_id}
response = requests.delete(url, headers=headers)
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py b/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py
index 06d25b9ed..046a821d4 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py
@@ -196,7 +196,7 @@ class Environment(Connection):
def ChangeTestCasePara(self, testcase, user, password):
"""
- When running test script, there's something need \
+ When running test script, there's something need
to change in every test folder's *.param & *.topo files
user: onos&compute node user
password: onos&compute node password
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
index 52462b60a..bf2c4302c 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
@@ -26,8 +26,7 @@ class Foundation:
def __init__(self):
# currentpath = os.getcwd()
- currentpath = \
- ft_constants.FUNCTEST_TEST_DIR + '/sdn/onos/teston/ci'
+ currentpath = '%s/sdn/onos/teston/ci' % ft_constants.FUNCTEST_TEST_DIR
self.cipath = currentpath
self.logdir = os.path.join(currentpath, 'log')
self.workhome = currentpath[0: currentpath.rfind('opnfv_tests') - 1]
diff --git a/functest/opnfv_tests/vnf/ims/orchestrator.py b/functest/opnfv_tests/vnf/ims/orchestrator.py
index 5f84df006..f3838f871 100644
--- a/functest/opnfv_tests/vnf/ims/orchestrator.py
+++ b/functest/opnfv_tests/vnf/ims/orchestrator.py
@@ -138,8 +138,8 @@ class Orchestrator:
bp_name, dep_name):
self.logger.info("Downloading the {0} blueprint".format(
blueprint['file_name']))
- destination_folder = self.testcase_dir + \
- blueprint['destination_folder']
+ destination_folder = os.path.join(self.testcase_dir,
+ blueprint['destination_folder'])
download_result = self._download_blueprints(blueprint['url'],
blueprint['branch'],
destination_folder)
diff --git a/functest/utils/functest_constants.py b/functest/utils/functest_constants.py
index a686b1945..2664ace1f 100644
--- a/functest/utils/functest_constants.py
+++ b/functest/utils/functest_constants.py
@@ -60,228 +60,205 @@ def get_value(functest_config_key, env_variable):
return constant
-HOME = \
- get_value('general.directories.dir_home', 'HOME')
-REPOS_DIR = \
- get_value('general.directories.dir_repos', 'REPOS_DIR')
-FUNCTEST_BASE_DIR = \
- get_value('general.directories.dir_functest', 'FUNCTEST_BASE_DIR')
-FUNCTEST_REPO_DIR = \
- get_value('general.directories.dir_repo_functest', 'FUNCTEST_REPO_DIR')
-FUNCTEST_TEST_DIR = \
- get_value('general.directories.dir_functest_test', 'FUNCTEST_TEST_DIR')
-FUNCTEST_CONF_DIR = \
- get_value('general.directories.dir_functest_conf', 'FUNCTEST_CONF_DIR')
-FUNCTEST_DATA_DIR = \
- get_value('general.directories.dir_functest_data', 'FUNCTEST_DATA_DIR')
-FUNCTEST_RESULTS_DIR = \
- get_value('general.directories.dir_results', 'FUNCTEST_RESULTS_DIR')
-FUNCTEST_TESTCASES_YAML = \
- get_value('general.functest.testcases_yaml', 'FUNCTEST_TESTCASES_YAML')
-RALLY_DEPLOYMENT_NAME = \
- get_value('rally.deployment_name', 'RALLY_DEPLOYMENT_NAME')
-TEMPEST_REPO_DIR = \
- get_value('general.directories.dir_repo_tempest', 'TEMPEST_REPO_DIR')
+HOME = get_value('general.directories.dir_home', 'HOME')
+REPOS_DIR = get_value('general.directories.dir_repos', 'REPOS_DIR')
+FUNCTEST_BASE_DIR = get_value('general.directories.dir_functest',
+ 'FUNCTEST_BASE_DIR')
+FUNCTEST_REPO_DIR = get_value('general.directories.dir_repo_functest',
+ 'FUNCTEST_REPO_DIR')
+FUNCTEST_TEST_DIR = get_value('general.directories.dir_functest_test',
+ 'FUNCTEST_TEST_DIR')
+FUNCTEST_CONF_DIR = get_value('general.directories.dir_functest_conf',
+ 'FUNCTEST_CONF_DIR')
+FUNCTEST_DATA_DIR = get_value('general.directories.dir_functest_data',
+ 'FUNCTEST_DATA_DIR')
+FUNCTEST_RESULTS_DIR = get_value('general.directories.dir_results',
+ 'FUNCTEST_RESULTS_DIR')
+FUNCTEST_TESTCASES_YAML = get_value('general.functest.testcases_yaml',
+ 'FUNCTEST_TESTCASES_YAML')
+RALLY_DEPLOYMENT_NAME = get_value('rally.deployment_name',
+ 'RALLY_DEPLOYMENT_NAME')
+TEMPEST_REPO_DIR = get_value('general.directories.dir_repo_tempest',
+ 'TEMPEST_REPO_DIR')
ENV_FILE = os.path.join(FUNCTEST_CONF_DIR, "env_active")
-OPENSTACK_CREDS = \
- get_value('general.openstack.creds', 'creds')
-OPENSTACK_SNAPSHOT_FILE = \
- get_value('general.openstack.snapshot_file', 'OPENSTACK_SNAPSHOT_FILE')
+OPENSTACK_CREDS = get_value('general.openstack.creds', 'creds')
+OPENSTACK_SNAPSHOT_FILE = get_value('general.openstack.snapshot_file',
+ 'OPENSTACK_SNAPSHOT_FILE')
-DOMINO_REPO_DIR = \
- get_value('general.directories.dir_repo_domino', 'DOMINO_REPO_DIR')
-SDNVPN_REPO_DIR = \
- get_value('general.directories.dir_repo_sdnvpn', 'SDNVPN_REPO_DIR')
-SFC_REPO_DIR = \
- get_value('general.directories.dir_repo_sfc', 'SFC_REPO_DIR')
+DOMINO_REPO_DIR = get_value('general.directories.dir_repo_domino',
+ 'DOMINO_REPO_DIR')
+SDNVPN_REPO_DIR = get_value('general.directories.dir_repo_sdnvpn',
+ 'SDNVPN_REPO_DIR')
+SFC_REPO_DIR = get_value('general.directories.dir_repo_sfc',
+ 'SFC_REPO_DIR')
-ONOS_SFC_IMAGE_NAME = \
- get_value('onos_sfc.image_name', 'ONOS_SFC_IMAGE_NAME')
-ONOS_SFC_IMAGE_FILENAME = \
- get_value('onos_sfc.image_file_name', 'ONOS_SFC_IMAGE_FILENAME')
-ONOS_SFC_RELATIVE_PATH = \
- get_value('general.directories.dir_onos_sfc', 'ONOS_SFC_RELATIVE_PATH')
-ONOS_SFC_IMAGE_BASE_URL = \
- get_value('onos_sfc.image_base_url', 'ONOS_SFC_IMAGE_BASE_URL')
-RALLY_RELATIVE_PATH = \
- get_value('general.directories.dir_rally', 'RALLY_RELATIVE_PATH')
-RALLY_PRIVATE_NET_NAME = \
- get_value('rally.network_name', 'RALLY_PRIVATE_NET_NAME')
-RALLY_PRIVATE_SUBNET_NAME = \
- get_value('rally.subnet_name', 'RALLY_PRIVATE_SUBNET_NAME')
-RALLY_PRIVATE_SUBNET_CIDR = \
- get_value('rally.subnet_cidr', 'RALLY_PRIVATE_SUBNET_CIDR')
-RALLY_ROUTER_NAME = \
- get_value('rally.router_name', 'RALLY_ROUTER_NAME')
-RALLY_INSTALLATION_DIR = \
- get_value('general.directories.dir_rally_inst', 'RALLY_INSTALLATION_DIR')
-GLANCE_IMAGE_NAME = \
- get_value('general.openstack.image_name', 'GLANCE_IMAGE_NAME')
-GLANCE_IMAGE_FILENAME = \
- get_value('general.openstack.image_file_name', 'GLANCE_IMAGE_FILENAME')
-GLANCE_IMAGE_FORMAT = \
- get_value('general.openstack.image_disk_format', 'GLANCE_IMAGE_FORMAT')
-FLAVOR_NAME = \
- get_value('general.openstack.flavor_name', 'FLAVOR_NAME')
-FLAVOR_RAM = \
- get_value('general.openstack.flavor_ram', 'FLAVOR_RAM')
-FLAVOR_DISK = \
- get_value('general.openstack.flavor_disk', 'FLAVOR_DISK')
-FLAVOR_VCPUS = \
- get_value('general.openstack.flavor_vcpus', 'FLAVOR_VCPUS')
-TEMPEST_PRIVATE_NET_NAME = \
- get_value('tempest.private_net_name', 'TEMPEST_PRIVATE_NET_NAME')
-TEMPEST_PRIVATE_SUBNET_NAME = \
- get_value('tempest.private_subnet_name', 'TEMPEST_PRIVATE_SUBNET_NAME')
-TEMPEST_PRIVATE_SUBNET_CIDR = \
- get_value('tempest.private_subnet_cidr', 'TEMPEST_PRIVATE_SUBNET_CIDR')
-TEMPEST_ROUTER_NAME = \
- get_value('tempest.router_name', 'TEMPEST_ROUTER_NAME')
-TEMPEST_TENANT_NAME = \
- get_value('tempest.identity.tenant_name', 'TEMPEST_TENANT_NAME')
-TEMPEST_TENANT_DESCRIPTION = \
- get_value('tempest.identity.tenant_description',
- 'TEMPEST_TENANT_DESCRIPTION')
-TEMPEST_USER_NAME = \
- get_value('tempest.identity.user_name', 'TEMPEST_USER_NAME')
-TEMPEST_USER_PASSWORD = \
- get_value('tempest.identity.user_password', 'TEMPEST_USER_PASSWORD')
-TEMPEST_SSH_TIMEOUT = \
- get_value('tempest.validation.ssh_timeout', 'TEMPEST_SSH_TIMEOUT')
-TEMPEST_USE_CUSTOM_IMAGES = \
- get_value('tempest.use_custom_images', 'TEMPEST_USE_CUSTOM_IMAGES')
-TEMPEST_USE_CUSTOM_FLAVORS = \
- get_value('tempest.use_custom_flavors', 'TEMPEST_USE_CUSTOM_FLAVORS')
-TEMPEST_TEST_LIST_DIR = \
- get_value('general.directories.dir_tempest_cases', 'TEMPEST_TEST_LIST_DIR')
-NAME_VM_1 = \
- get_value('vping.vm_name_1', 'NAME_VM_1')
-NAME_VM_2 = \
- get_value('vping.vm_name_2', 'NAME_VM_2')
-PING_TIMEOUT = \
- get_value('vping.ping_timeout', 'PING_TIMEOUT')
-VPING__IMAGE_NAME = \
- get_value('vping.image_name', 'VPING__IMAGE_NAME')
-VPING_VM_FLAVOR = \
- get_value('vping.vm_flavor', 'VPING_VM_FLAVOR')
-VPING_PRIVATE_NET_NAME = \
- get_value('vping.vping_private_net_name', 'VPING_PRIVATE_NET_NAME')
-VPING_PRIVATE_SUBNET_NAME = \
- get_value('vping.vping_private_subnet_name', 'VPING_PRIVATE_SUBNET_NAME')
-VPING_PRIVATE_SUBNET_CIDR = \
- get_value('vping.vping_private_subnet_cidr', 'VPING_PRIVATE_SUBNET_CIDR')
-VPING_ROUTER_NAME = \
- get_value('vping.vping_router_name', 'VPING_ROUTER_NAME')
-VPING_SECGROUP_NAME = \
- get_value('vping.vping_sg_name', 'VPING_SECGROUP_NAME')
-VPING_SECGROUP_DESCR = \
- get_value('vping.vping_sg_descr', 'VPING_SECGROUP_DESCR')
-ONOSBENCH_USERNAME = \
- get_value('ONOS.general.onosbench_username', 'ONOSBENCH_USERNAME')
-ONOSBENCH_PASSWORD = \
- get_value('ONOS.general.onosbench_password', 'ONOSBENCH_PASSWORD')
-ONOSCLI_USERNAME = \
- get_value('ONOS.general.onoscli_username', 'ONOSCLI_USERNAME')
-ONOSCLI_PASSWORD = \
- get_value('ONOS.general.onoscli_password', 'ONOSCLI_PASSWORD')
-ONOS_RUNTIMEOUT = \
- get_value('ONOS.general.runtimeout', 'ONOS_RUNTIMEOUT')
-ONOS_OCT = \
- get_value('ONOS.environment.OCT', 'ONOS_OCT')
-ONOS_OC1 = \
- get_value('ONOS.environment.OC1', 'ONOS_OC1')
-ONOS_OC2 = \
- get_value('ONOS.environment.OC2', 'ONOS_OC2')
-ONOS_OC3 = \
- get_value('ONOS.environment.OC3', 'ONOS_OC3')
-ONOS_OCN = \
- get_value('ONOS.environment.OCN', 'ONOS_OCN')
-ONOS_OCN2 = \
- get_value('ONOS.environment.OCN2', 'ONOS_OCN2')
-ONOS_INSTALLER_MASTER = \
- get_value('ONOS.environment.installer_master', 'ONOS_INSTALLER_MASTER')
-ONOS_INSTALLER_MASTER_USERNAME = \
- get_value('ONOS.environment.installer_master_username',
- 'ONOS_INSTALLER_MASTER_USERNAME')
-ONOS_INSTALLER_MASTER_PASSWORD = \
- get_value('ONOS.environment.installer_master_password',
- 'ONOS_INSTALLER_MASTER_PASSWORD')
-PROMISE_REPO_DIR = \
- get_value('general.directories.dir_repo_promise', 'PROMISE_REPO_DIR')
-PROMISE_TENANT_NAME = \
- get_value('promise.tenant_name', 'PROMISE_TENANT_NAME')
-TENANT_DESCRIPTION = \
- get_value('promise.tenant_description', 'TENANT_DESCRIPTION')
-PROMISE_USER_NAME = \
- get_value('promise.user_name', 'PROMISE_USER_NAME')
-PROMISE_USER_PWD = \
- get_value('promise.user_pwd', 'PROMISE_USER_PWD')
-PROMISE_IMAGE_NAME = \
- get_value('promise.image_name', 'PROMISE_IMAGE_NAME')
-PROMISE_FLAVOR_NAME = \
- get_value('promise.flavor_name', 'PROMISE_FLAVOR_NAME')
-PROMISE_FLAVOR_VCPUS = \
- get_value('promise.flavor_vcpus', 'PROMISE_FLAVOR_VCPUS')
-PROMISE_FLAVOR_RAM = \
- get_value('promise.flavor_ram', 'PROMISE_FLAVOR_RAM')
-PROMISE_FLAVOR_DISK = \
- get_value('promise.flavor_disk', 'PROMISE_FLAVOR_DISK')
-PROMISE_NET_NAME = \
- get_value('promise.network_name', 'PROMISE_NET_NAME')
-PROMISE_SUBNET_NAME = \
- get_value('promise.subnet_name', 'PROMISE_SUBNET_NAME')
-PROMISE_SUBNET_CIDR = \
- get_value('promise.subnet_cidr', 'PROMISE_SUBNET_CIDR')
-PROMISE_ROUTER_NAME = \
- get_value('promise.router_name', 'PROMISE_ROUTER_NAME')
-DOCTOR_REPO_DIR = \
- get_value('general.directories.dir_repo_doctor', 'DOCTOR_REPO_DIR')
-COPPER_REPO_DIR = \
- get_value('general.directories.dir_repo_copper', 'COPPER_REPO_DIR')
-EXAMPLE_INSTANCE_NAME = \
- get_value('example.example_vm_name', 'EXAMPLE_INSTANCE_NAME')
-EXAMPLE_FLAVOR = \
- get_value('example.example_flavor', 'EXAMPLE_FLAVOR')
-EXAMPLE_IMAGE_NAME = \
- get_value('example.example_image_name', 'EXAMPLE_IMAGE_NAME')
-EXAMPLE_PRIVATE_NET_NAME = \
- get_value('example.example_private_net_name', 'EXAMPLE_PRIVATE_NET_NAME')
-EXAMPLE_PRIVATE_SUBNET_NAME = \
- get_value('example.example_private_subnet_name',
- 'EXAMPLE_PRIVATE_SUBNET_NAME')
-EXAMPLE_PRIVATE_SUBNET_CIDR = \
- get_value('example.example_private_subnet_cidr',
- 'EXAMPLE_PRIVATE_SUBNET_CIDR')
-EXAMPLE_ROUTER_NAME = \
- get_value('example.example_router_name', 'EXAMPLE_ROUTER_NAME')
-EXAMPLE_SECGROUP_NAME = \
- get_value('example.example_sg_name', 'EXAMPLE_SECGROUP_NAME')
-EXAMPLE_SECGROUP_DESCR = \
- get_value('example.example_sg_descr', 'EXAMPLE_SECGROUP_DESCR')
-VIMS_DATA_DIR = \
- get_value('general.directories.dir_vIMS_data', 'VIMS_DATA_DIR')
-VIMS_TEST_DIR = \
- get_value('general.directories.dir_repo_vims_test', 'VIMS_TEST_DIR')
-VIMS_TENANT_NAME = \
- get_value('vIMS.general.tenant_name', 'VIMS_TENANT_NAME')
-VIMS_TENANT_DESCRIPTION = \
- get_value('vIMS.general.tenant_description', 'VIMS_TENANT_DESCRIPTION')
+ONOS_SFC_IMAGE_NAME = get_value('onos_sfc.image_name',
+ 'ONOS_SFC_IMAGE_NAME')
+ONOS_SFC_IMAGE_FILENAME = get_value('onos_sfc.image_file_name',
+ 'ONOS_SFC_IMAGE_FILENAME')
+ONOS_SFC_RELATIVE_PATH = get_value('general.directories.dir_onos_sfc',
+ 'ONOS_SFC_RELATIVE_PATH')
+ONOS_SFC_IMAGE_BASE_URL = get_value('onos_sfc.image_base_url',
+ 'ONOS_SFC_IMAGE_BASE_URL')
+RALLY_RELATIVE_PATH = get_value('general.directories.dir_rally',
+ 'RALLY_RELATIVE_PATH')
+RALLY_PRIVATE_NET_NAME = get_value('rally.network_name',
+ 'RALLY_PRIVATE_NET_NAME')
+RALLY_PRIVATE_SUBNET_NAME = get_value('rally.subnet_name',
+ 'RALLY_PRIVATE_SUBNET_NAME')
+RALLY_PRIVATE_SUBNET_CIDR = get_value('rally.subnet_cidr',
+ 'RALLY_PRIVATE_SUBNET_CIDR')
+RALLY_ROUTER_NAME = get_value('rally.router_name', 'RALLY_ROUTER_NAME')
+RALLY_INSTALLATION_DIR = get_value('general.directories.dir_rally_inst',
+ 'RALLY_INSTALLATION_DIR')
+GLANCE_IMAGE_NAME = get_value('general.openstack.image_name',
+ 'GLANCE_IMAGE_NAME')
+GLANCE_IMAGE_FILENAME = get_value('general.openstack.image_file_name',
+ 'GLANCE_IMAGE_FILENAME')
+GLANCE_IMAGE_FORMAT = get_value('general.openstack.image_disk_format',
+ 'GLANCE_IMAGE_FORMAT')
+FLAVOR_NAME = get_value('general.openstack.flavor_name',
+ 'FLAVOR_NAME')
+FLAVOR_RAM = get_value('general.openstack.flavor_ram',
+ 'FLAVOR_RAM')
+FLAVOR_DISK = get_value('general.openstack.flavor_disk',
+ 'FLAVOR_DISK')
+FLAVOR_VCPUS = get_value('general.openstack.flavor_vcpus',
+ 'FLAVOR_VCPUS')
+TEMPEST_PRIVATE_NET_NAME = get_value('tempest.private_net_name',
+ 'TEMPEST_PRIVATE_NET_NAME')
+TEMPEST_PRIVATE_SUBNET_NAME = get_value('tempest.private_subnet_name',
+ 'TEMPEST_PRIVATE_SUBNET_NAME')
+TEMPEST_PRIVATE_SUBNET_CIDR = get_value('tempest.private_subnet_cidr',
+ 'TEMPEST_PRIVATE_SUBNET_CIDR')
+TEMPEST_ROUTER_NAME = get_value('tempest.router_name',
+ 'TEMPEST_ROUTER_NAME')
+TEMPEST_TENANT_NAME = get_value('tempest.identity.tenant_name',
+ 'TEMPEST_TENANT_NAME')
+TEMPEST_TENANT_DESCRIPTION = get_value('tempest.identity.tenant_description',
+ 'TEMPEST_TENANT_DESCRIPTION')
+TEMPEST_USER_NAME = get_value('tempest.identity.user_name',
+ 'TEMPEST_USER_NAME')
+TEMPEST_USER_PASSWORD = get_value('tempest.identity.user_password',
+ 'TEMPEST_USER_PASSWORD')
+TEMPEST_SSH_TIMEOUT = get_value('tempest.validation.ssh_timeout',
+ 'TEMPEST_SSH_TIMEOUT')
+TEMPEST_USE_CUSTOM_IMAGES = get_value('tempest.use_custom_images',
+ 'TEMPEST_USE_CUSTOM_IMAGES')
+TEMPEST_USE_CUSTOM_FLAVORS = get_value('tempest.use_custom_flavors',
+ 'TEMPEST_USE_CUSTOM_FLAVORS')
+TEMPEST_TEST_LIST_DIR = get_value('general.directories.dir_tempest_cases',
+ 'TEMPEST_TEST_LIST_DIR')
+NAME_VM_1 = get_value('vping.vm_name_1', 'NAME_VM_1')
+NAME_VM_2 = get_value('vping.vm_name_2', 'NAME_VM_2')
+PING_TIMEOUT = get_value('vping.ping_timeout', 'PING_TIMEOUT')
+VPING__IMAGE_NAME = get_value('vping.image_name', 'VPING__IMAGE_NAME')
+VPING_VM_FLAVOR = get_value('vping.vm_flavor', 'VPING_VM_FLAVOR')
+VPING_PRIVATE_NET_NAME = get_value('vping.vping_private_net_name',
+ 'VPING_PRIVATE_NET_NAME')
+VPING_PRIVATE_SUBNET_NAME = get_value('vping.vping_private_subnet_name',
+ 'VPING_PRIVATE_SUBNET_NAME')
+VPING_PRIVATE_SUBNET_CIDR = get_value('vping.vping_private_subnet_cidr',
+ 'VPING_PRIVATE_SUBNET_CIDR')
+VPING_ROUTER_NAME = get_value('vping.vping_router_name',
+ 'VPING_ROUTER_NAME')
+VPING_SECGROUP_NAME = get_value('vping.vping_sg_name',
+ 'VPING_SECGROUP_NAME')
+VPING_SECGROUP_DESCR = get_value('vping.vping_sg_descr',
+ 'VPING_SECGROUP_DESCR')
+ONOSBENCH_USERNAME = get_value('ONOS.general.onosbench_username',
+ 'ONOSBENCH_USERNAME')
+ONOSBENCH_PASSWORD = get_value('ONOS.general.onosbench_password',
+ 'ONOSBENCH_PASSWORD')
+ONOSCLI_USERNAME = get_value('ONOS.general.onoscli_username',
+ 'ONOSCLI_USERNAME')
+ONOSCLI_PASSWORD = get_value('ONOS.general.onoscli_password',
+ 'ONOSCLI_PASSWORD')
+ONOS_RUNTIMEOUT = get_value('ONOS.general.runtimeout',
+ 'ONOS_RUNTIMEOUT')
+ONOS_OCT = get_value('ONOS.environment.OCT', 'ONOS_OCT')
+ONOS_OC1 = get_value('ONOS.environment.OC1', 'ONOS_OC1')
+ONOS_OC2 = get_value('ONOS.environment.OC2', 'ONOS_OC2')
+ONOS_OC3 = get_value('ONOS.environment.OC3', 'ONOS_OC3')
+ONOS_OCN = get_value('ONOS.environment.OCN', 'ONOS_OCN')
+ONOS_OCN2 = get_value('ONOS.environment.OCN2', 'ONOS_OCN2')
+ONOS_INSTALLER_MASTER = get_value('ONOS.environment.installer_master',
+ 'ONOS_INSTALLER_MASTER')
+ONOS_INSTALLER_MASTER_USERNAME = get_value(
+ 'ONOS.environment.installer_master_username',
+ 'ONOS_INSTALLER_MASTER_USERNAME')
+ONOS_INSTALLER_MASTER_PASSWORD = get_value(
+ 'ONOS.environment.installer_master_password',
+ 'ONOS_INSTALLER_MASTER_PASSWORD')
+PROMISE_REPO_DIR = get_value('general.directories.dir_repo_promise',
+ 'PROMISE_REPO_DIR')
+PROMISE_TENANT_NAME = get_value('promise.tenant_name',
+ 'PROMISE_TENANT_NAME')
+TENANT_DESCRIPTION = get_value('promise.tenant_description',
+ 'TENANT_DESCRIPTION')
+PROMISE_USER_NAME = get_value('promise.user_name', 'PROMISE_USER_NAME')
+PROMISE_USER_PWD = get_value('promise.user_pwd', 'PROMISE_USER_PWD')
+PROMISE_IMAGE_NAME = get_value('promise.image_name',
+ 'PROMISE_IMAGE_NAME')
+PROMISE_FLAVOR_NAME = get_value('promise.flavor_name',
+ 'PROMISE_FLAVOR_NAME')
+PROMISE_FLAVOR_VCPUS = get_value('promise.flavor_vcpus',
+ 'PROMISE_FLAVOR_VCPUS')
+PROMISE_FLAVOR_RAM = get_value('promise.flavor_ram',
+ 'PROMISE_FLAVOR_RAM')
+PROMISE_FLAVOR_DISK = get_value('promise.flavor_disk',
+ 'PROMISE_FLAVOR_DISK')
+PROMISE_NET_NAME = get_value('promise.network_name', 'PROMISE_NET_NAME')
+PROMISE_SUBNET_NAME = get_value('promise.subnet_name',
+ 'PROMISE_SUBNET_NAME')
+PROMISE_SUBNET_CIDR = get_value('promise.subnet_cidr',
+ 'PROMISE_SUBNET_CIDR')
+PROMISE_ROUTER_NAME = get_value('promise.router_name',
+ 'PROMISE_ROUTER_NAME')
+DOCTOR_REPO_DIR = get_value('general.directories.dir_repo_doctor',
+ 'DOCTOR_REPO_DIR')
+COPPER_REPO_DIR = get_value('general.directories.dir_repo_copper',
+ 'COPPER_REPO_DIR')
+EXAMPLE_INSTANCE_NAME = get_value('example.example_vm_name',
+ 'EXAMPLE_INSTANCE_NAME')
+EXAMPLE_FLAVOR = get_value('example.example_flavor', 'EXAMPLE_FLAVOR')
+EXAMPLE_IMAGE_NAME = get_value('example.example_image_name',
+ 'EXAMPLE_IMAGE_NAME')
+EXAMPLE_PRIVATE_NET_NAME = get_value('example.example_private_net_name',
+ 'EXAMPLE_PRIVATE_NET_NAME')
+EXAMPLE_PRIVATE_SUBNET_NAME = get_value(
+ 'example.example_private_subnet_name',
+ 'EXAMPLE_PRIVATE_SUBNET_NAME')
+EXAMPLE_PRIVATE_SUBNET_CIDR = get_value(
+ 'example.example_private_subnet_cidr',
+ 'EXAMPLE_PRIVATE_SUBNET_CIDR')
+EXAMPLE_ROUTER_NAME = get_value('example.example_router_name',
+ 'EXAMPLE_ROUTER_NAME')
+EXAMPLE_SECGROUP_NAME = get_value('example.example_sg_name',
+ 'EXAMPLE_SECGROUP_NAME')
+EXAMPLE_SECGROUP_DESCR = get_value('example.example_sg_descr',
+ 'EXAMPLE_SECGROUP_DESCR')
+VIMS_DATA_DIR = get_value('general.directories.dir_vIMS_data',
+ 'VIMS_DATA_DIR')
+VIMS_TEST_DIR = get_value('general.directories.dir_repo_vims_test',
+ 'VIMS_TEST_DIR')
+VIMS_TENANT_NAME = get_value('vIMS.general.tenant_name',
+ 'VIMS_TENANT_NAME')
+VIMS_TENANT_DESCRIPTION = get_value('vIMS.general.tenant_description',
+ 'VIMS_TENANT_DESCRIPTION')
VIMS_IMAGES = get_value('vIMS.general.images', 'VIMS_IMAGES')
-CFY_MANAGER_BLUEPRINT = \
- get_value('vIMS.cloudify.blueprint', 'CFY_MANAGER_BLUEPRINT')
-CFY_MANAGER_REQUIERMENTS = \
- get_value('vIMS.cloudify.requierments', 'CFY_MANAGER_REQUIERMENTS')
-CFY_INPUTS = \
- get_value('vIMS.cloudify.inputs', 'CFY_INPUTS')
-CW_BLUEPRINT = \
- get_value('vIMS.clearwater.blueprint', 'CW_BLUEPRINT')
-CW_DEPLOYMENT_NAME = \
- get_value('vIMS.clearwater.deployment-name', 'CW_DEPLOYMENT_NAME')
-CW_INPUTS = \
- get_value('vIMS.clearwater.inputs', 'CW_INPUTS')
-CW_REQUIERMENTS = \
- get_value('vIMS.clearwater.requierments', 'CW_REQUIERMENTS')
-PARSER_REPO_DIR = \
- get_value('general.directories.dir_repo_parser', 'PARSER_REPO_DIR')
+CFY_MANAGER_BLUEPRINT = get_value('vIMS.cloudify.blueprint',
+ 'CFY_MANAGER_BLUEPRINT')
+CFY_MANAGER_REQUIERMENTS = get_value('vIMS.cloudify.requierments',
+ 'CFY_MANAGER_REQUIERMENTS')
+CFY_INPUTS = get_value('vIMS.cloudify.inputs', 'CFY_INPUTS')
+CW_BLUEPRINT = get_value('vIMS.clearwater.blueprint', 'CW_BLUEPRINT')
+CW_DEPLOYMENT_NAME = get_value('vIMS.clearwater.deployment-name',
+ 'CW_DEPLOYMENT_NAME')
+CW_INPUTS = get_value('vIMS.clearwater.inputs', 'CW_INPUTS')
+CW_REQUIERMENTS = get_value('vIMS.clearwater.requierments',
+ 'CW_REQUIERMENTS')
+PARSER_REPO_DIR = get_value('general.directories.dir_repo_parser',
+ 'PARSER_REPO_DIR')
diff --git a/functest/utils/functest_vacation.py b/functest/utils/functest_vacation.py
index 6c7312fa0..c2e40b072 100644
--- a/functest/utils/functest_vacation.py
+++ b/functest/utils/functest_vacation.py
@@ -1,6 +1,6 @@
from os import environ
-from curses import initscr, curs_set, newwin, endwin,\
- KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP
+from curses import initscr, curs_set, newwin, endwin
+from curses import KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP
from random import randrange
@@ -48,6 +48,6 @@ def main():
print '\nSnake.PY-26lines by Kris Cieslak (defaultset.blogspot.com).'
print 'OPNFV adaptation by Functest dream team.'
- print 'Thanks for playing, your score: ' + \
- str(len(snake) - len(body) - 1) + '.'
+ score = str(len(snake) - len(body) - 1)
+ print ('Thanks for playing, your score: %s.' % score)
print 'Find and fix more bugs in your real OPNFV setup!\n'
diff --git a/functest/utils/openstack_clean.py b/functest/utils/openstack_clean.py
index 949eee90f..0c3ae3e32 100755
--- a/functest/utils/openstack_clean.py
+++ b/functest/utils/openstack_clean.py
@@ -9,6 +9,8 @@
# - Neutron networks, subnets and ports
# - Routers
# - Users and tenants
+# - Tacker VNFDs and VNFs
+# - Tacker SFCs and SFC classifiers
#
# Author:
# jose.lausuch@ericsson.com
@@ -23,6 +25,7 @@
import time
import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
+import functest.utils.openstack_tacker as os_tacker
import yaml
import functest.utils.functest_constants as ft_constants
@@ -369,6 +372,109 @@ def remove_tenants(keystone_client, default_tenants):
"NOT be deleted.")
+def remove_tacker_vnfds(tacker_client, default_vnfds):
+ logger.debug("Removing Tacker VNFDs...")
+ vnfds = os_tacker.list_vnfds(tacker_client, verbose=True)['vnfds']
+ if vnfds is None:
+ logger.debug("There are no Tacker VNFDs in the deployment. ")
+ return
+
+ for vnfd in vnfds:
+ vnfd_name = vnfd['name']
+ vnfd_id = vnfd['id']
+ logger.debug("'%s', ID=%s " % (vnfd_name, vnfd_id))
+ if (vnfd_id not in default_vnfds and
+ vnfd_name not in default_vnfds.values()):
+ logger.debug(" Removing '%s'..." % vnfd_name)
+ deleted = os_tacker.delete_vnfd(tacker_client, vnfd_id=vnfd_id)
+ if deleted is not None:
+ logger.debug(" > Done!")
+ else:
+ logger.error("There has been a problem removing the "
+ "VNFD '%s'(%s)..." % (vnfd_name, vnfd_id))
+ else:
+ logger.debug(" > this is a default VNFD and will "
+ "NOT be deleted.")
+
+
+def remove_tacker_vnfs(tacker_client, default_vnfs):
+ logger.debug("Removing Tacker VNFs...")
+ vnfs = os_tacker.list_vnfs(tacker_client, verbose=True)['vnfs']
+ if vnfs is None:
+ logger.debug("There are no Tacker VNFs in the deployment. ")
+ return
+
+ for vnf in vnfs:
+ vnf_name = vnf['name']
+ vnf_id = vnf['id']
+ logger.debug("'%s', ID=%s " % (vnf_name, vnf_id))
+ if (vnf_id not in default_vnfs and
+ vnf_name not in default_vnfs.values()):
+ logger.debug(" Removing '%s'..." % vnf_name)
+ deleted = os_tacker.delete_vnf(tacker_client, vnf_id=vnf_id)
+ if deleted is not None:
+ logger.debug(" > Done!")
+ else:
+ logger.error("There has been a problem removing the "
+ "VNF '%s'(%s)..." % (vnf_name, vnf_id))
+ else:
+ logger.debug(" > this is a default VNF and will "
+ "NOT be deleted.")
+
+
+def remove_tacker_sfcs(tacker_client, default_sfcs):
+ logger.debug("Removing Tacker SFCs...")
+ sfcs = os_tacker.list_sfcs(tacker_client, verbose=True)['sfcs']
+ if sfcs is None:
+ logger.debug("There are no Tacker SFCs in the deployment. ")
+ return
+
+ for sfc in sfcs:
+ sfc_name = sfc['name']
+ sfc_id = sfc['id']
+ logger.debug("'%s', ID=%s " % (sfc_name, sfc_id))
+ if (sfc_id not in default_sfcs and
+ sfc_name not in default_sfcs.values()):
+ logger.debug(" Removing '%s'..." % sfc_name)
+ deleted = os_tacker.delete_sfc(tacker_client, sfc_id=sfc_id)
+ if deleted is not None:
+ logger.debug(" > Done!")
+ else:
+ logger.error("There has been a problem removing the "
+ "SFC '%s'(%s)..." % (sfc_name, sfc_id))
+ else:
+ logger.debug(" > this is a default SFC and will "
+ "NOT be deleted.")
+
+
+def remove_tacker_sfc_classifiers(tacker_client, default_sfc_classifiers):
+ logger.debug("Removing Tacker SFC classifiers...")
+ sfc_clfs = os_tacker.list_sfc_classifiers(
+ tacker_client, verbose=True)['sfc_classfiers']
+ if sfc_clfs is None:
+ logger.debug("There are no Tacker SFC classifiers in the deployment.")
+ return
+
+ for sfc_clf in sfc_clfs:
+ sfc_clf_name = sfc_clf['name']
+ sfc_clf_id = sfc_clf['id']
+ logger.debug("'%s', ID=%s " % (sfc_clf_name, sfc_clf_id))
+ if (sfc_clf_id not in default_sfc_classifiers and
+ sfc_clf_name not in default_sfc_classifiers.values()):
+ logger.debug(" Removing '%s'..." % sfc_clf_name)
+ deleted = os_tacker.delete_sfc_classifier(
+ tacker_client, sfc_clf_id=sfc_clf_id)
+ if deleted is not None:
+ logger.debug(" > Done!")
+ else:
+ logger.error("There has been a problem removing the "
+ "SFC classifier '%s'(%s)..."
+ % (sfc_clf_name, sfc_clf_id))
+ else:
+ logger.debug(" > this is a default SFC classifier and will "
+ "NOT be deleted.")
+
+
def main():
logger.info("Cleaning OpenStack resources...")
@@ -376,6 +482,7 @@ def main():
neutron_client = os_utils.get_neutron_client()
keystone_client = os_utils.get_keystone_client()
cinder_client = os_utils.get_cinder_client()
+ tacker_client = os_tacker.get_tacker_client()
try:
with open(OS_SNAPSHOT_FILE) as f:
@@ -394,6 +501,10 @@ def main():
default_floatingips = snapshot_yaml.get('floatingips')
default_users = snapshot_yaml.get('users')
default_tenants = snapshot_yaml.get('tenants')
+ default_vnfds = snapshot_yaml.get('vnfds')
+ default_vnfs = snapshot_yaml.get('vnfs')
+ default_sfcs = snapshot_yaml.get('sfcs')
+ default_sfc_classifiers = snapshot_yaml.get('sfc_classifiers')
if not os_utils.check_credentials():
logger.error("Please source the openrc credentials and run "
@@ -416,6 +527,16 @@ def main():
separator()
remove_tenants(keystone_client, default_tenants)
separator()
+ # Note: Delete in this order
+ # 1. Classifiers, 2. SFCs, 3. VNFs, 4. VNFDs
+ remove_tacker_sfc_classifiers(tacker_client, default_sfc_classifiers)
+ separator()
+ remove_tacker_sfcs(tacker_client, default_sfcs)
+ separator()
+ remove_tacker_vnfs(tacker_client, default_vnfs)
+ separator()
+ remove_tacker_vnfds(tacker_client, default_vnfds)
+ separator()
if __name__ == '__main__':
diff --git a/functest/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py
index 4be1af443..d6e7fe006 100755
--- a/functest/utils/openstack_snapshot.py
+++ b/functest/utils/openstack_snapshot.py
@@ -9,6 +9,8 @@
# - Neutron networks, subnets and ports
# - Routers
# - Users and tenants
+# - Tacker VNFDs and VNFs
+# - Tacker SFCs and SFC classifiers
#
# Author:
# jose.lausuch@ericsson.com
@@ -22,6 +24,7 @@
import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
+import functest.utils.openstack_tacker as os_tacker
import yaml
import functest.utils.functest_constants as ft_constants
@@ -127,6 +130,51 @@ def get_tenants(keystone_client):
return {'tenants': dic_tenants}
+def get_tacker_vnfds(tacker_client):
+ logger.debug("Getting Tacker VNFDs...")
+ dic_vnfds = {}
+ vnfds = os_tacker.list_vnfds(tacker_client, verbose=True)['vnfds']
+ if not (vnfds is None or len(vnfds) == 0):
+ for vnfd in vnfds:
+ dic_vnfds.update({vnfd['id']:
+ vnfd['name']})
+ return {'vnfds': dic_vnfds}
+
+
+def get_tacker_vnfs(tacker_client):
+ logger.debug("Getting Tacker VNFs...")
+ dic_vnfs = {}
+ vnfs = os_tacker.list_vnfs(tacker_client, verbose=True)['vnfs']
+ if not (vnfs is None or len(vnfs) == 0):
+ for vnf in vnfs:
+ dic_vnfs.update({vnf['id']:
+ vnf['name']})
+ return {'vnfs': dic_vnfs}
+
+
+def get_tacker_sfcs(tacker_client):
+ logger.debug("Getting Tacker SFCs...")
+ dic_sfcs = {}
+ sfcs = os_tacker.list_sfcs(tacker_client, verbose=True)['sfcs']
+ if not (sfcs is None or len(sfcs) == 0):
+ for sfc in sfcs:
+ dic_sfcs.update({sfc['id']:
+ sfc['name']})
+ return {'sfcs': dic_sfcs}
+
+
+def get_tacker_sfc_classifiers(tacker_client):
+ logger.debug("Getting Tacker SFC classifiers...")
+ dic_sfc_clfs = {}
+ sfc_clfs = os_tacker.list_sfc_clasifiers(
+ tacker_client, verbose=True)['sfc_classifiers']
+ if not (sfc_clfs is None or len(sfc_clfs) == 0):
+ for sfc_clf in sfc_clfs:
+ dic_sfc_clfs.update({sfc_clf['id']:
+ sfc_clf['name']})
+ return {'sfc_classifiers': dic_sfc_clfs}
+
+
def main():
logger.info("Generating OpenStack snapshot...")
@@ -134,6 +182,7 @@ def main():
neutron_client = os_utils.get_neutron_client()
keystone_client = os_utils.get_keystone_client()
cinder_client = os_utils.get_cinder_client()
+ tacker_client = os_tacker.get_tacker_client()
if not os_utils.check_credentials():
logger.error("Please source the openrc credentials and run the" +
@@ -150,6 +199,10 @@ def main():
snapshot.update(get_floatinips(nova_client))
snapshot.update(get_users(keystone_client))
snapshot.update(get_tenants(keystone_client))
+ snapshot.update(get_tacker_vnfds(tacker_client))
+ snapshot.update(get_tacker_vnfs(tacker_client))
+ snapshot.update(get_tacker_sfcs(tacker_client))
+ snapshot.update(get_tacker_sfc_classifiers(tacker_client))
with open(OS_SNAPSHOT_FILE, 'w+') as yaml_file:
yaml_file.write(yaml.safe_dump(snapshot, default_flow_style=False))
diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py
index 3a6a34d41..6ab056683 100644
--- a/functest/utils/openstack_tacker.py
+++ b/functest/utils/openstack_tacker.py
@@ -225,7 +225,7 @@ def delete_sfc(tacker_client, sfc_id=None, sfc_name=None):
return None
-def list_sfc_clasifiers(tacker_client, verbose=False):
+def list_sfc_classifiers(tacker_client, verbose=False):
try:
sfc_clfs = tacker_client.list_sfc_classifiers(retrieve_all=True)
if not verbose: