upgrade to python3 libraries
[testsuite.git] / robot / resources / demo_preload.robot
index ff7e9bf..ef8bbab 100644 (file)
@@ -2,17 +2,19 @@
 Documentation    This test template encapsulates the VNF Orchestration use case.
 
 Resource        test_templates/model_test_template.robot
+Resource        test_templates/model_test_template_vcperescust.robot
 Resource        test_templates/vnf_orchestration_test_template.robot
 Resource        asdc_interface.robot
 Resource        so_interface.robot
 Resource        vid/vid_interface.robot
-Resource       policy_interface.robot
+Resource           policy_interface.robot
+Resource        aai/create_availability_zone.robot
 
 Library                UUID
 Library                Collections
 Library         OperatingSystem
 Library         HttpLibrary.HTTP
-Library         ExtendedSelenium2Library
+Library         SeleniumLibrary
 Library         RequestsLibrary
 
 *** Variables ***
@@ -55,20 +57,39 @@ Load Customer
     Set Test Variable    ${CUSTOMER_NAME}    ${customer_name}
     ${region}=   Get Openstack Region
     Create Customer For VNF Demo    ${CUSTOMER_NAME}    ${CUSTOMER_NAME}    INFRA    ${GLOBAL_AAI_CLOUD_OWNER}    ${region}   ${TENANT_ID}
+    Create Customer For VNF Demo    ${CUSTOMER_NAME}    ${CUSTOMER_NAME}    INFRA    ${GLOBAL_AAI_CLOUD_OWNER}    RegionTlab  50b190410b2a4c229d8a6044a80ab7c1 
+    Create Availability Zone If Not Exists    ${GLOBAL_AAI_CLOUD_OWNER}    ${region}   ${GLOBAL_AAI_AVAILABILITY_ZONE_NAME}
 
 Load Models
     [Documentation]   Use openECOMP to Orchestrate a service.
     [Arguments]    ${customer_name}
     Set Test Variable    ${CUSTOMER_NAME}    ${customer_name}
+    Log To Console   ${\n}Distributing vFWCL
     ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vFWCL   ${DEMO_PREFIX}VFWCL
+    Log To Console   Distibuting vLB
     ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vLB   ${DEMO_PREFIX}VLB
-    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vCPE   ${DEMO_PREFIX}VCPE
+    ##${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vCPE   ${DEMO_PREFIX}VCPE
     ##${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vIMS   ${DEMO_PREFIX}VIMS
+    Log To Console   Distibuting vCPEInfra
+    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vCPEInfra   ${DEMO_PREFIX}VCPEInfra
+    Log To Console   Distibuting vCPEvBNG
+    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vCPEvBNG   ${DEMO_PREFIX}VCPEvBNG
+    Log To Console   Distibuting vCPEvBRGEMU
+    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vCPEvBRGEMU   ${DEMO_PREFIX}VCPEvBRGEMU 
+    Log To Console   Distibuting vCPEvGMUX
+    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vCPEvGMUX    ${DEMO_PREFIX}VCPEvGMUX
+    Log To Console   Distibuting vCPEvGW (this is not vCPEResCust service)
+    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vCPEvGW    ${DEMO_PREFIX}VCPEvGW
 
 Distribute Model
     [Arguments]   ${service}   ${modelName}
     ${service_model_type}     ${vnf_type}    ${vf_modules}   ${catalog_resources}=   Model Distribution For Directory    ${service}   ${modelName}
 
+Distribute vCPEResCust Model
+    [Arguments]   ${service}   ${modelName}
+    ${service_model_type}     ${vnf_type}    ${vf_modules}   ${catalog_resources}=   Model Distribution For vCPEResCust Directory    ${service}   ${modelName}
+
+
 Create Customer For VNF Demo
     [Documentation]    Create demo customer for the demo
     [Arguments]    ${customer_name}   ${customer_id}   ${customer_type}    ${clouder_owner}    ${cloud_region_id}    ${tenant_id}
@@ -96,7 +117,7 @@ Preload User Model
     ${relationships}=   Set Variable   ${generic_vnf['relationship-list']['relationship']}
     ${relationship_data}=    Get Relationship Data   ${relationships}
     ${customer_id}=   Catenate
-    :for    ${r}   in   @{relationship_data}
+    :FOR    ${r}   IN   @{relationship_data}
     \   ${service}=   Set Variable If    '${r['relationship-key']}' == 'service-subscription.service-type'   ${r['relationship-value']}    ${service}
     \   ${service_instance_id}=   Set Variable If    '${r['relationship-key']}' == 'service-instance.service-instance-id'   ${r['relationship-value']}   ${service_instance_id}
     \   ${customer_id}=    Set Variable If   '${r['relationship-key']}' == 'customer.global-customer-id'   ${r['relationship-value']}   ${customer_id}
@@ -114,7 +135,7 @@ Preload User Model
 
 Get Relationship Data
     [Arguments]   ${relationships}
