Added CSIT support for listPolicy API
Issue-ID: POLICY-1488
Change-Id: I27a504ad3c4e8835212d3ab05e48712636b7f402
Signed-off-by: HOCKLA <ah999m@att.com>
diff --git a/tests/policy/suite1/Policy-CSIT.robot b/tests/policy/suite1/Policy-CSIT.robot
index 785619f..7855b76 100644
--- a/tests/policy/suite1/Policy-CSIT.robot
+++ b/tests/policy/suite1/Policy-CSIT.robot
@@ -12,6 +12,7 @@
${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy
${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy
${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig
+${RESOURCE_PATH_LISTPOLICY} /pdp/api/listPolicy
${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW_R1.template
${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS_R1.template
${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE_R1.template
@@ -24,6 +25,7 @@
${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template
${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template
${GETOOF_TEMPLATE} ${CURDIR}/getoofpolicy.template
+${LISTPOLICY_TEMPLATE} ${CURDIR}/listpolicy.template
${CONFIG_POLICY_VFW_NAME} vFirewall
${CONFIG_POLICY_VFW_TYPE} MicroService
${CONFIG_POLICY_VDNS_NAME} vLoadBalancer
@@ -115,6 +117,9 @@
Sleep 5s
Get OOF HPA Policy
+ListPolicy
+ ListPolicy test com.Config_Sample.1.xml
+
*** Keywords ***
VFW Policy Tests
@@ -358,3 +363,12 @@
# ${files}= Create Dictionary file ${file_data}
${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files}
Should Be Equal As Strings ${put_resp.status_code} 200
+
+ListPolicy test
+ [Documentation] Listing Config Policies
+ [Arguments] ${policy_name}
+ ${dict}= Create Dictionary policy_name=${policy_name}
+ ${output} = Fill JSON Template File ${LISTPOLICY_TEMPLATE} ${dict}
+ ${put_resp} = policy_interface.Run Policy Post Request ${RESOURCE_PATH_LISTPOLICY} ${output}
+ Should Be Equal As Strings ${put_resp.status_code} 200
+
diff --git a/tests/policy/suite1/listpolicy.template b/tests/policy/suite1/listpolicy.template
new file mode 100644
index 0000000..aef17a2
--- /dev/null
+++ b/tests/policy/suite1/listpolicy.template
@@ -0,0 +1,3 @@
+{
+ "policyName": "${policy_name}"
+}
diff --git a/tests/policy/suite1/policy_interface.robot b/tests/policy/suite1/policy_interface.robot
index 7917870..745f781 100644
--- a/tests/policy/suite1/policy_interface.robot
+++ b/tests/policy/suite1/policy_interface.robot
@@ -38,7 +38,17 @@
${resp}= Put Request policy ${data_path} data=${data} headers=${headers}
Log Received response from policy ${resp.text}
[Return] ${resp}
-
+
+Run Policy Post Request
+ [Documentation] Runs Policy Post request
+ [Arguments] ${data_path} ${data}
+ Log Creating session ${GLOBAL_POLICY_SERVER_URL}
+ ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST
+ ${resp}= Post Request policy ${data_path} data=${data} headers=${headers}
+ Log Received response from policy ${resp.text}
+ [Return] ${resp}
+
Run Policy Delete Request
[Documentation] Runs Policy Delete request
[Arguments] ${data_path} ${data}
@@ -57,4 +67,4 @@
${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}