[SEBA-184] Libraries for Status checks
Change-Id: I6f7d5cb12d4d3c8167a491b7dd1ea8d52d5b6394
diff --git a/src/test/cord-api/Framework/AttWorkFlowDriver.robot b/src/test/cord-api/Framework/AttWorkFlowDriver.robot
new file mode 100644
index 0000000..ef8ed94
--- /dev/null
+++ b/src/test/cord-api/Framework/AttWorkFlowDriver.robot
@@ -0,0 +1,21 @@
+*** Settings ***
+Documentation Library to retrieve status fields from ATT WorkFlow Driver Service Instance List
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../Framework/utils/utils.py
+Library ../Framework/restApi.py
+
+*** Keywords ***
+Service Instance Status Check
+ [Arguments] ${onu_device}
+ [Documentation] Returns Status and authentication_state field values from att work flow driver for a particular ONU device
+ ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES
+ Log ${json_result}
+ ${json_result_list}= Get From dictionary ${json_result} items
+ ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
+ ${status}= Get From Dictionary ${getJsonDict} valid
+ ${authentication_status}= Get From Dictionary ${getJsonDict} authentication_state
+ [Return] ${status} ${authentication_status}
diff --git a/src/test/cord-api/Framework/ONU.robot b/src/test/cord-api/Framework/ONU.robot
new file mode 100644
index 0000000..596a865
--- /dev/null
+++ b/src/test/cord-api/Framework/ONU.robot
@@ -0,0 +1,21 @@
+*** Settings ***
+Documentation Library to check the status in ONU List
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../Framework/utils/utils.py
+Library ../Framework/restApi.py
+
+*** Keywords ***
+ONU Status Check
+ [Arguments] ${onu_device}
+ [Documentation] Returns "operational_status" and "admin_status" of a particular ONU device from "onu device list"
+ ${json_result}= restApi.ApiGet ONU_DEVICE
+ Log ${json_result}
+ ${json_result_list}= Get From dictionary ${json_result} items
+ ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
+ ${operational_status}= Get From Dictionary ${getJsonDict} oper_status
+ ${admin_status}= Get From Dictionary ${getJsonDict} admin_state
+ [Return] ${operational_status} ${admin_status}
diff --git a/src/test/cord-api/Tests/AttWhiteList-disableTests.txt b/src/test/cord-api/Tests/AttWhiteList-disableTests.txt
deleted file mode 100644
index c53097c..0000000
--- a/src/test/cord-api/Tests/AttWhiteList-disableTests.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-*** Settings ***
-Documentation Test to Configure White List
-Suite Setup Read InputFile
-Test Template Configuring White List
-Library Collections
-Library String
-Library OperatingSystem
-Library XML
-Library RequestsLibrary
-Library ../Framework/utils/utils.py
-Library ../Framework/restApi.py
-
-*** Variables ***
-${PATHFILE} ${CURDIR}/data/AttWhiteList.json
-
-*** Test Cases *** TYPE LISTINDEX
-Test Service Instance States
- STATUS_CHECK 0
-Test ONU States
- ONU_STATUS 0
-
-*** Keywords ***
-Read InputFile
- ${AttWhiteListList}= utils.jsonToList ${PATHFILE} AttWhiteListInfo
- Set Suite Variable ${slist} ${AttWhiteListList}
- Set Global Variable ${AttWorkFlowDriver_Id} ${EMPTY}
- Set Global Variable ${AttWhiteList_Id} ${EMPTY}
- Set Global Variable ${onu_device} ${EMPTY}
- Set Global Variable ${AttServiceInstance_Id} ${EMPTY}
- Set Global Variable ${authentication_status} ${EMPTY}
-
-Configuring White List
- [Arguments] ${type} ${listIndex}
- Run Keyword If "${type}" == "CREATE" Post White List ${listIndex}
- Run Keyword If "${type}" == "RETRIEVE" Get White List ${listIndex}
- Run Keyword If "${type}" == "STATUS_CHECK" Service Instance Status Check ${listIndex}
- Run Keyword If "${type}" == "ONU_STATUS" ONU Status Check ${listIndex}
-
-Post White List
- [Arguments] ${listIndex}
- ${AttWhiteListList} = Get Variable Value ${slist}
- ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex}
- ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
- Log ${onu_device}
- # Retrieve ATT Service Driver Id
- ${api_getResult}= restApi.ApiGet ATT_SERVICE
- ${AttWorkFlowDriverList}= Get From Dictionary ${api_getResult} items
- ${AttWorkFlowDriverDict}= utils.getDictFromListOfDict ${AttWorkFlowDriverList} leaf_model_name AttWorkflowDriverService
- ${AttWorkFlowDriver_Id}= Get From Dictionary ${AttWorkFlowDriverDict} id
- ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${AttWorkFlowDriver_Id}
- Log ${AttWhiteListDict}
- ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson ATT_WHITELIST ${AttWhiteListDict}
- Should Be True ${api_result_status}
- ${AttWhiteList_Id}= Get From Dictionary ${api_result_json} id
- Set Global Variable ${AttWhiteList_Id}
- Set Global Variable ${onu_device}
-
-Get White List
- [Arguments] ${listIndex}
- Log ${AttWhiteList_Id}
- ${json_result}= restApi.ApiChameleonGet ATT_WHITELIST ${AttWhiteList_Id}
- Log ${json_result}
- ${AttWhiteListList} = Get Variable Value ${slist}
- ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex}
- Log ${AttWhiteListDict}
- ${test_result}= utils.compare_dict ${AttWhiteListDict} ${json_result}
- Should Be True ${test_result}
-
-Service Instance Status Check
- [Arguments] ${listIndex}
- Set Global Variable ${AttServiceInstance_Id} ${EMPTY}
- Log ${AttServiceInstance_Id}
- ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES
- Log ${json_result}
- ${json_result_list}= Get From dictionary ${json_result} items
- ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
- ${status}= Get From Dictionary ${getJsonDict} valid
- ${authentication_status}= Get From Dictionary ${getJsonDict} authentication_state
- ${AttServiceInstance_Id}= Get From Dictionary ${getJsonDict} id
- Set Global Variable ${AttServiceInstance_Id}
- #Should Be Equal ${status} valid
- Should Be Equal ${authentication_status} AWAITING
-
-ONU Status Check
- [Arguments] ${listIndex}
- ${json_result}= restApi.ApiGet ONU_DEVICE
- Log ${json_result}
- ${json_result_list}= Get From dictionary ${json_result} items
- ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
- ${operational_status}= Get From Dictionary ${getJsonDict} oper_status
- ${admin_status}= Get From Dictionary ${getJsonDict} admin_state
- Should Be Equal ${operational_status} DISABLED
- Should Be Equal ${admin_status} DISABLED
diff --git a/src/test/cord-api/Tests/AttWhiteList-enableTests.txt b/src/test/cord-api/Tests/AttWhiteList-enableTests.txt
deleted file mode 100644
index 872b350..0000000
--- a/src/test/cord-api/Tests/AttWhiteList-enableTests.txt
+++ /dev/null
@@ -1,97 +0,0 @@
-*** Settings ***
-Documentation Test to Configure White List
-Suite Setup Read InputFile
-Test Template Configuring White List
-Library Collections
-Library String
-Library OperatingSystem
-Library XML
-Library RequestsLibrary
-Library ../Framework/utils/utils.py
-Library ../Framework/restApi.py
-
-*** Variables ***
-${PATHFILE} ${CURDIR}/data/AttWhiteList.json
-
-*** Test Cases *** TYPE LISTINDEX
-Test Create ONUWhiteList-1
- CREATE 0
-Test Get ONUWhiteList-1
- RETRIEVE 0
-Test Service Instance States
- STATUS_CHECK 0
-Test ONU States
- ONU_STATUS 0
-
-*** Keywords ***
-Read InputFile
- ${AttWhiteListList}= utils.jsonToList ${PATHFILE} AttWhiteListInfo
- Set Suite Variable ${slist} ${AttWhiteListList}
- Set Global Variable ${AttWorkFlowDriver_Id} ${EMPTY}
- Set Global Variable ${AttWhiteList_Id} ${EMPTY}
- Set Global Variable ${onu_device} ALPHe3d1cfa7
- Set Global Variable ${AttServiceInstance_Id} ${EMPTY}
- Set Global Variable ${authentication_status} ${EMPTY}
-
-Configuring White List
- [Arguments] ${type} ${listIndex}
- Run Keyword If "${type}" == "CREATE" Post White List ${listIndex}
- Run Keyword If "${type}" == "RETRIEVE" Get White List ${listIndex}
- Run Keyword If "${type}" == "STATUS_CHECK" Service Instance Status Check ${listIndex}
- Run Keyword If "${type}" == "ONU_STATUS" ONU Status Check ${listIndex}
-
-Post White List
- [Arguments] ${listIndex}
- ${AttWhiteListList} = Get Variable Value ${slist}
- ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex}
- ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
- Log ${onu_device}
- # Retrieve ATT Service Driver Id
- ${api_getResult}= restApi.ApiGet ATT_SERVICE
- ${AttWorkFlowDriverList}= Get From Dictionary ${api_getResult} items
- ${AttWorkFlowDriverDict}= utils.getDictFromListOfDict ${AttWorkFlowDriverList} leaf_model_name AttWorkflowDriverService
- ${AttWorkFlowDriver_Id}= Get From Dictionary ${AttWorkFlowDriverDict} id
- ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${AttWorkFlowDriver_Id}
- Log ${AttWhiteListDict}
- ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson ATT_WHITELIST ${AttWhiteListDict}
- Should Be True ${api_result_status}
- ${AttWhiteList_Id}= Get From Dictionary ${api_result_json} id
- Set Global Variable ${AttWhiteList_Id}
- Set Global Variable ${onu_device}
-
-Get White List
- [Arguments] ${listIndex}
- Log ${AttWhiteList_Id}
- ${json_result}= restApi.ApiChameleonGet ATT_WHITELIST ${AttWhiteList_Id}
- Log ${json_result}
- ${AttWhiteListList} = Get Variable Value ${slist}
- ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex}
- Log ${AttWhiteListDict}
- ${test_result}= utils.compare_dict ${AttWhiteListDict} ${json_result}
- Should Be True ${test_result}
-
-Service Instance Status Check
- [Arguments] ${listIndex}
- Set Global Variable ${AttServiceInstance_Id} ${EMPTY}
- Log ${AttServiceInstance_Id}
- ${json_result}= restApi.ApiGet ATT_SERVICEINSTANTCES
- Log ${json_result}
- ${json_result_list}= Get From dictionary ${json_result} items
- ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
- ${status}= Get From Dictionary ${getJsonDict} valid
- ${authentication_status}= Get From Dictionary ${getJsonDict} authentication_state
- ${AttServiceInstance_Id}= Get From Dictionary ${getJsonDict} id
- Set Global Variable ${AttServiceInstance_Id}
- Should Be Equal ${status} valid
- Should Be Equal ${authentication_status} AWAITING
-
-ONU Status Check
- [Arguments] ${listIndex}
- ${json_result}= restApi.ApiGet ONU_DEVICE
- Log ${json_result}
- ${json_result_list}= Get From dictionary ${json_result} items
- ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
- ${operational_status}= Get From Dictionary ${getJsonDict} oper_status
- ${admin_status}= Get From Dictionary ${getJsonDict} admin_state
- Should Be Equal ${operational_status} ACTIVE
- Should Be Equal ${admin_status} ENABLED