| *** 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 |