Fix vFW Closed Loop robot test case 83/37883/16
authorGary Wu <gary.i.wu@huawei.com>
Thu, 22 Mar 2018 20:25:49 +0000 (13:25 -0700)
committerGary Wu <gary.i.wu@huawei.com>
Mon, 26 Mar 2018 20:13:32 +0000 (13:13 -0700)
Issued addressed by this change:

* Send the invariantUUID of VPKTG to Policy instead of VFW
* Extraneous single quote characters in the policy yaml
* Policy update wouldn’t “stick” until I added in the delays
  in between the various Policy API calls
* Had to ignore the VID teardown errors; not sure if this is
  necessary to pass the closed loop test

Change-Id: Ie504736484df78c46f564ee21bbd0c22d494af1f
Issue-ID: INT-406
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
.gitreview
robot/assets/templates/policy/FirewallPolicy_update.template
robot/resources/demo_preload.robot
robot/resources/policy_interface.robot
robot/resources/ssh/processes.robot
robot/resources/stack_validation/policy_check_vfw.robot
robot/resources/test_templates/vnf_orchestration_test_template.robot
robot/testsuites/closed-loop.robot

index b42004a..3dfdfb1 100644 (file)
@@ -2,3 +2,4 @@
 host=gerrit.onap.org
 port=29418
 project=testsuite.git
+defaultbranch=amsterdam
\ No newline at end of file
index f2fadc3..a5709f5 100644 (file)
@@ -10,7 +10,7 @@
                "RULE": {
                        "templateName": "ClosedLoopControlName",
                        "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
-                       "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+'${RESOURCE_ID}'%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
+                       "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+${RESOURCE_ID}%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
                }
        }
 }
index b1eff95..4628d38 100644 (file)
@@ -134,6 +134,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}
index 1918b48..7ac3f76 100644 (file)
@@ -82,9 +82,13 @@ Run Policy Get Configs Request
 Update vVFWCL Policy
     [Arguments]   ${resource_id}
     Delete vFWCL Policy
+    Sleep    20s
     Create vFWCL Policy     ${resource_id}
+    Sleep    5s
     Push vFWCL Policy
+    Sleep    20s
     Reboot Drools
+    Sleep    20s
     Validate the vFWCL Policy
 
 Delete vFWCL Policy
@@ -100,7 +104,8 @@ Create vFWCL Policy
     Should Be Equal As Strings         ${resp.status_code}     200
 
 Push vFWCL Policy
-     ${data}=   OperatingSystem.Get File    ${POLICY_TEMPLATES}/FirewallPolicy_push.template
+     ${dict}=   Create Dictionary
+     ${data}=   Fill JSON Template File    ${POLICY_TEMPLATES}/FirewallPolicy_push.template   ${dict}
      ${resp}=   Run Policy Put Request    /pdp/api/pushPolicy    ${data}
      Should Be Equal As Strings        ${resp.status_code}     200
 
index e9f3731..2ab6a14 100644 (file)
@@ -38,7 +38,7 @@ Create Process Map
          
 Wait for Process on Host
     [Documentation]     Wait for the passed process name (regular expression) to be running on the passed host  
-    [Arguments]    ${process_name}    ${host}    ${timeout}=600s    
+    [Arguments]    ${process_name}    ${host}    ${timeout}=1200s
     ${map}=    Wait Until Keyword Succeeds    ${timeout}    10 sec    Is Process On Host    ${process_name}    ${host}
     [Return]    ${map}
 
index a1daa87..3dfba50 100644 (file)
@@ -35,11 +35,10 @@ Policy Check FirewallCL Stack
     ${vpkg_stack_info}=    Wait for Stack to Be Deployed    auth    ${vpkg_stack_name}
     ${server_list}=    Get Openstack Servers    auth
     Log     ${server_list}
