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 |
| 10 | Library ../Framework/utils/utils.py |
| 11 | Library ../Framework/restApi.py |
| 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 |
| 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 Vemuri | d489186 | 2018-05-22 11:08:16 -0700 | [diff] [blame] | 65 | ${ONUDeviceList}= utils.jsonToList ${PATHFILE2} ONUDeviceInfo |
| 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} |
| 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 | |
| 94 | Test 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 | |
| 105 | Test 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 | |
| 115 | Test 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 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} |
| 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 | |
| 136 | Test 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 Vemuri | 7dbf03c | 2018-04-25 23:06:23 -0700 | [diff] [blame] | 147 | Test Delete VOLT Device API |
| 148 | [Arguments] ${listIndex} |
| 149 | ${test_result}= restApi.ApiChameleonDelete VOLT_DEVICE ${VOLTDevice_Id} |
| 150 | Should Be True ${test_result} |