aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/policy_interface.robot
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-03-22 13:25:49 -0700
committerBrian Freeman <bf1936@att.com>2018-04-19 11:13:41 -0500
commit76bc74f47aaae4064f836b351074e3db07180c91 (patch)
tree0b6566990178bc6bc90096f73435a2feb8dffd2e /robot/resources/policy_interface.robot
parent735671a2ed190ef5dd9244d4c7e1bd7ba4e27132 (diff)
Fix vFW Closed Loop robot test case
Issued addressed by this change: * Cherry picked from Amsterdam * 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> Signed-off-by: Brian Freeman <bf1936@att.com>
Diffstat (limited to 'robot/resources/policy_interface.robot')
-rw-r--r--robot/resources/policy_interface.robot55
1 files changed, 54 insertions, 1 deletions
diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot
index a622ae6c..f05f2650 100644
--- a/robot/resources/policy_interface.robot
+++ b/robot/resources/policy_interface.robot
@@ -57,4 +57,57 @@ Run Policy Get Configs Request
${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH}
${resp}= Post Request policy ${data_path} data=${data} headers=${headers}
Log Received response from policy ${resp.text}
- [Return] ${resp} \ No newline at end of file
+ [Return] ${resp}
+
+
+
+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
+ ${data}= OperatingSystem.Get File ${POLICY_TEMPLATES}/FirewallPolicy_delete.template
+ ${resp}= Run Policy Delete Request /pdp/api/deletePolicy ${data}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Create vFWCL Policy
+ [Arguments] ${resource_id}
+ ${dict}= Create Dictionary RESOURCE_ID=${resource_id}
+ ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/FirewallPolicy_update.template ${dict}
+ ${resp}= Run Policy Put Request /pdp/api/updatePolicy ${data}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Push vFWCL Policy
+ ${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
+
+Reboot Drools
+ ${stop}= Catenate docker exec -t -u policy drools bash -c "source /opt/app/policy/etc/profile.d/env.sh; policy stop"
+ ${start}= Catenate docker exec -t -u policy drools bash -c "source /opt/app/policy/etc/profile.d/env.sh; policy start"
+ Wait Until Keyword Succeeds 120 5 sec Open Connection And Log In ${GLOBAL_INJECTED_POLICY_IP_ADDR} root ${GLOBAL_VM_PRIVATE_KEY}
+ Write ${stop}
+ ${status} ${stdout}= Run Keyword And Ignore Error SSHLibrary.Read Until Regexp has stopped
+ Log ${status}: stdout=${stdout}
+ ${ctrlc}= Evaluate '\x03'
+ Run Keyword If '${status}' == 'FAIL' Write ${ctrlc}
+ Sleep 5s
+ Write ${start}
+ ${stdout}= SSHLibrary.Read Until Regexp is running
+ Log stdout=${stdout}
+ Should Contain ${stdout} is running
+
+Validate the vFWCL Policy
+ ${resp}= Run Drools Get Request /policy/pdp/engine/controllers/amsterdam/drools
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${resp}= Run Drools Get Request /policy/pdp/engine/controllers/amsterdam/drools/facts/closedloop-amsterdam/org.onap.policy.controlloop.Params
+ Should Be Equal As Strings ${resp.status_code} 200