-    # WIth amsterdam, the generic-vnf-name = the vFW host name
-    ${vfw_name}=   Get From Dictionary     ${vsnk_stack_info}   vfw_name_0
-    ${status}  ${generic_vnf}=   Run Keyword And Ignore Error   Get Service Instance    ${vfw_name}
-    Run Keyword If   '${status}' == 'FAIL'   FAIL   VNF Name: ${vfw_name} is not found.
-    ${invariantUUID}   ${service}   ${customer_id}   ${service_instance_id}=   Get Generic VNF Info    ${generic_vnf}
+    ${vpkg_id}=   Get From Dictionary     ${vpkg_stack_info}   vnf_id
+    ${status}  ${generic_vnf}=   Run Keyword And Ignore Error   Get Generic VNF By ID    ${vpkg_id}
+    Run Keyword If   '${status}' == 'FAIL'   FAIL   VNF ID: ${vpkg_id} is not found.
+    ${invariantUUID}   Get From Dictionary  ${generic_vnf}   persona-model-id
     Update vVFWCL Policy   ${invariantUUID}
 
     ${vpg_unprotected_ip}=    Get From Dictionary    ${vpkg_stack_info}    vpg_private_ip_0
@@ -47,7 +46,7 @@ Policy Check FirewallCL Stack
     ${vpg_public_ip}=    Get Server Ip    ${server_list}    ${vpkg_stack_info}   vpg_name_0    network_name=public
     ${vsn_public_ip}=    Get Server Ip    ${server_list}    ${vsnk_stack_info}   vsn_name_0    network_name=public
     ${upper_bound}=    Evaluate    ${policy_rate}*2
-    Wait Until Keyword Succeeds    300s    1s    Run VFW Policy Check    ${vpg_public_ip}   ${policy_rate}    ${upper_bound}    1
+    Wait Until Keyword Succeeds    30m    2s    Run VFW Policy Check    ${vpg_public_ip}   ${policy_rate}    ${upper_bound}    1
 
 Policy Check Firewall Stack
     [Documentation]    Executes the vFW policy closed loop test.
@@ -62,7 +61,7 @@ Policy Check Firewall Stack
     ${vpg_public_ip}=    Get Server Ip    ${server_list}    ${stack_info}   vpg_name_0    network_name=public
     ${vsn_public_ip}=    Get Server Ip    ${server_list}    ${stack_info}   vsn_name_0    network_name=public
     ${upper_bound}=    Evaluate    ${policy_rate}*2
-    Wait Until Keyword Succeeds    300s    1s    Run VFW Policy Check    ${vpg_public_ip}   ${policy_rate}    ${upper_bound}    1
+    Wait Until Keyword Succeeds    30m    2s    Run VFW Policy Check    ${vpg_public_ip}   ${policy_rate}    ${upper_bound}    1
 
 
 Run VFW Policy Check
@@ -78,8 +77,8 @@ Check For Policy Enforcement
     [Documentation]     Push traffic above upper bound, wait for policy to fix it, push traffic to lower bound, wait for policy to fix it,
     [Arguments]    ${vpg_public_ip}    ${policy_rate}    ${forced_rate}
     Enable Streams    ${vpg_public_ip}    ${forced_rate}
-    Wait Until Keyword Succeeds    20s    5s    Test For Expected Rate    ${vpg_public_ip}    ${forced_rate}
-    Wait Until Keyword Succeeds    280s    5s    Test For Expected Rate    ${vpg_public_ip}    ${policy_rate}
+    Wait Until Keyword Succeeds    20s    2s    Test For Expected Rate    ${vpg_public_ip}    ${forced_rate}
+    Wait Until Keyword Succeeds    10m    2s    Test For Expected Rate    ${vpg_public_ip}    ${policy_rate}
 
 Test For Expected Rate
     [Documentation]    Ge the number of pg-streams from the PGN, and test to see if it is what we expect.
index 1d84426..09ef446 100644 (file)
@@ -202,7 +202,7 @@ Delete VNF
     ${lcp_region}=   Get Openstack Region
     Teardown VVG Server
     Teardown VLB Closed Loop Hack
-    Teardown VID   ${SERVICE_INSTANCE_ID}   ${lcp_region}   ${TENANT_NAME}   ${CUSTOMER_NAME}
+    Run Keyword and Ignore Error   Teardown VID   ${SERVICE_INSTANCE_ID}   ${lcp_region}   ${TENANT_NAME}   ${CUSTOMER_NAME}
     Log    VNF Deleted
 
 Teardown VNF
index 403506b..e197eca 100644 (file)
@@ -12,4 +12,4 @@ VFW Closed Loop Test
     VFWCL Policy
 VDNS Closed Loop Test
     [TAGS]    ete    closedloop
-    VDNS Policy    
\ No newline at end of file
+    VDNS Policy