From 05acf08ad5ed275e41402115acf177f8c49764f8 Mon Sep 17 00:00:00 2001 From: Moshe Date: Tue, 20 Mar 2018 10:51:42 +0200 Subject: New test case - instantiate vnf Issue-ID: VNFSDK-181 Change-Id: Ic160a125452473a228d8861ecc457e3c021a2dfb Signed-off-by: Moshe --- vnftest/onap/lifecycle/create_customer.yaml | 51 ++++++++++++++ vnftest/onap/lifecycle/create_region.yaml | 40 +++++++++++ vnftest/onap/lifecycle/create_service.yaml | 25 +++++++ .../onap/lifecycle/create_service_instance.yaml | 52 +++++++++++++++ vnftest/onap/lifecycle/create_vf_module.yaml | 78 ++++++++++++++++++++++ vnftest/onap/lifecycle/create_vnf_instance.yaml | 67 +++++++++++++++++++ vnftest/onap/lifecycle/monitor_request.yaml | 24 +++++++ vnftest/onap/lifecycle/preload_sdnc.yaml | 54 +++++++++++++++ vnftest/onap/onap_api_call.py | 15 +++-- vnftest/onap/onboard/accept_service_test.yaml | 2 +- vnftest/onap/onboard/add_resource_instance.yaml | 2 +- vnftest/onap/onboard/start_service_test.yaml | 2 +- .../onap/onboard/submit_service_for_testing.yaml | 2 +- 13 files changed, 405 insertions(+), 9 deletions(-) create mode 100644 vnftest/onap/lifecycle/create_customer.yaml create mode 100644 vnftest/onap/lifecycle/create_region.yaml create mode 100644 vnftest/onap/lifecycle/create_service.yaml create mode 100644 vnftest/onap/lifecycle/create_service_instance.yaml create mode 100644 vnftest/onap/lifecycle/create_vf_module.yaml create mode 100644 vnftest/onap/lifecycle/create_vnf_instance.yaml create mode 100644 vnftest/onap/lifecycle/monitor_request.yaml create mode 100644 vnftest/onap/lifecycle/preload_sdnc.yaml (limited to 'vnftest/onap') 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", -- cgit 1.2.3-korg