Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for VOLTDevice |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Verify VOLTDevice functionality |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library OperatingSystem |
| 8 | Library XML |
| 9 | Library RequestsLibrary |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 10 | Library CORDRobot |
| 11 | Library ImportResource resources=CORDRobot |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
| 14 | ${PATHFILE} ${CURDIR}/data/VOLTDevice.json |
| 15 | ${PATHFILE1} ${CURDIR}/data/PONPort.json |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 16 | ${PATHFILE2} ${CURDIR}/data/ONUDevice.json |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 17 | |
| 18 | *** Test Cases *** TYPE LISTINDEX |
| 19 | Test Create VOLTDevice-1 |
| 20 | CREATE 0 |
| 21 | Test Get VOLTDevice-1 |
| 22 | RETRIEVE 0 |
| 23 | Test Create PONPort-1 |
| 24 | PONCREATE 0 |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 25 | Test Get PONPort-1 |
| 26 | PONRETRIEVE 0 |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 27 | Test Create ONUDevice-1 |
| 28 | ONUCREATE 0 |
| 29 | Test Get ONUDevice-1 |
| 30 | ONURETRIEVE 0 |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 31 | Test Create VOLTDevice-2 |
| 32 | CREATE 1 |
| 33 | Test Get VOLTDevice-2 |
| 34 | RETRIEVE 1 |
| 35 | Test Create PONPort-2 |
| 36 | PONCREATE 1 |
| 37 | Test Get PONPort-2 |
| 38 | PONRETRIEVE 1 |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 39 | Test Create ONUDevice-2 |
| 40 | ONUCREATE 1 |
| 41 | Test Get ONUDevice-2 |
| 42 | ONURETRIEVE 1 |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 43 | Test Create VOLTDevice-3 |
| 44 | CREATE 2 |
| 45 | Test Get VOLTDevice-3 |
| 46 | RETRIEVE 2 |
| 47 | Test Create PONPort-3 |
Suchitra Vemuri | b347855 | 2018-04-27 18:05:27 -0700 | [diff] [blame] | 48 | PONCREATE 2 |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 49 | Test Get PONPort-3 |
Suchitra Vemuri | b347855 | 2018-04-27 18:05:27 -0700 | [diff] [blame] | 50 | PONRETRIEVE 2 |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 51 | Test Create ONUDevice-3 |
| 52 | ONUCREATE 2 |
| 53 | Test Get ONUDevice-3 |
| 54 | ONURETRIEVE 2 |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 55 | |
| 56 | |
| 57 | *** Keywords *** |
| 58 | Read InputFile |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 59 | ${voltDeviceList}= CORDRobot.jsonToList ${PATHFILE} VOLTDeviceInfo |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 60 | Set Suite Variable ${dlist} ${voltDeviceList} |
| 61 | Set Global Variable ${VOLTDevice_Id} ${EMPTY} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 62 | ${PONPortList}= CORDRobot.jsonToList ${PATHFILE1} PONPortInfo |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 63 | Set Suite Variable ${plist} ${PONPortList} |
| 64 | Set Suite Variable ${PONPort_Id} ${EMPTY} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 65 | ${ONUDeviceList}= CORDRobot.jsonToList ${PATHFILE2} ONUDeviceInfo |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 66 | Set Suite Variable ${nlist} ${ONUDeviceList} |
| 67 | Set Suite Variable ${ONUDevice_Id} ${EMPTY} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 68 | |
| 69 | Verify 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 Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 76 | Run Keyword If "${type}" == "ONUCREATE" Test Post ONUDevice API ${listIndex} |
| 77 | Run Keyword If "${type}" == "ONURETRIEVE" Test Get ONUDevice API ${listIndex} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 78 | |
| 79 | Test Post VOLT Device API |
| 80 | [Arguments] ${listIndex} |
| 81 | ${voltDeviceList} = Get Variable Value ${dlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 82 | ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex} |
| 83 | ${api_getResult}= CORDRobot.ApiGet VOLT_SERVICE |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 84 | ${voltServiceList}= Get From Dictionary ${api_getResult} items |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 85 | ${voltServiceDict}= CORDRobot.getDictFromListOfDict ${voltServiceList} leaf_model_name VOLTService |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 86 | ${VOLTService_Id}= Get From Dictionary ${voltServiceDict} id |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 87 | ${voltDeviceDict}= CORDRobot.setFieldValueInDict ${voltDeviceDict} volt_service_id ${VOLTService_Id} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 88 | Log ${voltDeviceDict} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 89 | ${api_result_status} ${api_result_json}= CORDRobot.ApiPostReturnJson VOLT_DEVICE ${voltDeviceDict} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 90 | Should Be True ${api_result_status} |
| 91 | ${VOLTDevice_Id}= Get From Dictionary ${api_result_json} id |
| 92 | Set Global Variable ${VOLTDevice_Id} |
| 93 | |
| 94 | Test Get VOLT Device API |
| 95 | [Arguments] ${listIndex} |
| 96 | Log ${VOLTDevice_Id} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 97 | ${json_result}= CORDRobot.ApiChameleonGet VOLT_DEVICE ${VOLTDevice_Id} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 98 | Log ${json_result} |
| 99 | ${voltDeviceList} = Get Variable Value ${dlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 100 | ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 101 | Log ${voltDeviceDict} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 102 | ${test_result}= CORDRobot.compare_dict ${voltDeviceDict} ${json_result} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 103 | Should Be True ${test_result} |
| 104 | |
| 105 | Test Post PONPort API |
| 106 | [Arguments] ${listIndex} |
| 107 | ${PONPortList} = Get Variable Value ${plist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 108 | ${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 Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 111 | Should Be True ${api_result_status} |
| 112 | ${PONPort_Id}= Get From Dictionary ${api_result_json} id |
| 113 | Set Global Variable ${PONPort_Id} |
| 114 | |
| 115 | Test Get PONPort API |
| 116 | [Arguments] ${listIndex} |
| 117 | Log ${PONPort_Id} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 118 | ${json_result}= CORDRobot.ApiChameleonGet PON_PORT ${PONPort_Id} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 119 | Log ${json_result} |
| 120 | ${PONPortList} = Get Variable Value ${plist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 121 | ${PONPortDict}= CORDRobot.listToDict ${PONPortList} ${listIndex} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 122 | Log ${PONPortDict} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 123 | ${test_result}= CORDRobot.compare_dict ${PONPortDict} ${json_result} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 124 | Should Be True ${test_result} |
| 125 | |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 126 | Test Post ONUDevice API |
| 127 | [Arguments] ${listIndex} |
| 128 | ${ONUDeviceList}= Get Variable Value ${nlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 129 | ${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 Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 132 | Should Be True ${api_result_status} |
| 133 | ${ONUDevice_Id}= Get From Dictionary ${api_result_json} id |
| 134 | Set Global Variable ${ONUDevice_Id} |
| 135 | |
| 136 | Test Get ONUDevice API |
| 137 | [Arguments] ${listIndex} |
| 138 | Log ${ONUDevice_Id} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 139 | ${json_result}= CORDRobot.ApiChameleonGet ONU_DEVICE ${ONUDevice_Id} |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 140 | Log ${json_result} |
| 141 | ${ONUDeviceList} = Get Variable Value ${nlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 142 | ${ONUDeviceDict}= CORDRobot.listToDict ${ONUDeviceList} ${listIndex} |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 143 | Log ${ONUDeviceDict} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 144 | ${test_result}= CORDRobot.compare_dict ${ONUDeviceDict} ${json_result} |
Suchitra Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 145 | Should Be True ${test_result} |
| 146 | |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 147 | Test Delete VOLT Device API |
| 148 | [Arguments] ${listIndex} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 149 | ${test_result}= CORDRobot.ApiChameleonDelete VOLT_DEVICE ${VOLTDevice_Id} |
Suchitra Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 150 | Should Be True ${test_result} |