Suchitra Vemuri | 9fa07c3 | 2018-08-28 16:56:01 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test to Configure White List |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Configuring White List |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library OperatingSystem |
| 8 | Library XML |
| 9 | Library RequestsLibrary |
| 10 | Library ../Framework/utils/utils.py |
| 11 | Library ../Framework/restApi.py |
| 12 | |
| 13 | *** Variables *** |
| 14 | ${PATHFILE} ${CURDIR}/data/AttWhiteList.json |
| 15 | |
| 16 | *** Test Cases *** TYPE LISTINDEX |
| 17 | Test Create ONUWhiteList-1 |
| 18 | CREATE 0 |
| 19 | Test Get ONUWhiteList-1 |
| 20 | RETRIEVE 0 |
| 21 | Test Service Instance States |
| 22 | STATUS_CHECK 0 |
| 23 | Test ONU States |
| 24 | ONU_STATUS 0 |
| 25 | |
| 26 | *** Keywords *** |
| 27 | Read InputFile |
| 28 | ${AttWhiteListList}= utils.jsonToList ${PATHFILE} AttWhiteListInfo |
| 29 | Set Suite Variable ${slist} ${AttWhiteListList} |
| 30 | Set Global Variable ${AttWorkFlowDriver_Id} ${EMPTY} |
| 31 | Set Global Variable ${AttWhiteList_Id} ${EMPTY} |
| 32 | Set Global Variable ${onu_device} ALPHe3d1cfa7 |
| 33 | Set Global Variable ${AttServiceInstance_Id} ${EMPTY} |
| 34 | Set Global Variable ${authentication_status} ${EMPTY} |
| 35 | |
| 36 | Configuring White List |
| 37 | [Arguments] ${type} ${listIndex} |
| 38 | Run Keyword If "${type}" == "CREATE" Post White List ${listIndex} |
| 39 | Run Keyword If "${type}" == "RETRIEVE" Get White List ${listIndex} |
| 40 | Run Keyword If "${type}" == "STATUS_CHECK" Service Instance Status Check ${listIndex} |
| 41 | Run Keyword If "${type}" == "ONU_STATUS" ONU Status Check ${listIndex} |
| 42 | |
| 43 | Post White List |
| 44 | [Arguments] ${listIndex} |
| 45 | ${AttWhiteListList} = Get Variable Value ${slist} |
| 46 | ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex} |
| 47 | ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number |
| 48 | Log ${onu_device} |
| 49 | # Retrieve ATT Service Driver Id |
| 50 | ${api_getResult}= restApi.ApiGet ATT_SERVICE |
| 51 | ${AttWorkFlowDriverList}= Get From Dictionary ${api_getResult} items |
| 52 | ${AttWorkFlowDriverDict}= utils.getDictFromListOfDict ${AttWorkFlowDriverList} leaf_model_name AttWorkflowDriverService |
| 53 | ${AttWorkFlowDriver_Id}= Get From Dictionary ${AttWorkFlowDriverDict} id |
| 54 | ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${AttWorkFlowDriver_Id} |
| 55 | Log ${AttWhiteListDict} |
| 56 | ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson ATT_WHITELIST ${AttWhiteListDict} |
| 57 | Should Be True ${api_result_status} |
| 58 | ${AttWhiteList_Id}= Get From Dictionary ${api_result_json} id |
| 59 | Set Global Variable ${AttWhiteList_Id} |
| 60 | Set Global Variable ${onu_device} |
| 61 | |
| 62 | Get White List |
| 63 | [Arguments] ${listIndex} |
| 64 | Log ${AttWhiteList_Id} |
| 65 | ${json_result}= restApi.ApiChameleonGet ATT_WHITELIST ${AttWhiteList_Id} |
| 66 | Log ${json_result} |
| 67 | ${AttWhiteListList} = Get Variable Value ${slist} |
| 68 | ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex} |
| 69 | Log ${AttWhiteListDict} |
| 70 | ${test_result}= utils.compare_dict ${AttWhiteListDict} ${json_result} |
| 71 | Should Be True ${test_result} |
| 72 | |
| 73 | Service Instance Status Check |
| 74 | [Arguments] ${listIndex} |
| 75 | Set Global Variable ${AttServiceInstance_Id} ${EMPTY} |
| 76 | Log ${AttServiceInstance_Id} |
| 77 | ${json_result}= restApi.ApiGet ATT_SERVICEINSTANTCES |
| 78 | Log ${json_result} |
| 79 | ${json_result_list}= Get From dictionary ${json_result} items |
| 80 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device} |
| 81 | ${status}= Get From Dictionary ${getJsonDict} valid |
| 82 | ${authentication_status}= Get From Dictionary ${getJsonDict} authentication_state |
| 83 | ${AttServiceInstance_Id}= Get From Dictionary ${getJsonDict} id |
| 84 | Set Global Variable ${AttServiceInstance_Id} |
| 85 | Should Be Equal ${status} valid |
| 86 | Should Be Equal ${authentication_status} AWAITING |
| 87 | |
| 88 | ONU Status Check |
| 89 | [Arguments] ${listIndex} |
| 90 | ${json_result}= restApi.ApiGet ONU_DEVICE |
| 91 | Log ${json_result} |
| 92 | ${json_result_list}= Get From dictionary ${json_result} items |
| 93 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device} |
| 94 | ${operational_status}= Get From Dictionary ${getJsonDict} oper_status |
| 95 | ${admin_status}= Get From Dictionary ${getJsonDict} admin_state |
| 96 | Should Be Equal ${operational_status} ACTIVE |
| 97 | Should Be Equal ${admin_status} ENABLED |