blob: d25059048ea6ff782dc56bd876962185a5b42d2a [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
22Library ../Framework/utils/utils.py
23Library ../Framework/restApi.py
24
25*** Keywords ***
26Service Instance Status Check
27 [Arguments] ${onu_device}
28 [Documentation] Returns Status and authentication_state field values from att work flow driver for a particular ONU device
29 ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES
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}
You Wangfa6d8cf2018-09-18 16:54:30 -070033 ${onu_state}= Get From Dictionary ${getJsonDict} onu_state
34 ${authentication_state}= Get From Dictionary ${getJsonDict} authentication_state
35 [Return] ${onu_state} ${authentication_state}
Kailash Khalasi30a6a392018-09-10 14:32:39 -070036
37Create Whitelist Entry
38 [Arguments] ${entry_list} ${list_index}
39 [Documentation] Sends a POST to create an att whitelist in XOS
40 ${elist} = Get Variable Value ${entry_list}
41 ${entry_dictionary}= utils.listToDict ${elist} ${list_index}
42 ${api_result}= restApi.ApiPost ATT_WHITELIST ${entry_dictionary}
43 Should Be True ${api_result}
44 ${AttWhiteList_Id}= Get From Dictionary ${api_result} id
45 Set Global Variable ${AttWhiteList_Id}
46 [Return] ${AttWhiteList_Id}
47
Kailash Khalasi16d95c12018-09-21 14:17:28 -070048Retrieve Whitelist Entry
49 [Arguments] ${serial_number}
50 [Documentation] Returns the whitelist entry per the onu's serial number
51 ${json_result}= restApi.ApiGet ATT_WHITELIST
52 Log ${json_result}
53 ${json_result_list}= Get From dictionary ${json_result} items
54 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${serial_number}
55 ${id}= Get From Dictionary ${getJsonDict} id
56 [Return] ${id}
57
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070058Retrieve ATT Service Instance ID
59 [Arguments] ${serial_number}
60 [Documentation] Returns the whitelist entry per the onu's serial number
61 ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES
62 Log ${json_result}
63 ${json_result_list}= Get From dictionary ${json_result} items
64 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${serial_number}
65 ${id}= Get From Dictionary ${getJsonDict} id
66 [Return] ${id}
67
Kailash Khalasi30a6a392018-09-10 14:32:39 -070068Delete Whitelist Entry
69 [Arguments] ${id}
70 [Documentation] Sends a DELETE to delete an att whitelist in XOS
71 ${api_result}= restApi.ApiChameleonDelete ATT_WHITELIST ${id}
You Wangfa6d8cf2018-09-18 16:54:30 -070072 Should Be True ${api_result}
You Wang5be816a2018-10-11 16:45:31 -070073
74Validate ATT Workflow Driver SI
75 [Arguments] ${expected_status} ${expected_auth_status} ${onu_device}
76 ${onu_state} ${authentication_status} Service Instance Status Check ${onu_device}
77 Should Be Equal ${onu_state} ${expected_status}
78 Should Be Equal ${authentication_status} ${expected_auth_status}