blob: a53197fb388e4dbb5dac7724beea4bb56edcdf4c [file] [log] [blame]
Kailash Khalasi6dab16e2018-09-17 20:24:08 -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 ***
Kailash Khalasi6dab16e2018-09-17 20:24:08 -070016Documentation Library to retrieve status fields from ATT WorkFlow Driver Service Instance List
Suchitra Vemuri2c734262018-09-06 14:34:42 -070017Library Collections
18Library String
19Library OperatingSystem
20Library XML
21Library RequestsLibrary
Zack Williamsc6722d52020-01-13 16:34:33 -070022Library utils/utils.py
23Library restApi.py
Suchitra Vemuri2c734262018-09-06 14:34:42 -070024
Kailashe230af72019-05-10 14:39:35 -070025*** Variable ***
Suchitra Vemuri6fd2d122019-05-13 14:40:32 -070026${ONU_STATE_VAR} admin_onu_state
Kailashe230af72019-05-10 14:39:35 -070027
Suchitra Vemuri2c734262018-09-06 14:34:42 -070028*** Keywords ***
29Service Instance Status Check
30 [Arguments] ${onu_device}
31 [Documentation] Returns Status and authentication_state field values from att work flow driver for a particular ONU device
32 ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES
33 Log ${json_result}
34 ${json_result_list}= Get From dictionary ${json_result} items
35 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
Kailashe230af72019-05-10 14:39:35 -070036 ${onu_state}= Get From Dictionary ${getJsonDict} ${ONU_STATE_VAR}
You Wangfa6d8cf2018-09-18 16:54:30 -070037 ${authentication_state}= Get From Dictionary ${getJsonDict} authentication_state
Andy Bavier3075b9b2019-01-31 13:45:35 -070038 ${status_message}= Get From Dictionary ${getJsonDict} status_message
39 [Return] ${onu_state} ${authentication_state} ${status_message}
Kailash Khalasi30a6a392018-09-10 14:32:39 -070040
Kailash4200e572018-12-11 14:50:46 -080041Service Instance DHCP State Check
42 [Arguments] ${onu_device}
43 [Documentation] Returns dhcp state value from att work flow driver for a particular ONU device
44 ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES
45 Log ${json_result}
46 ${json_result_list}= Get From dictionary ${json_result} items
47 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device}
48 ${state}= Get From Dictionary ${getJsonDict} dhcp_state
49 [Return] ${state}
50
Kailash Khalasi30a6a392018-09-10 14:32:39 -070051Create Whitelist Entry
52 [Arguments] ${entry_list} ${list_index}
53 [Documentation] Sends a POST to create an att whitelist in XOS
54 ${elist} = Get Variable Value ${entry_list}
55 ${entry_dictionary}= utils.listToDict ${elist} ${list_index}
56 ${api_result}= restApi.ApiPost ATT_WHITELIST ${entry_dictionary}
57 Should Be True ${api_result}
58 ${AttWhiteList_Id}= Get From Dictionary ${api_result} id
59 Set Global Variable ${AttWhiteList_Id}
60 [Return] ${AttWhiteList_Id}
61
Kailash Khalasi16d95c12018-09-21 14:17:28 -070062Retrieve Whitelist Entry
63 [Arguments] ${serial_number}
64 [Documentation] Returns the whitelist entry per the onu's serial number
65 ${json_result}= restApi.ApiGet ATT_WHITELIST
66 Log ${json_result}
67 ${json_result_list}= Get From dictionary ${json_result} items
68 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${serial_number}
69 ${id}= Get From Dictionary ${getJsonDict} id
70 [Return] ${id}
71
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070072Retrieve ATT Service Instance ID
73 [Arguments] ${serial_number}
74 [Documentation] Returns the whitelist entry per the onu's serial number
75 ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES
76 Log ${json_result}
77 ${json_result_list}= Get From dictionary ${json_result} items
78 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${serial_number}
79 ${id}= Get From Dictionary ${getJsonDict} id
80 [Return] ${id}
81
Kailash Khalasi30a6a392018-09-10 14:32:39 -070082Delete Whitelist Entry
83 [Arguments] ${id}
84 [Documentation] Sends a DELETE to delete an att whitelist in XOS
85 ${api_result}= restApi.ApiChameleonDelete ATT_WHITELIST ${id}
You Wangfa6d8cf2018-09-18 16:54:30 -070086 Should Be True ${api_result}
You Wang5be816a2018-10-11 16:45:31 -070087
88Validate ATT Workflow Driver SI
Andy Bavier3075b9b2019-01-31 13:45:35 -070089 [Arguments] ${expected_status} ${expected_auth_status} ${onu_device} ${expected_status_message}=${EMPTY}
90 ${onu_state} ${authentication_status} ${status_message} Service Instance Status Check ${onu_device}
You Wang5be816a2018-10-11 16:45:31 -070091 Should Be Equal ${onu_state} ${expected_status}
92 Should Be Equal ${authentication_status} ${expected_auth_status}
Andy Bavier3075b9b2019-01-31 13:45:35 -070093 Run Keyword If '${expected_status_message}' != '${EMPTY}' Should Be Equal ${status_message} ${expected_status_message}
Kailash4200e572018-12-11 14:50:46 -080094
95Validate ATT Workflow Driver SI DHCP State
96 [Arguments] ${expected_status} ${onu_device}
97 ${dhcp_state}= Service Instance DHCP State Check ${onu_device}
98 Should Be Equal ${dhcp_state} ${expected_status}