blob: 75444a8c653c87594f3563fca731835ccd71d379 [file] [log] [blame]
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -07001*** Settings ***
2Documentation Test suite for VOLTDevice
3Suite Setup Read InputFile
4Test Template Verify VOLTDevice functionality
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/VOLTDevice.json
15${PATHFILE1} ${CURDIR}/data/PONPort.json
Suchitra Vemurid4891862018-05-22 11:08:16 -070016${PATHFILE2} ${CURDIR}/data/ONUDevice.json
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070017
18*** Test Cases *** TYPE LISTINDEX
19Test Create VOLTDevice-1
20 CREATE 0
21Test Get VOLTDevice-1
22 RETRIEVE 0
23Test Create PONPort-1
24 PONCREATE 0
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070025Test Get PONPort-1
26 PONRETRIEVE 0
Suchitra Vemurid4891862018-05-22 11:08:16 -070027Test Create ONUDevice-1
28 ONUCREATE 0
29Test Get ONUDevice-1
30 ONURETRIEVE 0
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070031Test Create VOLTDevice-2
32 CREATE 1
33Test Get VOLTDevice-2
34 RETRIEVE 1
35Test Create PONPort-2
36 PONCREATE 1
37Test Get PONPort-2
38 PONRETRIEVE 1
Suchitra Vemurid4891862018-05-22 11:08:16 -070039Test Create ONUDevice-2
40 ONUCREATE 1
41Test Get ONUDevice-2
42 ONURETRIEVE 1
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070043Test Create VOLTDevice-3
44 CREATE 2
45Test Get VOLTDevice-3
46 RETRIEVE 2
47Test Create PONPort-3
Suchitra Vemurib3478552018-04-27 18:05:27 -070048 PONCREATE 2
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070049Test Get PONPort-3
Suchitra Vemurib3478552018-04-27 18:05:27 -070050 PONRETRIEVE 2
Suchitra Vemurid4891862018-05-22 11:08:16 -070051Test Create ONUDevice-3
52 ONUCREATE 2
53Test Get ONUDevice-3
54 ONURETRIEVE 2
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070055
56
57*** Keywords ***
58Read InputFile
59 ${voltDeviceList}= utils.jsonToList ${PATHFILE} VOLTDeviceInfo
60 Set Suite Variable ${dlist} ${voltDeviceList}
61 Set Global Variable ${VOLTDevice_Id} ${EMPTY}
62 ${PONPortList}= utils.jsonToList ${PATHFILE1} PONPortInfo
63 Set Suite Variable ${plist} ${PONPortList}
64 Set Suite Variable ${PONPort_Id} ${EMPTY}
Suchitra Vemurid4891862018-05-22 11:08:16 -070065 ${ONUDeviceList}= utils.jsonToList ${PATHFILE2} ONUDeviceInfo
66 Set Suite Variable ${nlist} ${ONUDeviceList}
67 Set Suite Variable ${ONUDevice_Id} ${EMPTY}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070068
69Verify VOLTDevice functionality
70 [Arguments] ${type} ${listIndex}
71 Run Keyword If "${type}" == "CREATE" Test Post VOLT Device API ${listIndex}
72 Run Keyword If "${type}" == "RETRIEVE" Test Get VOLT Device API ${listIndex}
73 Run Keyword If "${type}" == "DELETE" Test Delete VOLT Device API ${listIndex}
74 Run Keyword If "${type}" == "PONCREATE" Test Post PONPort API ${listIndex}
75 Run Keyword If "${type}" == "PONRETRIEVE" Test Get PONPort API ${listIndex}
Suchitra Vemurid4891862018-05-22 11:08:16 -070076 Run Keyword If "${type}" == "ONUCREATE" Test Post ONUDevice API ${listIndex}
77 Run Keyword If "${type}" == "ONURETRIEVE" Test Get ONUDevice API ${listIndex}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070078
79Test Post VOLT Device API
80 [Arguments] ${listIndex}
81 ${voltDeviceList} = Get Variable Value ${dlist}
82 ${voltDeviceDict}= utils.listToDict ${voltDeviceList} ${listIndex}
83 ${api_getResult}= restApi.ApiGet VOLT_SERVICE
84 ${voltServiceList}= Get From Dictionary ${api_getResult} items
85 ${voltServiceDict}= utils.getDictFromListOfDict ${voltServiceList} leaf_model_name VOLTService
86 ${VOLTService_Id}= Get From Dictionary ${voltServiceDict} id
87 ${voltDeviceDict}= utils.setFieldValueInDict ${voltDeviceDict} volt_service_id ${VOLTService_Id}
88 Log ${voltDeviceDict}
89 ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson VOLT_DEVICE ${voltDeviceDict}
90 Should Be True ${api_result_status}
91 ${VOLTDevice_Id}= Get From Dictionary ${api_result_json} id
92 Set Global Variable ${VOLTDevice_Id}
93
94Test Get VOLT Device API
95 [Arguments] ${listIndex}
96 Log ${VOLTDevice_Id}
97 ${json_result}= restApi.ApiChameleonGet VOLT_DEVICE ${VOLTDevice_Id}
98 Log ${json_result}
99 ${voltDeviceList} = Get Variable Value ${dlist}
100 ${voltDeviceDict}= utils.listToDict ${voltDeviceList} ${listIndex}
101 Log ${voltDeviceDict}
102 ${test_result}= utils.compare_dict ${voltDeviceDict} ${json_result}
103 Should Be True ${test_result}
104
105Test Post PONPort API
106 [Arguments] ${listIndex}
107 ${PONPortList} = Get Variable Value ${plist}
108 ${PONPortDict}= utils.listToDict ${PONPortList} ${listIndex}
109 ${PONPortDict}= utils.setFieldValueInDict ${PONPortDict} olt_device_id ${VOLTDevice_Id}
110 ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson PON_PORT ${PONPortDict}
111 Should Be True ${api_result_status}
112 ${PONPort_Id}= Get From Dictionary ${api_result_json} id
113 Set Global Variable ${PONPort_Id}
114
115Test Get PONPort API
116 [Arguments] ${listIndex}
117 Log ${PONPort_Id}
118 ${json_result}= restApi.ApiChameleonGet PON_PORT ${PONPort_Id}
119 Log ${json_result}
120 ${PONPortList} = Get Variable Value ${plist}
121 ${PONPortDict}= utils.listToDict ${PONPortList} ${listIndex}
122 Log ${PONPortDict}
123 ${test_result}= utils.compare_dict ${PONPortDict} ${json_result}
124 Should Be True ${test_result}
125
Suchitra Vemurid4891862018-05-22 11:08:16 -0700126Test Post ONUDevice API
127 [Arguments] ${listIndex}
128 ${ONUDeviceList}= Get Variable Value ${nlist}
129 ${ONUDeviceDict}= utils.listToDict ${ONUDeviceList} ${listIndex}
130 ${ONUDeviceDict}= utils.setFieldValueInDict ${ONUDeviceDict} pon_port_id ${PONPort_Id}
131 ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson ONU_DEVICE ${ONUDeviceDict}
132 Should Be True ${api_result_status}
133 ${ONUDevice_Id}= Get From Dictionary ${api_result_json} id
134 Set Global Variable ${ONUDevice_Id}
135
136Test Get ONUDevice API
137 [Arguments] ${listIndex}
138 Log ${ONUDevice_Id}
139 ${json_result}= restApi.ApiChameleonGet ONU_DEVICE ${ONUDevice_Id}
140 Log ${json_result}
141 ${ONUDeviceList} = Get Variable Value ${nlist}
142 ${ONUDeviceDict}= utils.listToDict ${ONUDeviceList} ${listIndex}
143 Log ${ONUDeviceDict}
144 ${test_result}= utils.compare_dict ${ONUDeviceDict} ${json_result}
145 Should Be True ${test_result}
146
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700147Test Delete VOLT Device API
148 [Arguments] ${listIndex}
149 ${test_result}= restApi.ApiChameleonDelete VOLT_DEVICE ${VOLTDevice_Id}
150 Should Be True ${test_result}