blob: 3240c5c6221c7e1eb0a7a76e6690e7d098d73402 [file] [log] [blame]
Suchitra Vemuriff825322018-09-07 14:00:04 -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
21Test Service Instance States
22 STATUS_CHECK 0
23Test ONU States
24 ONU_STATUS 0
25
26*** Keywords ***
27Read InputFile
28 ${AttWhiteListList}= utils.jsonToList ${PATHFILE} AttWhiteListInfo
29 Set Suite Variable ${slist} ${AttWhiteListList}
30 ${AttWhiteListList} = Get Variable Value ${slist}
31 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
32 ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
33 Log ${onu_device}
34 Set Global Variable ${AttWorkFlowDriver_Id} ${EMPTY}
35 Set Global Variable ${AttWhiteList_Id} ${EMPTY}
36 Set Global Variable ${onu_device} ALPHe3d1cfa7
37 Set Global Variable ${AttServiceInstance_Id} ${EMPTY}
38 Set Global Variable ${authentication_status} ${EMPTY}
39
40
41Configuring White List
42 [Arguments] ${type} ${listIndex}
43 Run Keyword If "${type}" == "CREATE" Post White List ${listIndex}
44 Run Keyword If "${type}" == "RETRIEVE" Get White List ${listIndex}
45 Run Keyword If "${type}" == "STATUS_CHECK" Service Instance Status Check ${listIndex}
46 Run Keyword If "${type}" == "ONU_STATUS" ONU Status Check ${listIndex}
47
48Post White List
49 [Arguments] ${listIndex}
50 ${AttWhiteListList} = Get Variable Value ${slist}
51 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex}
52 ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
53 Log ${onu_device}
54 # Retrieve ATT Service Driver Id
55 ${api_getResult}= restApi.ApiGet ATT_SERVICE
56 ${AttWorkFlowDriverList}= Get From Dictionary ${api_getResult} items
57 ${AttWorkFlowDriverDict}= utils.getDictFromListOfDict ${AttWorkFlowDriverList} leaf_model_name AttWorkflowDriverService
58 ${AttWorkFlowDriver_Id}= Get From Dictionary ${AttWorkFlowDriverDict} id
59 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${AttWorkFlowDriver_Id}
60 Log ${AttWhiteListDict}
61 ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson ATT_WHITELIST ${AttWhiteListDict}
62 Should Be True ${api_result_status}
63 ${AttWhiteList_Id}= Get From Dictionary ${api_result_json} id
64 Set Global Variable ${AttWhiteList_Id}
65 Set Global Variable ${onu_device}
66
67Get White List
68 [Arguments] ${listIndex}
69 Log ${AttWhiteList_Id}
70 ${json_result}= restApi.ApiChameleonGet ATT_WHITELIST ${AttWhiteList_Id}
71 Log ${json_result}
72 ${AttWhiteListList} = Get Variable Value ${slist}
73 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${listIndex}
74 Log ${AttWhiteListDict}
75 ${test_result}= utils.compare_dict ${AttWhiteListDict} ${json_result}
76 Should Be True ${test_result}
77
78Service Instance Status Check
79 [Arguments] ${listIndex}
80 Set Global Variable ${AttServiceInstance_Id} ${EMPTY}
81 Log ${AttServiceInstance_Id}
82 ${json_result}= restApi.ApiGet ATT_SERVICEINSTANTCES
83 Log ${json_result}
84 ${json_result_list}= Get From dictionary ${json_result} items
85 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
86 ${status}= Get From Dictionary ${getJsonDict} valid
87 ${authentication_status}= Get From Dictionary ${getJsonDict} authentication_state
88 ${AttServiceInstance_Id}= Get From Dictionary ${getJsonDict} id
89 Set Global Variable ${AttServiceInstance_Id}
90 Should Be Equal ${status} valid
91 Should Be Equal ${authentication_status} AWAITING
92
93ONU Status Check
94 [Arguments] ${listIndex}
95 ${json_result}= restApi.ApiGet ONU_DEVICE
96 Log ${json_result}
97 ${json_result_list}= Get From dictionary ${json_result} items
98 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
99 ${operational_status}= Get From Dictionary ${getJsonDict} oper_status
100 ${admin_status}= Get From Dictionary ${getJsonDict} admin_state
101 Should Be Equal ${operational_status} ACTIVE
102 Should Be Equal ${admin_status} ENABLED