You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Suchitra Vemuri | 2c73426 | 2018-09-06 14:34:42 -0700 | [diff] [blame] | 15 | *** Settings *** |
| 16 | Documentation Library to check the status in ONU List |
| 17 | Library Collections |
| 18 | Library String |
| 19 | Library OperatingSystem |
| 20 | Library XML |
| 21 | Library RequestsLibrary |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 22 | Library CORDRobot |
Suchitra Vemuri | 2c73426 | 2018-09-06 14:34:42 -0700 | [diff] [blame] | 23 | |
| 24 | *** Keywords *** |
| 25 | ONU Status Check |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 26 | [Documentation] Returns "operational_status" and "admin_status" of |
| 27 | ... a particular ONU device from "onu device list" |
Suchitra Vemuri | 2c73426 | 2018-09-06 14:34:42 -0700 | [diff] [blame] | 28 | [Arguments] ${onu_device} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 29 | ${json_result}= CORDRobot.ApiGet ONU_DEVICE |
Suchitra Vemuri | 2c73426 | 2018-09-06 14:34:42 -0700 | [diff] [blame] | 30 | Log ${json_result} |
| 31 | ${json_result_list}= Get From dictionary ${json_result} items |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 32 | ${getJsonDict}= CORDRobot.getDictFromListOfDict ${json_result_list} |
| 33 | ... serial_number ${onu_device} |
| 34 | ${operational_status}= Get From Dictionary ${getJsonDict} oper_status |
| 35 | ${admin_status}= Get From Dictionary ${getJsonDict} admin_state |
Zack Williams | c6722d5 | 2020-01-13 16:34:33 -0700 | [diff] [blame] | 36 | [Return] ${operational_status} ${admin_status} |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 37 | |
| 38 | Create ONU Device |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 39 | [Documentation] Sends a POST to create an att whitelist in XOS |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 40 | [Arguments] ${device_list} ${list_index} |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 41 | ${dlist} = Get Variable Value ${device_list} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 42 | ${onu_dictionary}= CORDRobot.listToDict ${dlist} ${list_index} |
| 43 | ${api_result}= CORDRobot.ApiPost ONU_DEVICE ${onu_dictionary} |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 44 | Should Be True ${api_result} |
| 45 | |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 46 | Retrieve ONU Device |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 47 | [Documentation] Returns the onu device id based on the onu's serial number |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 48 | [Arguments] ${serial_number} |
| 49 | ${json_result}= CORDRobot.ApiGet ONU_DEVICE |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 50 | Log ${json_result} |
| 51 | Log To Console ${json_result} |
| 52 | ${json_result_list}= Get From dictionary ${json_result} items |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 53 | ${getJsonDict}= CORDRobot.getDictFromListOfDict ${json_result_list} |
| 54 | ... serial_number ${serial_number} |
| 55 | ${id}= Get From Dictionary ${getJsonDict} id |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 56 | [Return] ${id} |
| 57 | |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 58 | Delete ONU Device |
| 59 | [Arguments] ${id} |
| 60 | [Documentation] Sends a DELETE to delete an onu device in XOS |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 61 | ${api_result}= CORDRobot.ApiChameleonDelete ONU_DEVICE ${id} |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 62 | Should Be True ${api_result} |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 63 | |
| 64 | Validate ONU States |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 65 | [Documentation] Check that ONU has the expected 'operational_status' and 'admin_status' |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 66 | [Arguments] ${expected_op_status} ${expected_admin_status} ${onu_device} |
| 67 | ${operational_status} ${admin_status} ONU Status Check ${onu_device} |
| 68 | Should Be Equal ${operational_status} ${expected_op_status} |
| 69 | Should Be Equal ${admin_status} ${expected_admin_status} |