Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for configuring OLT device using REST APIs |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Configuring Real OLT device |
| 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 | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
| 14 | ${PATHFILE} ${CURDIR}/data/RealOLTDevice.json |
| 15 | |
| 16 | *** Test Cases *** TYPE LISTINDEX |
| 17 | Test Create VOLTDevice-1 |
| 18 | CREATE 0 |
| 19 | Test Get VOLTDevice-1 |
| 20 | RETRIEVE 0 |
| 21 | |
| 22 | *** Keywords *** |
| 23 | Read InputFile |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 24 | ${voltDeviceList}= CORDRobot.jsonToList ${PATHFILE} VOLTDeviceInfo |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 25 | Set Suite Variable ${dlist} ${voltDeviceList} |
| 26 | Set Global Variable ${VOLTDevice_Id} ${EMPTY} |
| 27 | |
| 28 | Configuring Real OLT device |
| 29 | [Arguments] ${type} ${listIndex} |
| 30 | Run Keyword If "${type}" == "CREATE" Test Post VOLT Device API ${listIndex} |
| 31 | Run Keyword If "${type}" == "RETRIEVE" Test Get VOLT Device API ${listIndex} |
| 32 | |
| 33 | Test Post VOLT Device API |
| 34 | [Arguments] ${listIndex} |
| 35 | ${voltDeviceList} = Get Variable Value ${dlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 36 | ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex} |
| 37 | ${api_getResult}= CORDRobot.ApiGet VOLT_SERVICE |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 38 | ${voltServiceList}= Get From Dictionary ${api_getResult} items |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 39 | ${voltServiceDict}= CORDRobot.getDictFromListOfDict ${voltServiceList} leaf_model_name VOLTService |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 40 | ${VOLTService_Id}= Get From Dictionary ${voltServiceDict} id |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 41 | ${voltDeviceDict}= CORDRobot.setFieldValueInDict ${voltDeviceDict} volt_service_id ${VOLTService_Id} |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 42 | Log ${voltDeviceDict} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 43 | ${api_result_status} ${api_result_json}= CORDRobot.ApiPostReturnJson VOLT_DEVICE ${voltDeviceDict} |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 44 | Should Be True ${api_result_status} |
| 45 | ${VOLTDevice_Id}= Get From Dictionary ${api_result_json} id |
| 46 | Set Global Variable ${VOLTDevice_Id} |
| 47 | |
| 48 | Test Get VOLT Device API |
| 49 | [Arguments] ${listIndex} |
| 50 | Log ${VOLTDevice_Id} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 51 | ${json_result}= CORDRobot.ApiChameleonGet VOLT_DEVICE ${VOLTDevice_Id} |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 52 | Log ${json_result} |
| 53 | ${voltDeviceList} = Get Variable Value ${dlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 54 | ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex} |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 55 | Log ${voltDeviceDict} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 56 | ${test_result}= CORDRobot.compare_dict ${voltDeviceDict} ${json_result} |
Suchitra Vemuri | 0f3dd09 | 2018-07-10 17:24:56 -0700 | [diff] [blame] | 57 | Should Be True ${test_result} |