blob: 7ec8d9829b998c32451ff23b33b8daa8442d7919 [file] [log] [blame]
You Wang0c2b3662018-10-01 16:56:17 -07001# 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 Vemuri2c734262018-09-06 14:34:42 -070015*** Settings ***
16Documentation Library to check the status in ONU List
17Library Collections
18Library String
19Library OperatingSystem
20Library XML
21Library RequestsLibrary
Zack Williams821c5022020-01-15 15:11:46 -070022Library CORDRobot
Suchitra Vemuri2c734262018-09-06 14:34:42 -070023
24*** Keywords ***
25ONU Status Check
Zack Williams821c5022020-01-15 15:11:46 -070026 [Documentation] Returns "operational_status" and "admin_status" of
27 ... a particular ONU device from "onu device list"
Suchitra Vemuri2c734262018-09-06 14:34:42 -070028 [Arguments] ${onu_device}
Zack Williams821c5022020-01-15 15:11:46 -070029 ${json_result}= CORDRobot.ApiGet ONU_DEVICE
Suchitra Vemuri2c734262018-09-06 14:34:42 -070030 Log ${json_result}
31 ${json_result_list}= Get From dictionary ${json_result} items
Zack Williams821c5022020-01-15 15:11:46 -070032 ${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 Williamsc6722d52020-01-13 16:34:33 -070036 [Return] ${operational_status} ${admin_status}
Kailash Khalasi30a6a392018-09-10 14:32:39 -070037
38Create ONU Device
Kailash Khalasi30a6a392018-09-10 14:32:39 -070039 [Documentation] Sends a POST to create an att whitelist in XOS
Zack Williams821c5022020-01-15 15:11:46 -070040 [Arguments] ${device_list} ${list_index}
Kailash Khalasi30a6a392018-09-10 14:32:39 -070041 ${dlist} = Get Variable Value ${device_list}
Zack Williams821c5022020-01-15 15:11:46 -070042 ${onu_dictionary}= CORDRobot.listToDict ${dlist} ${list_index}
43 ${api_result}= CORDRobot.ApiPost ONU_DEVICE ${onu_dictionary}
Kailash Khalasi30a6a392018-09-10 14:32:39 -070044 Should Be True ${api_result}
45
Kailash Khalasi16d95c12018-09-21 14:17:28 -070046Retrieve ONU Device
Kailash Khalasi16d95c12018-09-21 14:17:28 -070047 [Documentation] Returns the onu device id based on the onu's serial number
Zack Williams821c5022020-01-15 15:11:46 -070048 [Arguments] ${serial_number}
49 ${json_result}= CORDRobot.ApiGet ONU_DEVICE
Kailash Khalasi16d95c12018-09-21 14:17:28 -070050 Log ${json_result}
51 Log To Console ${json_result}
52 ${json_result_list}= Get From dictionary ${json_result} items
Zack Williams821c5022020-01-15 15:11:46 -070053 ${getJsonDict}= CORDRobot.getDictFromListOfDict ${json_result_list}
54 ... serial_number ${serial_number}
55 ${id}= Get From Dictionary ${getJsonDict} id
Kailash Khalasi16d95c12018-09-21 14:17:28 -070056 [Return] ${id}
57
Kailash Khalasi30a6a392018-09-10 14:32:39 -070058Delete ONU Device
59 [Arguments] ${id}
60 [Documentation] Sends a DELETE to delete an onu device in XOS
Zack Williams821c5022020-01-15 15:11:46 -070061 ${api_result}= CORDRobot.ApiChameleonDelete ONU_DEVICE ${id}
Kailash Khalasi16d95c12018-09-21 14:17:28 -070062 Should Be True ${api_result}
You Wang5be816a2018-10-11 16:45:31 -070063
64Validate ONU States
Zack Williams821c5022020-01-15 15:11:46 -070065 [Documentation] Check that ONU has the expected 'operational_status' and 'admin_status'
You Wang5be816a2018-10-11 16:45:31 -070066 [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}