diff options
20 files changed, 817 insertions, 70 deletions
diff --git a/tests/onap/test_cases/onap_vnftest_tc001.yaml b/tests/onap/test_cases/onap_vnftest_tc001.yaml index 185cc1a..0bc34aa 100644 --- a/tests/onap/test_cases/onap_vnftest_tc001.yaml +++ b/tests/onap/test_cases/onap_vnftest_tc001.yaml @@ -16,13 +16,13 @@ schema: "vnftest:task:0.1" description: > Vnftest TC001 config file; - Create VLM in SDC - -{% 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 %} - + 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: OnapApiCall @@ -81,13 +81,16 @@ steps: run_step: "setup,run" - - type: PackageUpload + type: OnapApiCall options: file: "onboard/upload_package.yaml" input: - parameter_name: "vsp_id" value: "{vsp_id}" + - + parameter_name: "package_file_path" + value: "{context|vnf_descriptor|csar_package_location}" runner: type: Iteration run_step: "setup,run" @@ -238,7 +241,7 @@ steps: value: {{service_name}} output: - - parameter_name: "service_id" + parameter_name: "sdc_service_id" value: "[uniqueId]" - parameter_name: "service_model_name" @@ -254,13 +257,13 @@ steps: input: - parameter_name: "resource_instance_unique_id" - value: {{ ["U+007B", "resource_version_id", "U+007D", range(10000)|random ]|join }} + value: {{resource_instance_unique_id}} - parameter_name: "resource_instance_name" value: {{resource_instance_name}} - - parameter_name: "service_id" - value: "{service_id}" + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" - parameter_name: "resource_version_id" value: "{resource_version_id}" @@ -285,8 +288,8 @@ steps: file: "onboard/submit_service_for_testing.yaml" input: - - parameter_name: "service_id" - value: "{service_id}" + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" runner: type: Iteration run_step: "setup,run" @@ -297,8 +300,8 @@ steps: file: "onboard/start_service_test.yaml" input: - - parameter_name: "service_id" - value: "{service_id}" + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" runner: type: Iteration run_step: "setup,run" @@ -308,8 +311,8 @@ steps: file: "onboard/accept_service_test.yaml" input: - - parameter_name: "service_id" - value: "{service_id}" + parameter_name: "sdc_service_id" + value: "{sdc_service_id}" output: - parameter_name: "service_version_id" @@ -358,7 +361,7 @@ steps: value: "[version]" - parameter_name: "service_model_customization_id" - value: "[componentInstances]" + value: "[componentInstances][0][groupInstances][0][customizationUUID]" runner: type: Iteration run_step: "setup,run" diff --git a/tests/onap/test_cases/onap_vnftest_tc002.yaml b/tests/onap/test_cases/onap_vnftest_tc002.yaml new file mode 100644 index 0000000..0af871e --- /dev/null +++ b/tests/onap/test_cases/onap_vnftest_tc002.yaml @@ -0,0 +1,346 @@ +############################################################################## +# 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 TC002 config file; + Instantiate VNF + +{% set rnd = rnd or range(10000)|random %} +# Optional input parameters +{% set cloud_owner = cloud_owner or ['test_cloud_', rnd ]|join %} +{% set customer_name = customer_name or ['test_customer_', rnd ]|join %} +{% set service_instance_name = service_instance_name or ['test_service_instance_', rnd ]|join %} +{% set vnf_instance_name = vnf_instance_name or ['test_vnf_instance_', rnd ]|join %} +{% set vnf_name = vnf_name or ['test_vnf_', rnd ]|join %} + +# Mandatory input parameters +{% set service_model_version_id = service_model_version_id or '\"\u007Bservice_model_version_id\u007D\"' %} +{% set service_model_version = service_model_version or '\"\u007Bservice_model_version\u007D\"' %} +{% set service_model_normalized_name = service_model_normalized_name or '\"\u007Bservice_model_normalized_name\u007D\"' %} +{% set service_model_invariant_id = service_model_invariant_id or '\"\u007Bservice_model_invariant_id\u007D\"' %} +{% set service_model_name = service_model_name or '\"\u007Bservice_model_name\u007D\"' %} +{% set service_model_customization_id = service_model_customization_id or '\"\u007Bservice_model_customization_id\u007D\"' %} +{% set resource_model_invariant_id = resource_model_invariant_id or '\"\u007Bresource_model_invariant_id\u007D\"' %} +{% set resource_model_version_id = resource_model_version_id or '\"\u007Bresource_model_version_id\u007D\"' %} +{% set resource_model_name = resource_model_name or '\"\u007Bresource_model_name\u007D\"' %} +{% set resource_model_version = resource_model_version or '\"\u007Bresource_model_version\u007D\"' %} +{% set resource_model_customization_id = resource_model_customization_id or '\"\u007Bresource_model_customization_id\u007D\"' %} +{% set resource_model_customization_name = resource_model_customization_name or '\"\u007Bresource_model_customization_name\u007D\"' %} +{% set distributed_service_id = distributed_service_id or '\"\u007Bdistributed_service_id\u007D\"' %} +{% set resource_instance_model_name = resource_instance_model_name or '\"\u007Bresource_instance_model_name\u007D\"' %} +{% set vnf_type = vnf_type or '\"\u007Bvnf_type\u007D\"' %} +{% set module_model_invariant_id = module_model_invariant_id or '\"\u007Bmodule_model_invariant_id\u007D\"' %} +{% set module_model_version_id = module_model_version_id or '\"\u007Bmodule_model_version_id\u007D\"' %} +{% set module_model_version = module_model_version or '\"\u007Bmodule_model_version\u007D\"' %} + +steps: +- + type: OnapApiCall + options: + file: "lifecycle/create_region.yaml" + input: + - + parameter_name: "cloud_owner" + value: {{cloud_owner}} + - + parameter_name: "tenant_id" + value: "{context|creds|tenant_id}" + - + parameter_name: "tenant_name" + value: "{context|creds|tenant_name}" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "lifecycle/create_service.yaml" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "lifecycle/create_customer.yaml" + input: + - + parameter_name: "customer_name" + value: {{customer_name}} + - + parameter_name: "cloud_owner" + value: {{cloud_owner}} + - + parameter_name: "tenant_id" + value: "{context|creds|tenant_id}" +- + type: OnapApiCall + options: + file: "lifecycle/create_service_instance.yaml" + delay: 30 + input: + - + parameter_name: "service_instance_name" + value: {{service_instance_name}} + - + parameter_name: "service_model_version_id" + value: {{service_model_version_id}} + - + parameter_name: "service_model_version" + value: {{service_model_version}} + - + parameter_name: "service_model_normalized_name" + value: {{service_model_normalized_name}} + - + parameter_name: "service_model_invariant_id" + value: {{service_model_invariant_id}} + - + parameter_name: "customer_name" + value: {{customer_name}} + output: + - + parameter_name: "service_instance_id" + value: "[requestReferences][instanceId]" + - + parameter_name: "request_id" + value: "[requestReferences][requestId]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "lifecycle/monitor_request.yaml" + input: + - + parameter_name: "request_id" + value: "{request_id}" + output: + - + parameter_name: "request_state" + value: "[request][requestStatus][requestState]" + sla: + action: assert + value: "{request_state}" + equals: "COMPLETE" + retries: 15 + interval: 5 + +- + type: OnapApiCall + options: + file: "lifecycle/create_vnf_instance.yaml" + delay: 30 + input: + - + parameter_name: "service_instance_id" + value: "{service_instance_id}" + - + parameter_name: "vnf_instance_name" + value: {{vnf_instance_name}} + - + parameter_name: "resource_model_invariant_id" + value: {{resource_model_invariant_id}} + - + parameter_name: "resource_model_version_id" + value: {{resource_model_version_id}} + - + parameter_name: "resource_model_name" + value: {{resource_model_name}} + - + parameter_name: "resource_model_version" + value: {{resource_model_version}} + - + parameter_name: "resource_model_customization_id" + value: {{resource_model_customization_id}} + - + parameter_name: "resource_model_customization_name" + value: {{resource_model_customization_name}} + - + parameter_name: "tenant_id" + value: "{context|creds|tenant_id}" + - + parameter_name: "service_model_name" + value: {{service_model_name}} + - + parameter_name: "service_model_invariant_id" + value: {{service_model_invariant_id}} + - + parameter_name: "service_model_version" + value: {{service_model_version}} + - + parameter_name: "distributed_service_id" + value: {{distributed_service_id}} + + output: + - + parameter_name: "vnf_instance_id" + value: "[requestReferences][instanceId]" + - + parameter_name: "request_id" + value: "[requestReferences][requestId]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "lifecycle/monitor_request.yaml" + input: + - + parameter_name: "request_id" + value: "{request_id}" + output: + - + parameter_name: "request_state" + value: "[request][requestStatus][requestState]" + sla: + action: assert + value: "{request_state}" + equals: "COMPLETE" + retries: 15 + interval: 5 + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "lifecycle/preload_sdnc.yaml" + input: + - + parameter_name: "vnf_name" + value: {{vnf_name}} + - + parameter_name: "vnf_instance_name" + value: {{vnf_instance_name}} + - + parameter_name: "service_model_name" + value: {{service_model_name}} + - + parameter_name: "resource_instance_model_name" + value: {{resource_instance_model_name}} + - + parameter_name: "service_instance_id" + value: "{service_instance_id}" + - + parameter_name: "vnf_type" + value: {{vnf_type}} + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "lifecycle/create_vf_module.yaml" + delay: 30 + input: + - + parameter_name: "service_instance_id" + value: "{service_instance_id}" + - + parameter_name: "vnf_instance_id" + value: "{vnf_instance_id}" + - + parameter_name: "vnf_name" + value: {{vnf_name}} + - + parameter_name: "module_model_invariant_id" + value: {{module_model_invariant_id}} + - + parameter_name: "module_model_version_id" + value: {{module_model_version_id}} + - + parameter_name: "vnf_type" + value: {{vnf_type}} + - + parameter_name: "module_model_version" + value: {{module_model_version}} + - + parameter_name: "service_model_customization_id" + value: {{service_model_customization_id}} + - + parameter_name: "tenant_id" + value: "{context|creds|tenant_id}" + - + parameter_name: "service_model_name" + value: {{service_model_name}} + - + parameter_name: "service_model_invariant_id" + value: {{service_model_invariant_id}} + - + parameter_name: "service_model_version" + value: {{service_model_version}} + - + parameter_name: "distributed_service_id" + value: {{distributed_service_id}} + - + parameter_name: "resource_model_name" + value: {{resource_model_name}} + - + parameter_name: "resource_model_invariant_id" + value: {{resource_model_invariant_id}} + - + parameter_name: "resource_model_version" + value: {{resource_model_version}} + - + parameter_name: "resource_model_version_id" + value: {{resource_model_version_id}} + - + parameter_name: "resource_model_customization_id" + value: {{resource_model_customization_id}} + - + parameter_name: "resource_model_customization_name" + value: {{resource_model_customization_name}} + + output: + - + parameter_name: "request_id" + value: "[requestReferences][requestId]" + runner: + type: Iteration + run_step: "setup,run" + +- + type: OnapApiCall + options: + file: "lifecycle/monitor_request.yaml" + input: + - + parameter_name: "request_id" + value: "{request_id}" + output: + - + parameter_name: "request_state" + value: "[request][requestStatus][requestState]" + sla: + action: assert + value: "{request_state}" + equals: "COMPLETE" + retries: 15 + interval: 5 + + runner: + type: Iteration + run_step: "setup,run" + +context: + 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 ee4a15f..508f068 100644 --- a/tests/onap/test_suites/onap_basic_lifecycle.yaml +++ b/tests/onap/test_suites/onap_basic_lifecycle.yaml @@ -21,3 +21,5 @@ test_cases_dir: "tests/onap/test_cases/" test_cases: - file_name: onap_vnftest_tc001.yaml +- + file_name: onap_vnftest_tc002.yaml diff --git a/vnftest/common/openstack_utils.py b/vnftest/common/openstack_utils.py index 954df2e..c97c1c2 100644 --- a/vnftest/common/openstack_utils.py +++ b/vnftest/common/openstack_utils.py @@ -33,44 +33,41 @@ log = logging.getLogger(__name__) DEFAULT_HEAT_API_VERSION = '1' DEFAULT_API_VERSION = '2' +creds = {} + # ********************************************* # CREDENTIALS # ********************************************* def get_credentials(): """Returns a creds dictionary filled with parsed from env""" - creds = {} - - keystone_api_version = os.getenv('OS_IDENTITY_API_VERSION') - - if keystone_api_version is None or keystone_api_version == '2': - keystone_v3 = False - tenant_env = 'OS_TENANT_NAME' - tenant = 'tenant_name' - else: - keystone_v3 = True - tenant_env = 'OS_PROJECT_NAME' - tenant = 'project_name' - - # The most common way to pass these info to the script is to do it - # through environment variables. - creds.update({ - "username": os.environ.get("OS_USERNAME"), - "password": os.environ.get("OS_PASSWORD"), - "auth_url": os.environ.get("OS_AUTH_URL"), - tenant: os.environ.get(tenant_env) - }) - - 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') - }) - + 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/contexts/base.py b/vnftest/contexts/base.py index ac1591c..6cb90e9 100644 --- a/vnftest/contexts/base.py +++ b/vnftest/contexts/base.py @@ -13,6 +13,8 @@ ############################################################################## import abc import six +from vnftest.common import openstack_utils + import vnftest.common.utils as utils import yaml @@ -39,10 +41,17 @@ class Context(object): def __init__(self): Context.list.append(self) + self.context_params = None - @abc.abstractmethod def init(self, attrs): - """Initiate context.""" + self.context_params = {} + for key, value in Context.vnf_descriptor.iteritems(): + key = "context|vnf_descriptor|" + key + self.context_params[key] = value + + for key, value in openstack_utils.get_credentials().iteritems(): + key = "context|creds|" + key + self.context_params[key] = value @staticmethod def get_cls(context_type): diff --git a/vnftest/contexts/csar.py b/vnftest/contexts/csar.py index 2dd4fa4..c3e91e9 100644 --- a/vnftest/contexts/csar.py +++ b/vnftest/contexts/csar.py @@ -25,16 +25,10 @@ class CSARContext(Context): __context_type__ = "CSAR" def __init__(self): - self.csar_name = None - self.csar_id = None - self.csar_package_location = None super(CSARContext, self).__init__() def init(self, attrs): - """initializes itself from the supplied arguments""" - self.csar_name = attrs.get("csar_name") - self.csar_id = attrs.get("csar_id") - self.csar_package_location = attrs.get("csar_package_location") + super(CSARContext, self).init(attrs) def deploy(self): """no need to deploy""" diff --git a/vnftest/core/task.py b/vnftest/core/task.py index 11c8bc6..a2963a5 100644 --- a/vnftest/core/task.py +++ b/vnftest/core/task.py @@ -142,7 +142,7 @@ class Task(object): # pragma: no cover testcases[case_name] = {'criteria': 'FAIL', 'tc_data': []} else: criteria = self.evaluate_task_criteria(data) - testcases[case_name] = {'criteria': criteria, 'tc_data': data} + testcases[case_name] = {'criteria': criteria, 'tc_data': data, 'output': self.outputs} if args.keep_deploy: # keep deployment, forget about stack diff --git a/vnftest/onap/lifecycle/create_customer.yaml b/vnftest/onap/lifecycle/create_customer.yaml new file mode 100644 index 0000000..97327ba --- /dev/null +++ b/vnftest/onap/lifecycle/create_customer.yaml @@ -0,0 +1,51 @@ +############################################################################## +# 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://{aai_ip}:30232/aai/v8/business/customers/customer/{customer_name}" +headers: { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": "Basic QUFJOkFBSQ==", + "X-FromAppId": "AAI", + "X-TransactionId": "get_aai_subscr" + } +body: { + "global-customer-id": "{customer_name}", + "service-subscriptions": { + "service-subscription": [{ + "relationship-list": { + "relationship": [{ + "related-to": "tenant", + "relationship-data": [{ + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "{cloud_owner}" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "{tenant_id}" + }] + }] + }, + "service-type": "vFW" + }] + }, + "subscriber-name": "{customer_name}", + "subscriber-type": "INFRA" + } diff --git a/vnftest/onap/lifecycle/create_region.yaml b/vnftest/onap/lifecycle/create_region.yaml new file mode 100644 index 0000000..1a67f41 --- /dev/null +++ b/vnftest/onap/lifecycle/create_region.yaml @@ -0,0 +1,40 @@ +############################################################################## +# 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://{aai_ip}:30232/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/{cloud_owner}/RegionOne" +headers: { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": "Basic QUFJOkFBSQ==", + "X-FromAppId": "AAI", + "X-TransactionId": "get_aai_subscr" + } +body: { + "cloud-owner": "{cloud_owner}", + "cloud-region-id": "RegionOne", + "cloud-region-version": "v1", + "cloud-type": "SharedNode", + "cloud-zone": "CloudZone", + "owner-defined-type": "OwnerType", + "tenants": { + "tenant": [ + { + "tenant-id": "{tenant_id}", + "tenant-name": "{tenant_name}" + } + ] + } + } diff --git a/vnftest/onap/lifecycle/create_service.yaml b/vnftest/onap/lifecycle/create_service.yaml new file mode 100644 index 0000000..7b8c107 --- /dev/null +++ b/vnftest/onap/lifecycle/create_service.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://{aai_ip}:30232/aai/v8/service-design-and-creation/services/service/vFW" +headers: { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": "Basic QUFJOkFBSQ==", + "X-FromAppId": "AAI", + "X-TransactionId": "get_aai_subscr" + } +body: {"service-description":"vFW","service-id":"vFW"} diff --git a/vnftest/onap/lifecycle/create_service_instance.yaml b/vnftest/onap/lifecycle/create_service_instance.yaml new file mode 100644 index 0000000..93850b7 --- /dev/null +++ b/vnftest/onap/lifecycle/create_service_instance.yaml @@ -0,0 +1,52 @@ +############################################################################## +# 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://{mso_ip}/ecomp/mso/infra/serviceInstances/v5" +headers: { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", + "X-FromAppId": "MSO", + "X-TransactionId": "demo" + } +body: { + "requestDetails": { + "requestInfo": { + "source": "VID", + "requestorId": "vid1", + "suppressRollback": "true", + "instanceName": "{service_instance_name}" + }, + "modelInfo": { + "modelVersionId": "{service_model_version_id}", + "modelVersion": "{service_model_version}", + "modelName": "{service_model_normalized_name}", + "modelInvariantId": "{service_model_invariant_id}", + "modelType": "service" + }, + "requestParameters": { + "userParams": [ + + ], + "aLaCarte": "true", + "subscriptionServiceType": "vFW" + }, + "subscriberInfo": { + "globalSubscriberId": "{customer_name}" + } + } + } + diff --git a/vnftest/onap/lifecycle/create_vf_module.yaml b/vnftest/onap/lifecycle/create_vf_module.yaml new file mode 100644 index 0000000..ed46c7d --- /dev/null +++ b/vnftest/onap/lifecycle/create_vf_module.yaml @@ -0,0 +1,78 @@ +############################################################################## +# 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://{mso_ip}/ecomp/mso/infra/serviceInstances/v5/{service_instance_id}/vnfs/{vnf_instance_id}/vfModules" +headers: { + "Content-Type": "application/json", + "Authorization": "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", + "X-FromAppId": "MSO", + "X-TransactionId": "demo", + "Accept": "application/json" + } +body: { + "requestDetails": { + "requestInfo": { + "instanceName": "{vnf_name}", + "source": "VID", + "suppressRollback": "true", + "requestorId": "vid1" + }, + "modelInfo": { + "modelType": "vfModule", + "modelInvariantId": "{module_model_invariant_id}", + "modelVersionId": "{module_model_version_id}", + "modelName": "{vnf_type}", + "modelVersion": "{module_model_version}", + "modelCustomizationId": "{service_model_customization_id}", + "modelCustomizationName": "{vnf_type}" + }, + "requestParameters": { + "usePreload": "true" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RegionOne", + "tenantId": "{tenant_id}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service_instance_id}", + "modelInfo": { + "modelType": "service", + "modelName": "{service_model_name}", + "modelInvariantId": "{service_model_invariant_id}", + "modelVersion": "{service_model_version}", + "modelVersionId": "{distributed_service_id}" + } + } + }, + { + "relatedInstance": { + "instanceId": "{vnf_instance_id}", + "modelInfo": { + "modelType": "vnf", + "modelName": "{resource_model_name}", + "modelInvariantId": "{resource_model_invariant_id}", + "modelVersion": "{resource_model_version}", + "modelVersionId": "{resource_model_version_id}", + "modelCustomizationId": "{resource_model_customization_id}", + "modelCustomizationName": "{resource_model_customization_name}" + } + } + } + ] + } + } diff --git a/vnftest/onap/lifecycle/create_vnf_instance.yaml b/vnftest/onap/lifecycle/create_vnf_instance.yaml new file mode 100644 index 0000000..653b97d --- /dev/null +++ b/vnftest/onap/lifecycle/create_vnf_instance.yaml @@ -0,0 +1,67 @@ +############################################################################## +# 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://{mso_ip}/ecomp/mso/infra/serviceInstances/v5/{service_instance_id}/vnfs/" +headers: { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", + "X-FromAppId": "MSO", + "X-TransactionId": "demo" + } +body: { + "requestDetails": { + "requestInfo": { + "instanceName":"{vnf_instance_name}", + "source": "VID", + "suppressRollback": "true", + "requestorId": "vid1", + "productFamilyId": "vFW" + }, + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "{resource_model_invariant_id}", + "modelVersionId": "{resource_model_version_id}", + "modelName": "{resource_model_name}", + "modelVersion": "{resource_model_version}", + "modelCustomizationId": "{resource_model_customization_id}", + "modelCustomizationName": "{resource_model_customization_name}" + }, + "requestParameters": { + "userParams": [] + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RegionOne", + "tenantId": "{tenant_id}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service_instance_id}", + "modelInfo": { + "modelType": "service", + "modelName": "{service_model_name}", + "modelInvariantId": "{service_model_invariant_id}", + "modelVersion": "{service_model_version}", + "modelVersionId": "{distributed_service_id}" + } + } + } + ] + } + } + + diff --git a/vnftest/onap/lifecycle/monitor_request.yaml b/vnftest/onap/lifecycle/monitor_request.yaml new file mode 100644 index 0000000..4304f0e --- /dev/null +++ b/vnftest/onap/lifecycle/monitor_request.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: "GET" +url: "http://{mso_ip}/ecomp/mso/infra/orchestrationRequests/v2/{request_id}" +headers: { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", + "X-FromAppId": "AAI", + "X-TransactionId": "get_aai_subscr" + } diff --git a/vnftest/onap/lifecycle/preload_sdnc.yaml b/vnftest/onap/lifecycle/preload_sdnc.yaml new file mode 100644 index 0000000..4053dd0 --- /dev/null +++ b/vnftest/onap/lifecycle/preload_sdnc.yaml @@ -0,0 +1,54 @@ +############################################################################## +# 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://{aai_ip}:30202/restconf/operations/VNF-API:preload-vnf-topology-operation" +headers: { + "Content-Type": "application/json", + "Authorization": "Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", + "X-FromAppId": "AAI", + "X-TransactionId": "0a3f6713-ba96-4971-a6f8-c2da85a3176e", + "Accept": "application/json" + } +body: { + "input": { + "request-information": { + "notification-url": "openecomp.org", + "order-number": "1", + "order-version": "1", + "request-action": "PreloadVNFRequest", + "request-id": "test" + }, + "sdnc-request-header": { + "svc-action": "reserve", + "svc-notification-url": "http:openecomp.org:8080", + "svc-request-id": "test" + }, + "vnf-topology-information": { + "vnf-assignments": { + "availability-zones": [], + "vnf-networks": [], + "vnf-vms": [] + }, + "vnf-topology-identifier": { + "generic-vnf-name": "{vnf_instance_name}", + "generic-vnf-type": "{service_model_name}/{resource_instance_model_name} 0", + "service-type": "{service_instance_id}", + "vnf-name": "{vnf_name}", + "vnf-type": "{vnf_type}" + } + } + } + } diff --git a/vnftest/onap/onap_api_call.py b/vnftest/onap/onap_api_call.py index 7cc68c3..8fbc98c 100644 --- a/vnftest/onap/onap_api_call.py +++ b/vnftest/onap/onap_api_call.py @@ -34,22 +34,25 @@ class OnapApiCall(base.Step): __step_type__ = "OnapApiCall" - def __init__(self, step_cfg, context_cfg, input_params): + def __init__(self, step_cfg, context, input_params): self.step_cfg = step_cfg - self.context_cfg = context_cfg + self.context = context self.input_params = input_params self.input_cfg = None self.output_cfg = None self.rest_def_file = None + self.delay = None self.setup_done = False self.curr_path = os.path.dirname(os.path.abspath(__file__)) def setup(self): options = self.step_cfg['options'] self.rest_def_file = options.get("file") + self.delay = options.get("delay", 0) self.input_cfg = options.get("input", {}) self.output_cfg = options.get("output", {}) self.sla_cfg = self.step_cfg.get('sla', {'retries': 0}) + self.input_params.update(self.context.context_params) self.setup_done = True def eval_input(self, params): @@ -98,15 +101,17 @@ class OnapApiCall(base.Step): 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): + if self.delay > 0: + time.sleep(self.delay) + try: return self.execute_operation_impl(params) except Exception as e: LOG.info(str(e)) - if attempt < 2: + if attempt < 3: time.sleep(15) LOG.info("############# retry operation ##########") attempt = attempt + 1 @@ -181,7 +186,7 @@ class OnapApiCall(base.Step): return st.format(**params) def handle_sla(self, output): - if 'assert' in self.sla_cfg and 'equals' in self.sla_cfg: + if self.sla_cfg.get('action', "") == 'assert' 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'] diff --git a/vnftest/onap/onboard/accept_service_test.yaml b/vnftest/onap/onboard/accept_service_test.yaml index 8b5e6db..d942084 100644 --- a/vnftest/onap/onboard/accept_service_test.yaml +++ b/vnftest/onap/onboard/accept_service_test.yaml @@ -14,7 +14,7 @@ --- method: "POST" -url: "http://{sdc_ip}:{sdc_catalog_port}/sdc1/feProxy/rest/v1/catalog/services/{service_id}/lifecycleState/certify" +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", diff --git a/vnftest/onap/onboard/add_resource_instance.yaml b/vnftest/onap/onboard/add_resource_instance.yaml index b92cc9b..a1af66c 100644 --- a/vnftest/onap/onboard/add_resource_instance.yaml +++ b/vnftest/onap/onboard/add_resource_instance.yaml @@ -14,7 +14,7 @@ --- method: "POST" -url: "http://{sdc_ip}:{sdc_catalog_port}/sdc1/feProxy/rest/v1/catalog/services/{service_id}/resourceInstance" +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", diff --git a/vnftest/onap/onboard/start_service_test.yaml b/vnftest/onap/onboard/start_service_test.yaml index 6a89b94..a9d9da4 100644 --- a/vnftest/onap/onboard/start_service_test.yaml +++ b/vnftest/onap/onboard/start_service_test.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: "POST" -url: "http://{sdc_ip}:{sdc_catalog_port}/sdc1/feProxy/rest/v1/catalog/services/{service_id}/lifecycleState/startCertification" +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", diff --git a/vnftest/onap/onboard/submit_service_for_testing.yaml b/vnftest/onap/onboard/submit_service_for_testing.yaml index e75e6af..fe57ded 100644 --- a/vnftest/onap/onboard/submit_service_for_testing.yaml +++ b/vnftest/onap/onboard/submit_service_for_testing.yaml @@ -13,7 +13,7 @@ ############################################################################## --- method: "POST" -url: "http://{sdc_ip}:{sdc_catalog_port}/sdc1/feProxy/rest/v1/catalog/services/{service_id}/lifecycleState/certificationRequest" +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", |