SEBA-238 adding POST/DELETE functions to libraries
Change-Id: I33e9d1211308fdeb1595035235dced0ba26137d3
diff --git a/src/test/cord-api/Framework/ATTWorkFlowDriver.robot b/src/test/cord-api/Framework/ATTWorkFlowDriver.robot
index ef8ed94..d38c8c4 100644
--- a/src/test/cord-api/Framework/ATTWorkFlowDriver.robot
+++ b/src/test/cord-api/Framework/ATTWorkFlowDriver.robot
@@ -19,3 +19,20 @@
${status}= Get From Dictionary ${getJsonDict} valid
${authentication_status}= Get From Dictionary ${getJsonDict} authentication_state
[Return] ${status} ${authentication_status}
+
+Create Whitelist Entry
+ [Arguments] ${entry_list} ${list_index}
+ [Documentation] Sends a POST to create an att whitelist in XOS
+ ${elist} = Get Variable Value ${entry_list}
+ ${entry_dictionary}= utils.listToDict ${elist} ${list_index}
+ ${api_result}= restApi.ApiPost ATT_WHITELIST ${entry_dictionary}
+ Should Be True ${api_result}
+ ${AttWhiteList_Id}= Get From Dictionary ${api_result} id
+ Set Global Variable ${AttWhiteList_Id}
+ [Return] ${AttWhiteList_Id}
+
+Delete Whitelist Entry
+ [Arguments] ${id}
+ [Documentation] Sends a DELETE to delete an att whitelist in XOS
+ ${api_result}= restApi.ApiChameleonDelete ATT_WHITELIST ${id}
+ Should Be True ${api_result}
\ No newline at end of file
diff --git a/src/test/cord-api/Framework/ONU.robot b/src/test/cord-api/Framework/ONU.robot
index 4171a50..e5b7a2e 100644
--- a/src/test/cord-api/Framework/ONU.robot
+++ b/src/test/cord-api/Framework/ONU.robot
@@ -19,3 +19,17 @@
${operational_status}= Get From Dictionary ${getJsonDict} oper_status
${admin_status}= Get From Dictionary ${getJsonDict} admin_state
[Return] ${operational_status} ${admin_status}
+
+Create ONU Device
+ [Arguments] ${device_list} ${list_index}
+ [Documentation] Sends a POST to create an att whitelist in XOS
+ ${dlist} = Get Variable Value ${device_list}
+ ${onu_dictionary}= utils.listToDict ${dlist} ${list_index}
+ ${api_result}= restApi.ApiPost ONU_DEVICE ${onu_dictionary}
+ Should Be True ${api_result}
+
+Delete ONU Device
+ [Arguments] ${id}
+ [Documentation] Sends a DELETE to delete an onu device in XOS
+ ${api_result}= restApi.ApiChameleonDelete ONU_DEVICE ${id}
+ Should Be True ${api_result}
\ No newline at end of file
diff --git a/src/test/cord-api/Framework/Subscriber.robot b/src/test/cord-api/Framework/Subscriber.robot
index ac6a43b..3a36bf8 100644
--- a/src/test/cord-api/Framework/Subscriber.robot
+++ b/src/test/cord-api/Framework/Subscriber.robot
@@ -41,3 +41,31 @@
${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} onu_device ${onu_device}
${status}= Get From Dictionary ${getJsonDict} status
[Return] ${status}
+
+Create Subscriber
+ [Arguments] ${subscriber_list} ${list_index}
+ [Documentation] Sends a POST to create a subscriber in XOS
+ ${slist} = Get Variable Value ${subscriber_list}
+ ${subscriber_dictionary}= utils.listToDict ${slist} ${list_index}
+ ${api_result}= restApi.ApiPost VOLT_SUBSCRIBER ${subscriber_dictionary}
+ Should Be True ${api_result}
+ ${Subscriber_id}= Get From Dictionary ${api_result} id
+ Set Global Variable ${Subscriber_id}
+ [Return] ${Subscriber_id}
+
+Retrieve Subscriber
+ [Arguments] ${ctag}
+ [Documentation] Returns the subscriber id based on the subscriber's C-Tag
+ ${json_result}= restApi.ApiGet VOLT_SUBSCRIBER
+ Log ${json_result}
+ ${json_result_list}= Get From dictionary ${json_result} items
+ ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} c_tag ${ctag}
+ ${id}= Get From Dictionary ${getJsonDict} id
+ [Return] ${id}
+
+Delete Subscriber
+ [Arguments] ${ctag}
+ [Documentation] Deletes a given subscriber based on its c_tag
+ ${id}= Retrieve Subscriber ${ctag}
+ ${api_result}= restApi.ApiChameleonDelete VOLT_SUBSCRIBER ${id}
+ Should Be True ${api_result}
diff --git a/src/test/cord-api/Tests/WorkflowValidations/ATT_Test001.txt b/src/test/cord-api/Tests/WorkflowValidations/ATT_Test001.txt
index 6603585..ce42e3f 100644
--- a/src/test/cord-api/Tests/WorkflowValidations/ATT_Test001.txt
+++ b/src/test/cord-api/Tests/WorkflowValidations/ATT_Test001.txt
@@ -17,7 +17,8 @@
Variables ../../Properties/RestApiProperties.py
*** Variables ***
-${PATHFILE} ${CURDIR}/data/ATTWhiteList.json
+${WHITELIST_PATHFILE} ${CURDIR}/data/ATTWhiteList.json
+${SUBSCRIBER_PATHFILE} ${CURDIR}/data/ATTSubscriber.json
${src_ip} X.X.X.X
${src_gateway} X.X.X.X
${src_user} user
@@ -64,13 +65,15 @@
*** Keywords ***
Read InputFile
- ${AttWhiteListList}= utils.jsonToList ${PATHFILE} AttWhiteListInfo
- Set Suite Variable ${slist} ${AttWhiteListList}
- ${AttWhiteListList} = Get Variable Value ${slist}
+ ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
+ Set Suite Variable ${alist} ${AttWhiteListList}
+ ${AttWhiteListList} = Get Variable Value ${alist}
${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
Log ${onu_device}
Set Global Variable ${onu_device}
+ ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
+ Set Global Variable ${slist} ${SubscriberList}
Teardown
[Documentation] Delete and clean up xos objects