Updates for vFWCL Setup

Issue-ID: TEST-110
Change-Id: If230afd903c51a01dad5a6204dca1a1eee1f8adc
Signed-off-by: Brian Freeman <bf1936@att.com>
diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot
index 102305a..bab21be 100644
--- a/robot/resources/demo_preload.robot
+++ b/robot/resources/demo_preload.robot
@@ -22,6 +22,7 @@
 ${VF_MODULES_NAME}     _Demo_VFModules.json
 ${FILE_CACHE}    /share/
 ${DEMO_PREFIX}   demo
+${VPKG_MODULE_LABEL}    base_vpkg
 
 
 *** Keywords ***
@@ -143,21 +144,23 @@
     ${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} 
+    ${model_invariant_id}=  Run MSO Get ModelInvariantId   ${SUITE_SERVICE_MODEL_NAME}  ${vf_module_label}
     Log to Console   ModelInvariantID=${model_invariant_id}
-    Update vVFWCL Policy   ${model_invariant_id}
-    APPC Mount Point    ${vf_module_name}
+    ${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}
     
     
     
diff --git a/robot/resources/mso_interface.robot b/robot/resources/mso_interface.robot
index 200b270..bded528 100644
--- a/robot/resources/mso_interface.robot
+++ b/robot/resources/mso_interface.robot
@@ -22,13 +22,20 @@
 
 Run MSO Get ModelInvariantId
     [Documentation]    Runs an MSO Get ModelInvariantID for ClosedLoop Polieis 
-    [Arguments]    ${service_model_name}    
+    [Arguments]    ${service_model_name}   ${vf_module_label}=NULL
     ${param_dict}=    Create Dictionary    serviceModelName    ${service_model_name}
     ${param}=   Evaluate   urllib.urlencode(${param_dict})    urllib
     ${data_path}=   Catenate   SEPARATOR=     /ecomp/mso/catalog/v2/serviceVnfs?  ${param}
     ${resp}=    Run MSO Get Request    ${data_path}
     Log    ${resp.json()}
-    [Return]   ${resp.json()['serviceVnfs'][0]['modelInfo']['modelInvariantUuid']}
+    # ${resp.json()['serviceVnfs'][0]['vfModules'][0]['vfModuleLabel'] should be 'base_vpkg'
+    ${model_invariant_id}=   Set Variable   NULL
+    @{ITEMS}=    Copy List    ${resp.json()['serviceVnfs']}
+    :FOR    ${ELEMENT}    IN    @{ITEMS}
+    \    Log    ${ELEMENT['vfModules']}
+    \    ${model_invariant_id}  Set Variable If   ('${vf_module_label}' in '${ELEMENT['vfModules'][0]['vfModuleLabel']}')   ${ELEMENT['modelInfo']['modelInvariantUuid']}  NULL
+    \    Exit For Loop If  '${model_invariant_id}' != 'NULL'
+    [Return]   ${model_invariant_id}
     
 Run MSO Get Request
     [Documentation]    Runs an MSO get request
diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot
index 8bc9c3b..49590c0 100644
--- a/robot/resources/policy_interface.robot
+++ b/robot/resources/policy_interface.robot
@@ -12,6 +12,7 @@
 ${POLICY_ENDPOINT}     ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_POLICY_SERVER_PORT}
 ${POLICY_HEALTHCHECK_ENDPOINT}     ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_POLICY_HEALTHCHECK_PORT}
 ${POLICY_TEMPLATES}        robot/assets/templates/policy
+${DROOLS_ENDPOINT}     ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_DROOLS_SERVER_PORT}
 
 *** Keywords ***
 
@@ -30,6 +31,18 @@
      \    Should Be Equal As Strings 	${ELEMENT['code']} 	200
      \    Should Be True    ${ELEMENT['healthy']}
     
+Run Drools Get Request
+     [Documentation]    Runs Drools Get Request
+     [Arguments]    ${data_path}
+     ${auth}=    Create List    ${GLOBAL_DROOLS_USERNAME}    ${GLOBAL_DROOLS_PASSWORD}
+     Log    Creating session ${POLICY_ENDPOINT}
+     ${session}=    Create Session      policy  ${DROOLS_ENDPOINT}   auth=${auth}
+     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+     ${resp}=   Get Request     policy  ${data_path}     headers=${headers}
+     Log    Received response from policy ${resp.text}
+     Should Be Equal As Strings         ${resp.status_code}     200
+     [Return]   ${resp}
+
 Run Policy Put Request
      [Documentation]    Runs Policy Put request
      [Arguments]    ${data_path}  ${data}
@@ -66,12 +79,16 @@
     [Arguments]   ${resource_id}
     Run Keyword and Ignore Error    Delete vFWCL Policy
     Sleep    20s
+    Log To Console   Create vFWCL Policy
     Create vFWCL Policy     ${resource_id}
     Sleep    5s
+    Log To Console   Push vFWCL Policy
     Push vFWCL Policy
     Sleep    20s
+    Log To Console   Reboot Drools
     Reboot Drools
     Sleep    20s
+    Log To Console   Validate vFWCL Policy
     Validate the vFWCL Policy
 
 Delete vFWCL Policy
diff --git a/robot/testsuites/demo.robot b/robot/testsuites/demo.robot
index e7c47f4..7129de6 100644
--- a/robot/testsuites/demo.robot
+++ b/robot/testsuites/demo.robot
@@ -41,7 +41,7 @@
 
 Instantiate VFWCL
     [Tags]   instantiateVFWCL
-    Instantiate VNF   vFWCL
+    Instantiate VNF   vFWCL  base_vpkg
 
 
 Delete Instantiated VNF