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 |
Suchitra Vemuri | 32fc2f2 | 2018-09-10 12:06:01 -0700 | [diff] [blame] | 10 | Library ../../Framework/utils/utils.py |
| 11 | Library ../../Framework/restApi.py |
Suchitra Vemuri | 9fa07c3 | 2018-08-28 16:56:01 -0700 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 14 | ${PATHFILE} ${CURDIR}/data/ATTWhiteList.json |
Suchitra Vemuri | 9fa07c3 | 2018-08-28 16:56:01 -0700 | [diff] [blame] | 15 | |
| 16 | *** Test Cases *** TYPE LISTINDEX |
| 17 | Test Create ONUWhiteList-1 |
| 18 | CREATE 0 |
| 19 | Test Get ONUWhiteList-1 |
| 20 | RETRIEVE 0 |
| 21 | |
| 22 | *** Keywords *** |
| 23 | Read InputFile |
| 24 | ${AttWhiteListList}= utils.jsonToList ${PATHFILE} AttWhiteListInfo |
| 25 | Set Suite Variable ${slist} ${AttWhiteListList} |
| 26 | Set Global Variable ${AttWorkFlowDriver_Id} ${EMPTY} |
| 27 | Set Global Variable ${AttWhiteList_Id} ${EMPTY} |
| 28 | |
| 29 | Configuring White List |
| 30 | [Arguments] ${type} ${listIndex} |
| 31 | Run Keyword If "${type}" == "CREATE" Post White List ${listIndex} |
| 32 | Run Keyword If "${type}" == "RETRIEVE" Get White List ${listIndex} |
| 33 | |
| 34 | Post White List |
| 35 | [Arguments] ${listIndex} |
| 36 | ${AttWhiteListList} = Get Variable Value ${slist} |
| 37 | ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex} |
| 38 | # Retrieve ATT Service Driver Id |
| 39 | ${api_getResult}= restApi.ApiGet ATT_SERVICE |
| 40 | ${AttWorkFlowDriverList}= Get From Dictionary ${api_getResult} items |
| 41 | ${AttWorkFlowDriverDict}= utils.getDictFromListOfDict ${AttWorkFlowDriverList} leaf_model_name AttWorkflowDriverService |
| 42 | ${AttWorkFlowDriver_Id}= Get From Dictionary ${AttWorkFlowDriverDict} id |
| 43 | ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${AttWorkFlowDriver_Id} |
| 44 | Log ${AttWhiteListDict} |
| 45 | ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson ATT_WHITELIST ${AttWhiteListDict} |
| 46 | Should Be True ${api_result_status} |
| 47 | ${AttWhiteList_Id}= Get From Dictionary ${api_result_json} id |
| 48 | Set Global Variable ${AttWhiteList_Id} |
| 49 | |
| 50 | Get White List |
| 51 | [Arguments] ${listIndex} |
| 52 | Log ${AttWhiteList_Id} |
| 53 | ${json_result}= restApi.ApiChameleonGet ATT_WHITELIST ${AttWhiteList_Id} |
| 54 | Log ${json_result} |
| 55 | ${AttWhiteListList} = Get Variable Value ${slist} |
| 56 | ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex} |
| 57 | Log ${AttWhiteListDict} |
| 58 | ${test_result}= utils.compare_dict ${AttWhiteListDict} ${json_result} |
| 59 | Should Be True ${test_result} |