Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -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 *** |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 16 | Documentation Library to retrieve status fields from ATT WorkFlow Driver Service Instance List |
Suchitra Vemuri | 2c73426 | 2018-09-06 14:34:42 -0700 | [diff] [blame] | 17 | Library Collections |
| 18 | Library String |
| 19 | Library OperatingSystem |
| 20 | Library XML |
| 21 | Library RequestsLibrary |
| 22 | Library ../Framework/utils/utils.py |
| 23 | Library ../Framework/restApi.py |
| 24 | |
| 25 | *** Keywords *** |
| 26 | Service 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 Wang | fa6d8cf | 2018-09-18 16:54:30 -0700 | [diff] [blame] | 33 | ${onu_state}= Get From Dictionary ${getJsonDict} onu_state |
| 34 | ${authentication_state}= Get From Dictionary ${getJsonDict} authentication_state |
Andy Bavier | 3075b9b | 2019-01-31 13:45:35 -0700 | [diff] [blame] | 35 | ${status_message}= Get From Dictionary ${getJsonDict} status_message |
| 36 | [Return] ${onu_state} ${authentication_state} ${status_message} |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 37 | |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 38 | Service Instance DHCP State Check |
| 39 | [Arguments] ${onu_device} |
| 40 | [Documentation] Returns dhcp state value from att work flow driver for a particular ONU device |
| 41 | ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES |
| 42 | Log ${json_result} |
| 43 | ${json_result_list}= Get From dictionary ${json_result} items |
| 44 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${onu_device} |
| 45 | ${state}= Get From Dictionary ${getJsonDict} dhcp_state |
| 46 | [Return] ${state} |
| 47 | |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 48 | Create Whitelist Entry |
| 49 | [Arguments] ${entry_list} ${list_index} |
| 50 | [Documentation] Sends a POST to create an att whitelist in XOS |
| 51 | ${elist} = Get Variable Value ${entry_list} |
| 52 | ${entry_dictionary}= utils.listToDict ${elist} ${list_index} |
| 53 | ${api_result}= restApi.ApiPost ATT_WHITELIST ${entry_dictionary} |
| 54 | Should Be True ${api_result} |
| 55 | ${AttWhiteList_Id}= Get From Dictionary ${api_result} id |
| 56 | Set Global Variable ${AttWhiteList_Id} |
| 57 | [Return] ${AttWhiteList_Id} |
| 58 | |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 59 | Retrieve Whitelist Entry |
| 60 | [Arguments] ${serial_number} |
| 61 | [Documentation] Returns the whitelist entry per the onu's serial number |
| 62 | ${json_result}= restApi.ApiGet ATT_WHITELIST |
| 63 | Log ${json_result} |
| 64 | ${json_result_list}= Get From dictionary ${json_result} items |
| 65 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${serial_number} |
| 66 | ${id}= Get From Dictionary ${getJsonDict} id |
| 67 | [Return] ${id} |
| 68 | |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 69 | Retrieve ATT Service Instance ID |
| 70 | [Arguments] ${serial_number} |
| 71 | [Documentation] Returns the whitelist entry per the onu's serial number |
| 72 | ${json_result}= restApi.ApiGet ATT_SERVICEINSTANCES |
| 73 | Log ${json_result} |
| 74 | ${json_result_list}= Get From dictionary ${json_result} items |
| 75 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} serial_number ${serial_number} |
| 76 | ${id}= Get From Dictionary ${getJsonDict} id |
| 77 | [Return] ${id} |
| 78 | |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 79 | Delete Whitelist Entry |
| 80 | [Arguments] ${id} |
| 81 | [Documentation] Sends a DELETE to delete an att whitelist in XOS |
| 82 | ${api_result}= restApi.ApiChameleonDelete ATT_WHITELIST ${id} |
You Wang | fa6d8cf | 2018-09-18 16:54:30 -0700 | [diff] [blame] | 83 | Should Be True ${api_result} |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 84 | |
| 85 | Validate ATT Workflow Driver SI |
Andy Bavier | 3075b9b | 2019-01-31 13:45:35 -0700 | [diff] [blame] | 86 | [Arguments] ${expected_status} ${expected_auth_status} ${onu_device} ${expected_status_message}=${EMPTY} |
| 87 | ${onu_state} ${authentication_status} ${status_message} Service Instance Status Check ${onu_device} |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 88 | Should Be Equal ${onu_state} ${expected_status} |
| 89 | Should Be Equal ${authentication_status} ${expected_auth_status} |
Andy Bavier | 3075b9b | 2019-01-31 13:45:35 -0700 | [diff] [blame] | 90 | Run Keyword If '${expected_status_message}' != '${EMPTY}' Should Be Equal ${status_message} ${expected_status_message} |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 91 | |
| 92 | Validate ATT Workflow Driver SI DHCP State |
| 93 | [Arguments] ${expected_status} ${onu_device} |
| 94 | ${dhcp_state}= Service Instance DHCP State Check ${onu_device} |
| 95 | Should Be Equal ${dhcp_state} ${expected_status} |