Merge "Add healthcheck for Data-Router"
[testsuite.git] / robot / resources / demo_preload.robot
index 6c7d054..f87cc36 100644 (file)
@@ -4,7 +4,9 @@ Documentation     This test template encapsulates the VNF Orchestration use case.
 Resource        test_templates/model_test_template.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
 
 Library                UUID
 Library                Collections
@@ -20,15 +22,32 @@ ${AAI_INDEX_PATH}     /aai/v8
 ${VF_MODULES_NAME}     _Demo_VFModules.json
 ${FILE_CACHE}    /share/
 ${DEMO_PREFIX}   demo
+${VPKG_MODULE_LABEL}    base_vpkg
 
 
 *** Keywords ***
 Load Customer And Models
     [Documentation]   Use openECOMP to Orchestrate a service.
     [Arguments]    ${customer_name}
+    Load OwningEntity  lineOfBusiness  LOB-${customer_name}
+    Load OwningEntity  platform  Platform-${customer_name}
+    Load OwningEntity  project  Project-${customer_name}
+    Load OwningEntity  owningEntity  OE-${customer_name}
     Load Customer  ${customer_name}
     Load Models  ${customer_name}
 
+Load OwningEntity
+    [Documentation]   Use openECOMP to Orchestrate a service.
+    [Arguments]    ${parameter}   ${name}
+    ${data_path}=  Set Variable  /maintenance/category_parameter/${parameter}
+    ${vid_data}=  Set Variable  {"options":["${name}"]}
+    ${auth}=  Create List  ${GLOBAL_VID_USERNAME}    ${GLOBAL_VID_PASSWORD}
+    Log    Creating session ${data_path}
+    ${session}=    Create Session       vid    ${VID_ENDPOINT}${VID_ENV}     auth=${auth}
+    ${uuid}=    Generate UUID
+    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${GLOBAL_VID_USERNAME}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
+    ${resp}=   Post Request    vid     ${data_path}   data=${vid_data}    headers=${headers}
+       
 Load Customer
     [Documentation]   Use openECOMP to Orchestrate a service.
     [Arguments]    ${customer_name}
@@ -41,29 +60,29 @@ Load Models
     [Documentation]   Use openECOMP to Orchestrate a service.
     [Arguments]    ${customer_name}
     Set Test Variable    ${CUSTOMER_NAME}    ${customer_name}
-    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vFW   ${DEMO_PREFIX}VFW
+    ${status}   ${value}=   Run Keyword And Ignore Error   Distribute Model   vFWCL   ${DEMO_PREFIX}VFWCL
     ${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   vIMS   ${DEMO_PREFIX}VIMS
 
 Distribute Model
     [Arguments]   ${service}   ${modelName}
-    ${service_model_type}     ${vnf_type}    ${vf_modules}=   Model Distribution For Directory    ${service}   ${modelName}
+    ${service_model_type}     ${vnf_type}    ${vf_modules}   ${catalog_resources}=   Model Distribution For 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}
+    Create Service If Not Exists    vFWCL
+    Create Service If Not Exists    vLB
+    Create Service If Not Exists    vCPE
+    Create Service If Not Exists    vIMS
     ${data_template}=    OperatingSystem.Get File    ${ADD_DEMO_CUSTOMER_BODY}
     ${arguments}=    Create Dictionary    subscriber_name=${customer_name}    global_customer_id=${customer_id}    subscriber_type=${customer_type}     cloud_owner=${clouder_owner}  cloud_region_id=${cloud_region_id}    tenant_id=${tenant_id}
-    Set To Dictionary   ${arguments}       service1=vFW       service2=vLB   service3=vCPE   service4=vIMS
+    Set To Dictionary   ${arguments}       service1=vFWCL       service2=vLB   service3=vCPE   service4=vIMS
     ${data}=   Fill JSON Template    ${data_template}    ${arguments}
     ${put_resp}=    Run A&AI Put Request     ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id}    ${data}
     ${status_string}=    Convert To String    ${put_resp.status_code}
     Should Match Regexp    ${status_string}    ^(200|201|412)$
-    Create Service If Not Exists    vFW
-    Create Service If Not Exists    vLB
-    Create Service If Not Exists    vCPE
-    Create Service If Not Exists    vIMS
 
 Preload User Model
     [Documentation]   Preload the demo data for the passed VNF with the passed module name
@@ -98,6 +117,12 @@ Get Relationship Data
     \     Return From Keyword If    '${status}' == 'PASS'   ${relationship_data}
 
 
+Get Generic VNF By ID
+    [Arguments]   ${vnf_id}
+    ${resp}=    Run A&AI Get Request      ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-id=${vnf_id}
+    Should Be Equal As Strings         ${resp.status_code}     200
+    [Return]   ${resp.json()}
+
 Get Service Instance
     [Arguments]   ${vnf_name}
     ${resp}=    Run A&AI Get Request      ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name}
@@ -108,7 +133,7 @@ Get Persona Model Id
     [Documentation]    Query and Validates A&AI Service Instance
     [Arguments]    ${service_instance_id}    ${service_type}   ${customer_id}
     ${resp}=    Run A&AI Get Request      ${INDEX PATH}${CUSTOMER SPEC PATH}${customer_id}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_id}
-    ${persona_model_id}=   Get From DIctionary   ${resp.json()['service-instance'][0]}    persona-model-id
+    ${persona_model_id}=   Get From DIctionary   ${resp.json()['service-instance'][0]}    model-invariant-id
     [Return]   ${persona_model_id}
 
 APPC Mount Point
@@ -119,17 +144,27 @@ APPC Mount Point
     ${stack_id}=    Get From Dictionary    ${stack_info}    id
     ${server_list}=    Get Openstack Servers    auth
     ${vpg_name_0}=    Get From Dictionary    ${stack_info}    vpg_name_0
+    ${vnf_id}=    Get From Dictionary    ${stack_info}    vnf_id
     ${vpg_public_ip}=    Get Server Ip    ${server_list}    ${stack_info}   vpg_name_0    network_name=public
     ${vpg_oam_ip}=    Get From Dictionary    ${stack_info}    vpg_private_ip_1
-    ${appc}=    Create Mount Point In APPC    ${vpg_name_0}    ${vpg_oam_ip}
+    #${appc}=    Create Mount Point In APPC    ${vpg_name_0}    ${vpg_oam_ip}
+    ${appc}=    Create Mount Point In APPC    ${vnf_id}    ${vpg_oam_ip}
 
 Instantiate VNF
-    [Arguments]   ${service}
+    [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}
     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}
+    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
     [Documentation]   Create a variable file to be loaded for save for delete
@@ -160,5 +195,6 @@ Save For Delete
     \    ${comma}=   Catenate   ,
     ${vars}=    Catenate  ${vars}]\n
     OperatingSystem.Create File   ${FILE_CACHE}/${STACK_NAME}.py   ${vars}
+    OperatingSystem.Create File   ${FILE_CACHE}/lastVNF4HEATBRIGE.py   ${vars}