blob: 653086b84bac597135169b6c87f987e689466e2a [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
Zack Williams821c5022020-01-15 15:11:46 -070010Library CORDRobot
11Library ImportResource resources=CORDRobot
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070012
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
Zack Williams821c5022020-01-15 15:11:46 -070059 ${voltDeviceList}= CORDRobot.jsonToList ${PATHFILE} VOLTDeviceInfo
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070060 Set Suite Variable ${dlist} ${voltDeviceList}
61 Set Global Variable ${VOLTDevice_Id} ${EMPTY}
Zack Williams821c5022020-01-15 15:11:46 -070062 ${PONPortList}= CORDRobot.jsonToList ${PATHFILE1} PONPortInfo
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070063 Set Suite Variable ${plist} ${PONPortList}
64 Set Suite Variable ${PONPort_Id} ${EMPTY}
Zack Williams821c5022020-01-15 15:11:46 -070065 ${ONUDeviceList}= CORDRobot.jsonToList ${PATHFILE2} ONUDeviceInfo
Suchitra Vemurid4891862018-05-22 11:08:16 -070066 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}
Zack Williams821c5022020-01-15 15:11:46 -070082 ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex}
83 ${api_getResult}= CORDRobot.ApiGet VOLT_SERVICE
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070084 ${voltServiceList}= Get From Dictionary ${api_getResult} items
Zack Williams821c5022020-01-15 15:11:46 -070085 ${voltServiceDict}= CORDRobot.getDictFromListOfDict ${voltServiceList} leaf_model_name VOLTService
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070086 ${VOLTService_Id}= Get From Dictionary ${voltServiceDict} id
Zack Williams821c5022020-01-15 15:11:46 -070087 ${voltDeviceDict}= CORDRobot.setFieldValueInDict ${voltDeviceDict} volt_service_id ${VOLTService_Id}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070088 Log ${voltDeviceDict}
Zack Williams821c5022020-01-15 15:11:46 -070089 ${api_result_status} ${api_result_json}= CORDRobot.ApiPostReturnJson VOLT_DEVICE ${voltDeviceDict}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070090 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}
Zack Williams821c5022020-01-15 15:11:46 -070097 ${json_result}= CORDRobot.ApiChameleonGet VOLT_DEVICE ${VOLTDevice_Id}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -070098 Log ${json_result}
99 ${voltDeviceList} = Get Variable Value ${dlist}
Zack Williams821c5022020-01-15 15:11:46 -0700100 ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700101 Log ${voltDeviceDict}
Zack Williams821c5022020-01-15 15:11:46 -0700102 ${test_result}= CORDRobot.compare_dict ${voltDeviceDict} ${json_result}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700103 Should Be True ${test_result}
104
105Test Post PONPort API
106 [Arguments] ${listIndex}
107 ${PONPortList} = Get Variable Value ${plist}
Zack Williams821c5022020-01-15 15:11:46 -0700108 ${PONPortDict}= CORDRobot.listToDict ${PONPortList} ${listIndex}
109 ${PONPortDict}= CORDRobot.setFieldValueInDict ${PONPortDict} olt_device_id ${VOLTDevice_Id}
110 ${api_result_status} ${api_result_json}= CORDRobot.ApiPostReturnJson PON_PORT ${PONPortDict}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700111 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}
Zack Williams821c5022020-01-15 15:11:46 -0700118 ${json_result}= CORDRobot.ApiChameleonGet PON_PORT ${PONPort_Id}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700119 Log ${json_result}
120 ${PONPortList} = Get Variable Value ${plist}
Zack Williams821c5022020-01-15 15:11:46 -0700121 ${PONPortDict}= CORDRobot.listToDict ${PONPortList} ${listIndex}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700122 Log ${PONPortDict}
Zack Williams821c5022020-01-15 15:11:46 -0700123 ${test_result}= CORDRobot.compare_dict ${PONPortDict} ${json_result}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700124 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}
Zack Williams821c5022020-01-15 15:11:46 -0700129 ${ONUDeviceDict}= CORDRobot.listToDict ${ONUDeviceList} ${listIndex}
130 ${ONUDeviceDict}= CORDRobot.setFieldValueInDict ${ONUDeviceDict} pon_port_id ${PONPort_Id}
131 ${api_result_status} ${api_result_json}= CORDRobot.ApiPostReturnJson ONU_DEVICE ${ONUDeviceDict}
Suchitra Vemurid4891862018-05-22 11:08:16 -0700132 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}
Zack Williams821c5022020-01-15 15:11:46 -0700139 ${json_result}= CORDRobot.ApiChameleonGet ONU_DEVICE ${ONUDevice_Id}
Suchitra Vemurid4891862018-05-22 11:08:16 -0700140 Log ${json_result}
141 ${ONUDeviceList} = Get Variable Value ${nlist}
Zack Williams821c5022020-01-15 15:11:46 -0700142 ${ONUDeviceDict}= CORDRobot.listToDict ${ONUDeviceList} ${listIndex}
Suchitra Vemurid4891862018-05-22 11:08:16 -0700143 Log ${ONUDeviceDict}
Zack Williams821c5022020-01-15 15:11:46 -0700144 ${test_result}= CORDRobot.compare_dict ${ONUDeviceDict} ${json_result}
Suchitra Vemurid4891862018-05-22 11:08:16 -0700145 Should Be True ${test_result}
146
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700147Test Delete VOLT Device API
148 [Arguments] ${listIndex}
Zack Williams821c5022020-01-15 15:11:46 -0700149 ${test_result}= CORDRobot.ApiChameleonDelete VOLT_DEVICE ${VOLTDevice_Id}
Suchitra Vemuri7dbf03c2018-04-25 23:06:23 -0700150 Should Be True ${test_result}