blob: 6633273384b071c6a98eeeebf93d956b129d912e [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
Suchitra Vemurief989602018-09-10 13:45:26 -070022Library utils/utils.py
23Library restApi.py
Suchitra Vemuri2c734262018-09-06 14:34:42 -070024
25*** Keywords ***
26ONU Status Check
27 [Arguments] ${onu_device}
28 [Documentation] Returns "operational_status" and "admin_status" of a particular ONU device from "onu device list"
29 ${json_result}= restApi.ApiGet ONU_DEVICE
30 Log ${json_result}
31 ${json_result_list}= Get From dictionary ${json_result} items
32 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
33 ${operational_status}= Get From Dictionary ${getJsonDict} oper_status
34 ${admin_status}= Get From Dictionary ${getJsonDict} admin_state
Zack Williamsc6722d52020-01-13 16:34:33 -070035 [Return] ${operational_status} ${admin_status}
Kailash Khalasi30a6a392018-09-10 14:32:39 -070036
37Create ONU Device
38 [Arguments] ${device_list} ${list_index}
39 [Documentation] Sends a POST to create an att whitelist in XOS
40 ${dlist} = Get Variable Value ${device_list}
41 ${onu_dictionary}= utils.listToDict ${dlist} ${list_index}
42 ${api_result}= restApi.ApiPost ONU_DEVICE ${onu_dictionary}
43 Should Be True ${api_result}
44
Kailash Khalasi16d95c12018-09-21 14:17:28 -070045Retrieve ONU Device
46 [Arguments] ${serial_number}
47 [Documentation] Returns the onu device id based on the onu's serial number
48 ${json_result}= restApi.ApiGet ONU_DEVICE
49 Log ${json_result}
50 Log To Console ${json_result}
51 ${json_result_list}= Get From dictionary ${json_result} items
52 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${serial_number}
53 ${id}= Get From Dictionary ${getJsonDict} id
54 [Return] ${id}
55
Kailash Khalasi30a6a392018-09-10 14:32:39 -070056Delete ONU Device
57 [Arguments] ${id}
58 [Documentation] Sends a DELETE to delete an onu device in XOS
59 ${api_result}= restApi.ApiChameleonDelete ONU_DEVICE ${id}
Kailash Khalasi16d95c12018-09-21 14:17:28 -070060 Should Be True ${api_result}
You Wang5be816a2018-10-11 16:45:31 -070061
62Validate ONU States
63 [Arguments] ${expected_op_status} ${expected_admin_status} ${onu_device}
64 ${operational_status} ${admin_status} ONU Status Check ${onu_device}
65 Should Be Equal ${operational_status} ${expected_op_status}
66 Should Be Equal ${admin_status} ${expected_admin_status}