blob: 19f305e8009b8c09bc83f2682205ea9f31acd81a [file] [log] [blame]
Suchitra Vemuri9fa07c32018-08-28 16:56:01 -07001*** Settings ***
2Documentation Test to Configure White List
3Suite Setup Read InputFile
4Test Template Configuring White List
5Library Collections
6Library String
7Library OperatingSystem
8Library XML
9Library RequestsLibrary
10Library ../Framework/utils/utils.py
11Library ../Framework/restApi.py
12
13*** Variables ***
14${PATHFILE} ${CURDIR}/data/AttWhiteList.json
15
16*** Test Cases *** TYPE LISTINDEX
17Test Create ONUWhiteList-1
18 CREATE 0
19Test Get ONUWhiteList-1
20 RETRIEVE 0
21
22*** Keywords ***
23Read 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
29Configuring 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
34Post 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
50Get 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}