blob: f0061e9a6b8c0a45d4d33c78ea7f79120c1560f7 [file] [log] [blame]
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -07001*** Settings ***
2Documentation Test suite for configuring OLT device using REST APIs
3Suite Setup Read InputFile
4Test Template Configuring Real OLT device
5Library Collections
6Library String
7Library OperatingSystem
8Library XML
9Library RequestsLibrary
Zack Williams821c5022020-01-15 15:11:46 -070010Library CORDRobot
11Library ImportResource resources=CORDRobot
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070012
13*** Variables ***
14${PATHFILE} ${CURDIR}/data/RealOLTDevice.json
15
16*** Test Cases *** TYPE LISTINDEX
17Test Create VOLTDevice-1
18 CREATE 0
19Test Get VOLTDevice-1
20 RETRIEVE 0
21
22*** Keywords ***
23Read InputFile
Zack Williams821c5022020-01-15 15:11:46 -070024 ${voltDeviceList}= CORDRobot.jsonToList ${PATHFILE} VOLTDeviceInfo
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070025 Set Suite Variable ${dlist} ${voltDeviceList}
26 Set Global Variable ${VOLTDevice_Id} ${EMPTY}
27
28Configuring 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
33Test Post VOLT Device API
34 [Arguments] ${listIndex}
35 ${voltDeviceList} = Get Variable Value ${dlist}
Zack Williams821c5022020-01-15 15:11:46 -070036 ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex}
37 ${api_getResult}= CORDRobot.ApiGet VOLT_SERVICE
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070038 ${voltServiceList}= Get From Dictionary ${api_getResult} items
Zack Williams821c5022020-01-15 15:11:46 -070039 ${voltServiceDict}= CORDRobot.getDictFromListOfDict ${voltServiceList} leaf_model_name VOLTService
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070040 ${VOLTService_Id}= Get From Dictionary ${voltServiceDict} id
Zack Williams821c5022020-01-15 15:11:46 -070041 ${voltDeviceDict}= CORDRobot.setFieldValueInDict ${voltDeviceDict} volt_service_id ${VOLTService_Id}
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070042 Log ${voltDeviceDict}
Zack Williams821c5022020-01-15 15:11:46 -070043 ${api_result_status} ${api_result_json}= CORDRobot.ApiPostReturnJson VOLT_DEVICE ${voltDeviceDict}
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070044 Should Be True ${api_result_status}
45 ${VOLTDevice_Id}= Get From Dictionary ${api_result_json} id
46 Set Global Variable ${VOLTDevice_Id}
47
48Test Get VOLT Device API
49 [Arguments] ${listIndex}
50 Log ${VOLTDevice_Id}
Zack Williams821c5022020-01-15 15:11:46 -070051 ${json_result}= CORDRobot.ApiChameleonGet VOLT_DEVICE ${VOLTDevice_Id}
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070052 Log ${json_result}
53 ${voltDeviceList} = Get Variable Value ${dlist}
Zack Williams821c5022020-01-15 15:11:46 -070054 ${voltDeviceDict}= CORDRobot.listToDict ${voltDeviceList} ${listIndex}
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070055 Log ${voltDeviceDict}
Zack Williams821c5022020-01-15 15:11:46 -070056 ${test_result}= CORDRobot.compare_dict ${voltDeviceDict} ${json_result}
Suchitra Vemuri0f3dd092018-07-10 17:24:56 -070057 Should Be True ${test_result}