From 3e332f4f600e684764e6436c37609a7d7fb27b78 Mon Sep 17 00:00:00 2001 From: HOCKLA Date: Wed, 20 Feb 2019 09:32:19 -0600 Subject: [PATCH] Added CSIT support for listPolicy API Issue-ID: POLICY-1488 Change-Id: I27a504ad3c4e8835212d3ab05e48712636b7f402 Signed-off-by: HOCKLA --- tests/policy/suite1/Policy-CSIT.robot | 14 ++++++++++++++ tests/policy/suite1/listpolicy.template | 3 +++ tests/policy/suite1/policy_interface.robot | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/policy/suite1/listpolicy.template diff --git a/tests/policy/suite1/Policy-CSIT.robot b/tests/policy/suite1/Policy-CSIT.robot index 785619f9..7855b76b 100644 --- a/tests/policy/suite1/Policy-CSIT.robot +++ b/tests/policy/suite1/Policy-CSIT.robot @@ -12,6 +12,7 @@ ${RESOURCE_PATH_CREATE} /pdp/api/createPolicy ${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 @@ ${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template ${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 @@ HPA Get OOF Policy Sleep 5s Get OOF HPA Policy +ListPolicy + ListPolicy test com.Config_Sample.1.xml + *** Keywords *** VFW Policy Tests @@ -358,3 +363,12 @@ Upload DRL file # ${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 00000000..aef17a23 --- /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 79178708..745f7817 100644 --- a/tests/policy/suite1/policy_interface.robot +++ b/tests/policy/suite1/policy_interface.robot @@ -38,7 +38,17 @@ Run Policy Put Request ${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 @@ 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} -- 2.16.6