From 82aeca18c66dc4c312a57f24ed3c4c33a2063070 Mon Sep 17 00:00:00 2001 From: Moshe Date: Sun, 8 Apr 2018 21:37:43 +0300 Subject: Refactor api definition yamls to support jinja2 Issue-ID: VNFSDK-181 Change-Id: Ibff00e985f95b400f08d4de4021dc3a8ab235ad7 Signed-off-by: Moshe Support creation of multiple vf-modules per vnf Issue-ID: VNFSDK-264 Change-Id: I45054bc4bb721d7df89653e99fafe61297939504 Signed-off-by: Moshe fix tests Issue-ID: VNFSDK-264 Change-Id: I077289bfcd4c68b0191fd74c4e02e07a67f5104f Signed-off-by: Moshe --- tests/onap/test_cases/onap_vnftest_tc001.yaml | 24 ++++------------ tests/onap/test_cases/onap_vnftest_tc002.yaml | 40 ++++++++++++++------------- tests/onap/test_cases/onap_vnftest_tc003.yaml | 17 ++++++------ 3 files changed, 34 insertions(+), 47 deletions(-) (limited to 'tests/onap') diff --git a/tests/onap/test_cases/onap_vnftest_tc001.yaml b/tests/onap/test_cases/onap_vnftest_tc001.yaml index 0bc34aa..26a5672 100644 --- a/tests/onap/test_cases/onap_vnftest_tc001.yaml +++ b/tests/onap/test_cases/onap_vnftest_tc001.yaml @@ -90,7 +90,7 @@ steps: value: "{vsp_id}" - parameter_name: "package_file_path" - value: "{context|vnf_descriptor|csar_package_location}" + value: "{context.vnf_descriptor.package_location}" runner: type: Iteration run_step: "setup,run" @@ -158,22 +158,7 @@ steps: - 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" @@ -360,8 +345,9 @@ steps: parameter_name: "service_model_version" value: "[version]" - - parameter_name: "service_model_customization_id" - value: "[componentInstances][0][groupInstances][0][customizationUUID]" + parameter_name: "vf_modules_list" + type: VfModuleCrawler + 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 index d2e2bee..341c1c8 100644 --- a/tests/onap/test_cases/onap_vnftest_tc002.yaml +++ b/tests/onap/test_cases/onap_vnftest_tc002.yaml @@ -24,7 +24,6 @@ description: > {% 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\"' %} @@ -41,10 +40,7 @@ description: > {% 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\"' %} +{% set vf_modules_list = vf_modules_list or {}%} steps: - @@ -57,10 +53,10 @@ steps: value: {{cloud_owner}} - parameter_name: "tenant_id" - value: "{context|creds|tenant_id}" + value: "{context.creds.tenant_id}" - parameter_name: "tenant_name" - value: "{context|creds|tenant_name}" + value: "{context.creds.tenant_name}" runner: type: Iteration run_step: "setup,run" @@ -86,12 +82,12 @@ steps: value: {{cloud_owner}} - parameter_name: "tenant_id" - value: "{context|creds|tenant_id}" + value: "{context.creds.tenant_id}" - type: OnapApiCall options: file: "lifecycle/create_service_instance.yaml" - delay: 30 + delay: 60 input: - parameter_name: "service_instance_name" @@ -173,7 +169,7 @@ steps: value: {{resource_model_customization_name}} - parameter_name: "tenant_id" - value: "{context|creds|tenant_id}" + value: "{context.creds.tenant_id}" - parameter_name: "service_model_name" value: {{service_model_name}} @@ -220,11 +216,17 @@ steps: type: Iteration run_step: "setup,run" +{% for vf_module_definition in vnf_descriptor.vf_modules %} + {% set vf_module = vf_modules_list[vf_module_definition.module_name] %} + {% set vnf_name = ['test_vnf_', rnd, '_', vf_module_definition.module_name ]|join %} - type: OnapApiCall options: file: "lifecycle/preload_sdnc.yaml" input: + - + parameter_name: "vnf_parameters" + value: {{vf_module_definition.input_parameters}} - parameter_name: "vnf_name" value: {{vnf_name}} @@ -242,7 +244,7 @@ steps: value: "{service_instance_id}" - parameter_name: "vnf_type" - value: {{vnf_type}} + value: {{vf_module.groupName}} runner: type: Iteration run_step: "setup,run" @@ -264,22 +266,22 @@ steps: value: {{vnf_name}} - parameter_name: "module_model_invariant_id" - value: {{module_model_invariant_id}} + value: {{vf_module.invariantUUID}} - parameter_name: "module_model_version_id" - value: {{module_model_version_id}} + value: {{vf_module.groupUUID}} - parameter_name: "vnf_type" - value: {{vnf_type}} + value: {{vf_module.groupName}} - parameter_name: "module_model_version" - value: {{module_model_version}} + value: {{vf_module.version}} - - parameter_name: "service_model_customization_id" - value: {{service_model_customization_id}} + parameter_name: "module_model_customization_id" + value: {{vf_module.customizationUUID}} - parameter_name: "tenant_id" - value: "{context|creds|tenant_id}" + value: "{context.creds.tenant_id}" - parameter_name: "service_model_name" value: {{service_model_name}} @@ -344,6 +346,6 @@ steps: runner: type: Iteration run_step: "setup,run" - +{% endfor %} context: type: CSAR \ No newline at end of file diff --git a/tests/onap/test_cases/onap_vnftest_tc003.yaml b/tests/onap/test_cases/onap_vnftest_tc003.yaml index 304513a..d3b173d 100644 --- a/tests/onap/test_cases/onap_vnftest_tc003.yaml +++ b/tests/onap/test_cases/onap_vnftest_tc003.yaml @@ -21,13 +21,12 @@ description: > {% set service_instance_id = service_instance_id or '\"\u007Bservice_instance_id\u007D\"' %} {% set vnf_instance_id = vnf_instance_id or '\"\u007Bvnf_instance_id\u007D\"' %} {% set vf_module_instance_id = vf_module_instance_id or '\"\u007Bvf_module_instance_id\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\"' %} {% set service_model_customization_id = service_model_customization_id or '\"\u007Bservice_model_customization_id\u007D\"' %} +{% set vf_modules_list = vf_modules_list or {}%} steps: +{% for vf_module_definition in vnf_descriptor.vf_modules %} + {% set vf_module = vf_modules_list[vf_module_definition.module_name] %} - type: OnapApiCall options: @@ -44,16 +43,16 @@ steps: value: {{vf_module_instance_id}} - parameter_name: "module_model_invariant_id" - value: {{module_model_invariant_id}} + value: {{vf_module.invariantUUID}} - parameter_name: "module_model_version_id" - value: {{module_model_version_id}} + value: {{vf_module.groupUUID}} - parameter_name: "vnf_type" - value: {{vnf_type}} + value: {{vf_module.name}} - parameter_name: "module_model_version" - value: {{module_model_version}} + value: {{vf_module.version}} - parameter_name: "service_model_customization_id" value: {{service_model_customization_id}} @@ -87,7 +86,7 @@ steps: equals: "COMPLETE" retries: 15 interval: 5 - +{% endfor %} runner: type: Iteration run_step: "setup,run" -- cgit 1.2.3-korg