diff options
author | Moshe <moshehoa@amdocs.com> | 2018-08-15 12:19:07 +0300 |
---|---|---|
committer | Moshe <moshehoa@amdocs.com> | 2018-08-15 17:00:11 +0300 |
commit | 5e5e493a5ec5048c0a340e2acd72f52869779fdf (patch) | |
tree | b4f787f6df2a4414660d7f235dfc128cc86fdc2e | |
parent | 1a54248ad5b5f836ae915413ffefaa487d1f73f5 (diff) |
versionize tests due to API changes in ONAP
Issue-ID: VNFSDK-301
Change-Id: I1fdf1b42fc2cd44021c2f33695c86bbbdc8bb62b
Signed-off-by: Moshe <moshehoa@amdocs.com>
fix tests
Issue-ID: VNFSDK-301
Change-Id: I87abc962b13956af07ad8bf7355ea681343664dc
Signed-off-by: Moshe <moshehoa@amdocs.com>
77 files changed, 1298 insertions, 249 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index 816371b..989bd02 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,19 +37,18 @@ RUN pip install appdirs==1.4.0 pyopenssl==17.5.0 python-openstackclient==3.11.0 RUN mkdir -p ${REPOS_DIR} RUN git config --global http.sslVerify false -RUN git clone --depth 1 -b $BRANCH https://gerrit.onap.org/r/vnfsdk/dovetail-integration ${VNFTEST_REPO_DIR} +#For developers: To test your changes you must comment out the git clone for ${VNFTEST_REPO_DIR}. +#You must also uncomment the RUN and COPY commands below. +#You must run docker build from your vnftest directory on the host. +RUN git clone --depth 1 -b $BRANCH https://gerrit.onap.org/r/vnfsdk/dovetail-integration ${VNFTEST_REPO_DIR} +#RUN mkdir ${VNFTEST_REPO_DIR} +#COPY ./ ${VNFTEST_REPO_DIR} WORKDIR ${VNFTEST_REPO_DIR} -RUN ${VNFTEST_REPO_DIR}/install.sh - -ADD http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img ${IMAGE_DIR} -ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img ${IMAGE_DIR} +RUN ${VNFTEST_REPO_DIR}/install.sh COPY ./exec_tests.sh /usr/local/bin/ - -ENV NSB_DIR="/opt/nsb_bin" \ - PYTHONPATH="${PYTHONPATH}:${NSB_DIR}/trex_client:${NSB_DIR}/trex_client/stl" - +ENV VNFTEST_ROOT_PATH="/" ADD startup.sh /startup.sh RUN chmod 755 /startup.sh -ENTRYPOINT /startup.sh
\ No newline at end of file +ENTRYPOINT /startup.sh diff --git a/etc/vnftest/environments/environment_sample.yaml b/etc/vnftest/environments/environment_sample.yaml new file mode 100644 index 0000000..b3943f5 --- /dev/null +++ b/etc/vnftest/environments/environment_sample.yaml @@ -0,0 +1,38 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- +onap: + aai_ip: 10.247.47.142 + aai_port: 30202 + aai_ssl_port: 30233 + mso_ip: 10.247.47.142 + sdc_ip: 10.247.47.138 + sdc_port: 30206 + sdc_catalog_port: 30206 + sdc_designer_user: cs0008 + sdc_tester_user: jm0007 + sdc_governance_user: gv0001 + sdc_operations_user: op0001 + +openstack: + OS_PASSWORD: moshekiev + OS_IDENTITY_API_VERSION: 3 + OS_USERNAME: moshekiev + OS_PROJECT_NAME: moshekiev + OS_AUTH_URL: http://10.247.134.65:5000/v3 + OS_TENANT_NAME: moshekiev + OS_TENANT_ID: c2c704ef98d0425f870dfa7a83763d93 + OS_PROJECT_DOMAIN_NAME: default + OS_USER_DOMAIN_NAME: default
\ No newline at end of file diff --git a/etc/vnftest/vnftest.yaml b/etc/vnftest/vnftest.yaml index 781540b..cd5b961 100644 --- a/etc/vnftest/vnftest.yaml +++ b/etc/vnftest/vnftest.yaml @@ -14,23 +14,10 @@ dir: conf: /etc/nvftest - repos: /home/vnftest/repos/vnftest - log: /tmp/vnftest + repos: /home/onap/repos/vnftest + log: /var/log/vnftest file: output_file: /tmp/vnftest.out html_file: /tmp/vnftest.htm reporting_file: /tmp/report.html - -component: - aai_ip: 10.247.43.140 - aai_port: 30202 - aai_ssl_port: 30233 - mso_ip: 10.247.43.140 - sdc_ip: 10.247.43.140 - sdc_port: 30205 - sdc_catalog_port: 30206 - sdc_designer_user: cs0008 - sdc_tester_user: jm0007 - sdc_governance_user: gv0001 - sdc_operations_user: op0001
\ No newline at end of file @@ -97,7 +97,8 @@ apt-get -y autoremove && apt-get clean git config --global http.sslVerify false -mkdir /etc/vnftest +mkdir -p /etc/vnftest +cp "${PWD}/etc/vnftest/vnftest.yaml" /etc/vnftest # install vnftest + dependencies easy_install -U pip pip install -r requirements.txt @@ -24,8 +24,11 @@ setup( include_package_data=True, package_data={ 'vnftest': [ - 'onap/onboard/*.yaml', + 'onap/onboard/v1/*.yaml', + 'onap/onboard/v2/*.yaml', 'onap/lifecycle/*.yaml', + 'onap/lifecycle/v1/*.yaml', + 'onap/lifecycle/v2/*.yaml', 'onap/steps/validation/*.yaml', 'test_config/onap/test_cases/*.yaml', 'test_config/onap/test_suites/*.yaml' diff --git a/tools/run_tests.sh b/tools/run_tests.sh index e225589..b1ef057 100755 --- a/tools/run_tests.sh +++ b/tools/run_tests.sh @@ -30,6 +30,8 @@ export PY_VER COVER_DIR_NAME="./tools/" export COVER_DIR_NAME +export CONF_FILE="${PWD}/tools/vnftest_test_config.yaml" + run_tests() { echo "Get external libs needed for unit test" diff --git a/tools/vnftest_test_config.yaml b/tools/vnftest_test_config.yaml new file mode 100644 index 0000000..cb2aa4b --- /dev/null +++ b/tools/vnftest_test_config.yaml @@ -0,0 +1,23 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +dir: + conf: ./ + repos: ./ + log: ./ + +file: + output_file: /tmp/vnftest.out + html_file: /tmp/vnftest.htm + reporting_file: /tmp/report.html diff --git a/vnftest.egg-info/SOURCES.txt b/vnftest.egg-info/SOURCES.txt index bc588a3..b702fbc 100644 --- a/vnftest.egg-info/SOURCES.txt +++ b/vnftest.egg-info/SOURCES.txt @@ -1,4 +1,25 @@ setup.py +api/__init__.py +api/client.py +api/server.py +api/urls.py +api/database/__init__.py +api/database/v1/__init__.py +api/database/v1/handlers.py +api/database/v1/models.py +api/resources/__init__.py +api/resources/v1/__init__.py +api/resources/v1/environments.py +api/resources/v1/projects.py +api/resources/v1/tasks.py +api/resources/v1/testcases.py +api/resources/v1/testsuites.py +api/resources/v1/vnf_descriptors.py +api/swagger/__init__.py +api/swagger/models.py +api/utils/__init__.py +api/utils/influx.py +api/utils/thread.py etc/__init__.py etc/vnftest/vnftest.yaml tools/vnftest-img-dpdk-modify @@ -54,11 +75,12 @@ vnftest/dispatcher/base.py vnftest/dispatcher/file.py vnftest/dispatcher/http.py vnftest/onap/__init__.py -vnftest/onap/onap_api_call.py vnftest/onap/common/__init__.py vnftest/onap/common/vf_module_crawler.py vnftest/onap/lifecycle/__init__.py vnftest/onap/onboard/__init__.py +vnftest/onap/onboard/v1/__init__.py +vnftest/onap/onboard/v2/__init__.py vnftest/onap/steps/__init__.py vnftest/onap/steps/validation/__init__.py vnftest/onap/steps/validation/vf_module_validator.py @@ -76,6 +98,7 @@ vnftest/runners/search.py vnftest/runners/sequence.py vnftest/steps/__init__.py vnftest/steps/base.py +vnftest/steps/rest_call.py vnftest/steps/dummy/__init__.py vnftest/steps/dummy/dummy.py vnftest/test_config/__init__.py diff --git a/vnftest.egg-info/top_level.txt b/vnftest.egg-info/top_level.txt index 32a8641..b5a830f 100644 --- a/vnftest.egg-info/top_level.txt +++ b/vnftest.egg-info/top_level.txt @@ -1,2 +1,3 @@ +api etc vnftest diff --git a/vnftest/__init__.py b/vnftest/__init__.py index 6456fc1..af1cdc3 100644 --- a/vnftest/__init__.py +++ b/vnftest/__init__.py @@ -21,7 +21,7 @@ import errno # not require loggers to be created, so this cannot # include vnftest.common.utils from vnftest.common import constants -import vnftest.common.utils as utils +import vnftest.common.import_utils as import_utils try: # do not use vnftest.common.utils.makedirs @@ -43,7 +43,7 @@ LOG = logging.getLogger(__name__) def _init_logging(): - + print ("initializing logging. log file: " + str(LOG_FILE)) LOG.setLevel(logging.DEBUG) _LOG_STREAM_HDLR.setFormatter(_LOG_FORMATTER) @@ -61,8 +61,9 @@ def _init_logging(): logging.root.addHandler(_LOG_FILE_HDLR) logging.debug("logging.root.handlers = %s", logging.root.handlers) -utils.import_modules_from_package("vnftest.contexts") -utils.import_modules_from_package("vnftest.runners") -utils.import_modules_from_package("vnftest.steps") -utils.import_modules_from_package("vnftest.crawlers") -utils.import_modules_from_package("vnftest.openstack") +import_utils.import_modules_from_package("vnftest.contexts") +import_utils.import_modules_from_package("vnftest.runners") +import_utils.import_modules_from_package("vnftest.steps") +import_utils.import_modules_from_package("vnftest.crawlers") +import_utils.import_modules_from_package("vnftest.openstack") +import_utils.import_modules_from_package("vnftest.onap") diff --git a/vnftest/cmd/commands/task.py b/vnftest/cmd/commands/task.py index 3e2a071..e0bf7e5 100644 --- a/vnftest/cmd/commands/task.py +++ b/vnftest/cmd/commands/task.py @@ -29,6 +29,7 @@ class TaskCommands(object): # pragma: no cover Set of commands to manage benchmark tasks. """ + @cliargs("environment", type=str, help="path to environment file", metavar="environment") @cliargs("vnfdescriptor", type=str, help="path to vnf descriptor file", metavar="vnf-descriptor") @cliargs("inputfile", type=str, help="path to task or suite file", metavar="input-file") @cliargs("--task-args", dest="task_args", diff --git a/vnftest/common/constants.py b/vnftest/common/constants.py index 46db92c..acf14ea 100644 --- a/vnftest/common/constants.py +++ b/vnftest/common/constants.py @@ -83,48 +83,23 @@ if not SERVER_IP: # dir CONF_DIR = get_param('dir.conf', join(VNFTEST_ROOT_PATH, 'etc/vnftest')) +IMAGE_DIR = get_param('dir.images', join(VNFTEST_ROOT_PATH, 'home/onap/images/')) +PACKAGE_DIR = get_param('dir.packages', join(VNFTEST_ROOT_PATH, 'home/onap/packages/')) CONF_FILE = join(CONF_DIR, 'vnftest.conf') REPOS_DIR = get_param('dir.repos', join(VNFTEST_ROOT_PATH, 'home/onap/repos/vnftest')) -LOG_DIR = get_param('dir.log', join(VNFTEST_ROOT_PATH, 'tmp/vnftest/')) +LOG_DIR = get_param('dir.log', join(VNFTEST_ROOT_PATH, 'var/log/vnftest/')) TASK_LOG_DIR = get_param('dir.tasklog', join(VNFTEST_ROOT_PATH, 'var/log/vnftest/')) CONF_SAMPLE_DIR = join(REPOS_DIR, 'etc/vnftest/') SAMPLE_CASE_DIR = join(REPOS_DIR, 'samples') -TESTCASE_DIR = join(VNFTEST_ROOT_PATH, 'vnftest/test_config/onap/test_cases/') -TESTSUITE_DIR = join(VNFTEST_ROOT_PATH, 'vnftest/test_config/onap/test_suites/') +TESTCASE_DIR = join(REPOS_DIR, 'vnftest/test_config/onap/test_cases/') +TESTSUITE_DIR = join(REPOS_DIR, 'vnftest/test_config/onap/test_suites/') # file DEFAULT_OUTPUT_FILE = get_param('file.output_file', join(VNFTEST_ROOT_PATH, 'tmp/vnftest.out')) DEFAULT_HTML_FILE = get_param('file.html_file', join(VNFTEST_ROOT_PATH, 'tmp/vnftest.htm')) REPORTING_FILE = get_param('file.reporting_file', join(VNFTEST_ROOT_PATH, 'tmp/report.html')) -# components -AAI_IP = get_param('component.aai_ip') -AAI_PORT = get_param('component.aai_port') -AAI_SSL_PORT = get_param('component.aai_ssl_port') -MSO_IP = get_param('component.mso_ip') -SDC_IP = get_param('component.sdc_ip') -SDC_PORT = get_param('component.sdc_port') -SDC_CATALOG_PORT = get_param('component.sdc_catalog_port') -SDC_DESIGNER_USER = get_param('component.sdc_designer_user') -SDC_TESTER_USER = get_param('component.sdc_tester_user') -SDC_GOVERNANCE_USER = get_param('component.sdc_governance_user') -SDC_OPERATIONS_USER = get_param('component.sdc_operations_user') - -component_constants = {} -component_constants['aai_ip'] = AAI_IP -component_constants['aai_port'] = AAI_PORT -component_constants['aai_ssl_port'] = AAI_SSL_PORT -component_constants['mso_ip'] = MSO_IP -component_constants['sdc_ip'] = SDC_IP -component_constants['sdc_port'] = SDC_PORT -component_constants['sdc_catalog_port'] = SDC_CATALOG_PORT -component_constants['sdc_designer_user'] = SDC_DESIGNER_USER -component_constants['sdc_tester_user'] = SDC_TESTER_USER -component_constants['sdc_governance_user'] = SDC_GOVERNANCE_USER -component_constants['sdc_operations_user'] = SDC_OPERATIONS_USER - - # api API_PORT = 5000 DOCKER_URL = 'unix://var/run/docker.sock' diff --git a/vnftest/common/html_template.py b/vnftest/common/html_template.py index 572d47f..7a91781 100644 --- a/vnftest/common/html_template.py +++ b/vnftest/common/html_template.py @@ -184,6 +184,7 @@ report_template = """ <td>{{ loop.index }}</td> <td>{{key}}</td> <td>{{value.criteria}}</td> + <td>{{value.output}}</td> </tr> {% endfor %} </tbody> diff --git a/vnftest/common/import_utils.py b/vnftest/common/import_utils.py new file mode 100644 index 0000000..1cff864 --- /dev/null +++ b/vnftest/common/import_utils.py @@ -0,0 +1,38 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +import importlib + +import os +import sys +import vnftest + + +def import_modules_from_package(package): + """Import modules given a package name + :param: package - Full package name. For example: rally.deploy.engines + """ + vnftest_root = os.path.dirname(os.path.dirname(vnftest.__file__)) + path = os.path.join(vnftest_root, *package.split('.')) + for root, _, files in os.walk(path): + matches = (filename for filename in files if filename.endswith('.py') + and not filename.startswith('__')) + new_package = os.path.relpath(root, vnftest_root).replace(os.sep, + '.') + module_names = set( + '{}.{}'.format(new_package, filename.rsplit('.py', 1)[0]) + for filename in matches) + # Find modules which haven't already been imported + missing_modules = module_names.difference(sys.modules) + for module_name in missing_modules: + importlib.import_module(module_name) diff --git a/vnftest/common/openstack_utils.py b/vnftest/common/openstack_utils.py index 829b916..c8842d8 100644 --- a/vnftest/common/openstack_utils.py +++ b/vnftest/common/openstack_utils.py @@ -40,35 +40,34 @@ creds = {} # ********************************************* # CREDENTIALS # ********************************************* +def initialize(openstack_env_config): + keystone_api_version = openstack_env_config.get('OS_IDENTITY_API_VERSION', None) + + if keystone_api_version is None or keystone_api_version == '2': + keystone_v3 = False + creds['tenant_name'] = openstack_env_config['OS_TENANT_NAME'] + else: + keystone_v3 = True + creds['tenant_name'] = openstack_env_config['OS_PROJECT_NAME'] + creds['project_name'] = openstack_env_config['OS_PROJECT_NAME'] + + creds["username"] = openstack_env_config["OS_USERNAME"] + creds["password"] = openstack_env_config["OS_PASSWORD"] + creds["auth_url"] = openstack_env_config["OS_AUTH_URL"] + creds["tenant_id"] = openstack_env_config["OS_TENANT_ID"] + + if keystone_v3: + if 'OS_USER_DOMAIN_NAME' in openstack_env_config: + creds.update({ + "user_domain_name": openstack_env_config['OS_USER_DOMAIN_NAME'] + }) + if 'OS_PROJECT_DOMAIN_NAME' in openstack_env_config: + creds.update({ + "project_domain_name": openstack_env_config['OS_PROJECT_DOMAIN_NAME'] + }) + + def get_credentials(): - """Returns a creds dictionary filled with parsed from env""" - if len(creds) == 0: - # The most common way to pass these info to the script is to do it - # through environment variables. - keystone_api_version = os.getenv('OS_IDENTITY_API_VERSION') - - if keystone_api_version is None or keystone_api_version == '2': - keystone_v3 = False - creds['tenant_name'] = os.environ.get('OS_TENANT_NAME') - else: - keystone_v3 = True - creds['tenant_name'] = os.environ.get('OS_PROJECT_NAME') - creds['project_name'] = os.environ.get('OS_PROJECT_NAME') - - creds["username"] = os.environ.get("OS_USERNAME") - creds["password"] = os.environ.get("OS_PASSWORD") - creds["auth_url"] = os.environ.get("OS_AUTH_URL") - creds["tenant_id"] = os.environ.get("OS_TENANT_ID") - - if keystone_v3: - if os.getenv('OS_USER_DOMAIN_NAME') is not None: - creds.update({ - "user_domain_name": os.getenv('OS_USER_DOMAIN_NAME') - }) - if os.getenv('OS_PROJECT_DOMAIN_NAME') is not None: - creds.update({ - "project_domain_name": os.getenv('OS_PROJECT_DOMAIN_NAME') - }) return creds diff --git a/vnftest/common/utils.py b/vnftest/common/utils.py index 10edc05..9e2496e 100644 --- a/vnftest/common/utils.py +++ b/vnftest/common/utils.py @@ -15,11 +15,9 @@ # yardstick/common/utils.py import collections -import formatter from contextlib import closing import datetime import errno -import importlib from string import Formatter import ipaddress @@ -28,7 +26,6 @@ import os import random import socket import subprocess -import sys import pkg_resources import six @@ -36,7 +33,6 @@ from flask import jsonify from six.moves import configparser from oslo_serialization import jsonutils import xml.etree.ElementTree -import vnftest from vnftest.common.exceptions import ResourceNotFound @@ -74,31 +70,6 @@ def findsubclasses(cls): return class_implementations[cls.__name__] -def import_modules_from_package(package): - """Import modules given a package name - - :param: package - Full package name. For example: rally.deploy.engines - """ - vnftest_root = os.path.dirname(os.path.dirname(vnftest.__file__)) - path = os.path.join(vnftest_root, *package.split('.')) - for root, _, files in os.walk(path): - matches = (filename for filename in files if filename.endswith('.py') - and not filename.startswith('__')) - new_package = os.path.relpath(root, vnftest_root).replace(os.sep, - '.') - module_names = set( - '{}.{}'.format(new_package, filename.rsplit('.py', 1)[0]) - for filename in matches) - # Find modules which haven't already been imported - missing_modules = module_names.difference(sys.modules) - logger.debug('Importing modules: %s', missing_modules) - for module_name in missing_modules: - try: - importlib.import_module(module_name) - except (ImportError, SyntaxError): - logger.exception('Unable to import module %s', module_name) - - def makedirs(d): try: os.makedirs(d) @@ -496,19 +467,20 @@ def element_tree_to_dict(element_tree): def resource_as_string(path): - split_path = os.path.split(path) - package = split_path[0].replace("/", ".") - if not pkg_resources.resource_exists(package, split_path[1]): - raise ResourceNotFound(resource=path) - return pkg_resources.resource_string(package, split_path[1]) + resource = load_resource(path) + return resource.read() def load_resource(path): - split_path = os.path.split(path) - package = split_path[0].replace("/", ".") - if not pkg_resources.resource_exists(package, split_path[1]): - raise ResourceNotFound(resource=path) - return pkg_resources.resource_stream(package, split_path[1]) + try: + return open(path) + except Exception: + logger.info("path not loaded as file, trying load as package") + split_path = os.path.split(path) + package = split_path[0].replace("/", ".") + if not pkg_resources.resource_exists(package, split_path[1]): + raise ResourceNotFound(resource=path) + return pkg_resources.resource_stream(package, split_path[1]) def format(st, params): diff --git a/vnftest/contexts/base.py b/vnftest/contexts/base.py index 47dbf01..c6f3992 100644 --- a/vnftest/contexts/base.py +++ b/vnftest/contexts/base.py @@ -17,21 +17,32 @@ from vnftest.common import openstack_utils import vnftest.common.utils as utils import yaml - +import logging +LOG = logging.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class Context(object): """Class that represents a context in the logical model""" list = [] vnf_descriptor = {} + onap_env_config = {} creds = {} @classmethod - def initialize(cls, vnf_descriptor_path): + def initialize(cls, vnf_descriptor_path, environment_path): + LOG.info('vnf descriptor path: %s', str(vnf_descriptor_path)) + LOG.info('environment path: %s', str(environment_path)) with open(vnf_descriptor_path) as f: cls.vnf_descriptor = yaml.safe_load(f) - for key, value in openstack_utils.get_credentials().iteritems(): - cls.creds[key] = value + with open(environment_path) as f: + environment_config = yaml.safe_load(f) + openstack_env_config = environment_config['openstack'] + openstack_utils.initialize(openstack_env_config) + cls.onap_env_config = environment_config['onap'] + + cls.creds = openstack_utils.get_credentials() + + @staticmethod def split_name(name, sep='.'): diff --git a/vnftest/core/__init__.py b/vnftest/core/__init__.py index 6ef8d70..d734360 100644 --- a/vnftest/core/__init__.py +++ b/vnftest/core/__init__.py @@ -25,6 +25,7 @@ class Param(object): def __init__(self, kwargs): # list + self.environment = kwargs.get('environment') self.vnfdescriptor = kwargs.get('vnfdescriptor') self.inputfile = kwargs.get('inputfile') self.task_args = kwargs.get('task-args') diff --git a/vnftest/core/task.py b/vnftest/core/task.py index 5e0267f..91e3d3c 100644 --- a/vnftest/core/task.py +++ b/vnftest/core/task.py @@ -72,7 +72,7 @@ class Task(object): # pragma: no cover output_config['DEFAULT']['dispatcher'] = out_types def start(self, args, **kwargs): - Context.initialize(args.vnfdescriptor) + Context.initialize(args.vnfdescriptor, args.environment) atexit.register(self.atexit_handler) task_id = getattr(args, 'task_id') @@ -195,7 +195,6 @@ class Task(object): # pragma: no cover output_config.setdefault('dispatcher_http', {}) output_config.setdefault('dispatcher_file', {}) output_config.setdefault('dispatcher_influxdb', {}) - output_config.setdefault('nsb', {}) def _set_output_config(self, output_config, file_path): try: diff --git a/vnftest/core/testsuite.py b/vnftest/core/testsuite.py index 986982a..9c58886 100644 --- a/vnftest/core/testsuite.py +++ b/vnftest/core/testsuite.py @@ -18,6 +18,8 @@ from __future__ import absolute_import from __future__ import print_function +import fnmatch + import os import logging @@ -41,7 +43,7 @@ class Testsuite(object): def _get_testsuite_file_list(self): try: - testsuite_files = sorted(os.listdir(consts.TESTSUITE_DIR)) + testsuite_files = sorted(fnmatch.filter(os.listdir(consts.TESTSUITE_DIR), '*.yaml')) except OSError: LOG.exception('Failed to list dir:\n%s\n', consts.TESTSUITE_DIR) raise diff --git a/vnftest/dispatcher/__init__.py b/vnftest/dispatcher/__init__.py index 232233f..998094d 100644 --- a/vnftest/dispatcher/__init__.py +++ b/vnftest/dispatcher/__init__.py @@ -17,9 +17,9 @@ from __future__ import absolute_import from oslo_config import cfg -import vnftest.common.utils as utils +import vnftest.common.import_utils as import_utils -utils.import_modules_from_package("vnftest.dispatcher") +import_utils.import_modules_from_package("vnftest.dispatcher") CONF = cfg.CONF OPTS = [ diff --git a/vnftest/onap/onboard/v1/__init__.py b/vnftest/onap/onboard/v1/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vnftest/onap/onboard/v1/__init__.py diff --git a/vnftest/onap/onboard/accept_resource_test.yaml b/vnftest/onap/onboard/v1/accept_resource_test_v1.yaml index 2479f52..2479f52 100644 --- a/vnftest/onap/onboard/accept_resource_test.yaml +++ b/vnftest/onap/onboard/v1/accept_resource_test_v1.yaml diff --git a/vnftest/onap/onboard/accept_service_test.yaml b/vnftest/onap/onboard/v1/accept_service_test_v1.yaml index 6d38244..6d38244 100644 --- a/vnftest/onap/onboard/accept_service_test.yaml +++ b/vnftest/onap/onboard/v1/accept_service_test_v1.yaml diff --git a/vnftest/onap/onboard/add_resource_instance.yaml b/vnftest/onap/onboard/v1/add_resource_instance_v1.yaml index e217bd7..e217bd7 100644 --- a/vnftest/onap/onboard/add_resource_instance.yaml +++ b/vnftest/onap/onboard/v1/add_resource_instance_v1.yaml diff --git a/vnftest/onap/onboard/add_service.yaml b/vnftest/onap/onboard/v1/add_service_v1.yaml index 91a6eff..91a6eff 100644 --- a/vnftest/onap/onboard/add_service.yaml +++ b/vnftest/onap/onboard/v1/add_service_v1.yaml diff --git a/vnftest/onap/onboard/approve_distribution.yaml b/vnftest/onap/onboard/v1/approve_distribution_v1.yaml index a0f6a0d..a0f6a0d 100644 --- a/vnftest/onap/onboard/approve_distribution.yaml +++ b/vnftest/onap/onboard/v1/approve_distribution_v1.yaml diff --git a/vnftest/onap/onboard/checkin_vlm.yaml b/vnftest/onap/onboard/v1/checkin_vlm_v1.yaml index be77446..08fe493 100644 --- a/vnftest/onap/onboard/checkin_vlm.yaml +++ b/vnftest/onap/onboard/v1/checkin_vlm_v1.yaml @@ -14,7 +14,7 @@ --- method: PUT -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-license-models/{{vendor_id}}/versions/0.1/actions +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models/{{vendor_id}}/versions/0.1/actions headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/checkin_vsp.yaml b/vnftest/onap/onboard/v1/checkin_vsp_v1.yaml index d0b9067..95fb7e9 100644 --- a/vnftest/onap/onboard/checkin_vsp.yaml +++ b/vnftest/onap/onboard/v1/checkin_vsp_v1.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: PUT -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/actions +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/actions headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/create_package_vsp.yaml b/vnftest/onap/onboard/v1/create_package_vsp_v1.yaml index 85a7bc5..b023555 100644 --- a/vnftest/onap/onboard/create_package_vsp.yaml +++ b/vnftest/onap/onboard/v1/create_package_vsp_v1.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: PUT -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/actions +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/actions headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/create_vlm.yaml b/vnftest/onap/onboard/v1/create_vlm_v1.yaml index 25418a9..4ca4c4c 100644 --- a/vnftest/onap/onboard/create_vlm.yaml +++ b/vnftest/onap/onboard/v1/create_vlm_v1.yaml @@ -14,7 +14,7 @@ --- method: POST -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-license-models +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/create_vsp.yaml b/vnftest/onap/onboard/v1/create_vsp_v1.yaml index 01d5d64..4a3ac62 100644 --- a/vnftest/onap/onboard/create_vsp.yaml +++ b/vnftest/onap/onboard/v1/create_vsp_v1.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: POST -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-software-products +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/distribute.yaml b/vnftest/onap/onboard/v1/distribute_v1.yaml index 70415bf..70415bf 100644 --- a/vnftest/onap/onboard/distribute.yaml +++ b/vnftest/onap/onboard/v1/distribute_v1.yaml diff --git a/vnftest/onap/onboard/import_vsp.yaml b/vnftest/onap/onboard/v1/import_vsp_v1.yaml index 539b427..539b427 100644 --- a/vnftest/onap/onboard/import_vsp.yaml +++ b/vnftest/onap/onboard/v1/import_vsp_v1.yaml diff --git a/vnftest/onap/onboard/monitor_distribution.yaml b/vnftest/onap/onboard/v1/monitor_distribution_v1.yaml index 40ad7ad..40ad7ad 100644 --- a/vnftest/onap/onboard/monitor_distribution.yaml +++ b/vnftest/onap/onboard/v1/monitor_distribution_v1.yaml diff --git a/vnftest/onap/onboard/process_package.yaml b/vnftest/onap/onboard/v1/process_package_v1.yaml index 20dc082..3716571 100644 --- a/vnftest/onap/onboard/process_package.yaml +++ b/vnftest/onap/onboard/v1/process_package_v1.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: PUT -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/orchestration-template-candidate/process +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/orchestration-template-candidate/process headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/start_resource_test.yaml b/vnftest/onap/onboard/v1/start_resource_test_v1.yaml index b55c909..b55c909 100644 --- a/vnftest/onap/onboard/start_resource_test.yaml +++ b/vnftest/onap/onboard/v1/start_resource_test_v1.yaml diff --git a/vnftest/onap/onboard/start_service_test.yaml b/vnftest/onap/onboard/v1/start_service_test_v1.yaml index dff74b9..dff74b9 100644 --- a/vnftest/onap/onboard/start_service_test.yaml +++ b/vnftest/onap/onboard/v1/start_service_test_v1.yaml diff --git a/vnftest/onap/onboard/submit_resource_for_testing.yaml b/vnftest/onap/onboard/v1/submit_resource_for_testing_v1.yaml index 22dbb64..22dbb64 100644 --- a/vnftest/onap/onboard/submit_resource_for_testing.yaml +++ b/vnftest/onap/onboard/v1/submit_resource_for_testing_v1.yaml diff --git a/vnftest/onap/onboard/submit_service_for_testing.yaml b/vnftest/onap/onboard/v1/submit_service_for_testing_v1.yaml index 1910695..1910695 100644 --- a/vnftest/onap/onboard/submit_service_for_testing.yaml +++ b/vnftest/onap/onboard/v1/submit_service_for_testing_v1.yaml diff --git a/vnftest/onap/onboard/submit_vlm.yaml b/vnftest/onap/onboard/v1/submit_vlm_v1.yaml index 8fcd234..ab86627 100644 --- a/vnftest/onap/onboard/submit_vlm.yaml +++ b/vnftest/onap/onboard/v1/submit_vlm_v1.yaml @@ -14,7 +14,7 @@ --- method: PUT -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-license-models/{{vendor_id}}/versions/0.1/actions +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models/{{vendor_id}}/versions/0.1/actions headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/submit_vsp.yaml b/vnftest/onap/onboard/v1/submit_vsp_v1.yaml index 38fe218..6b991fe 100644 --- a/vnftest/onap/onboard/submit_vsp.yaml +++ b/vnftest/onap/onboard/v1/submit_vsp_v1.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: PUT -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/actions +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/actions headers: Content-Type: application/json Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/upload_package.yaml b/vnftest/onap/onboard/v1/upload_package_v1.yaml index 43bdae3..33f1b6a 100644 --- a/vnftest/onap/onboard/upload_package.yaml +++ b/vnftest/onap/onboard/v1/upload_package_v1.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: POST -url: http://{{sdc_ip}}:{{sdc_port}}/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/orchestration-template-candidate +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/0.1/orchestration-template-candidate headers: Content-Type: multipart/form-data Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== diff --git a/vnftest/onap/onboard/v2/__init__.py b/vnftest/onap/onboard/v2/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vnftest/onap/onboard/v2/__init__.py diff --git a/vnftest/onap/onboard/v2/accept_resource_test_v2.yaml b/vnftest/onap/onboard/v2/accept_resource_test_v2.yaml new file mode 100644 index 0000000..2479f52 --- /dev/null +++ b/vnftest/onap/onboard/v2/accept_resource_test_v2.yaml @@ -0,0 +1,26 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/resources/{{resource_id}}/lifecycleState/certify +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_tester_user}} + Accept: application/json + +body: + userRemarks: certified + diff --git a/vnftest/onap/onboard/v2/accept_service_test_v2.yaml b/vnftest/onap/onboard/v2/accept_service_test_v2.yaml new file mode 100644 index 0000000..6d38244 --- /dev/null +++ b/vnftest/onap/onboard/v2/accept_service_test_v2.yaml @@ -0,0 +1,24 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services/{{sdc_service_id}}/lifecycleState/certify +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_tester_user}} + Accept: application/json +body: + userRemarks: certified diff --git a/vnftest/onap/onboard/v2/add_resource_instance_v2.yaml b/vnftest/onap/onboard/v2/add_resource_instance_v2.yaml new file mode 100644 index 0000000..e217bd7 --- /dev/null +++ b/vnftest/onap/onboard/v2/add_resource_instance_v2.yaml @@ -0,0 +1,32 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services/{{sdc_service_id}}/resourceInstance +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + uniqueId: {{resource_instance_unique_id}} + posX: 500 + posY: 100 + name: {{resource_instance_name}} + componentVersion: 1.0 + originType: VF + icon: defaulticon + componentUid: {{resource_version_id}} diff --git a/vnftest/onap/onboard/v2/add_service_v2.yaml b/vnftest/onap/onboard/v2/add_service_v2.yaml new file mode 100644 index 0000000..91a6eff --- /dev/null +++ b/vnftest/onap/onboard/v2/add_service_v2.yaml @@ -0,0 +1,57 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + artifacts: + toscaArtifacts: + contactId: {{sdc_designer_user}} + categories: + - + name: Network L4+ + normalizedName: network l4+ + uniqueId: serviceNewCategory.network l4+ + icons: + - + network_l_4 + + subcategories: null + ownerId: null + description: service test + icon: defaulticon + componentInstancesProperties: + componentInstancesAttributes: + name: {{service_name}} + tags: + - + {{service_name}} + + capabilities: + requirements: + deploymentArtifacts: + componentType: SERVICE + projectCode: 100100 + componentInstances: [] + properties: [] + attributes: [] + groups: [] + ecompGeneratedNaming: true + serviceApiArtifacts: diff --git a/vnftest/onap/onboard/v2/approve_distribution_v2.yaml b/vnftest/onap/onboard/v2/approve_distribution_v2.yaml new file mode 100644 index 0000000..a0f6a0d --- /dev/null +++ b/vnftest/onap/onboard/v2/approve_distribution_v2.yaml @@ -0,0 +1,23 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services/{{service_version_id}}/distribution-state/approve +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_governance_user}} + Accept: application/json +body: + userRemarks: approved diff --git a/vnftest/onap/onboard/v2/checkin_vsp_v2.yaml b/vnftest/onap/onboard/v2/checkin_vsp_v2.yaml new file mode 100644 index 0000000..5db1930 --- /dev/null +++ b/vnftest/onap/onboard/v2/checkin_vsp_v2.yaml @@ -0,0 +1,24 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: PUT +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/{{vsp_version_id}}/actions +headers: + Content-Type: application/json + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + action: Checkin diff --git a/vnftest/onap/onboard/v2/create_package_vsp_v2.yaml b/vnftest/onap/onboard/v2/create_package_vsp_v2.yaml new file mode 100644 index 0000000..dadc34a --- /dev/null +++ b/vnftest/onap/onboard/v2/create_package_vsp_v2.yaml @@ -0,0 +1,24 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: PUT +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/{{vsp_version_id}}/actions +headers: + Content-Type: application/json + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + action: Create_Package diff --git a/vnftest/onap/onboard/v2/create_vlm_v2.yaml b/vnftest/onap/onboard/v2/create_vlm_v2.yaml new file mode 100644 index 0000000..4ca4c4c --- /dev/null +++ b/vnftest/onap/onboard/v2/create_vlm_v2.yaml @@ -0,0 +1,27 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models +headers: + Content-Type: application/json + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + vendorName: {{vendor_name}} + description: vlm via dovetail + iconRef: icon
\ No newline at end of file diff --git a/vnftest/onap/onboard/v2/create_vsp_v2.yaml b/vnftest/onap/onboard/v2/create_vsp_v2.yaml new file mode 100644 index 0000000..4a3ac62 --- /dev/null +++ b/vnftest/onap/onboard/v2/create_vsp_v2.yaml @@ -0,0 +1,32 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products +headers: + Content-Type: application/json + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + vendorId: {{vendor_id}} + name: {{vsp_name}} + category: resourceNewCategory.application l4+ + subCategory: resourceNewCategory.application l4+.firewall + description: vlm via dovetail + onboardingMethod: NetworkPackage + vendorName: dovetailVendor + icon: icon + licensingData:
\ No newline at end of file diff --git a/vnftest/onap/onboard/v2/distribute_v2.yaml b/vnftest/onap/onboard/v2/distribute_v2.yaml new file mode 100644 index 0000000..70415bf --- /dev/null +++ b/vnftest/onap/onboard/v2/distribute_v2.yaml @@ -0,0 +1,23 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services/{{service_version_id}}/distribution/PROD/activate +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_operations_user}} + Accept: application/json + +body: diff --git a/vnftest/onap/onboard/v2/import_vsp_v2.yaml b/vnftest/onap/onboard/v2/import_vsp_v2.yaml new file mode 100644 index 0000000..539b427 --- /dev/null +++ b/vnftest/onap/onboard/v2/import_vsp_v2.yaml @@ -0,0 +1,64 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/resources +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + artifacts: + toscaArtifacts: + contactId: {{sdc_designer_user}} + categories: + - + name: Application L4+ + normalizedName: application l4+ + uniqueId: resourceNewCategory.application l4+ + icons: null + subcategories: + - + name: Firewall + normalizedName: firewall + uniqueId: resourceNewCategory.application l4+.firewall + icons: + - + firewall + groupings: null + ownerId: null + ownerId: null + description: dovetail initiated + icon: defaulticon + componentInstancesProperties: + componentInstancesAttributes: + name: {{vsp_name}} + tags: + - + {{vsp_name}} + capabilities: + requirements: + deploymentArtifacts: + componentType: RESOURCE + vendorName: dovetailVendor + vendorRelease: 1.0 + componentInstances: [] + properties: [] + attributes: [] + groups: [] + resourceType: VF + csarUUID: {{vsp_id}} + csarVersion: 1.0 diff --git a/vnftest/onap/onboard/v2/monitor_distribution_v2.yaml b/vnftest/onap/onboard/v2/monitor_distribution_v2.yaml new file mode 100644 index 0000000..40ad7ad --- /dev/null +++ b/vnftest/onap/onboard/v2/monitor_distribution_v2.yaml @@ -0,0 +1,23 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: GET +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services/{{distributed_service_id}}/distribution +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_operations_user}} + Accept: application/json + +body: diff --git a/vnftest/onap/onboard/v2/process_package_v2.yaml b/vnftest/onap/onboard/v2/process_package_v2.yaml new file mode 100644 index 0000000..4d8d3a3 --- /dev/null +++ b/vnftest/onap/onboard/v2/process_package_v2.yaml @@ -0,0 +1,21 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: PUT +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/{{vsp_version_id}}/orchestration-template-candidate/process +headers: + Content-Type: application/json + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json diff --git a/vnftest/onap/onboard/v2/start_resource_test_v2.yaml b/vnftest/onap/onboard/v2/start_resource_test_v2.yaml new file mode 100644 index 0000000..b55c909 --- /dev/null +++ b/vnftest/onap/onboard/v2/start_resource_test_v2.yaml @@ -0,0 +1,23 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/resources/{{resource_id}}/lifecycleState/startCertification +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_tester_user}} + Accept: application/json + +body: {} diff --git a/vnftest/onap/onboard/v2/start_service_test_v2.yaml b/vnftest/onap/onboard/v2/start_service_test_v2.yaml new file mode 100644 index 0000000..dff74b9 --- /dev/null +++ b/vnftest/onap/onboard/v2/start_service_test_v2.yaml @@ -0,0 +1,22 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services/{{sdc_service_id}}/lifecycleState/startCertification +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_tester_user}} + Accept: application/json +body: {} diff --git a/vnftest/onap/onboard/v2/submit_resource_for_testing_v2.yaml b/vnftest/onap/onboard/v2/submit_resource_for_testing_v2.yaml new file mode 100644 index 0000000..22dbb64 --- /dev/null +++ b/vnftest/onap/onboard/v2/submit_resource_for_testing_v2.yaml @@ -0,0 +1,24 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/resources/{{resource_id}}/lifecycleState/certificationRequest +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + userRemarks: resource submited for testing diff --git a/vnftest/onap/onboard/v2/submit_service_for_testing_v2.yaml b/vnftest/onap/onboard/v2/submit_service_for_testing_v2.yaml new file mode 100644 index 0000000..1910695 --- /dev/null +++ b/vnftest/onap/onboard/v2/submit_service_for_testing_v2.yaml @@ -0,0 +1,24 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_catalog_port}}/sdc1/feProxy/rest/v1/catalog/services/{{sdc_service_id}}/lifecycleState/certificationRequest +headers: + Content-Type: application/json + Authorization: Basic YmVlcDpib29w + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + userRemarks: resource submited for testing diff --git a/vnftest/onap/onboard/v2/submit_vlm_v2.yaml b/vnftest/onap/onboard/v2/submit_vlm_v2.yaml new file mode 100644 index 0000000..b05331f --- /dev/null +++ b/vnftest/onap/onboard/v2/submit_vlm_v2.yaml @@ -0,0 +1,25 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- +method: PUT +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models/{{vendor_id}}/versions/{{vlm_version_id}}/actions +headers: + Content-Type: application/json + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + action: Submit diff --git a/vnftest/onap/onboard/v2/submit_vsp_v2.yaml b/vnftest/onap/onboard/v2/submit_vsp_v2.yaml new file mode 100644 index 0000000..a85f63f --- /dev/null +++ b/vnftest/onap/onboard/v2/submit_vsp_v2.yaml @@ -0,0 +1,24 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: PUT +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/{{vsp_version_id}}/actions +headers: + Content-Type: application/json + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json + +body: + action: Submit diff --git a/vnftest/onap/onboard/v2/upload_package_v2.yaml b/vnftest/onap/onboard/v2/upload_package_v2.yaml new file mode 100644 index 0000000..e623438 --- /dev/null +++ b/vnftest/onap/onboard/v2/upload_package_v2.yaml @@ -0,0 +1,22 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## +--- +method: POST +url: http://{{sdc_ip}}:{{sdc_port}}/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/{{vsp_id}}/versions/{{vsp_version_id}}/orchestration-template-candidate +headers: + Content-Type: multipart/form-data + Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== + USER_ID: {{sdc_designer_user}} + Accept: application/json +file: {{package_file_path}}
\ No newline at end of file diff --git a/vnftest/onap/steps/validation/vf_module_validator.py b/vnftest/onap/steps/validation/vf_module_validator.py index 63caf58..1b54fad 100644 --- a/vnftest/onap/steps/validation/vf_module_validator.py +++ b/vnftest/onap/steps/validation/vf_module_validator.py @@ -14,11 +14,11 @@ from __future__ import absolute_import -from vnftest.common import openstack_utils, utils - -from vnftest.onap.onap_api_call import OnapApiCall import logging +from vnftest.steps.rest_call import RestCall + +from vnftest.common import openstack_utils, utils from vnftest.steps import base LOG = logging.getLogger(__name__) @@ -57,7 +57,8 @@ class VfModuleValidator(base.Step): 'value': self.vf_module_instance_id} ] step_conf['output'] = {'heat_stack_id': '[heat-stack-id]'} - onap_api_call = OnapApiCall(step_conf, self.context, self.input_params) - output = onap_api_call.run({}) + options = {'options': step_conf} + rest_call = RestCall(options, self.context, self.input_params) + output = rest_call.run({}) return output['heat_stack_id'] diff --git a/vnftest/runners/base.py b/vnftest/runners/base.py index 7310d9b..28127af 100755 --- a/vnftest/runners/base.py +++ b/vnftest/runners/base.py @@ -26,7 +26,6 @@ from Queue import Empty import vnftest.common.utils as utils from vnftest.steps import base as base_step -from vnftest.onap.onap_api_call import OnapApiCall log = logging.getLogger(__name__) diff --git a/vnftest/onap/onap_api_call.py b/vnftest/steps/rest_call.py index 9ab95e7..f8b1cf7 100644 --- a/vnftest/onap/onap_api_call.py +++ b/vnftest/steps/rest_call.py @@ -24,7 +24,6 @@ from vnftest.common import rest_client from vnftest.common.utils import dotdict from vnftest.common.exceptions import MandatoryKeyException, InputParameterMissing from vnftest.crawlers.base import Crawler -from vnftest.onap.common.vf_module_crawler import VfModuleCrawler from vnftest.steps import base import jinja2 import jinja2.meta @@ -32,10 +31,10 @@ import jinja2.meta LOG = logging.getLogger(__name__) -class OnapApiCall(base.Step): - """Call ONAP API +class RestCall(base.Step): + """Call REST API """ - __step_type__ = "OnapApiCall" + __step_type__ = "RestCall" def __init__(self, step_cfg, context, input_params): self.step_cfg = step_cfg @@ -91,7 +90,7 @@ class OnapApiCall(base.Step): def run_impl(self, result): if not self.setup_done: self.setup() - params = copy.deepcopy(consts.component_constants) + params = copy.deepcopy(self.context.onap_env_config) self.eval_input(params) execution_result = self.execute_operation(params) result_body = execution_result['body'] diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_tc002.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml index 5688f30..addee64 100644 --- a/vnftest/test_config/onap/test_cases/onap_vnftest_tc002.yaml +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml @@ -44,9 +44,9 @@ description: > steps: - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/create_region.yaml" + file: "vnftest/onap/lifecycle/create_region.yaml" input: - parameter_name: "cloud_owner" @@ -62,17 +62,17 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/create_service.yaml" + file: "vnftest/onap/lifecycle/create_service.yaml" runner: type: Iteration run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/create_customer.yaml" + file: "vnftest/onap/lifecycle/create_customer.yaml" input: - parameter_name: "customer_name" @@ -84,9 +84,9 @@ steps: parameter_name: "tenant_id" value: "{context.creds.tenant_id}" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/create_service_instance.yaml" + file: "vnftest/onap/lifecycle/create_service_instance.yaml" delay: 60 input: - @@ -119,9 +119,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/monitor_request.yaml" + file: "vnftest/onap/lifecycle/monitor_request.yaml" input: - parameter_name: "request_id" @@ -138,9 +138,9 @@ steps: interval: 5 - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/create_vnf_instance.yaml" + file: "vnftest/onap/lifecycle/create_vnf_instance.yaml" delay: 30 input: - @@ -195,9 +195,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/monitor_request.yaml" + file: "vnftest/onap/lifecycle/monitor_request.yaml" input: - parameter_name: "request_id" @@ -220,9 +220,9 @@ steps: {% set vf_module = vf_modules_list[vf_module_definition.module_name] %} {% set vnf_name = ['test_vnf_', rnd, '_', vf_module_definition.module_name ]|join %} - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/preload_sdnc.yaml" + file: "vnftest/onap/lifecycle/preload_sdnc.yaml" input: - parameter_name: "vnf_parameters" @@ -250,9 +250,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/create_vf_module.yaml" + file: "vnftest/onap/lifecycle/create_vf_module.yaml" delay: 30 input: - @@ -328,9 +328,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/monitor_request.yaml" + file: "vnftest/onap/lifecycle/monitor_request.yaml" input: - parameter_name: "request_id" diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_tc001.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml index 882d172..c0fcc84 100644 --- a/vnftest/test_config/onap/test_cases/onap_vnftest_tc001.yaml +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml @@ -25,9 +25,9 @@ description: > {% set resource_instance_unique_id = resource_instance_unique_id or ['\"\u007Bresource_version_id\u007D_', rnd, '\"']|join %} steps: - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/create_vlm.yaml" + file: "vnftest/onap/onboard/v1/create_vlm_v1.yaml" input: - parameter_name: "vendor_name" @@ -40,9 +40,9 @@ steps: type: Iteration run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/checkin_vlm.yaml" + file: "vnftest/onap/onboard/v1/checkin_vlm_v1.yaml" input: - parameter_name: "vendor_id" @@ -51,9 +51,9 @@ steps: type: Iteration run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/submit_vlm.yaml" + file: "vnftest/onap/onboard/v1/submit_vlm_v1.yaml" input: - parameter_name: "vendor_id" @@ -62,9 +62,9 @@ steps: type: Iteration run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/create_vsp.yaml" + file: "vnftest/onap/onboard/v1/create_vsp_v1.yaml" input: - parameter_name: "vendor_id" @@ -81,9 +81,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/upload_package.yaml" + file: "vnftest/onap/onboard/v1/upload_package_v1.yaml" input: - parameter_name: "vsp_id" @@ -96,9 +96,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/process_package.yaml" + file: "vnftest/onap/onboard/v1/process_package_v1.yaml" input: - parameter_name: "vsp_id" @@ -108,9 +108,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/checkin_vsp.yaml" + file: "vnftest/onap/onboard/v1/checkin_vsp_v1.yaml" input: - parameter_name: "vsp_id" @@ -120,9 +120,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/submit_vsp.yaml" + file: "vnftest/onap/onboard/v1/submit_vsp_v1.yaml" input: - parameter_name: "vsp_id" @@ -132,9 +132,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/create_package_vsp.yaml" + file: "vnftest/onap/onboard/v1/create_package_vsp_v1.yaml" input: - parameter_name: "vsp_id" @@ -144,9 +144,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/import_vsp.yaml" + file: "vnftest/onap/onboard/v1/import_vsp_v1.yaml" input: - parameter_name: "vsp_name" @@ -164,9 +164,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/submit_resource_for_testing.yaml" + file: "vnftest/onap/onboard/v1/submit_resource_for_testing_v1.yaml" input: - parameter_name: "resource_id" @@ -176,9 +176,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/start_resource_test.yaml" + file: "vnftest/onap/onboard/v1/start_resource_test_v1.yaml" input: - parameter_name: "resource_id" @@ -188,9 +188,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/accept_resource_test.yaml" + file: "vnftest/onap/onboard/v1/accept_resource_test_v1.yaml" input: - parameter_name: "resource_id" @@ -217,9 +217,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/add_service.yaml" + file: "vnftest/onap/onboard/v1/add_service_v1.yaml" input: - parameter_name: "service_name" @@ -236,9 +236,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/add_resource_instance.yaml" + file: "vnftest/onap/onboard/v1/add_resource_instance_v1.yaml" input: - parameter_name: "resource_instance_unique_id" @@ -268,9 +268,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/submit_service_for_testing.yaml" + file: "vnftest/onap/onboard/v1/submit_service_for_testing_v1.yaml" input: - parameter_name: "sdc_service_id" @@ -280,9 +280,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/start_service_test.yaml" + file: "vnftest/onap/onboard/v1/start_service_test_v1.yaml" input: - parameter_name: "sdc_service_id" @@ -291,9 +291,9 @@ steps: type: Iteration run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/accept_service_test.yaml" + file: "vnftest/onap/onboard/v1/accept_service_test_v1.yaml" input: - parameter_name: "sdc_service_id" @@ -307,9 +307,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/approve_distribution.yaml" + file: "vnftest/onap/onboard/v1/approve_distribution_v1.yaml" input: - parameter_name: "service_version_id" @@ -318,9 +318,9 @@ steps: type: Iteration run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/distribute.yaml" + file: "vnftest/onap/onboard/v1/distribute_v1.yaml" input: - parameter_name: "service_version_id" @@ -352,9 +352,9 @@ steps: type: Iteration run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/onboard/monitor_distribution.yaml" + file: "vnftest/onap/onboard/v1/monitor_distribution_v1.yaml" input: - parameter_name: "distributed_service_id" diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml new file mode 100644 index 0000000..931974e --- /dev/null +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml @@ -0,0 +1,387 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- +schema: "vnftest:task:0.1" +description: > + Vnftest TC001 config file; + Onboard VNF package to SDC +{% set rnd = range(10000)|random %} +{% set vsp_name = vsp_name or ['test_vsp_', rnd ]|join %} +{% set vendor_name = vendor_name or ['test_vendor_', rnd ]|join %} +{% set service_name = service_name or ['test_service_', rnd ]|join %} +{% set resource_instance_name = resource_instance_name or ["test_resource_instance_", rnd ]|join %} +{% set resource_instance_unique_id = resource_instance_unique_id or ['\"\u007Bresource_version_id\u007D_', rnd, '\"']|join %} +steps: +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/create_vlm_v2.yaml" + input: + - + parameter_name: "vendor_name" + value: {{vendor_name}} + output: + - + parameter_name: "vendor_id" + value: "[itemId]" + - + parameter_name: "vlm_version_id" + value: "[version][id]" + runner: + type: Iteration + run_step: "setup,run" +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/submit_vlm_v2.yaml" + input: + - + parameter_name: "vendor_id" + value: "{vendor_id}" + - + parameter_name: "vlm_version_id" + value: "{vlm_version_id}" + runner: + type: Iteration + run_step: "setup,run" +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/create_vsp_v2.yaml" + input: + - + parameter_name: "vendor_id" + value: "{vendor_id}" + - + parameter_name: "vsp_name" + value: {{vsp_name}} + output: + - + parameter_name: "vsp_id" + value: "[itemId]" + - + parameter_name: "vsp_version_id" + value: "[version][id]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/upload_package_v2.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + - + parameter_name: "vsp_version_id" + value: "{vsp_version_id}" + - + parameter_name: "package_file_path" + value: "{context.vnf_descriptor.package_location}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/process_package_v2.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + - + parameter_name: "vsp_version_id" + value: "{vsp_version_id}" + runner: + type: Iteration + run_step: "setup,run" + +#- +# type: RestCall +# options: +# file: "vnftest/onap/onboard/v2/checkin_vsp_v2.yaml" +# input: +# - +# parameter_name: "vsp_id" +# value: "{vsp_id}" +# - +# parameter_name: "vsp_version_id" +# value: "{vsp_version_id}" +# runner: +# type: Iteration +# run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/submit_vsp_v2.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + - + parameter_name: "vsp_version_id" + value: "{vsp_version_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/create_package_vsp_v2.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + - + parameter_name: "vsp_version_id" + value: "{vsp_version_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/import_vsp_v2.yaml" + input: + - + parameter_name: "vsp_name" + value: {{vsp_name}} + - + parameter_name: "vsp_id" + value: "{vsp_id}" + output: + - + parameter_name: "resource_id" + value: "[uniqueId]" + + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/submit_resource_for_testing_v2.yaml" + input: + - + parameter_name: "resource_id" + value: "{resource_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/start_resource_test_v2.yaml" + input: + - + parameter_name: "resource_id" + value: "{resource_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/accept_resource_test_v2.yaml" + input: + - + parameter_name: "resource_id" + value: "{resource_id}" + output: + - + parameter_name: "resource_version_id" + value: "[allVersions][1.0]" + - + parameter_name: "resource_model_invariant_id" + value: "[invariantUUID]" + - + parameter_name: "resource_model_version_id" + value: "[uuid]" + - + parameter_name: "resource_model_name" + value: "[name]" + - + parameter_name: "resource_model_version" + value: "[version]" + + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/add_service_v2.yaml" + input: + - + parameter_name: "service_name" + value: {{service_name}} + output: + - + parameter_name: "sdc_service_id" + value: "[uniqueId]" + - + parameter_name: "service_model_name" + value: "[name]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/add_resource_instance_v2.yaml" + input: + - + parameter_name: "resource_instance_unique_id" + value: {{resource_instance_unique_id}} + - + parameter_name: "resource_instance_name" + value: {{resource_instance_name}} + - + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" + - + parameter_name: "resource_version_id" + value: "{resource_version_id}" + output: + - + parameter_name: "resource_model_customization_id" + value: "[customizationUUID]" + - + parameter_name: "resource_model_customization_name" + value: "[normalizedName]" + - + parameter_name: "resource_instance_model_name" + value: "[name]" + + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/submit_service_for_testing_v2.yaml" + input: + - + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/start_service_test_v2.yaml" + input: + - + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" + runner: + type: Iteration + run_step: "setup,run" +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/accept_service_test_v2.yaml" + input: + - + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" + output: + - + parameter_name: "service_version_id" + value: "[allVersions][1.0]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/approve_distribution_v2.yaml" + input: + - + parameter_name: "service_version_id" + value: "{service_version_id}" + runner: + type: Iteration + run_step: "setup,run" +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/distribute_v2.yaml" + input: + - + parameter_name: "service_version_id" + value: "{service_version_id}" + output: + - + parameter_name: "distributed_service_id" + value: "[uuid]" + - + parameter_name: "service_model_invariant_id" + value: "[invariantUUID]" + - + parameter_name: "service_model_version_id" + value: "[uuid]" + - + parameter_name: "service_model_normalized_name" + value: "[normalizedName]" + - + parameter_name: "service_model_name" + value: "[name]" + - + parameter_name: "service_model_version" + value: "[version]" + - + parameter_name: "vf_modules_list" + type: VfModuleCrawler + + runner: + type: Iteration + run_step: "setup,run" +- + type: RestCall + options: + file: "vnftest/onap/onboard/v2/monitor_distribution_v2.yaml" + input: + - + parameter_name: "distributed_service_id" + value: "{distributed_service_id}" + output: + - + parameter_name: "distribution_status" + value: "[distributionStatusOfServiceList][0][deployementStatus]" + sla: + action: assert + value: "{distribution_status}" + equals: "Distributed" + retries: 5 + interval: 5 + +context: + type: CSAR
\ No newline at end of file diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_tc003.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml index 278f8ef..59aed7b 100644 --- a/vnftest/test_config/onap/test_cases/onap_vnftest_tc003.yaml +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml @@ -28,9 +28,9 @@ steps: {% for vf_module_definition in vnf_descriptor.vf_modules %} {% set vf_module = vf_modules_list[vf_module_definition.module_name] %} - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/delete_vf_module.yaml" + file: "vnftest/onap/lifecycle/delete_vf_module.yaml" input: - parameter_name: "service_instance_id" @@ -69,9 +69,9 @@ steps: run_step: "setup,run" - - type: OnapApiCall + type: RestCall options: - file: "onap/lifecycle/monitor_request.yaml" + file: "vnftest/onap/lifecycle/monitor_request.yaml" input: - parameter_name: "request_id" diff --git a/vnftest/test_config/onap/test_suites/onap_basic_lifecycle.yaml b/vnftest/test_config/onap/test_suites/onap_basic_lifecycle-v1.yaml index 773a8e0..b3cd1d3 100644 --- a/vnftest/test_config/onap/test_suites/onap_basic_lifecycle.yaml +++ b/vnftest/test_config/onap/test_suites/onap_basic_lifecycle-v1.yaml @@ -19,8 +19,8 @@ schema: "vnftest:suite:0.1" name: "onap-basic-lifecycle" test_cases: - - file_name: test_config/onap/test_cases/onap_vnftest_tc001.yaml + file_name: vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml - - file_name: test_config/onap/test_cases/onap_vnftest_tc002.yaml + file_name: vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml #- -# file_name: test_config/onap/test_cases/onap_vnftest_tc003.yaml +# file_name: vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml diff --git a/vnftest/test_config/onap/test_suites/onap_basic_lifecycle-v2.yaml b/vnftest/test_config/onap/test_suites/onap_basic_lifecycle-v2.yaml new file mode 100644 index 0000000..670196d --- /dev/null +++ b/vnftest/test_config/onap/test_suites/onap_basic_lifecycle-v2.yaml @@ -0,0 +1,26 @@ +############################################################################## +# Copyright 2018 EuropeanSoftwareMarketingLtd. +# =================================================================== +# Licensed under the ApacheLicense, Version2.0 (the"License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under +# the License +############################################################################## + +--- + +schema: "vnftest:suite:0.1" + +name: "onap-basic-lifecycle" +test_cases: +- + file_name: vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml +- + file_name: vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml +#- +# file_name: vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml diff --git a/vnftest/tests/unit/common/test_utils.py b/vnftest/tests/unit/common/test_utils.py index e8860cb..d152a98 100644 --- a/vnftest/tests/unit/common/test_utils.py +++ b/vnftest/tests/unit/common/test_utils.py @@ -28,6 +28,7 @@ import unittest import vnftest from vnftest import ssh from vnftest.common import utils +from vnftest.common import import_utils from vnftest.common import constants @@ -62,7 +63,7 @@ class ImportModulesFromPackageTestCase(unittest.TestCase): (os.path.join(vnftest_root, 'foo', 'bar'), [], ['baz.txt', 'qux.rst']) ]) - utils.import_modules_from_package('foo.bar') + import_utils.import_modules_from_package('foo.bar') @mock.patch('vnftest.common.utils.os.walk') @mock.patch.object(importlib, 'import_module') @@ -73,7 +74,7 @@ class ImportModulesFromPackageTestCase(unittest.TestCase): (os.path.join(vnftest_root, 'foo', os.pardir, 'bar'), [], ['baz.py']) ]) - utils.import_modules_from_package('foo.bar') + import_utils.import_modules_from_package('foo.bar') mock_import_module.assert_called_once_with('bar.baz') diff --git a/vnftest/tests/unit/core/test_commands.py b/vnftest/tests/unit/core/test_commands.py index 35660bd..fee15a3 100755 --- a/vnftest/tests/unit/core/test_commands.py +++ b/vnftest/tests/unit/core/test_commands.py @@ -14,18 +14,15 @@ # vnftest comment: this is a modified copy of # yardstick/tests/functional/test_cli_runner.py +import sys import unittest +from cStringIO import StringIO from vnftest.cmd.commands.runner import RunnerCommands from vnftest.cmd.commands.step import StepCommands from vnftest.core import Param from vnftest.core.runner import Runners from vnftest.core.step import Steps -from vnftest.runners.iteration import IterationRunner -from vnftest.runners.duration import DurationRunner -from vnftest.onap.onap_api_call import OnapApiCall -from cStringIO import StringIO -import sys class Capture(list): @@ -56,7 +53,7 @@ class CommandsTestCase(unittest.TestCase): step_cmd = StepCommands() with Capture() as output: step_cmd.do_list(None) - self.assert_text_in_lines(output, ["OnapApiCall"]) + self.assert_text_in_lines(output, ["RestCall"]) def test_runner_show_Duration(self): param = Param({}) @@ -72,12 +69,12 @@ class CommandsTestCase(unittest.TestCase): Runners().show(param) self.assert_text_in_lines(output, ["iterations - amount of times"]) - def test_step_show_OnapApiCall(self): + def test_step_show_RestCall(self): param = Param({}) - setattr(param, 'type', ['OnapApiCall']) + setattr(param, 'type', ['RestCall']) with Capture() as output: Steps().show(param) - self.assert_text_in_lines(output, ["Call ONAP API"]) + self.assert_text_in_lines(output, ["Call REST API"]) def assert_text_in_lines(self, lines, texts): for text in texts: diff --git a/vnftest/tests/unit/core/test_testcase.py b/vnftest/tests/unit/core/test_testcase.py index 0ba4873..5b1146d 100644 --- a/vnftest/tests/unit/core/test_testcase.py +++ b/vnftest/tests/unit/core/test_testcase.py @@ -23,7 +23,7 @@ from vnftest.core import testcase class Arg(object): def __init__(self): - self.casename = ('onap_vnftest_tc001',) + self.casename = ('onap_vnftest_onboard-v1',) class TestcaseUT(unittest.TestCase): diff --git a/vnftest/tests/unit/onap/test_onap_api_call.py b/vnftest/tests/unit/onap/test_rest_call.py index 2b6d79d..ec3c88f 100644 --- a/vnftest/tests/unit/onap/test_onap_api_call.py +++ b/vnftest/tests/unit/onap/test_rest_call.py @@ -14,16 +14,14 @@ import mock import testtools - from vnftest.contexts.base import Context from vnftest.core import task -from vnftest.onap.onap_api_call import OnapApiCall -class OnapApiCallTestCase(testtools.TestCase): +class RestCallTestCase(testtools.TestCase): step = { - 'type': 'OnapApiCall', + 'type': 'RestCall', 'options': { 'file': "dummy.yaml", 'input': @@ -46,9 +44,9 @@ class OnapApiCallTestCase(testtools.TestCase): NAME = 'sample' def setUp(self): - super(OnapApiCallTestCase, self).setUp() + super(RestCallTestCase, self).setUp() - @mock.patch('vnftest.onap.onap_api_call.OnapApiCall.execute_operation_impl') + @mock.patch('vnftest.steps.rest_call.RestCall.execute_operation_impl') def test_run(self, mock_execute_operation): mock_execute_operation.return_value = {'body': {'value': 'output1'}} t = task.Task() @@ -56,5 +54,5 @@ class OnapApiCallTestCase(testtools.TestCase): context = Context.get("CSAR") context.init(context_cfg) t.context = context - output = t._run([OnapApiCallTestCase.step], False, "vnftest.out") + output = t._run([RestCallTestCase.step], False, "vnftest.out") self.assertEquals(output[0]['data']['output1'], 'output1') |