-    :for    ${r}   in   @{relationships}
+    :FOR    ${r}   IN   @{relationships}
     \     ${status}   ${relationship_data}   Run Keyword And Ignore Error    Set Variable   ${r['relationship-data']}
     \     Return From Keyword If    '${status}' == 'PASS'   ${relationship_data}
 
@@ -156,17 +177,39 @@ APPC Mount Point
 Instantiate VNF
     [Arguments]   ${service}   ${vf_module_label}=NULL
     Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}    SharedNode    OwnerType    v1    CloudZone
-    ${vf_module_name}    ${service}=    Orchestrate VNF    DemoCust    ${service}   ${service}    ${TENANT_NAME}
+    ${vf_module_name_list}    ${service}     ${generic_vnfs}=    Orchestrate VNF    DemoCust    ${service}   ${service}    ${TENANT_NAME}
     Save For Delete
     Log to Console   Customer Name=${CUSTOMER_NAME}
+    :FOR  ${vf_module_name}  IN   @{vf_module_name_list}
+    \   Log To Console   VNF Module Name=${vf_module_name}
+    # Don't get from MSO for now due to SO-1186
+    # ${model_invariant_id}=  Run MSO Get ModelInvariantId   ${SUITE_SERVICE_MODEL_NAME}  ${vf_module_label}
+    ${model_invariant_id}=   Set Variable   ${EMPTY}
+    :FOR    ${vf_module}    IN    @{generic_vnfs}
+    \    ${generic_vnf}=    Get From Dictionary    ${generic_vnfs}    ${vf_module}
+    \    ${model_invariant_id}=    Set Variable If    '${vf_module_label}' in '${vf_module}'   ${generic_vnf['model-invariant-id']}    ${model_invariant_id}
+    Log to Console   Update old vFWCL Policy for ModelInvariantID=${model_invariant_id}
+    ${status}   ${value}=   Run Keyword And Ignore Error  Update vVFWCL Policy   ${model_invariant_id}
+    :FOR  ${vf_module_name}  IN   @{vf_module_name_list}
+    \   Log To Console   APPC Mount Point for VNF Module Name=${vf_module_name}
+    \   ${status}   ${value}=   Run Keyword And Ignore Error  APPC Mount Point    ${vf_module_name}
+
+Instantiate Demo VNF
+    [Arguments]   ${service}   ${vf_module_label}=NULL
+    Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}    SharedNode    OwnerType    v1    CloudZone
+    ${vf_module_name}    ${service}    ${generic_vnfs}=   Orchestrate Demo VNF    Demonstration    ${service}   ${service}    ${TENANT_NAME}
+    #Save For Delete
+    Log to Console   Customer Name=${CUSTOMER_NAME}
     Log to Console   VNF Module Name=${vf_module_name}
-    ${model_invariant_id}=  Run MSO Get ModelInvariantId   ${SUITE_SERVICE_MODEL_NAME}  ${vf_module_label}
+    # Don't get from MSO for now due to SO-1186
+    # ${model_invariant_id}=  Run MSO Get ModelInvariantId   ${SUITE_SERVICE_MODEL_NAME}  ${vf_module_label}
+    ${model_invariant_id}=   Set Variable   ${EMPTY}
+    :FOR    ${vf_module}    IN    @{generic_vnfs}
+    \    ${generic_vnf}=    Get From Dictionary    ${generic_vnfs}    ${vf_module}
+    \    ${model_invariant_id}=    Set Variable If    '${vf_module_label}' in '${vf_module}'   ${generic_vnf['model-invariant-id']}    ${model_invariant_id}
     Log to Console   ModelInvariantID=${model_invariant_id}
     ${status}   ${value}=   Run Keyword And Ignore Error  Update vVFWCL Policy   ${model_invariant_id}
     ${status}   ${value}=   Run Keyword And Ignore Error  APPC Mount Point    ${vf_module_name}
-    
-    
-    
 
 
 Save For Delete
@@ -187,13 +230,13 @@ Save For Delete
 
     ${vars}=    Catenate
     ${keys}=   Get Dictionary Keys    ${dict}
-    :for   ${key}   in   @{keys}
+    :FOR   ${key}   IN   @{keys}
     \    ${value}=   Get From Dictionary   ${dict}   ${key}
     \    ${vars}=   Catenate   ${vars}${key} = "${value}"\n
 
     ${comma}=   Catenate
     ${vars}=    Catenate   ${vars}CATALOG_RESOURCE_IDS = [
-    :for   ${id}   in    @{CATALOG_RESOURCE_IDS}
+    :FOR   ${id}   IN    @{CATALOG_RESOURCE_IDS}
     \    ${vars}=    Catenate  ${vars}${comma} "${id}"
     \    ${comma}=   Catenate   ,
     ${vars}=    Catenate  ${vars}]\n