diff options
author | Chris Donley <christopher.donley@huawei.com> | 2018-03-14 14:18:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-14 14:18:27 +0000 |
commit | 4951250edc384d1736669ec9f656ecca6aab5426 (patch) | |
tree | d690c086bd29339cb88bf18bbb3da3de13010ac6 | |
parent | ab3381d2e8a6207fa792d12ba516e5c6efa2dc27 (diff) | |
parent | 30497ac60f062adba7dae751110dd9fc87ef04db (diff) |
Merge "Onboard package test case"
-rw-r--r-- | dist/vnftest-0.1.dev0-py2.7.egg | bin | 189028 -> 195887 bytes | |||
-rw-r--r-- | etc/vnftest/vnf_descriptors/vnf_descriptor_sample.yaml | 20 | ||||
-rw-r--r-- | tests/onap/test_cases/onap_vnftest_tc001.yaml | 340 | ||||
-rw-r--r-- | tests/onap/test_suites/onap_basic_lifecycle.yaml | 2 | ||||
-rw-r--r-- | vnftest.egg-info/SOURCES.txt | 56 | ||||
-rw-r--r-- | vnftest/cmd/commands/__init__.py | 2 | ||||
-rw-r--r-- | vnftest/cmd/commands/plugin.py | 2 | ||||
-rw-r--r-- | vnftest/cmd/commands/report.py | 2 | ||||
-rw-r--r-- | vnftest/cmd/commands/runner.py | 2 | ||||
-rw-r--r-- | vnftest/cmd/commands/step.py | 2 | ||||
-rw-r--r-- | vnftest/cmd/commands/task.py | 7 | ||||
-rw-r--r-- | vnftest/cmd/commands/testcase.py | 2 | ||||
-rw-r--r-- | vnftest/common/constants.py | 7 | ||||
-rw-r--r-- | vnftest/contexts/__init__.py (renamed from vnftest/onap/contexts/__init__.py) | 0 | ||||
-rw-r--r-- | vnftest/contexts/base.py (renamed from vnftest/onap/contexts/base.py) | 8 | ||||
-rw-r--r-- | vnftest/contexts/csar.py (renamed from vnftest/onap/contexts/csar.py) | 3 | ||||
-rw-r--r-- | vnftest/contexts/dummy.py (renamed from vnftest/onap/contexts/dummy.py) | 2 | ||||
-rw-r--r-- | vnftest/core/__init__.py (renamed from vnftest/onap/core/__init__.py) | 1 | ||||
-rw-r--r-- | vnftest/core/plugin.py (renamed from vnftest/onap/core/plugin.py) | 0 | ||||
-rw-r--r-- | vnftest/core/report.py (renamed from vnftest/onap/core/report.py) | 0 | ||||
-rw-r--r-- | vnftest/core/runner.py (renamed from vnftest/onap/core/runner.py) | 2 | ||||
-rw-r--r-- | vnftest/core/step.py (renamed from vnftest/onap/core/step.py) | 2 | ||||
-rw-r--r-- | vnftest/core/task.py (renamed from vnftest/onap/core/task.py) | 37 | ||||
-rw-r--r-- | vnftest/core/testcase.py (renamed from vnftest/onap/core/testcase.py) | 0 | ||||
-rw-r--r-- | vnftest/core/testsuite.py (renamed from vnftest/onap/core/testsuite.py) | 0 | ||||
-rw-r--r-- | vnftest/crawlers/__init__.py (renamed from vnftest/onap/runners/__init__.py) | 0 | ||||
-rwxr-xr-x | vnftest/crawlers/base.py | 37 | ||||
-rw-r--r-- | vnftest/crawlers/default.py | 35 | ||||
-rw-r--r-- | vnftest/onap/common/__init__.py (renamed from vnftest/onap/steps/__init__.py) | 0 | ||||
-rw-r--r-- | vnftest/onap/common/vnf_type_crawler.py | 31 | ||||
-rw-r--r-- | vnftest/onap/onap_api_call.py (renamed from vnftest/onap/steps/onap_api_call.py) | 64 | ||||
-rw-r--r-- | vnftest/onap/onboard/__init__.py (renamed from vnftest/onap/steps/dummy/__init__.py) | 0 | ||||
-rw-r--r-- | vnftest/onap/onboard/accept_resource_test.yaml | 24 | ||||
-rw-r--r-- | vnftest/onap/onboard/accept_service_test.yaml | 24 | ||||
-rw-r--r-- | vnftest/onap/onboard/add_resource_instance.yaml | 33 | ||||
-rw-r--r-- | vnftest/onap/onboard/add_service.yaml | 82 | ||||
-rw-r--r-- | vnftest/onap/onboard/approve_distribution.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/checkin_vlm.yaml (renamed from vnftest/onap/steps/onboard/checkin_vlm.yaml) | 0 | ||||
-rw-r--r-- | vnftest/onap/onboard/checkin_vsp.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/create_package_vsp.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/create_vlm.yaml (renamed from vnftest/onap/steps/onboard/create_vlm.yaml) | 0 | ||||
-rw-r--r-- | vnftest/onap/onboard/create_vsp.yaml | 34 | ||||
-rw-r--r-- | vnftest/onap/onboard/distribute.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/import_vsp.yaml | 91 | ||||
-rw-r--r-- | vnftest/onap/onboard/monitor_distribution.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/process_package.yaml | 22 | ||||
-rw-r--r-- | vnftest/onap/onboard/start_resource_test.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/start_service_test.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/submit_resource_for_testing.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/submit_service_for_testing.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/submit_vlm.yaml (renamed from vnftest/onap/steps/onboard/submit_vlm.yaml) | 0 | ||||
-rw-r--r-- | vnftest/onap/onboard/submit_vsp.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/onboard/upload_package.yaml | 23 | ||||
-rw-r--r-- | vnftest/onap/package_upload.py | 43 | ||||
-rw-r--r-- | vnftest/runners/__init__.py (renamed from vnftest/onap/steps/onboard/__init__.py) | 0 | ||||
-rwxr-xr-x | vnftest/runners/base.py (renamed from vnftest/onap/runners/base.py) | 8 | ||||
-rw-r--r-- | vnftest/runners/duration.py (renamed from vnftest/onap/runners/duration.py) | 10 | ||||
-rwxr-xr-x | vnftest/runners/dynamictp.py (renamed from vnftest/onap/runners/dynamictp.py) | 2 | ||||
-rw-r--r-- | vnftest/runners/iteration.py (renamed from vnftest/onap/runners/iteration.py) | 12 | ||||
-rw-r--r-- | vnftest/runners/search.py (renamed from vnftest/onap/runners/search.py) | 4 | ||||
-rw-r--r-- | vnftest/runners/sequence.py (renamed from vnftest/onap/runners/sequence.py) | 2 | ||||
-rw-r--r-- | vnftest/steps/__init__.py | 0 | ||||
-rw-r--r-- | vnftest/steps/base.py (renamed from vnftest/onap/steps/base.py) | 0 | ||||
-rw-r--r-- | vnftest/steps/dummy/__init__.py | 0 | ||||
-rw-r--r-- | vnftest/steps/dummy/dummy.py (renamed from vnftest/onap/steps/dummy/dummy.py) | 3 |
65 files changed, 1198 insertions, 115 deletions
diff --git a/dist/vnftest-0.1.dev0-py2.7.egg b/dist/vnftest-0.1.dev0-py2.7.egg Binary files differindex eaf52c6..7df66f0 100644 --- a/dist/vnftest-0.1.dev0-py2.7.egg +++ b/dist/vnftest-0.1.dev0-py2.7.egg diff --git a/etc/vnftest/vnf_descriptors/vnf_descriptor_sample.yaml b/etc/vnftest/vnf_descriptors/vnf_descriptor_sample.yaml new file mode 100644 index 0000000..21008df --- /dev/null +++ b/etc/vnftest/vnf_descriptors/vnf_descriptor_sample.yaml @@ -0,0 +1,20 @@ +############################################################################## +# 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 +############################################################################## + +--- + +type: CSAR +vnf_name: sample_firewall +vnf_id: 123456 +csar_package_location: /etc/nvftest/sample_fw.csar
\ No newline at end of file diff --git a/tests/onap/test_cases/onap_vnftest_tc001.yaml b/tests/onap/test_cases/onap_vnftest_tc001.yaml index d309826..185cc1a 100644 --- a/tests/onap/test_cases/onap_vnftest_tc001.yaml +++ b/tests/onap/test_cases/onap_vnftest_tc001.yaml @@ -18,9 +18,11 @@ description: > Vnftest TC001 config file; Create VLM in SDC -{% set csar_name = csar_name or none %} -{% set csar_id = csar_id or none %} -{% set csar_package_location = csar_package_location or none %} +{% set vsp_name = vsp_name or ['test_vsp_', range(10000)|random ]|join %} +{% set vendor_name = vendor_name or ['test_vendor_', range(10000)|random ]|join %} +{% set service_name = service_name or ['test_service_', range(10000)|random ]|join %} +{% set resource_instance_name = resource_instance_name or ["test_resource_instance_", range(10000)|random ]|join %} + steps: - type: OnapApiCall @@ -29,11 +31,11 @@ steps: input: - parameter_name: "vendor_name" - value: {{ ["test_vendor_", range(10000)|random ]|join }} + value: {{vendor_name}} output: - parameter_name: "vendor_id" - path: "value" + value: "[value]" runner: type: Iteration run_step: "setup,run" @@ -44,7 +46,7 @@ steps: input: - parameter_name: "vendor_id" - source: prev_step + value: "{vendor_id}" runner: type: Iteration run_step: "setup,run" @@ -55,13 +57,329 @@ steps: input: - parameter_name: "vendor_id" - source: prev_step + value: "{vendor_id}" + runner: + type: Iteration + run_step: "setup,run" +- + type: OnapApiCall + options: + file: "onboard/create_vsp.yaml" + input: + - + parameter_name: "vendor_id" + value: "{vendor_id}" + - + parameter_name: "vsp_name" + value: {{vsp_name}} + output: + - + parameter_name: "vsp_id" + value: "[vspId]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: PackageUpload + options: + file: "onboard/upload_package.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/process_package.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/checkin_vsp.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/submit_vsp.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/create_package_vsp.yaml" + input: + - + parameter_name: "vsp_id" + value: "{vsp_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/import_vsp.yaml" + input: + - + parameter_name: "vsp_name" + value: {{vsp_name}} + - + parameter_name: "vsp_id" + value: "{vsp_id}" + output: + - + parameter_name: "resource_id" + value: "[uniqueId]" + - + parameter_name: "vnf_type" + value: "[name]" + type: VnfTypeCrawler + - + parameter_name: "module_model_invariant_id" + value: "[invariantUUID]" + type: VnfTypeCrawler + - + parameter_name: "module_model_version_id" + value: "[groupUUID]" + type: VnfTypeCrawler + - + parameter_name: "module_model_version" + value: "[version]" + type: VnfTypeCrawler + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/submit_resource_for_testing.yaml" + input: + - + parameter_name: "resource_id" + value: "{resource_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/start_resource_test.yaml" + input: + - + parameter_name: "resource_id" + value: "{resource_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/accept_resource_test.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: OnapApiCall + options: + file: "onboard/add_service.yaml" + input: + - + parameter_name: "service_name" + value: {{service_name}} + output: + - + parameter_name: "service_id" + value: "[uniqueId]" + - + parameter_name: "service_model_name" + value: "[name]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/add_resource_instance.yaml" + input: + - + parameter_name: "resource_instance_unique_id" + value: {{ ["U+007B", "resource_version_id", "U+007D", range(10000)|random ]|join }} + - + parameter_name: "resource_instance_name" + value: {{resource_instance_name}} + - + parameter_name: "service_id" + value: "{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: OnapApiCall + options: + file: "onboard/submit_service_for_testing.yaml" + input: + - + parameter_name: "service_id" + value: "{service_id}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/start_service_test.yaml" + input: + - + parameter_name: "service_id" + value: "{service_id}" runner: type: Iteration run_step: "setup,run" +- + type: OnapApiCall + options: + file: "onboard/accept_service_test.yaml" + input: + - + parameter_name: "service_id" + value: "{service_id}" + output: + - + parameter_name: "service_version_id" + value: "[allVersions][1.0]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "onboard/approve_distribution.yaml" + input: + - + parameter_name: "service_version_id" + value: "{service_version_id}" + runner: + type: Iteration + run_step: "setup,run" +- + type: OnapApiCall + options: + file: "onboard/distribute.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: "service_model_customization_id" + value: "[componentInstances]" + runner: + type: Iteration + run_step: "setup,run" +- + type: OnapApiCall + options: + file: "onboard/monitor_distribution.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 - csar_name: {{csar_name}} - csar_id: {{csar_id}} - csar_package_location: {{csar_package_location}}
\ No newline at end of file + type: CSAR
\ No newline at end of file diff --git a/tests/onap/test_suites/onap_basic_lifecycle.yaml b/tests/onap/test_suites/onap_basic_lifecycle.yaml index 6be8a1b..ee4a15f 100644 --- a/tests/onap/test_suites/onap_basic_lifecycle.yaml +++ b/tests/onap/test_suites/onap_basic_lifecycle.yaml @@ -21,5 +21,3 @@ test_cases_dir: "tests/onap/test_cases/" test_cases: - file_name: onap_vnftest_tc001.yaml - task_args: - default: '{"csar_name": "dummy_package_name", "csar_id":"dummy123", "csar_package_location": "/etc/vnftest/dummy_package.csar"}' diff --git a/vnftest.egg-info/SOURCES.txt b/vnftest.egg-info/SOURCES.txt index 4bb5c16..611c563 100644 --- a/vnftest.egg-info/SOURCES.txt +++ b/vnftest.egg-info/SOURCES.txt @@ -37,33 +37,39 @@ vnftest/common/task_template.py vnftest/common/template_format.py vnftest/common/utils.py vnftest/common/yaml_loader.py +vnftest/contexts/__init__.py +vnftest/contexts/base.py +vnftest/contexts/csar.py +vnftest/contexts/dummy.py +vnftest/core/__init__.py +vnftest/core/plugin.py +vnftest/core/report.py +vnftest/core/runner.py +vnftest/core/step.py +vnftest/core/task.py +vnftest/core/testcase.py +vnftest/core/testsuite.py +vnftest/crawlers/__init__.py +vnftest/crawlers/base.py +vnftest/crawlers/default.py vnftest/dispatcher/__init__.py vnftest/dispatcher/base.py vnftest/dispatcher/file.py vnftest/dispatcher/http.py vnftest/onap/__init__.py -vnftest/onap/contexts/__init__.py -vnftest/onap/contexts/base.py -vnftest/onap/contexts/csar.py -vnftest/onap/contexts/dummy.py -vnftest/onap/core/__init__.py -vnftest/onap/core/plugin.py -vnftest/onap/core/report.py -vnftest/onap/core/runner.py -vnftest/onap/core/step.py -vnftest/onap/core/task.py -vnftest/onap/core/testcase.py -vnftest/onap/core/testsuite.py -vnftest/onap/runners/__init__.py -vnftest/onap/runners/base.py -vnftest/onap/runners/duration.py -vnftest/onap/runners/dynamictp.py -vnftest/onap/runners/iteration.py -vnftest/onap/runners/search.py -vnftest/onap/runners/sequence.py -vnftest/onap/steps/__init__.py -vnftest/onap/steps/base.py -vnftest/onap/steps/onap_api_call.py -vnftest/onap/steps/dummy/__init__.py -vnftest/onap/steps/dummy/dummy.py -vnftest/onap/steps/onboard/__init__.py
\ No newline at end of file +vnftest/onap/onap_api_call.py +vnftest/onap/package_upload.py +vnftest/onap/common/__init__.py +vnftest/onap/common/vnf_type_crawler.py +vnftest/onap/onboard/__init__.py +vnftest/runners/__init__.py +vnftest/runners/base.py +vnftest/runners/duration.py +vnftest/runners/dynamictp.py +vnftest/runners/iteration.py +vnftest/runners/search.py +vnftest/runners/sequence.py +vnftest/steps/__init__.py +vnftest/steps/base.py +vnftest/steps/dummy/__init__.py +vnftest/steps/dummy/dummy.py
\ No newline at end of file diff --git a/vnftest/cmd/commands/__init__.py b/vnftest/cmd/commands/__init__.py index 8c46b47..f0ecc97 100644 --- a/vnftest/cmd/commands/__init__.py +++ b/vnftest/cmd/commands/__init__.py @@ -1,5 +1,5 @@ from __future__ import absolute_import -from vnftest.onap.core import Param +from vnftest.core import Param def change_osloobj_to_paras(args): diff --git a/vnftest/cmd/commands/plugin.py b/vnftest/cmd/commands/plugin.py index e05130a..ff5f45d 100644 --- a/vnftest/cmd/commands/plugin.py +++ b/vnftest/cmd/commands/plugin.py @@ -18,7 +18,7 @@ from __future__ import print_function from __future__ import absolute_import -from vnftest.onap.core.plugin import Plugin +from vnftest.core.plugin import Plugin from vnftest.common.utils import cliargs from vnftest.cmd.commands import change_osloobj_to_paras diff --git a/vnftest/cmd/commands/report.py b/vnftest/cmd/commands/report.py index 05b9249..582d76e 100644 --- a/vnftest/cmd/commands/report.py +++ b/vnftest/cmd/commands/report.py @@ -15,7 +15,7 @@ from __future__ import print_function from __future__ import absolute_import -from vnftest.onap.core.report import Report +from vnftest.core.report import Report from vnftest.cmd.commands import change_osloobj_to_paras from vnftest.common.utils import cliargs diff --git a/vnftest/cmd/commands/runner.py b/vnftest/cmd/commands/runner.py index 557f58f..5d130c3 100644 --- a/vnftest/cmd/commands/runner.py +++ b/vnftest/cmd/commands/runner.py @@ -18,7 +18,7 @@ from __future__ import print_function from __future__ import absolute_import -from vnftest.onap.core.runner import Runners +from vnftest.core.runner import Runners from vnftest.common.utils import cliargs from vnftest.cmd.commands import change_osloobj_to_paras diff --git a/vnftest/cmd/commands/step.py b/vnftest/cmd/commands/step.py index 10ae913..90b3d68 100644 --- a/vnftest/cmd/commands/step.py +++ b/vnftest/cmd/commands/step.py @@ -17,7 +17,7 @@ from __future__ import print_function from __future__ import absolute_import -from vnftest.onap.core.step import Steps +from vnftest.core.step import Steps from vnftest.common.utils import cliargs from vnftest.cmd.commands import change_osloobj_to_paras diff --git a/vnftest/cmd/commands/task.py b/vnftest/cmd/commands/task.py index c0aa63d..3e2a071 100644 --- a/vnftest/cmd/commands/task.py +++ b/vnftest/cmd/commands/task.py @@ -14,14 +14,13 @@ from __future__ import absolute_import import logging -from vnftest.onap.core.task import Task +from vnftest.core.task import Task from vnftest.common.utils import cliargs from vnftest.common.utils import write_json_to_file from vnftest.cmd.commands import change_osloobj_to_paras output_file_default = "/tmp/vnftest.out" - LOG = logging.getLogger(__name__) @@ -30,8 +29,8 @@ class TaskCommands(object): # pragma: no cover Set of commands to manage benchmark tasks. """ - - @cliargs("inputfile", type=str, help="path to task or suite file", nargs=1) + @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", help="Input task args (dict in json). These args are used" "to render input task that is jinja2 template.") diff --git a/vnftest/cmd/commands/testcase.py b/vnftest/cmd/commands/testcase.py index 518df2d..445a8fe 100644 --- a/vnftest/cmd/commands/testcase.py +++ b/vnftest/cmd/commands/testcase.py @@ -18,7 +18,7 @@ from __future__ import absolute_import import prettytable -from vnftest.onap.core.testcase import Testcase +from vnftest.core.testcase import Testcase from vnftest.common.utils import cliargs from vnftest.cmd.commands import change_osloobj_to_paras from vnftest.cmd.commands import Commands diff --git a/vnftest/common/constants.py b/vnftest/common/constants.py index 9da64ba..8bbe070 100644 --- a/vnftest/common/constants.py +++ b/vnftest/common/constants.py @@ -38,11 +38,12 @@ VNFTEST_ROOT_PATH = dirname( def get_param(key, default=''): - # we have to defer this to runtime so that we can mock os.environ.get in unittests - default_path = os.path.join(VNFTEST_ROOT_PATH, "etc/vnftest/vnftest.yaml") - conf_file = os.environ.get('CONF_FILE', default_path) # don't re-parse yaml for each lookup if not CONF: + # we have to defer this to runtime so that we can mock os.environ.get in unittests + default_path = os.path.join(VNFTEST_ROOT_PATH, "etc/vnftest/vnftest.yaml") + conf_file = os.environ.get('CONF_FILE', default_path) + # do not use vnftest.common.utils.parse_yaml # since vnftest.common.utils creates a logger # and so it cannot be imported before this code diff --git a/vnftest/onap/contexts/__init__.py b/vnftest/contexts/__init__.py index e69de29..e69de29 100644 --- a/vnftest/onap/contexts/__init__.py +++ b/vnftest/contexts/__init__.py diff --git a/vnftest/onap/contexts/base.py b/vnftest/contexts/base.py index a6ddb56..ac1591c 100644 --- a/vnftest/onap/contexts/base.py +++ b/vnftest/contexts/base.py @@ -14,13 +14,19 @@ import abc import six import vnftest.common.utils as utils +import yaml @six.add_metaclass(abc.ABCMeta) class Context(object): """Class that represents a context in the logical model""" list = [] - params = {} + vnf_descriptor = {} + + @classmethod + def load_vnf_descriptor(cls, vnf_descriptor_path): + with open(vnf_descriptor_path) as f: + cls.vnf_descriptor = yaml.safe_load(f) @staticmethod def split_name(name, sep='.'): diff --git a/vnftest/onap/contexts/csar.py b/vnftest/contexts/csar.py index 8d89467..2dd4fa4 100644 --- a/vnftest/onap/contexts/csar.py +++ b/vnftest/contexts/csar.py @@ -13,7 +13,8 @@ ############################################################################## import logging -from vnftest.onap.contexts.base import Context + +from vnftest.contexts.base import Context LOG = logging.getLogger(__name__) diff --git a/vnftest/onap/contexts/dummy.py b/vnftest/contexts/dummy.py index b61d55e..04d63ed 100644 --- a/vnftest/onap/contexts/dummy.py +++ b/vnftest/contexts/dummy.py @@ -15,7 +15,7 @@ from __future__ import absolute_import import logging -from vnftest.onap.contexts.base import Context +from vnftest.contexts.base import Context LOG = logging.getLogger(__name__) diff --git a/vnftest/onap/core/__init__.py b/vnftest/core/__init__.py index c204f9d..6ef8d70 100644 --- a/vnftest/onap/core/__init__.py +++ b/vnftest/core/__init__.py @@ -25,6 +25,7 @@ class Param(object): def __init__(self, kwargs): # list + self.vnfdescriptor = kwargs.get('vnfdescriptor') self.inputfile = kwargs.get('inputfile') self.task_args = kwargs.get('task-args') self.task_args_file = kwargs.get('task-args-file') diff --git a/vnftest/onap/core/plugin.py b/vnftest/core/plugin.py index 90b3a7e..90b3a7e 100644 --- a/vnftest/onap/core/plugin.py +++ b/vnftest/core/plugin.py diff --git a/vnftest/onap/core/report.py b/vnftest/core/report.py index bb791dc..bb791dc 100644 --- a/vnftest/onap/core/report.py +++ b/vnftest/core/report.py diff --git a/vnftest/onap/core/runner.py b/vnftest/core/runner.py index 32ec6e9..d4830eb 100644 --- a/vnftest/onap/core/runner.py +++ b/vnftest/core/runner.py @@ -19,7 +19,7 @@ from __future__ import absolute_import import prettytable -from vnftest.onap.runners.base import Runner +from vnftest.runners.base import Runner class Runners(object): # pragma: no cover diff --git a/vnftest/onap/core/step.py b/vnftest/core/step.py index 4411780..dcd1fb4 100644 --- a/vnftest/onap/core/step.py +++ b/vnftest/core/step.py @@ -19,7 +19,7 @@ from __future__ import absolute_import import prettytable -from vnftest.onap.steps.base import Step +from vnftest.steps.base import Step class Steps(object): # pragma: no cover diff --git a/vnftest/onap/core/task.py b/vnftest/core/task.py index 32d61f5..11c8bc6 100644 --- a/vnftest/onap/core/task.py +++ b/vnftest/core/task.py @@ -18,29 +18,33 @@ from __future__ import absolute_import from __future__ import print_function -import sys -import os -from collections import OrderedDict -import copy -import yaml import atexit -import ipaddress -import time +import collections +import copy import logging +import sys +import time import uuid -import collections +from collections import OrderedDict -from six.moves import filter +import ipaddress +import os +import yaml from jinja2 import Environment +from six.moves import filter +from vnftest.runners import base as base_runner -from vnftest.onap.contexts.base import Context -from vnftest.onap.contexts.csar import CSARContext -from vnftest.onap.runners import base as base_runner -from vnftest.onap.runners.duration import DurationRunner -from vnftest.onap.runners.iteration import IterationRunner +from vnftest.contexts.base import Context +from vnftest.contexts.csar import CSARContext +from vnftest.runners import base as base_runner +from vnftest.runners.duration import DurationRunner +from vnftest.runners.iteration import IterationRunner from vnftest.common.constants import CONF_FILE +from vnftest.common.html_template import report_template +from vnftest.common.task_template import TaskTemplate from vnftest.common.yaml_loader import yaml_load +from vnftest.contexts.base import Context from vnftest.dispatcher.base import Base as DispatcherBase from vnftest.common.task_template import TaskTemplate from vnftest.common import utils @@ -69,8 +73,7 @@ class Task(object): # pragma: no cover output_config['DEFAULT']['dispatcher'] = out_types def start(self, args, **kwargs): - """Start a vnf step.""" - + Context.load_vnf_descriptor(args.vnfdescriptor) atexit.register(self.atexit_handler) task_id = getattr(args, 'task_id') @@ -96,7 +99,7 @@ class Task(object): # pragma: no cover utils.write_json_to_file(args.output_file, result) total_start_time = time.time() - parser = TaskParser(args.inputfile[0]) + parser = TaskParser(args.inputfile) if args.suite: # 1.parse suite, return suite_params info diff --git a/vnftest/onap/core/testcase.py b/vnftest/core/testcase.py index ef3e535..ef3e535 100644 --- a/vnftest/onap/core/testcase.py +++ b/vnftest/core/testcase.py diff --git a/vnftest/onap/core/testsuite.py b/vnftest/core/testsuite.py index 986982a..986982a 100644 --- a/vnftest/onap/core/testsuite.py +++ b/vnftest/core/testsuite.py diff --git a/vnftest/onap/runners/__init__.py b/vnftest/crawlers/__init__.py index e69de29..e69de29 100644 --- a/vnftest/onap/runners/__init__.py +++ b/vnftest/crawlers/__init__.py diff --git a/vnftest/crawlers/base.py b/vnftest/crawlers/base.py new file mode 100755 index 0000000..8b5a526 --- /dev/null +++ b/vnftest/crawlers/base.py @@ -0,0 +1,37 @@ +############################################################################## +# 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 +############################################################################## + +from __future__ import absolute_import +import logging + +from vnftest.common import utils + +log = logging.getLogger(__name__) + + +class Crawler(object): + + @staticmethod + def get_cls(crawler_type): + """return class of specified type""" + for crawler in utils.itersubclasses(Crawler): + if crawler_type == crawler.__crawler_type__: + return crawler + raise RuntimeError("No such crawler_type %s" % crawler_type) + + def __init__(self): + pass + + def crawl(self, dictionary, path): + raise NotImplementedError diff --git a/vnftest/crawlers/default.py b/vnftest/crawlers/default.py new file mode 100644 index 0000000..da4df0a --- /dev/null +++ b/vnftest/crawlers/default.py @@ -0,0 +1,35 @@ +############################################################################## +# 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 +############################################################################## + +from __future__ import absolute_import +from vnftest.crawlers import base +import logging + +LOG = logging.getLogger(__name__) + + +class DefaultCrawler(base.Crawler): + __crawler_type__ = 'default' + + def crawl(self, dictionary, path): + path_list = path.split("[") + value = dictionary + for path_element in path_list: + if path_element == "": + continue + path_element = path_element.replace("]", "") + if isinstance(value, list): + path_element = int(path_element) + value = value[path_element] + return value diff --git a/vnftest/onap/steps/__init__.py b/vnftest/onap/common/__init__.py index e69de29..e69de29 100644 --- a/vnftest/onap/steps/__init__.py +++ b/vnftest/onap/common/__init__.py diff --git a/vnftest/onap/common/vnf_type_crawler.py b/vnftest/onap/common/vnf_type_crawler.py new file mode 100644 index 0000000..9e03dc0 --- /dev/null +++ b/vnftest/onap/common/vnf_type_crawler.py @@ -0,0 +1,31 @@ +############################################################################## +# 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 +############################################################################## + +from __future__ import absolute_import +from vnftest.crawlers.default import DefaultCrawler +import logging + +LOG = logging.getLogger(__name__) + + +class VnfTypeCrawler(DefaultCrawler): + __crawler_type__ = 'VnfTypeCrawler' + + def crawl(self, dictionary, path): + index = 0 + vnf_type = dictionary['groups'][0]['name'] + if ".." not in vnf_type: + index = 1 + dictionary = dictionary['groups'][index] + return super(VnfTypeCrawler, self).crawl(dictionary, path) diff --git a/vnftest/onap/steps/onap_api_call.py b/vnftest/onap/onap_api_call.py index e03e00a..7cc68c3 100644 --- a/vnftest/onap/steps/onap_api_call.py +++ b/vnftest/onap/onap_api_call.py @@ -13,17 +13,19 @@ ############################################################################## from __future__ import absolute_import +import copy import logging import time + import os import yaml -import copy -from vnftest.common.exceptions import MandatoryKeyException, InputParameterMissing -from vnftest.onap.steps import base -from vnftest.common import rest_client from vnftest.common import constants as consts -from vnftest.onap.contexts.csar import CSARContext +from vnftest.common import rest_client +from vnftest.common.exceptions import MandatoryKeyException, InputParameterMissing +from vnftest.crawlers.base import Crawler +from vnftest.onap.common.vnf_type_crawler import VnfTypeCrawler +from vnftest.steps import base LOG = logging.getLogger(__name__) @@ -47,6 +49,7 @@ class OnapApiCall(base.Step): self.rest_def_file = options.get("file") self.input_cfg = options.get("input", {}) self.output_cfg = options.get("output", {}) + self.sla_cfg = self.step_cfg.get('sla', {'retries': 0}) self.setup_done = True def eval_input(self, params): @@ -54,19 +57,28 @@ class OnapApiCall(base.Step): param_name = input_parameter['parameter_name'] value = None if 'value' in input_parameter: - value = input_parameter['value'] - elif 'source' in input_parameter: - source = input_parameter['source'] - if source == 'prev_step': - if param_name in self.input_params: - value = self.input_params[param_name] - else: - raise InputParameterMissing(param_name=param_name, source='input parameters') - if value is None: + value_def = input_parameter['value'] + value = self.format_string(value_def, self.input_params) + if value is None or value == "": raise InputParameterMissing(param_name=param_name, source="task configuration") params[param_name] = value - def run(self, result): + def run(self, result, attempt=0): + output = self.run_impl(result) + try: + self.handle_sla(output) + except AssertionError as e: + LOG.info(str(e)) + if attempt < self.sla_cfg['retries']: + time.sleep(self.sla_cfg['interval']) + LOG.info("retry operation") + attempt = attempt + 1 + return self.run(result, attempt) + else: + raise e + return output + + def run_impl(self, result): if not self.setup_done: self.setup() output = {} @@ -76,15 +88,17 @@ class OnapApiCall(base.Step): result_body = execution_result['body'] for output_parameter in self.output_cfg: param_name = output_parameter['parameter_name'] - param_path = output_parameter['path'] - path_list = param_path.split("|") - param_value = result_body - for path_element in path_list: - param_value = param_value[path_element] + param_value = output_parameter['value'] + if param_value.find("[") > -1: + crawler_type = output_parameter.get('type', 'default') + crawler_class = Crawler.get_cls(crawler_type) + crawler = crawler_class() + param_value = crawler.crawl(result_body, param_value) if param_value is None: raise MandatoryKeyException(key_name='param_path', class_name=str(result_body)) result[param_name] = param_value output[param_name] = param_value + self.handle_sla(output) return output def execute_operation(self, params, attempt=0): @@ -154,7 +168,8 @@ class OnapApiCall(base.Step): ret = self.format_string(d, params) return ret - def format_string(self, st, params): + @staticmethod + def format_string(st, params): try: return st.format(**params) except Exception as e: @@ -165,4 +180,9 @@ class OnapApiCall(base.Step): LOG.info("param" + params[s]) return st.format(**params) - + def handle_sla(self, output): + if 'assert' in self.sla_cfg and 'equals' in self.sla_cfg: + value_def = self.sla_cfg['value'] + value = self.format_string(value_def, output) + expected_value = self.sla_cfg['equals'] + assert value == expected_value diff --git a/vnftest/onap/steps/dummy/__init__.py b/vnftest/onap/onboard/__init__.py index e69de29..e69de29 100644 --- a/vnftest/onap/steps/dummy/__init__.py +++ b/vnftest/onap/onboard/__init__.py diff --git a/vnftest/onap/onboard/accept_resource_test.yaml b/vnftest/onap/onboard/accept_resource_test.yaml new file mode 100644 index 0000000..60a079e --- /dev/null +++ b/vnftest/onap/onboard/accept_resource_test.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/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/accept_service_test.yaml b/vnftest/onap/onboard/accept_service_test.yaml new file mode 100644 index 0000000..8b5e6db --- /dev/null +++ b/vnftest/onap/onboard/accept_service_test.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/{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/add_resource_instance.yaml b/vnftest/onap/onboard/add_resource_instance.yaml new file mode 100644 index 0000000..b92cc9b --- /dev/null +++ b/vnftest/onap/onboard/add_resource_instance.yaml @@ -0,0 +1,33 @@ +############################################################################## +# 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_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}" + }
\ No newline at end of file diff --git a/vnftest/onap/onboard/add_service.yaml b/vnftest/onap/onboard/add_service.yaml new file mode 100644 index 0000000..9602a6b --- /dev/null +++ b/vnftest/onap/onboard/add_service.yaml @@ -0,0 +1,82 @@ +############################################################################## +# 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/approve_distribution.yaml b/vnftest/onap/onboard/approve_distribution.yaml new file mode 100644 index 0000000..b1efc48 --- /dev/null +++ b/vnftest/onap/onboard/approve_distribution.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/steps/onboard/checkin_vlm.yaml b/vnftest/onap/onboard/checkin_vlm.yaml index 93fdd07..93fdd07 100644 --- a/vnftest/onap/steps/onboard/checkin_vlm.yaml +++ b/vnftest/onap/onboard/checkin_vlm.yaml diff --git a/vnftest/onap/onboard/checkin_vsp.yaml b/vnftest/onap/onboard/checkin_vsp.yaml new file mode 100644 index 0000000..399aa47 --- /dev/null +++ b/vnftest/onap/onboard/checkin_vsp.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: "PUT" +url: "http://{sdc_ip}:{sdc_port}/onboarding-api/v1.0/vendor-software-products/{vsp_id}/versions/0.1/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/create_package_vsp.yaml b/vnftest/onap/onboard/create_package_vsp.yaml new file mode 100644 index 0000000..a961b86 --- /dev/null +++ b/vnftest/onap/onboard/create_package_vsp.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: "PUT" +url: "http://{sdc_ip}:{sdc_port}/onboarding-api/v1.0/vendor-software-products/{vsp_id}/versions/0.1/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/steps/onboard/create_vlm.yaml b/vnftest/onap/onboard/create_vlm.yaml index dce110a..dce110a 100644 --- a/vnftest/onap/steps/onboard/create_vlm.yaml +++ b/vnftest/onap/onboard/create_vlm.yaml diff --git a/vnftest/onap/onboard/create_vsp.yaml b/vnftest/onap/onboard/create_vsp.yaml new file mode 100644 index 0000000..d9721a2 --- /dev/null +++ b/vnftest/onap/onboard/create_vsp.yaml @@ -0,0 +1,34 @@ +############################################################################## +# 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}/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/distribute.yaml b/vnftest/onap/onboard/distribute.yaml new file mode 100644 index 0000000..7deb9a1 --- /dev/null +++ b/vnftest/onap/onboard/distribute.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/import_vsp.yaml b/vnftest/onap/onboard/import_vsp.yaml new file mode 100644 index 0000000..d3a3100 --- /dev/null +++ b/vnftest/onap/onboard/import_vsp.yaml @@ -0,0 +1,91 @@ +############################################################################## +# 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/monitor_distribution.yaml b/vnftest/onap/onboard/monitor_distribution.yaml new file mode 100644 index 0000000..07216d0 --- /dev/null +++ b/vnftest/onap/onboard/monitor_distribution.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/process_package.yaml b/vnftest/onap/onboard/process_package.yaml new file mode 100644 index 0000000..ee8f791 --- /dev/null +++ b/vnftest/onap/onboard/process_package.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: "PUT" +url: "http://{sdc_ip}:{sdc_port}/onboarding-api/v1.0/vendor-software-products/{vsp_id}/versions/0.1/orchestration-template-candidate/process" +headers: { + "Content-Type": "application/json", + "Authorization": "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", + "USER_ID": "{sdc_designer_user}", + "Accept": "application/json" + }
\ No newline at end of file diff --git a/vnftest/onap/onboard/start_resource_test.yaml b/vnftest/onap/onboard/start_resource_test.yaml new file mode 100644 index 0000000..d6ba7b3 --- /dev/null +++ b/vnftest/onap/onboard/start_resource_test.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/start_service_test.yaml b/vnftest/onap/onboard/start_service_test.yaml new file mode 100644 index 0000000..6a89b94 --- /dev/null +++ b/vnftest/onap/onboard/start_service_test.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_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/submit_resource_for_testing.yaml b/vnftest/onap/onboard/submit_resource_for_testing.yaml new file mode 100644 index 0000000..4bdc2be --- /dev/null +++ b/vnftest/onap/onboard/submit_resource_for_testing.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/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/submit_service_for_testing.yaml b/vnftest/onap/onboard/submit_service_for_testing.yaml new file mode 100644 index 0000000..e75e6af --- /dev/null +++ b/vnftest/onap/onboard/submit_service_for_testing.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_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/steps/onboard/submit_vlm.yaml b/vnftest/onap/onboard/submit_vlm.yaml index eb1683a..eb1683a 100644 --- a/vnftest/onap/steps/onboard/submit_vlm.yaml +++ b/vnftest/onap/onboard/submit_vlm.yaml diff --git a/vnftest/onap/onboard/submit_vsp.yaml b/vnftest/onap/onboard/submit_vsp.yaml new file mode 100644 index 0000000..c255cd7 --- /dev/null +++ b/vnftest/onap/onboard/submit_vsp.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: "PUT" +url: "http://{sdc_ip}:{sdc_port}/onboarding-api/v1.0/vendor-software-products/{vsp_id}/versions/0.1/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/upload_package.yaml b/vnftest/onap/onboard/upload_package.yaml new file mode 100644 index 0000000..958782f --- /dev/null +++ b/vnftest/onap/onboard/upload_package.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_port}/onboarding-api/v1.0/vendor-software-products/{vsp_id}/versions/0.1/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/package_upload.py b/vnftest/onap/package_upload.py new file mode 100644 index 0000000..084de78 --- /dev/null +++ b/vnftest/onap/package_upload.py @@ -0,0 +1,43 @@ +############################################################################## +# 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 +############################################################################## +from __future__ import absolute_import + +import copy +import logging +import time + +import os +import yaml + +from vnftest.common import constants as consts +from vnftest.common import rest_client +from vnftest.common.exceptions import MandatoryKeyException, InputParameterMissing +from vnftest.contexts.base import Context +from vnftest.crawlers.base import Crawler +from vnftest.onap.common.vnf_type_crawler import VnfTypeCrawler +from vnftest.onap.onap_api_call import OnapApiCall + +LOG = logging.getLogger(__name__) + + +class PackageUpload(OnapApiCall): + + __step_type__ = "PackageUpload" + + def __init__(self, step_cfg, context_cfg, input_params): + super(PackageUpload, self).__init__(step_cfg, context_cfg, input_params) + + def setup(self): + super(PackageUpload, self).setup() + self.input_cfg.append({'parameter_name': "package_file_path", 'value': Context.vnf_descriptor["csar_package_location"]}) diff --git a/vnftest/onap/steps/onboard/__init__.py b/vnftest/runners/__init__.py index e69de29..e69de29 100644 --- a/vnftest/onap/steps/onboard/__init__.py +++ b/vnftest/runners/__init__.py diff --git a/vnftest/onap/runners/base.py b/vnftest/runners/base.py index 15d8a8d..c00a4cd 100755 --- a/vnftest/onap/runners/base.py +++ b/vnftest/runners/base.py @@ -15,17 +15,19 @@ # rally/rally/benchmark/runners/base.py from __future__ import absolute_import + +import importlib import logging import multiprocessing import subprocess import time import traceback -import importlib from Queue import Empty import vnftest.common.utils as utils -from vnftest.onap.steps import base as base_step -from vnftest.onap.steps.onap_api_call import OnapApiCall +from vnftest.steps import base as base_step +from vnftest.onap.onap_api_call import OnapApiCall +from vnftest.onap.package_upload import PackageUpload log = logging.getLogger(__name__) diff --git a/vnftest/onap/runners/duration.py b/vnftest/runners/duration.py index 7e539e5..a3bf33f 100644 --- a/vnftest/onap/runners/duration.py +++ b/vnftest/runners/duration.py @@ -18,13 +18,15 @@ """ from __future__ import absolute_import -import os -import multiprocessing + import logging -import traceback +import multiprocessing import time +import traceback + +import os -from vnftest.onap.runners import base +from vnftest.runners import base LOG = logging.getLogger(__name__) diff --git a/vnftest/onap/runners/dynamictp.py b/vnftest/runners/dynamictp.py index 5ea0910..e394567 100755 --- a/vnftest/onap/runners/dynamictp.py +++ b/vnftest/runners/dynamictp.py @@ -24,7 +24,7 @@ import traceback import os -from vnftest.onap.runners import base +from vnftest.runners import base LOG = logging.getLogger(__name__) diff --git a/vnftest/onap/runners/iteration.py b/vnftest/runners/iteration.py index 9c9ab2c..1fec101 100644 --- a/vnftest/onap/runners/iteration.py +++ b/vnftest/runners/iteration.py @@ -12,7 +12,7 @@ # the License ############################################################################## # vnftest comment: this is a modified copy of -# rally/rally/benchmark/runners/iteration.py +# rally/rally/benchmark/runners/vnf_type_crawler.py """A runner that runs a configurable number of times before it returns """ @@ -25,9 +25,9 @@ import time import traceback import os -from vnftest.common.exceptions import VnftestException -from vnftest.onap.runners import base +from vnftest.common.exceptions import VnftestException +from vnftest.runners import base LOG = logging.getLogger(__name__) @@ -94,16 +94,12 @@ def _worker_process(result_queue, cls, method_name, step_cfg, step_cfg['options']['rate'] -= delta sequence = 1 continue - except VnftestException: + except Exception: errors.append(traceback.format_exc()) LOG.exception("") LOG.info("Abort the task") fatal_error = True - except Exception: - errors.append(traceback.format_exc()) - LOG.exception("") - time.sleep(interval) step_results = { diff --git a/vnftest/onap/runners/search.py b/vnftest/runners/search.py index d5bd417..79ade19 100644 --- a/vnftest/onap/runners/search.py +++ b/vnftest/runners/search.py @@ -23,14 +23,14 @@ import logging import multiprocessing import time import traceback +from collections import Mapping from contextlib import contextmanager from itertools import takewhile import os -from collections import Mapping from six.moves import zip -from vnftest.onap.runners import base +from vnftest.runners import base LOG = logging.getLogger(__name__) diff --git a/vnftest/onap/runners/sequence.py b/vnftest/runners/sequence.py index b341495..80afa16 100644 --- a/vnftest/onap/runners/sequence.py +++ b/vnftest/runners/sequence.py @@ -27,7 +27,7 @@ import traceback import os -from vnftest.onap.runners import base +from vnftest.runners import base LOG = logging.getLogger(__name__) diff --git a/vnftest/steps/__init__.py b/vnftest/steps/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vnftest/steps/__init__.py diff --git a/vnftest/onap/steps/base.py b/vnftest/steps/base.py index d5c606a..d5c606a 100644 --- a/vnftest/onap/steps/base.py +++ b/vnftest/steps/base.py diff --git a/vnftest/steps/dummy/__init__.py b/vnftest/steps/dummy/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vnftest/steps/dummy/__init__.py diff --git a/vnftest/onap/steps/dummy/dummy.py b/vnftest/steps/dummy/dummy.py index 27e9a32..650fdb4 100644 --- a/vnftest/onap/steps/dummy/dummy.py +++ b/vnftest/steps/dummy/dummy.py @@ -12,9 +12,10 @@ # the License ############################################################################## from __future__ import absolute_import + import logging -from vnftest.onap.steps import base +from vnftest.steps import base LOG = logging.getLogger(__name__) |