summaryrefslogtreecommitdiffstats
path: root/kubernetes/config/docker/init/src/config/robot/robot/resources/policy_interface.robot
diff options
context:
space:
mode:
authorMandeep Khinda <Mandeep.Khinda@amdocs.com>2017-06-24 11:49:37 -0400
committerMandeep Khinda <Mandeep.Khinda@amdocs.com>2017-06-24 11:49:37 -0400
commitd6ea987caed84a9f36030a5a1516df7c6186362d (patch)
tree265dda9cfb43a78542e4b2ccac382a8a5583bc56 /kubernetes/config/docker/init/src/config/robot/robot/resources/policy_interface.robot
parent43d96ac929c93d0aa2a55d860e0425a39118f7b4 (diff)
onap on kubernetes source files
Change-Id: I4de34baf90979651223a28323010deb7aef21946 Signed-off-by: Mandeep Khinda <Mandeep.Khinda@amdocs.com>
Diffstat (limited to 'kubernetes/config/docker/init/src/config/robot/robot/resources/policy_interface.robot')
-rw-r--r--kubernetes/config/docker/init/src/config/robot/robot/resources/policy_interface.robot58
1 files changed, 58 insertions, 0 deletions
diff --git a/kubernetes/config/docker/init/src/config/robot/robot/resources/policy_interface.robot b/kubernetes/config/docker/init/src/config/robot/robot/resources/policy_interface.robot
new file mode 100644
index 0000000000..3bd51f5a43
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/robot/robot/resources/policy_interface.robot
@@ -0,0 +1,58 @@
+*** Settings ***
+Documentation The main interface for interacting with Policy. It handles low level stuff like managing the http request library and Policy required fields
+Library RequestsClientCert
+Library RequestsLibrary
+Library String
+Library JSONUtils
+Library Collections
+Resource global_properties.robot
+
+*** Variables ***
+${POLICY_HEALTH_CHECK_PATH} /healthcheck
+
+*** Keywords ***
+
+Run Policy Health Check
+ [Documentation] Runs Policy Health check
+ ${auth}= Create List ${GLOBAL_POLICY_USERNAME} ${GLOBAL_POLICY_PASSWORD}
+ Log Creating session ${GLOBAL_POLICY_SERVER_URL}
+ ${session}= Create Session policy ${GLOBAL_POLICY_HEALTHCHECK_URL} auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy ${POLICY_HEALTH_CHECK_PATH} headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be True ${resp.json()['healthy']}
+ @{ITEMS}= Copy List ${resp.json()['details']}
+ :FOR ${ELEMENT} IN @{ITEMS}
+ \ Should Be Equal As Strings ${ELEMENT['code']} 200
+ \ Should Be True ${ELEMENT['healthy']}
+
+Run Policy Put Request
+ [Documentation] Runs Policy Put 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}= Put 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}
+ 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}= Delete Request policy ${data_path} data=${data} headers=${headers}
+ Log Received response from policy ${resp.text}
+ [Return] ${resp}
+
+Run Policy Get Configs Request
+ [Documentation] Runs Policy Get Configs 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}
+ ${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