Kailash | 6f5acb6 | 2019-08-28 14:38:45 -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. |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 14 | # voltctl common functions |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Library for various utilities |
| 18 | Library SSHLibrary |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 19 | Library String |
| 20 | Library DateTime |
| 21 | Library Process |
| 22 | Library Collections |
| 23 | Library RequestsLibrary |
| 24 | Library OperatingSystem |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 25 | Resource ./utils.robot |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 26 | Resource ./flows.robot |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 27 | |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 28 | *** Variables *** |
| 29 | ${voltctlGrpcLimit} 32M |
| 30 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 31 | *** Keywords *** |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 32 | Test Empty Device List |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 33 | [Documentation] Verify that there are no devices in the system |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 34 | ${rc} ${output}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device list -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 35 | Should Be Equal As Integers ${rc} 0 |
| 36 | ${jsondata}= To Json ${output} |
| 37 | Log ${jsondata} |
| 38 | ${length}= Get Length ${jsondata} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 39 | Should Be Equal As Integers ${length} 0 |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 40 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 41 | Create Device |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 42 | [Arguments] ${ip} ${port} ${type}=openolt |
You Wang | 2b55064 | 2019-10-07 14:39:48 -0700 | [diff] [blame] | 43 | [Documentation] Creates a device in VOLTHA |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 44 | #create/preprovision device |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 45 | ${rc} ${device_id}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 46 | ... voltctl -c ${VOLTCTL_CONFIG} device create -t ${type} -H ${ip}:${port} |
| 47 | Log ${device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 48 | Should Be Equal As Integers ${rc} 0 Failed to Create Device beause of ${device_id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 49 | [Return] ${device_id} |
| 50 | |
| 51 | Enable Device |
| 52 | [Arguments] ${device_id} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 53 | [Documentation] Enables a device in VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 54 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 55 | ... voltctl -c ${VOLTCTL_CONFIG} device enable ${device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 56 | Should Be Equal As Integers ${rc} 0 Failed to Enable Device beause of ${output} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 57 | |
Suchitra Vemuri | 6db8941 | 2019-11-14 14:52:54 -0800 | [diff] [blame] | 58 | Disable Device |
| 59 | [Arguments] ${device_id} |
Hardik Windlass | aaea340 | 2020-03-10 19:45:45 +0530 | [diff] [blame] | 60 | [Documentation] Disables a device in VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 61 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 62 | ... voltctl -c ${VOLTCTL_CONFIG} device disable ${device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 63 | Should Be Equal As Integers ${rc} 0 Failed to Disable Device beause of ${output} |
Suchitra Vemuri | 6db8941 | 2019-11-14 14:52:54 -0800 | [diff] [blame] | 64 | |
Hardik Windlass | aaea340 | 2020-03-10 19:45:45 +0530 | [diff] [blame] | 65 | Delete Device |
| 66 | [Arguments] ${device_id} |
| 67 | [Documentation] Deletes a device in VOLTHA |
| 68 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 69 | ... voltctl -c ${VOLTCTL_CONFIG} device delete ${device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 70 | Should Be Equal As Integers ${rc} 0 Failed to Delete Device beause of ${output} |
Hardik Windlass | aaea340 | 2020-03-10 19:45:45 +0530 | [diff] [blame] | 71 | |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 72 | Reboot Device |
| 73 | [Arguments] ${device_id} |
| 74 | [Documentation] Reboot the OLT using voltctl command |
| 75 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 76 | ... voltctl -c ${VOLTCTL_CONFIG} device reboot ${device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 77 | Should Be Equal As Integers ${rc} 0 Failed to Reboot Device beause of ${output} |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 78 | |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 79 | Disable Devices In Voltha |
| 80 | [Documentation] Disables all the known devices in voltha |
| 81 | [Arguments] ${filter} |
| 82 | ${arg}= Set Variable ${EMPTY} |
| 83 | ${arg}= Run Keyword If len('${filter}'.strip()) != 0 Set Variable --filter ${filter} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 84 | ${rc} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 85 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} ${arg} --orderby Root -q | xargs echo -n |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 86 | Should Be Equal As Integers ${rc} 0 |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 87 | ${rc} ${output}= Run Keyword If len('${devices}') != 0 Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 88 | ... voltctl -c ${VOLTCTL_CONFIG} device disable ${devices} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 89 | Run Keyword If len('${devices}') != 0 |
| 90 | ... Should Be Equal As Integers ${rc} 0 Failed to Disable Devices beause of ${output} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 91 | |
| 92 | Test Devices Disabled In Voltha |
| 93 | [Documentation] Tests to verify that all devices in VOLTHA are disabled |
| 94 | [Arguments] ${filter} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 95 | ${rc} ${count}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 96 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} --filter '${filter},AdminState!=DISABLED' -q | wc -l |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 97 | Should Be Equal As Integers ${rc} 0 |
| 98 | Should Be Equal As Integers ${count} 0 |
| 99 | |
| 100 | Delete Devices In Voltha |
| 101 | [Documentation] Disables all the known devices in voltha |
| 102 | [Arguments] ${filter} |
| 103 | ${arg}= Set Variable ${EMPTY} |
| 104 | ${arg}= Run Keyword If len('${filter}'.strip()) != 0 Set Variable --filter ${filter} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 105 | ${rc} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 106 | ... voltctl -c ${VOLTCTL_CONFIG} device list ${arg} -m ${voltctlGrpcLimit} --orderby Root -q | xargs echo -n |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 107 | Should Be Equal As Integers ${rc} 0 |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 108 | ${rc} ${output}= Run Keyword If len('${devices}') != 0 Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 109 | ... voltctl -c ${VOLTCTL_CONFIG} device delete ${devices} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 110 | Run Keyword If len('${devices}') != 0 Should Be Equal As Integers ${rc} 0 |
| 111 | |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 112 | Get Device Flows from Voltha |
| 113 | [Arguments] ${device_id} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 114 | [Documentation] Gets device flows from VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 115 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 116 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${device_id} -m ${voltctlGrpcLimit} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 117 | Should Be Equal As Integers ${rc} 0 |
| 118 | [Return] ${output} |
| 119 | |
| 120 | Get Logical Device Output from Voltha |
| 121 | [Arguments] ${device_id} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 122 | [Documentation] Gets logicaldevice flows and ports from VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 123 | ${rc1} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 124 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice flows ${device_id} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 125 | ${rc2} ${ports}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 126 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice port list ${device_id} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 127 | Log ${flows} |
| 128 | Log ${ports} |
| 129 | Should Be Equal As Integers ${rc1} 0 |
| 130 | Should Be Equal As Integers ${rc2} 0 |
| 131 | |
| 132 | Get Device Output from Voltha |
| 133 | [Arguments] ${device_id} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 134 | [Documentation] Gets device flows and ports from VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 135 | ${rc1} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 136 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${device_id} -m ${voltctlGrpcLimit} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 137 | ${rc2} ${ports}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 138 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${device_id} -m ${voltctlGrpcLimit} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 139 | Log ${flows} |
| 140 | Log ${ports} |
| 141 | Should Be Equal As Integers ${rc1} 0 |
| 142 | Should Be Equal As Integers ${rc2} 0 |
| 143 | |
Suchitra Vemuri | 1a970a6 | 2019-11-26 12:52:16 -0800 | [diff] [blame] | 144 | Get Device List from Voltha |
| 145 | [Documentation] Gets Device List Output from Voltha |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 146 | ${rc1} ${devices}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} |
Suchitra Vemuri | 1a970a6 | 2019-11-26 12:52:16 -0800 | [diff] [blame] | 147 | Log ${devices} |
| 148 | Should Be Equal As Integers ${rc1} 0 |
| 149 | |
Hardik Windlass | f8b3ee6 | 2022-01-24 16:36:32 +0000 | [diff] [blame] | 150 | Get ONUs Device IDs from Voltha |
| 151 | [Documentation] Fetches the ONU Device Ids from Voltha |
| 152 | ${rc} ${onus}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 153 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} -f Type=brcm_openomci_onu -q |
Hardik Windlass | f8b3ee6 | 2022-01-24 16:36:32 +0000 | [diff] [blame] | 154 | Should Be Equal as Integers ${rc} 0 |
| 155 | @{onuDevList}= Split To Lines ${onus} |
| 156 | [Return] ${onuDevList} |
| 157 | |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 158 | Get Device List from Voltha by type |
| 159 | [Documentation] Gets Device List Output from Voltha applying filtering by device type |
| 160 | [Arguments] ${type} |
| 161 | ${rc1} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 162 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} -f Type=${type} -o json |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 163 | Log ${devices} |
| 164 | Should Be Equal As Integers ${rc1} 0 |
| 165 | Return From Keyword ${devices} |
| 166 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 167 | Get Logical Device List from Voltha |
| 168 | [Documentation] Gets Logical Device List Output from Voltha (in json format) |
Andrea Campanella | 80655eb | 2020-07-10 15:49:22 +0200 | [diff] [blame] | 169 | ${rc1} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 170 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice list -m ${voltctlGrpcLimit} -o json |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 171 | Log ${devices} |
| 172 | Should Be Equal As Integers ${rc1} 0 |
| 173 | Return From Keyword ${devices} |
| 174 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 175 | Validate Device |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 176 | [Documentation] |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 177 | ... Parses the output of "voltctl device list" and inspects a device ${id}, specified as either |
| 178 | ... the serial number or device ID. Arguments are matched for device states of: "admin_state", |
| 179 | ... "oper_status", and "connect_status" |
Hardik Windlass | 8b44649 | 2021-06-10 06:25:23 +0000 | [diff] [blame] | 180 | ... Note: Set "by_dev_id" to True if Device Id is passed for validation |
| 181 | ... otherwise look up will be based on Device Serial Number |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 182 | [Arguments] ${admin_state} ${oper_status} ${connect_status} |
Hardik Windlass | 8b44649 | 2021-06-10 06:25:23 +0000 | [diff] [blame] | 183 | ... ${id} ${onu_reason}=${EMPTY} ${onu}=False ${by_dev_id}=False |
| 184 | ${rc} ${output}= Run Keyword If ${by_dev_id} Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 185 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} -f Id=${id} -o json |
Hardik Windlass | 8b44649 | 2021-06-10 06:25:23 +0000 | [diff] [blame] | 186 | ... ELSE Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 187 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} -f SerialNumber=${id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 188 | Should Be Equal As Integers ${rc} 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 189 | ${jsondata}= To Json ${output} |
Matteo Scandolo | bfb7438 | 2021-05-10 15:45:16 -0700 | [diff] [blame] | 190 | Log ${output} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 191 | ${length}= Get Length ${jsondata} |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 192 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 193 | FOR ${INDEX} IN RANGE 0 ${length} |
| 194 | ${value}= Get From List ${jsondata} ${INDEX} |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 195 | ${jsonCamelCaseFieldnames}= Run Keyword And Return Status |
| 196 | ... Dictionary Should Contain Key ${value} adminState |
| 197 | ${astate}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 198 | ... Get From Dictionary ${value} adminState |
| 199 | ... ELSE |
| 200 | ... Get From Dictionary ${value} adminstate |
| 201 | ${opstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 202 | ... Get From Dictionary ${value} operStatus |
| 203 | ... ELSE |
| 204 | ... Get From Dictionary ${value} operstatus |
| 205 | ${cstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 206 | ... Get From Dictionary ${value} connectStatus |
| 207 | ... ELSE |
| 208 | ... Get From Dictionary ${value} connectstatus |
| 209 | ${sn}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 210 | ... Get From Dictionary ${value} serialNumber |
| 211 | ... ELSE |
| 212 | ... Get From Dictionary ${value} serialnumber |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 213 | ${devId}= Get From Dictionary ${value} id |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 214 | ${mib_state}= Get From Dictionary ${value} reason |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 215 | ${matched}= Set Variable If '${sn}' == '${id}' or '${devId}' == '${id}' True False |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 216 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 217 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 218 | Should Be True ${matched} No match found for ${id} to validate device |
Matteo Scandolo | 5e10b28 | 2019-11-25 10:54:32 -0700 | [diff] [blame] | 219 | Log ${value} |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 220 | Should Be Equal '${astate}' '${admin_state}' Device ${sn} admin_state != ${admin_state} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 221 | ... values=False |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 222 | Should Be Equal '${opstatus}' '${oper_status}' Device ${sn} oper_status != ${oper_status} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 223 | ... values=False |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 224 | Should Be Equal '${cstatus}' '${connect_status}' Device ${sn} conn_status != ${connect_status} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 225 | ... values=False |
Matteo Scandolo | 74bd5c3 | 2020-12-08 09:52:19 -0800 | [diff] [blame] | 226 | Run Keyword If '${onu}' == 'True' Should Contain '${onu_reason}' '${mib_state}' |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 227 | ... Device ${sn} mib_state incorrect (${mib_state}) values=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 228 | |
| 229 | Validate OLT Device |
Hardik Windlass | 8b44649 | 2021-06-10 06:25:23 +0000 | [diff] [blame] | 230 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${id} ${by_dev_id}=False |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 231 | [Documentation] Parses the output of "voltctl device list" and inspects device ${id}, specified |
| 232 | ... as either its serial numbner or device ID. Match on OLT Serial number or Device Id and inspect states |
Hardik Windlass | 8b44649 | 2021-06-10 06:25:23 +0000 | [diff] [blame] | 233 | ... Note: Set "by_dev_id" to True if Device Id is passed for validation |
| 234 | ... otherwise look up will be based on Device Serial Number |
| 235 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${id} by_dev_id=${by_dev_id} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 236 | |
Suchitra Vemuri | a6879aa | 2020-11-03 11:03:11 -0800 | [diff] [blame] | 237 | Validate OLT Devices |
| 238 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${ids}=${EMPTY} |
| 239 | [Documentation] Parses the output of "voltctl device list" and inspects device ${id}, specified |
| 240 | ... as either its serial numbner or device ID. Match on OLT Serial number or Device Id and inspect states |
| 241 | FOR ${I} IN RANGE 0 ${olt_count} |
| 242 | ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn |
| 243 | ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number} |
Hardik Windlass | 8b44649 | 2021-06-10 06:25:23 +0000 | [diff] [blame] | 244 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${olt_device_id} by_dev_id=True |
Suchitra Vemuri | a6879aa | 2020-11-03 11:03:11 -0800 | [diff] [blame] | 245 | END |
| 246 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 247 | Validate ONU Devices |
| 248 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${List_ONU_Serial} |
Andy Bavier | f1f26ed | 2020-03-18 10:59:07 -0700 | [diff] [blame] | 249 | ... ${onu_reason}=omci-flows-pushed |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 250 | [Documentation] Parses the output of "voltctl device list" and inspects device ${List_ONU_Serial} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 251 | ... Iteratively match on each Serial number contained in ${List_ONU_Serial} and inspect |
| 252 | ... states including MIB state |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 253 | FOR ${serial_number} IN @{List_ONU_Serial} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 254 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${serial_number} |
Andy Bavier | f1f26ed | 2020-03-18 10:59:07 -0700 | [diff] [blame] | 255 | ... onu_reason=${onu_reason} onu=True |
Debasish | 28130d0 | 2020-03-16 11:05:26 +0000 | [diff] [blame] | 256 | END |
| 257 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 258 | Validate Device Port Types |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 259 | [Documentation] |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 260 | ... Parses the output of voltctl device port list <device_id> and matches the port types listed |
Andy Bavier | 90eb1a1 | 2020-03-26 11:54:35 -0700 | [diff] [blame] | 261 | [Arguments] ${device_id} ${pon_type} ${ethernet_type} ${all_active}=True |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 262 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 263 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${device_id} -m ${voltctlGrpcLimit} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 264 | Should Be Equal As Integers ${rc} 0 |
| 265 | ${jsondata}= To Json ${output} |
| 266 | Log ${jsondata} |
| 267 | ${length}= Get Length ${jsondata} |
| 268 | FOR ${INDEX} IN RANGE 0 ${length} |
| 269 | ${value}= Get From List ${jsondata} ${INDEX} |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 270 | ${jsonCamelCaseFieldnames}= Run Keyword And Return Status |
| 271 | ... Dictionary Should Contain Key ${value} adminState |
| 272 | ${astate}= Run Keyword If ${jsonCamelCaseFieldNames} |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 273 | ... Get From Dictionary ${value} adminState |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 274 | ... ELSE |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 275 | ... Get From Dictionary ${value} adminstate |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 276 | ${opstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 277 | ... Get From Dictionary ${value} operStatus |
| 278 | ... ELSE |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 279 | ... Get From Dictionary ${value} operstatus |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 280 | ${type}= Get From Dictionary ${value} type |
Hema | f64d34c | 2020-03-25 00:40:17 +0530 | [diff] [blame] | 281 | Should Be Equal '${astate}' 'ENABLED' Device ${device_id} port admin_state != ENABLED values=False |
Andy Bavier | 90eb1a1 | 2020-03-26 11:54:35 -0700 | [diff] [blame] | 282 | Run Keyword If ${all_active} Should Be Equal '${opstatus}' 'ACTIVE' |
| 283 | ... Device ${device_id} port oper_status != ACTIVE values=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 284 | Should Be True '${type}' == '${pon_type}' or '${type}' == '${ethernet_type}' |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 285 | ... Device ${device_id} port type is neither ${pon_type} or ${ethernet_type} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 286 | END |
| 287 | |
| 288 | Validate OLT Port Types |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 289 | [Documentation] Parses the output of voltctl device port list ${olt_device_id} and matches the port types listed |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 290 | [Arguments] ${pon_type} ${ethernet_type} |
| 291 | Validate Device Port Types ${olt_device_id} ${pon_type} ${ethernet_type} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 292 | |
| 293 | Validate ONU Port Types |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 294 | [Arguments] ${List_ONU_Serial} ${pon_type} ${ethernet_type} |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 295 | [Documentation] Parses the output of voltctl device port list for each ONU SN listed in ${List_ONU_Serial} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 296 | ... and matches the port types listed |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 297 | FOR ${serial_number} IN @{List_ONU_Serial} |
| 298 | ${onu_dev_id}= Get Device ID From SN ${serial_number} |
Andy Bavier | 90eb1a1 | 2020-03-26 11:54:35 -0700 | [diff] [blame] | 299 | # Only first UNI port is ACTIVE; the rest are in DISCOVERED operstatus |
| 300 | Validate Device Port Types ${onu_dev_id} ${pon_type} ${ethernet_type} all_active=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 301 | END |
| 302 | |
| 303 | Validate Device Flows |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 304 | [Arguments] ${device_id} ${flow_count}=${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 305 | [Documentation] Parses the output of voltctl device flows <device_id> and expects flow count > 0 |
Andrea Campanella | 80655eb | 2020-07-10 15:49:22 +0200 | [diff] [blame] | 306 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 307 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${device_id} -m ${voltctlGrpcLimit} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 308 | Should Be Equal As Integers ${rc} 0 |
| 309 | ${jsondata}= To Json ${output} |
| 310 | Log ${jsondata} |
| 311 | ${length}= Get Length ${jsondata} |
| 312 | Log 'Number of flows = ' ${length} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 313 | Run Keyword If '${flow_count}' == '${EMPTY}' Should Be True ${length} > 0 |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 314 | ... Number of flows for ${device_id} was 0 |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 315 | ... ELSE Should Be True ${length} == ${flow_count} |
| 316 | ... Number of flows for ${device_id} was not ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 317 | |
| 318 | Validate OLT Flows |
Suchitra Vemuri | a6879aa | 2020-11-03 11:03:11 -0800 | [diff] [blame] | 319 | [Arguments] ${flow_count}=${EMPTY} ${olt_device_id}=${EMPTY} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 320 | [Documentation] Parses the output of voltctl device flows ${olt_device_id} |
| 321 | ... and expects flow count == ${flow_count} |
| 322 | Validate Device Flows ${olt_device_id} ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 323 | |
| 324 | Validate ONU Flows |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 325 | [Arguments] ${List_ONU_Serial} ${flow_count}=${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 326 | [Documentation] Parses the output of voltctl device flows for each ONU SN listed in ${List_ONU_Serial} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 327 | ... and expects flow count == ${flow_count} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 328 | FOR ${serial_number} IN @{List_ONU_Serial} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 329 | ${onu_dev_id}= Get Device ID From SN ${serial_number} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 330 | Validate Device Flows ${onu_dev_id} ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 331 | END |
| 332 | |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 333 | Validate ONU Devices With Duration |
| 334 | [Documentation] |
| 335 | ... Parses the output of "voltctl device list" and inspects all devices ${List_ONU_Serial}, |
| 336 | ... Iteratively match on each Serial number contained in ${List_ONU_Serial} and inspect |
| 337 | ... states including MIB state. |
| 338 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${onu_reason} |
| 339 | ... ${List_ONU_Serial} ${startTime} ${print2console}=False ${output_file}=${EMPTY} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 340 | ... ${alternate_reason}=${EMPTY} |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 341 | ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} -f Type=brcm_openomci_onu |
Matteo Scandolo | 6f24ea9 | 2021-04-29 11:55:50 -0700 | [diff] [blame] | 342 | ... --format "{{.SerialNumber}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.ConnectStatus}}\t{{.Reason}}" | grep -v SERIALNUMBER |
TorstenThieme | f78a9d8 | 2021-03-05 13:42:09 +0000 | [diff] [blame] | 343 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 344 | Should Be Equal As Integers ${rc} 0 Failed Validate ONU Devices because of ${output} |
| 345 | Log ${output} |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 346 | ${timeCurrent} = Get Current Date |
| 347 | ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number |
TorstenThieme | f78a9d8 | 2021-03-05 13:42:09 +0000 | [diff] [blame] | 348 | @{Results}= Split String ${output} \n |
| 349 | FOR ${Line} IN @{Results} |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 350 | ${matched}= Set Variable False |
TorstenThieme | f78a9d8 | 2021-03-05 13:42:09 +0000 | [diff] [blame] | 351 | @{words}= Split String ${Line} \t |
| 352 | ${sn}= Set Variable ${words[0]} |
| 353 | ${astate}= Set Variable ${words[1]} |
| 354 | ${opstatus}= Set Variable ${words[2]} |
| 355 | ${cstatus}= Set Variable ${words[3]} |
| 356 | ${mib_state}= Set Variable ${words[4]} |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 357 | ${onu_id}= Get Index From List ${List_ONU_Serial} ${sn} |
| 358 | ${matched}= Set Variable If -1 != ${onu_id} True False |
| 359 | ${matched}= Set Variable If '${astate}' == '${admin_state}' ${matched} False |
| 360 | ${matched}= Set Variable If '${opstatus}' == '${oper_status}' ${matched} False |
| 361 | ${matched}= Set Variable If '${cstatus}' == '${connect_status}' ${matched} False |
TorstenThieme | c3c2323 | 2021-01-13 13:06:31 +0000 | [diff] [blame] | 362 | ${len}= Get Length ${alternate_reason} |
TorstenThieme | 105c598 | 2021-01-21 09:50:27 +0000 | [diff] [blame] | 363 | ${matches}= Run Keyword If ${len} >= 1 Get Match Count ${alternate_reason} ${mib_state} |
| 364 | ... ELSE Set Variable 0 |
TorstenThieme | c3c2323 | 2021-01-13 13:06:31 +0000 | [diff] [blame] | 365 | ${matched}= Set Variable If '${mib_state}' == '${onu_reason}' or ${matches} >= 1 |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 366 | ... ${matched} False |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 367 | Run Keyword If ${matched} and ${print2console} Log |
| 368 | ... \r\nONU ${sn} reached the state ${onu_reason} after ${timeTotalMs} sec. console=yes |
| 369 | Run Keyword If ${matched} and ('${output_file}'!='${EMPTY}') Append To File ${output_file} |
| 370 | ... \r\nONU ${sn} reached the state ${onu_reason} after ${timeTotalMs} sec. |
| 371 | Run Keyword If ${matched} Remove Values From List ${List_ONU_Serial} ${sn} |
| 372 | END |
| 373 | Should Be Empty ${List_ONU_Serial} List ${List_ONU_Serial} not empty |
| 374 | |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 375 | Validate ONU Devices MIB State With Duration |
| 376 | [Documentation] |
| 377 | ... Parses the output of "voltctl device list" and inspects all devices ${List_ONU_Serial}, |
| 378 | ... Iteratively match on each Serial number contained in ${List_ONU_Serial} and inspect MIB state. |
| 379 | [Arguments] ${onu_reason} |
| 380 | ... ${List_ONU_Serial} ${startTime} ${print2console}=False ${output_file}=${EMPTY} |
| 381 | ${type} = Set Variable brcm_openomci_onu |
Andrea Campanella | 80655eb | 2020-07-10 15:49:22 +0200 | [diff] [blame] | 382 | ${voltctl_commad} = Catenate SEPARATOR= |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 383 | ... voltctl device list -m ${voltctlGrpcLimit} -f Type=${type} -f Reason=${onu_reason} --format '{{.SerialNumber}}' |
Andrea Campanella | 80655eb | 2020-07-10 15:49:22 +0200 | [diff] [blame] | 384 | ${rc} ${output}= Run and Return Rc and Output ${voltctl_commad} |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 385 | Should Be Equal As Integers ${rc} 0 |
| 386 | ${timeCurrent} = Get Current Date |
| 387 | ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number |
| 388 | @{outputdata} = Split String ${output} |
| 389 | ${outputlength} = Get Length ${outputdata} |
| 390 | ${onulength} = Get Length ${List_ONU_Serial} |
| 391 | ${Matches} = Run Keyword If ${outputlength}<=${onulength} |
| 392 | ... Compare Lists ${outputdata} ${List_ONU_Serial} |
| 393 | ... ELSE Compare Lists ${List_ONU_Serial} ${outputdata} |
| 394 | ${length} = Get Length ${Matches} |
| 395 | FOR ${INDEX} IN RANGE 0 ${length} |
| 396 | ${sn}= Get From List ${Matches} ${INDEX} |
| 397 | Run Keyword If ${print2console} Log |
| 398 | ... \r\nONU ${sn} reached the state ${onu_reason} after ${timeTotalMs} sec. console=yes |
| 399 | Run Keyword If ('${output_file}'!='${EMPTY}') Append To File ${output_file} |
| 400 | ... \r\nONU ${sn} reached the state ${onu_reason} after ${timeTotalMs} sec. |
| 401 | Remove Values From List ${List_ONU_Serial} ${sn} |
| 402 | END |
| 403 | Should Be Empty ${List_ONU_Serial} List ${List_ONU_Serial} not empty |
| 404 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 405 | Validate ONU Device By Device Id |
| 406 | [Documentation] |
| 407 | ... Parses the output of "voltctl device list" filtered by device id and inspects states including reason. |
| 408 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${onu_reason} ${onu_id} |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 409 | ${cmd} Catenate voltctl -c ${VOLTCTL_CONFIG} device list --filter=Id=${onu_id} -m ${voltctlGrpcLimit} -o json |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 410 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 411 | Should Be Equal As Integers ${rc} 0 |
| 412 | ${jsondata}= To Json ${output} |
| 413 | ${length}= Get Length ${jsondata} |
| 414 | Should Be Equal As Integers ${length} 1 No match found for ${onu_id} to validate device |
| 415 | ${value}= Get From List ${jsondata} 0 |
| 416 | Log ${value} |
| 417 | ${jsonCamelCaseFieldnames}= Run Keyword And Return Status |
| 418 | ... Dictionary Should Contain Key ${value} adminState |
| 419 | ${astate}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 420 | ... Get From Dictionary ${value} adminState |
| 421 | ... ELSE |
| 422 | ... Get From Dictionary ${value} adminstate |
| 423 | ${opstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 424 | ... Get From Dictionary ${value} operStatus |
| 425 | ... ELSE |
| 426 | ... Get From Dictionary ${value} operstatus |
| 427 | ${cstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 428 | ... Get From Dictionary ${value} connectStatus |
| 429 | ... ELSE |
| 430 | ... Get From Dictionary ${value} connectstatus |
| 431 | ${sn}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 432 | ... Get From Dictionary ${value} serialNumber |
| 433 | ... ELSE |
| 434 | ... Get From Dictionary ${value} serialnumber |
| 435 | ${devId}= Get From Dictionary ${value} id |
| 436 | ${mib_state}= Get From Dictionary ${value} reason |
| 437 | Should Be Equal '${devId}' '${onu_id}' No match found for ${onu_id} to validate device |
| 438 | ... values=False |
| 439 | Should Be Equal '${astate}' '${admin_state}' Device ${sn} admin_state != ${admin_state} |
| 440 | ... values=False |
| 441 | Should Be Equal '${opstatus}' '${oper_status}' Device ${sn} oper_status != ${oper_status} |
| 442 | ... values=False |
| 443 | Should Be Equal '${cstatus}' '${connect_status}' Device ${sn} conn_status != ${connect_status} |
| 444 | ... values=False |
| 445 | Should Be Equal '${mib_state}' '${onu_reason}' |
| 446 | ... Device ${sn} mib_state incorrect (${mib_state}) values=False |
| 447 | |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 448 | Check all ONU OperStatus |
| 449 | [Documentation] Checks that all ONUs OperStatus is the required one. |
| 450 | [Arguments] ${List_ONU_Serial} ${oper_status} |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 451 | ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} -f Type=brcm_openomci_onu |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 452 | ... --format "{{.SerialNumber}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.ConnectStatus}}\t{{.Reason}}" |
| 453 | ... | grep -v SERIALNUMBER | grep ${oper_status} |
| 454 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 455 | Should Be Equal As Integers ${rc} 0 |
| 456 | @{Results}= Split String ${output} \n |
| 457 | FOR ${Line} IN @{Results} |
| 458 | @{words}= Split String ${Line} \t |
| 459 | ${sn}= Set Variable ${words[0]} |
| 460 | Remove Values From List ${List_ONU_Serial} ${sn} |
| 461 | END |
| 462 | Should Be Empty ${List_ONU_Serial} For ONUs ${List_ONU_Serial} OperStatus ${oper_status} not matched! |
| 463 | |
| 464 | Validate Last ONU Communication |
| 465 | [Documentation] Validates last communication with ONU. |
| 466 | [Arguments] ${validation_duration}=5s |
| 467 | ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} adapter list -f Type=brcm_openomci_onu |
| 468 | ... --format '{{gosince .LastCommunication}}' |
| 469 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 470 | Should Be Equal As Integers ${rc} 0 |
TorstenThieme | 7079028 | 2021-11-19 10:26:25 +0000 | [diff] [blame] | 471 | ${lastcomm}= Convert Time ${output} |
| 472 | ${validduration}= Convert Time ${validation_duration} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 473 | Should Be True ${lastcomm}<=${validduration} |
| 474 | |
| 475 | Get Onu Image List |
| 476 | [Documentation] Delivers the ONU device image list |
| 477 | [Arguments] ${dev_id} |
| 478 | ${rc} ${output}= Run and Return Rc and Output |
| 479 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage list ${dev_id} |
| 480 | [return] ${rc} ${output} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 481 | |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 482 | Compare Lists |
| 483 | [Documentation] |
| 484 | ... Compares both lists and put all matches in the returned list |
| 485 | [Arguments] ${ListIterate} ${ListCompare} |
| 486 | @{list} = Create List |
| 487 | ${length} = Get Length ${ListIterate} |
| 488 | FOR ${INDEX} IN RANGE 0 ${length} |
| 489 | ${sn}= Get From List ${ListIterate} ${INDEX} |
| 490 | ${onu_id}= Get Index From List ${ListCompare} ${sn} |
| 491 | Run Keyword If -1 != ${onu_id} Append To List ${list} ${sn} |
| 492 | END |
| 493 | [Return] ${list} |
| 494 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 495 | Validate Logical Device |
| 496 | [Documentation] Validate Logical Device is listed |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 497 | ${rc} ${output}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} logicaldevice list -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 498 | Should Be Equal As Integers ${rc} 0 |
| 499 | ${jsondata}= To Json ${output} |
| 500 | Log ${jsondata} |
| 501 | ${length}= Get Length ${jsondata} |
| 502 | FOR ${INDEX} IN RANGE 0 ${length} |
| 503 | ${value}= Get From List ${jsondata} ${INDEX} |
| 504 | ${devid}= Get From Dictionary ${value} id |
Scott Baker | 2ab2a0c | 2020-06-05 12:51:47 -0700 | [diff] [blame] | 505 | ${rootdev}= Get From Dictionary ${value} rootDeviceId |
| 506 | ${desc}= Get From Dictionary ${value} desc |
| 507 | ${sn}= Get From Dictionary ${desc} serialNum |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 508 | Exit For Loop |
| 509 | END |
| 510 | Should Be Equal '${rootdev}' '${olt_device_id}' Root Device does not match ${olt_device_id} values=False |
| 511 | Should Be Equal '${sn}' '${BBSIM_OLT_SN}' Logical Device ${sn} does not match ${BBSIM_OLT_SN} |
| 512 | ... values=False |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 513 | [Return] ${devid} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 514 | |
| 515 | Validate Logical Device Ports |
| 516 | [Arguments] ${logical_device_id} |
| 517 | [Documentation] Validate Logical Device Ports are listed and are > 0 |
| 518 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 519 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice port list ${logical_device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 520 | Should Be Equal As Integers ${rc} 0 |
| 521 | ${jsondata}= To Json ${output} |
| 522 | Log ${jsondata} |
| 523 | ${length}= Get Length ${jsondata} |
| 524 | Should Be True ${length} > 0 Number of ports for ${logical_device_id} was 0 |
| 525 | |
| 526 | Validate Logical Device Flows |
| 527 | [Arguments] ${logical_device_id} |
| 528 | [Documentation] Validate Logical Device Flows are listed and are > 0 |
| 529 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 530 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice flows ${logical_device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 531 | Should Be Equal As Integers ${rc} 0 |
| 532 | ${jsondata}= To Json ${output} |
| 533 | Log ${jsondata} |
| 534 | ${length}= Get Length ${jsondata} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 535 | Should Be True ${length} > 0 Number of flows for ${logical_device_id} was 0 |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 536 | |
Hardik Windlass | 1ed2eee | 2021-06-25 09:51:03 +0000 | [diff] [blame] | 537 | Retrieve ONU UNI Ports |
| 538 | [Arguments] ${onu_device_id} |
| 539 | [Documentation] Retrieves the list of Active and Enabled UNI ports from the ONU device |
| 540 | ${rc} ${output}= Run and Return Rc and Output |
| 541 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${onu_device_id} -o json |
| 542 | Should Be Equal As Integers ${rc} 0 |
| 543 | ${jsondata}= To Json ${output} |
| 544 | Log ${jsondata} |
| 545 | ${length}= Get Length ${jsondata} |
| 546 | ${onu_uni_list}= Create List |
| 547 | FOR ${INDEX} IN RANGE 0 ${length} |
| 548 | ${value}= Get From List ${jsondata} ${INDEX} |
| 549 | ${type}= Get From Dictionary ${value} type |
| 550 | ${portno}= Get From Dictionary ${value} portNo |
| 551 | ${adminstate}= Get From Dictionary ${value} adminState |
| 552 | ${operstate}= Get From Dictionary ${value} operStatus |
| 553 | Run Keyword If '${type}'=='ETHERNET_UNI' and '${adminstate}'=='ENABLED' and '${operstate}'=='ACTIVE' |
| 554 | ... Append To List ${onu_uni_list} ${portno} |
| 555 | END |
| 556 | [Return] ${onu_uni_list} |
| 557 | |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 558 | Retrieve OLT PON Ports |
| 559 | [Arguments] ${olt_device_id} |
| 560 | [Documentation] Retrieves the list of PON ports from the OLT device |
| 561 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 562 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 563 | Should Be Equal As Integers ${rc} 0 |
| 564 | ${jsondata}= To Json ${output} |
| 565 | Log ${jsondata} |
| 566 | ${length}= Get Length ${jsondata} |
| 567 | ${olt_pon_list}= Create List |
| 568 | FOR ${INDEX} IN RANGE 0 ${length} |
| 569 | ${value}= Get From List ${jsondata} ${INDEX} |
| 570 | ${type}= Get From Dictionary ${value} type |
| 571 | ${portno}= Get From Dictionary ${value} portNo |
| 572 | ${peers}= Get From Dictionary ${value} peers |
| 573 | ${len_peers}= Get Length ${peers} |
| 574 | Run Keyword If '${type}' == 'PON_OLT' and ${len_peers} > 0 |
| 575 | ... Append To List ${olt_pon_list} ${portno} |
| 576 | END |
| 577 | [Return] ${olt_pon_list} |
| 578 | |
| 579 | Retrieve Peer List From OLT PON Port |
TorstenThieme | 17d6fd2 | 2021-09-23 10:00:08 +0000 | [diff] [blame] | 580 | [Arguments] ${olt_device_id} ${pon_port} ${expected_num_peers}=0 |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 581 | [Documentation] Retrieves the list of peer device ids list from the OLT PON port |
| 582 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 583 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 584 | Should Be Equal As Integers ${rc} 0 |
| 585 | ${jsondata}= To Json ${output} |
| 586 | Log ${jsondata} |
| 587 | ${length}= Get Length ${jsondata} |
| 588 | ${matched}= Set Variable False |
| 589 | FOR ${INDEX} IN RANGE 0 ${length} |
| 590 | ${value}= Get From List ${jsondata} ${INDEX} |
| 591 | ${type}= Get From Dictionary ${value} type |
| 592 | ${portno}= Get From Dictionary ${value} portNo |
| 593 | ${peers}= Get From Dictionary ${value} peers |
| 594 | ${matched}= Set Variable If '${type}' == 'PON_OLT' and '${portno}' == '${pon_port}' True False |
| 595 | Exit For Loop If ${matched} |
| 596 | END |
| 597 | Should Be True ${matched} No PON port found for OLT ${olt_device_id} |
| 598 | ${length}= Get Length ${peers} |
TorstenThieme | 17d6fd2 | 2021-09-23 10:00:08 +0000 | [diff] [blame] | 599 | Run Keyword If ${expected_num_peers}>0 Should Be Equal As Integers ${length} ${expected_num_peers} |
| 600 | ... Number of found peers does not match expected number ${length}:${expected_num_peers} |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 601 | ${olt_peer_list}= Create List |
| 602 | FOR ${INDEX} IN RANGE 0 ${length} |
| 603 | ${value}= Get From List ${peers} ${INDEX} |
| 604 | ${peer_id}= Get From Dictionary ${value} deviceId |
| 605 | Append To List ${olt_peer_list} ${peer_id} |
| 606 | END |
| 607 | [Return] ${olt_peer_list} |
| 608 | |
| 609 | Validate OLT PON Port Status |
| 610 | [Arguments] ${olt_device_id} ${pon_port} ${admin_state} ${oper_status} |
| 611 | [Documentation] Verifies the state of the PON port of the OLT |
| 612 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 613 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 614 | Should Be Equal As Integers ${rc} 0 |
| 615 | ${jsondata}= To Json ${output} |
| 616 | Log ${jsondata} |
| 617 | ${length}= Get Length ${jsondata} |
| 618 | ${matched}= Set Variable False |
| 619 | FOR ${INDEX} IN RANGE 0 ${length} |
| 620 | ${value}= Get From List ${jsondata} ${INDEX} |
| 621 | ${type}= Get From Dictionary ${value} type |
| 622 | ${portno}= Get From Dictionary ${value} portNo |
| 623 | ${astate}= Get From Dictionary ${value} adminState |
| 624 | ${opstatus}= Get From Dictionary ${value} operStatus |
| 625 | ${matched}= Set Variable If '${type}' == 'PON_OLT' and '${portno}' == '${pon_port}' True False |
| 626 | Exit For Loop If ${matched} |
| 627 | END |
| 628 | Should Be True ${matched} No PON port found for OLT ${olt_device_id} ${pon_port} |
| 629 | Log ${value} |
| 630 | Should Be Equal '${astate}' '${admin_state}' OLT PON Port admin_state != ${admin_state} |
| 631 | ... values=False |
| 632 | Should Be Equal '${opstatus}' '${oper_status}' OLT PON Port oper_status != ${oper_status} |
| 633 | ... values=False |
| 634 | |
| 635 | DisableOrEnable OLT PON Port |
| 636 | [Arguments] ${operation} ${olt_device_id} ${portno} |
| 637 | [Documentation] Disables or Enables the PON port of the OLT |
| 638 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 639 | ... voltctl -c ${VOLTCTL_CONFIG} device port ${operation} ${olt_device_id} ${portno} |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 640 | Should Be Equal As Integers ${rc} 0 |
| 641 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 642 | Retrieve Peer List From OLT |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 643 | [Arguments] ${olt_peer_list} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 644 | [Documentation] Retrieve the list of peer device id list from port list |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 645 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 646 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 647 | Should Be Equal As Integers ${rc} 0 |
| 648 | ${jsondata}= To Json ${output} |
| 649 | Log ${jsondata} |
| 650 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 651 | ${matched}= Set Variable False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 652 | FOR ${INDEX} IN RANGE 0 ${length} |
| 653 | ${value}= Get From List ${jsondata} ${INDEX} |
| 654 | ${type}= Get From Dictionary ${value} type |
| 655 | ${peers}= Get From Dictionary ${value} peers |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 656 | ${matched}= Set Variable If '${type}' == 'PON_OLT' True False |
| 657 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 658 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 659 | Should Be True ${matched} No PON port found for OLT ${olt_device_id} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 660 | ${length}= Get Length ${peers} |
| 661 | FOR ${INDEX} IN RANGE 0 ${length} |
| 662 | ${value}= Get From List ${peers} ${INDEX} |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 663 | ${peer_id}= Get From Dictionary ${value} deviceId |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 664 | Append To List ${olt_peer_list} ${peer_id} |
| 665 | END |
| 666 | |
| 667 | Validate OLT Peer Id List |
| 668 | [Arguments] ${olt_peer_id_list} |
| 669 | [Documentation] Match each entry in the ${olt_peer_id_list} against ONU device ids. |
| 670 | FOR ${peer_id} IN @{olt_peer_id_list} |
| 671 | Match OLT Peer Id ${peer_id} |
| 672 | END |
| 673 | |
| 674 | Match OLT Peer Id |
| 675 | [Arguments] ${olt_peer_id} |
| 676 | [Documentation] Lookup the OLT Peer Id in against the list of ONU device Ids |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 677 | ${rc} ${output}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device list -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 678 | Should Be Equal As Integers ${rc} 0 |
| 679 | ${jsondata}= To Json ${output} |
| 680 | Log ${jsondata} |
| 681 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 682 | ${matched}= Set Variable False |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 683 | FOR ${INDEX} IN RANGE 0 ${length} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 684 | ${value}= Get From List ${jsondata} ${INDEX} |
| 685 | ${devid}= Get From Dictionary ${value} id |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 686 | ${matched}= Set Variable If '${devid}' == '${olt_peer_id}' True False |
| 687 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 688 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 689 | Should Be True ${matched} Peer id ${olt_peer_id} does not match any ONU device id |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 690 | |
| 691 | Validate ONU Peer Id |
| 692 | [Arguments] ${olt_device_id} ${List_ONU_Serial} |
| 693 | [Documentation] Match each ONU peer to that of the OLT device id |
| 694 | FOR ${onu_serial} IN @{List_ONU_Serial} |
| 695 | ${onu_dev_id}= Get Device ID From SN ${onu_serial} |
| 696 | Match ONU Peer Id ${onu_dev_id} |
| 697 | END |
| 698 | |
| 699 | Match ONU Peer Id |
| 700 | [Arguments] ${onu_dev_id} |
| 701 | [Documentation] Match an ONU peer to that of the OLT device id |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 702 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 703 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${onu_dev_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 704 | Should Be Equal As Integers ${rc} 0 |
| 705 | ${jsondata}= To Json ${output} |
| 706 | Log ${jsondata} |
| 707 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 708 | ${matched}= Set Variable False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 709 | FOR ${INDEX} IN RANGE 0 ${length} |
| 710 | ${value}= Get From List ${jsondata} ${INDEX} |
| 711 | ${type}= Get From Dictionary ${value} type |
| 712 | ${peers}= Get From Dictionary ${value} peers |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 713 | ${matched}= Set Variable If '${type}' == 'PON_ONU' True False |
| 714 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 715 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 716 | Should Be True ${matched} No PON port found for ONU ${onu_dev_id} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 717 | ${length}= Get Length ${peers} |
| 718 | FOR ${INDEX} IN RANGE 0 ${length} |
| 719 | ${value}= Get From List ${peers} ${INDEX} |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 720 | ${peer_id}= Get From Dictionary ${value} deviceId |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 721 | END |
| 722 | Should Be Equal '${peer_id}' '${olt_device_id}' |
| 723 | ... Mismatch between ONU peer ${peer_id} and OLT device id ${olt_device_id} values=False |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 724 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 725 | Get Device ID From SN |
| 726 | [Arguments] ${serial_number} |
| 727 | [Documentation] Gets the device id by matching for ${serial_number} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 728 | ${rc} ${id}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 729 | ... voltctl -c ${VOLTCTL_CONFIG} device list --filter=SerialNumber=${serial_number} --format='{{.Id}}' |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 730 | Should Be Equal As Integers ${rc} 0 "Error while fetching device list from VOLTHA" |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 731 | Log ${id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 732 | [Return] ${id} |
| 733 | |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 734 | Get Logical Device ID From SN |
| 735 | [Arguments] ${serial_number} |
| 736 | [Documentation] Gets the device id by matching for ${serial_number} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 737 | ${rc} ${id}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 738 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice list --filter=Desc.SerialNum=${serial_number} --format='{{.Id}}' |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 739 | Should Be Equal As Integers ${rc} 0 |
| 740 | Log ${id} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 741 | [Return] ${id} |
| 742 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 743 | Build ONU SN List |
Andrea Campanella | 6391f84 | 2020-11-16 10:01:18 +0100 | [diff] [blame] | 744 | [Arguments] ${serial_numbers} ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus} |
| 745 | [Documentation] Appends all ONU SNs for the given OLT to the ${serial_numbers} list |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 746 | FOR ${INDEX} IN RANGE 0 ${num_onus} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 747 | ${onu_sn}= Set Variable ${hosts.src[${INDEX}]['onu']} |
| 748 | # skip if we have already append this ONU |
| 749 | ${onu_id}= Get Index From List ${serial_numbers} ${onu_sn} |
| 750 | Continue For Loop If -1 != ${onu_id} |
| 751 | Run Keyword IF "${olt_serial_number}"=="${hosts.src[${INDEX}].olt}" or "${olt_serial_number}"=="${EMPTY}" |
| 752 | ... Append To List ${serial_numbers} ${onu_sn} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 753 | END |
| 754 | |
TorstenThieme | f3e492c | 2021-11-08 15:25:48 +0000 | [diff] [blame] | 755 | Build ONU Device Id List |
| 756 | [Arguments] ${device_ids} ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus} |
| 757 | [Documentation] Appends all ONU Device IDs for the given OLT to the ${serial_numbers} list |
| 758 | FOR ${INDEX} IN RANGE 0 ${num_onus} |
| 759 | ${onu_device_id}= Get Device ID From SN ${hosts.src[${INDEX}]['onu']} |
| 760 | # skip if we have already append this ONU |
| 761 | ${onu_id}= Get Index From List ${device_ids} ${onu_device_id} |
| 762 | Continue For Loop If -1 != ${onu_id} |
| 763 | Run Keyword IF "${olt_serial_number}"=="${hosts.src[${INDEX}].olt}" or "${olt_serial_number}"=="${EMPTY}" |
| 764 | ... Append To List ${device_ids} ${onu_device_id} |
| 765 | END |
| 766 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 767 | Get SN From Device ID |
| 768 | [Arguments] ${device_id} |
| 769 | [Documentation] Gets the device id by matching for ${device_id} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 770 | ${rc} ${sn}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 771 | ... voltctl -c ${VOLTCTL_CONFIG} device list --filter=Id=${device_id} --format='{{.SerialNumber}}' |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 772 | Should Be Equal As Integers ${rc} 0 |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 773 | Log ${sn} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 774 | [Return] ${sn} |
| 775 | |
Scott Baker | 60e570d | 2020-02-02 22:10:13 -0800 | [diff] [blame] | 776 | Get Parent ID From Device ID |
| 777 | [Arguments] ${device_id} |
| 778 | [Documentation] Gets the device id by matching for ${device_id} |
| 779 | ${rc} ${pid}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 780 | ... voltctl -c ${VOLTCTL_CONFIG} device list --filter=Id=${device_id} --format='{{.ParentId}}' |
Scott Baker | 60e570d | 2020-02-02 22:10:13 -0800 | [diff] [blame] | 781 | Should Be Equal As Integers ${rc} 0 |
| 782 | Log ${pid} |
| 783 | [Return] ${pid} |
| 784 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 785 | Validate Device Removed |
TorstenThieme | 4489b51 | 2021-12-16 09:41:50 +0000 | [diff] [blame] | 786 | [Arguments] ${serialNumber} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 787 | [Documentation] Verifys that device, ${serial_number}, has been removed |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 788 | ${rc} ${output}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device list -o json |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 789 | Should Be Equal As Integers ${rc} 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 790 | ${jsondata}= To Json ${output} |
| 791 | Log ${jsondata} |
| 792 | ${length}= Get Length ${jsondata} |
TorstenThieme | 4489b51 | 2021-12-16 09:41:50 +0000 | [diff] [blame] | 793 | @{sns}= Create List |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 794 | FOR ${INDEX} IN RANGE 0 ${length} |
| 795 | ${value}= Get From List ${jsondata} ${INDEX} |
TorstenThieme | 4489b51 | 2021-12-16 09:41:50 +0000 | [diff] [blame] | 796 | ${device_sn}= Get From Dictionary ${value} serialNumber |
| 797 | Append To List ${sns} ${device_sn} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 798 | END |
TorstenThieme | 4489b51 | 2021-12-16 09:41:50 +0000 | [diff] [blame] | 799 | List Should Not Contain Value ${sns} ${serialNumber} |
Suchitra Vemuri | cd2f64f | 2020-02-18 18:30:27 -0800 | [diff] [blame] | 800 | |
Andrea Campanella | 4e50788 | 2020-11-26 11:33:11 +0100 | [diff] [blame] | 801 | Validate all ONUS for OLT Removed |
| 802 | [Arguments] ${num_all_onus} ${hosts} ${olt_serial_number} ${timeout} |
| 803 | [Documentation] Verifys that all the ONUS for OLT ${serial_number}, has been removed |
TorstenThieme | 4489b51 | 2021-12-16 09:41:50 +0000 | [diff] [blame] | 804 | @{onu_list}= Create List |
Andrea Campanella | 4e50788 | 2020-11-26 11:33:11 +0100 | [diff] [blame] | 805 | FOR ${J} IN RANGE 0 ${num_all_onus} |
| 806 | ${src}= Set Variable ${hosts.src[${J}]} |
| 807 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
TorstenThieme | 4489b51 | 2021-12-16 09:41:50 +0000 | [diff] [blame] | 808 | ${sn}= Set Variable ${src['onu']} |
| 809 | ${onu_id}= Get Index From List ${onu_list} ${sn} |
| 810 | Continue For Loop If -1 != ${onu_id} |
| 811 | Append To List ${onu_list} ${sn} |
| 812 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${sn} |
Andrea Campanella | 4e50788 | 2020-11-26 11:33:11 +0100 | [diff] [blame] | 813 | END |
| 814 | |
Suchitra Vemuri | cd2f64f | 2020-02-18 18:30:27 -0800 | [diff] [blame] | 815 | Reboot ONU |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 816 | [Arguments] ${onu_id} ${validate_device}=True |
Suchitra Vemuri | cd2f64f | 2020-02-18 18:30:27 -0800 | [diff] [blame] | 817 | [Documentation] Using voltctl command reboot ONU and verify that ONU comes up to running state |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 818 | ${rc} ${devices}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device reboot ${onu_id} |
Suchitra Vemuri | cd2f64f | 2020-02-18 18:30:27 -0800 | [diff] [blame] | 819 | Should Be Equal As Integers ${rc} 0 |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 820 | Run Keyword If ${validate_device} Run Keyword And Continue On Failure Wait Until Keyword Succeeds |
| 821 | ... 60s 1s Validate ONU Device By Device Id ENABLED DISCOVERED REACHABLE rebooting ${onu_id} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 822 | |
| 823 | Assert ONUs in Voltha |
| 824 | [Arguments] ${count} |
| 825 | [Documentation] Check that a certain number of devices reached the ACTIVE/ENABLE state |
| 826 | ${rc1} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 827 | ... voltctl -c ${VOLTCTL_CONFIG} -m ${voltctlGrpcLimit} device list | grep -v OLT | grep ACTIVE | wc -l |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 828 | Should Be Equal As Integers ${rc1} 0 |
| 829 | Should Be Equal As Integers ${devices} ${count} |
| 830 | |
| 831 | Wait for ONUs in VOLTHA |
Andrea Campanella | 4ec9b83 | 2022-02-09 13:21:54 +0100 | [diff] [blame] | 832 | [Arguments] ${count} ${timeout}=10m |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 833 | [Documentation] Waits until a certain number of devices reached the ACTIVE/ENABLE state |
Andrea Campanella | 4ec9b83 | 2022-02-09 13:21:54 +0100 | [diff] [blame] | 834 | Wait Until Keyword Succeeds ${timeout} 5s Assert ONUs In Voltha ${count} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 835 | |
TorstenThieme | a8bcec7 | 2022-06-13 12:01:30 +0000 | [diff] [blame] | 836 | Validate ONU Model |
| 837 | [Documentation] |
| 838 | ... Parses the output of "voltctl device list" and inspects onu model and optionally Vendor and Vendor-id |
| 839 | ... Iteratively match on each Serial number contained in ${List_ONU_Serial} and inspect passed values |
| 840 | [Arguments] ${List_ONU_Serial} ${onu_model} ${onu_vendor}=${EMPTY} ${onu_vendor_id}=${EMPTY} |
| 841 | ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} device list -m ${voltctlGrpcLimit} -f Type=brcm_openomci_onu |
| 842 | ... --format "{{.Id}}\t{{.SerialNumber}}\t{{.Vendor}}\t{{.VendorId}}\t{{.Model}}" | grep -v SERIALNUMBER |
| 843 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 844 | Should Be Equal As Integers ${rc} 0 Failed Validate ONU model because of ${output} |
| 845 | Log ${output} |
| 846 | @{Results}= Split String ${output} \n |
| 847 | FOR ${Line} IN @{Results} |
| 848 | ${matched}= Set Variable False |
| 849 | @{words}= Split String ${Line} \t |
| 850 | ${id}= Set Variable ${words[0]} |
| 851 | ${sn}= Set Variable ${words[1]} |
| 852 | ${vendor}= Set Variable ${words[2]} |
| 853 | ${vendor_id}= Set Variable ${words[3]} |
| 854 | ${model}= Set Variable ${words[4]} |
| 855 | ${onu_id}= Get Index From List ${List_ONU_Serial} ${sn} |
| 856 | ${matched}= Set Variable If -1 != ${onu_id} True False |
| 857 | ${matched}= Set Variable If '${model}'=='${onu_model}' ${matched} False |
| 858 | ${matched}= Set Variable If '${onu_vendor}'=='${EMPTY}' or '${vendor}'=='${onu_vendor}' ${matched} False |
| 859 | ${matched}= Set Variable If '${onu_vendor_id}'=='${EMPTY}' or '${vendor_id}'=='${onu_vendor_id}' ${matched} False |
| 860 | Run Keyword If ${matched} Remove Values From List ${List_ONU_Serial} ${sn} |
| 861 | END |
| 862 | Should Be Empty ${List_ONU_Serial} No valid ONU model found for ${List_ONU_Serial}! |
| 863 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 864 | Count Logical Devices flows |
| 865 | [Documentation] Count the flows across logical devices in VOLTHA |
| 866 | [Arguments] ${targetFlows} |
| 867 | ${output}= Get Logical Device List From Voltha |
| 868 | ${logical_devices}= To Json ${output} |
| 869 | ${total_flows}= Set Variable 0 |
| 870 | FOR ${device} IN @{logical_devices} |
| 871 | ${rc} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 872 | ... voltctl -m ${voltctlGrpcLimit} -c ${VOLTCTL_CONFIG} logicaldevice flows ${device['id']} | grep -v ID | wc -l |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 873 | Should Be Equal As Integers ${rc} 0 |
| 874 | ${total_flows}= Evaluate ${total_flows} + ${flows} |
| 875 | END |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 876 | ${msg}= Format String Found {total_flows} flows of {targetFlows} expected |
| 877 | ... total_flows=${total_flows} targetFlows=${targetFlows} |
| 878 | Log ${msg} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 879 | Should Be Equal As Integers ${targetFlows} ${total_flows} |
| 880 | |
| 881 | Wait for Logical Devices flows |
| 882 | [Documentation] Waits until the flows have been provisioned in the logical device |
| 883 | [Arguments] ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 4ec9b83 | 2022-02-09 13:21:54 +0100 | [diff] [blame] | 884 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} ${timeout}=10m |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 885 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 886 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 887 | Log ${targetFlows} |
| 888 | # TODO extend Validate Logical Device Flows to check the correct number of flows |
Andrea Campanella | 4ec9b83 | 2022-02-09 13:21:54 +0100 | [diff] [blame] | 889 | Wait Until Keyword Succeeds ${timeout} 5s Count Logical Devices flows ${targetFlows} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 890 | |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 891 | Count OpenOLT Device Flows |
| 892 | [Documentation] Count the flows across openolt devices in VOLTHA |
| 893 | [Arguments] ${targetFlows} |
| 894 | ${output}= Get Device List from Voltha by type openolt |
| 895 | ${devices}= To Json ${output} |
| 896 | ${total_flows}= Set Variable 0 |
| 897 | FOR ${device} IN @{devices} |
| 898 | ${rc} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 899 | ... voltctl -m ${voltctlGrpcLimit} -c ${VOLTCTL_CONFIG} device flows ${device['id']} | grep -v ID | wc -l |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 900 | Should Be Equal As Integers ${rc} 0 |
| 901 | ${total_flows}= Evaluate ${total_flows} + ${flows} |
| 902 | END |
| 903 | ${msg}= Format String Found {total_flows} flows of {targetFlows} expected |
| 904 | ... total_flows=${total_flows} targetFlows=${targetFlows} |
| 905 | Log ${msg} |
| 906 | Should Be Equal As Integers ${targetFlows} ${total_flows} |
| 907 | |
| 908 | Wait for OpenOLT Devices flows |
| 909 | [Documentation] Waits until the flows have been provisioned in the openolt devices |
| 910 | [Arguments] ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 911 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 912 | ${beforeFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
| 913 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 914 | # In the physical device we only have 2 data plane flows (on the PON) instead of 4 |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 915 | ${afterFlows}= Evaluate ${beforeFlows} - (${uni_count} * 2) |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 916 | # In the TT workflow we have multiple service, |
| 917 | # so we need to remove 6 flows per each UNI that are only on the ONU device |
| 918 | ${ttFlows}= Evaluate ${beforeFlows} - (${uni_count} * 6) |
| 919 | ${afterFlows}= Set Variable If $workflow=='tt' ${ttFlows} ${afterFlows} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 920 | ${targetFlows}= Set Variable If $provisioned=='true' ${afterFlows} ${beforeFlows} |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 921 | Log ${targetFlows} |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 922 | Wait Until Keyword Succeeds 10m 5s Count OpenOLT Device Flows ${targetFlows} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 923 | |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 924 | Validate ONU Device Image |
| 925 | [Documentation] Validates the ONU device image |
| 926 | [Arguments] ${data} ${image_version} ${dev_id} ${download_state} ${expected_reason} ${image_status} |
| 927 | ${jsondata}= To Json ${data} |
| 928 | ${length}= Get Length ${jsondata} |
TorstenThieme | f3e492c | 2021-11-08 15:25:48 +0000 | [diff] [blame] | 929 | Should Not Be Equal As Integers ${length} 0 No record to validate device image |
| 930 | FOR ${J} IN RANGE 0 ${length} |
| 931 | ${value}= Get From List ${jsondata} ${J} |
| 932 | Log ${value} |
| 933 | ${deviceId}= Get From Dictionary ${value} deviceId |
| 934 | Should Contain ${dev_id} ${deviceId} No match found for ${deviceId} to validate device image! |
| 935 | ${imageState}= Get From Dictionary ${value} imageState |
| 936 | ${version}= Get From Dictionary ${imageState} version |
| 937 | ${dwlState}= Get From Dictionary ${imageState} downloadState |
| 938 | ${reason}= Get From Dictionary ${imageState} reason |
| 939 | ${imgStatus}= Get From Dictionary ${imageState} imageState |
Hardik Windlass | ca8ce7c | 2022-02-01 09:01:23 +0000 | [diff] [blame] | 940 | Should Be Equal '${version}' '${image_version}' Device ${deviceId}: '${version}' != '${image_version}' |
TorstenThieme | f3e492c | 2021-11-08 15:25:48 +0000 | [diff] [blame] | 941 | ... values=False |
Hardik Windlass | ca8ce7c | 2022-02-01 09:01:23 +0000 | [diff] [blame] | 942 | Should Be Equal '${dwlState}' '${download_state}' Device ${deviceId}: '${dwlState}' != '${download_state}' |
TorstenThieme | f3e492c | 2021-11-08 15:25:48 +0000 | [diff] [blame] | 943 | ... values=False |
Hardik Windlass | ca8ce7c | 2022-02-01 09:01:23 +0000 | [diff] [blame] | 944 | Should Be Equal '${reason}' '${expected_reason}' Device ${deviceId}: '${reason}' != '${expected_reason}' |
TorstenThieme | f3e492c | 2021-11-08 15:25:48 +0000 | [diff] [blame] | 945 | ... values=False |
Hardik Windlass | ca8ce7c | 2022-02-01 09:01:23 +0000 | [diff] [blame] | 946 | Should Be Equal '${imgStatus}' '${image_status}' Device ${deviceId}: '${imgStatus}' != '${image_status}' |
TorstenThieme | f3e492c | 2021-11-08 15:25:48 +0000 | [diff] [blame] | 947 | ... values=False |
| 948 | END |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 949 | |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 950 | Download ONU Device Image |
| 951 | [Documentation] Downloads the given ONU software image |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 952 | [Arguments] ${ver} ${url} ${vendor} ${active} ${commit} ${crc} ${id} |
TorstenThieme | 7cb9de7 | 2021-08-24 09:40:57 +0000 | [diff] [blame] | 953 | ... ${download_state}=DOWNLOAD_STARTED ${expected_reason}=NO_ERROR ${image_state}=IMAGE_UNKNOWN |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 954 | ${rc} ${output}= Run and Return Rc and Output |
| 955 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage download ${ver} ${url} ${vendor} ${active} ${commit} ${crc} ${id} -o json |
| 956 | Log ${output} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 957 | Should Be Equal As Integers ${rc} 0 |
TorstenThieme | 7cb9de7 | 2021-08-24 09:40:57 +0000 | [diff] [blame] | 958 | Validate ONU Device Image ${output} ${ver} ${id} ${download_state} ${expected_reason} ${image_state} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 959 | |
| 960 | Activate ONU Device Image |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 961 | [Documentation] Activates the given ONU software image |
| 962 | [Arguments] ${ver} ${commit} ${id} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 963 | ${rc} ${output}= Run and Return Rc and Output |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 964 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage activate ${ver} ${commit} ${id} -o json |
| 965 | Log ${output} |
| 966 | Should Be Equal As Integers ${rc} 0 |
Andrea Campanella | f3b88f6 | 2021-10-01 18:43:03 +0200 | [diff] [blame] | 967 | Validate ONU Device Image ${output} ${ver} ${id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_ACTIVATING |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 968 | |
| 969 | Commit ONU Device Image |
| 970 | [Documentation] Commits the given ONU software image |
| 971 | [Arguments] ${ver} ${id} |
| 972 | ${rc} ${output}= Run and Return Rc and Output |
| 973 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage commit ${ver} ${id} -o json |
| 974 | Log ${output} |
| 975 | Should Be Equal As Integers ${rc} 0 |
Andrea Campanella | f3b88f6 | 2021-10-01 18:43:03 +0200 | [diff] [blame] | 976 | Validate ONU Device Image ${output} ${ver} ${id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_COMMITTING |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 977 | |
TorstenThieme | 3716540 | 2021-09-03 11:39:40 +0000 | [diff] [blame] | 978 | Abort ONU Device Image |
| 979 | [Documentation] Aborts the given ONU software image |
| 980 | [Arguments] ${ver} ${id} ${download_state} ${expected_reason} ${image_state} |
| 981 | ${rc} ${output}= Run and Return Rc and Output |
| 982 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage abort ${ver} ${id} -o json |
| 983 | Log ${output} |
| 984 | Should Be Equal As Integers ${rc} 0 |
| 985 | Validate ONU Device Image ${output} ${ver} ${id} ${download_state} ${expected_reason} ${image_state} |
| 986 | |
Andrea Campanella | f3b88f6 | 2021-10-01 18:43:03 +0200 | [diff] [blame] | 987 | Remove Adapter Image |
| 988 | [Documentation] Aborts the upgrade processing for a given ONU software image and thus removes the image from adapter |
| 989 | [Arguments] ${ver} ${id} |
| 990 | ${rc} ${output}= Run and Return Rc and Output |
| 991 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage abort ${ver} ${id} -o json |
| 992 | Log ${output} |
| 993 | |
TorstenThieme | f3e492c | 2021-11-08 15:25:48 +0000 | [diff] [blame] | 994 | Remove Adapter Image from ONUs |
| 995 | [Documentation] Aborts the upgrade processing for a given ONU software image and thus removes the image from adapter |
| 996 | ... for the passed ONUs |
| 997 | [Arguments] ${ver} ${onu_id_list} |
| 998 | FOR ${onu_device_id} IN @{onu_id_list} |
| 999 | Remove Adapter Image ${ver} ${onu_device_id} |
| 1000 | END |
| 1001 | |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 1002 | Verify ONU Device Image Status |
| 1003 | [Documentation] Verfies the ONU device image state |
| 1004 | [Arguments] ${image_version} ${dev_id} ${download_state} ${expected_reason} ${image_state} |
| 1005 | ${rc} ${output}= Run and Return Rc and Output |
| 1006 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage status ${image_version} ${dev_id} -o json |
| 1007 | Log ${output} |
| 1008 | Should Be Equal As Integers ${rc} 0 |
| 1009 | Validate ONU Device Image ${output} ${image_version} ${dev_id} ${download_state} ${expected_reason} |
| 1010 | ... ${image_state} |
| 1011 | |
Hardik Windlass | 6fd3cae | 2022-03-03 08:35:33 +0000 | [diff] [blame] | 1012 | Assert ONUs Image Status in Voltha |
| 1013 | [Arguments] ${onu_count} ${image_version} ${download_state} ${expected_reason} ${image_state} |
| 1014 | [Documentation] Check that a certain number of devices reached the given image status |
Matteo Scandolo | c2a19e3 | 2022-03-11 08:05:55 -0800 | [diff] [blame] | 1015 | ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} -m ${voltctlGrpcLimit} device onuimage status ${image_version} |
Hardik Windlass | 6fd3cae | 2022-03-03 08:35:33 +0000 | [diff] [blame] | 1016 | ... | grep ${download_state} | grep ${expected_reason} | grep ${image_state} | wc -l |
| 1017 | ${rc} ${count}= Run and Return Rc and Output ${cmd} |
| 1018 | Should Be Equal As Integers ${rc} 0 |
| 1019 | Should Be Equal As Integers ${count} ${onu_count} |
| 1020 | |
| 1021 | Wait for ONUs Image Status in VOLTHA |
| 1022 | [Arguments] ${onu_count} ${image_version} ${download_state} ${expected_reason} ${image_state} |
| 1023 | ... ${timeout}=10m |
| 1024 | [Documentation] Waits until a certain number of devices reached the given image status |
| 1025 | Wait Until Keyword Succeeds ${timeout} 5s Assert ONUs Image Status in Voltha ${onu_count} |
| 1026 | ... ${image_version} ${download_state} ${expected_reason} ${image_state} |
| 1027 | |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 1028 | Verify ONU Device Image List |
| 1029 | [Documentation] Verfies the ONU device image list |
TorstenThieme | 7079028 | 2021-11-19 10:26:25 +0000 | [diff] [blame] | 1030 | [Arguments] ${dev_id} ${image_version} ${committed} ${activated} ${valid} ${image_should_not_in_list}=False |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 1031 | ${rc} ${output}= Run and Return Rc and Output |
| 1032 | ... voltctl -c ${VOLTCTL_CONFIG} device onuimage list ${dev_id} -o json |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 1033 | Should Be Equal As Integers ${rc} 0 |
| 1034 | ${jsondata}= To Json ${output} |
| 1035 | Log ${jsondata} |
| 1036 | ${length}= Get Length ${jsondata} |
| 1037 | ${matched}= Set Variable False |
| 1038 | FOR ${INDEX} IN RANGE 0 ${length} |
| 1039 | ${value}= Get From List ${jsondata} ${INDEX} |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 1040 | ${version}= Get From Dictionary ${value} version |
| 1041 | ${isCommited}= Get From Dictionary ${value} isCommited |
| 1042 | ${isActive}= Get From Dictionary ${value} isActive |
| 1043 | ${isValid}= Get From Dictionary ${value} isValid |
| 1044 | ${matched}= Set Variable If '${version}' == '${image_version}' True False |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 1045 | Exit For Loop If ${matched} |
| 1046 | END |
TorstenThieme | 7079028 | 2021-11-19 10:26:25 +0000 | [diff] [blame] | 1047 | Run Keyword If ${image_should_not_in_list} |
| 1048 | ... Should Not Be True ${matched} ONU Image found unexpectedly with Version ${image_version} |
| 1049 | ... ELSE Should Be True ${matched} No ONU Image found with Version ${image_version} |
| 1050 | Run Keyword If ${matched} Should Be Equal '${isCommited}' '${committed}' |
| 1051 | ... Device ${dev_id}: '${isCommited}' != '${committed}' values=False |
| 1052 | Run Keyword If ${matched} Should Be Equal '${isActive}' '${activated}' |
| 1053 | ... Device ${dev_id}: '${isActive}' != '${activated}' values=False |
| 1054 | Run Keyword If ${matched} Should Be Equal '${isValid}' '${valid}' |
| 1055 | ... Device ${dev_id}: '${isValid}' != '${valid}' values=False |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 1056 | |
| 1057 | # pm-data relevant keywords |
| 1058 | Read Default Interval From Pmconfig |
| 1059 | [Documentation] Reads default interval from pm config |
| 1060 | [Arguments] ${device_id} |
| 1061 | ${rc} ${result}= Run and Return Rc and Output voltctl device pmconfig get ${device_id} |
| 1062 | Should Be Equal As Integers ${rc} 0 |
| 1063 | log ${result} |
| 1064 | @{words}= Split String ${result} |
| 1065 | ${interval}= Get From List ${words} 3 |
| 1066 | log ${interval} |
| 1067 | [return] ${interval} |
| 1068 | |
| 1069 | Read Group Interval From Pmconfig |
| 1070 | [Documentation] Reads default interval from pm config |
| 1071 | [Arguments] ${device_id} ${group} |
| 1072 | ${rc} ${result}= Run and Return Rc and Output voltctl device pmconfig group list ${device_id} | grep ${group} |
| 1073 | Should Be Equal As Integers ${rc} 0 |
| 1074 | log ${result} |
| 1075 | @{words}= Split String ${result} |
| 1076 | ${interval}= Get From List ${words} -1 |
| 1077 | log ${interval} |
| 1078 | [return] ${interval} |
| 1079 | |
| 1080 | Set and Validate Default Interval |
| 1081 | [Documentation] Sets and validates default interval of pm data |
| 1082 | [Arguments] ${device_id} ${interval} |
| 1083 | ${rc} ${result}= Run and Return Rc and Output voltctl device pmconfig frequency set ${device_id} ${interval} |
| 1084 | Should Be Equal As Integers ${rc} 0 |
| 1085 | log ${result} |
| 1086 | # workaround until unit will be printed out in voltctl - remove unit |
| 1087 | ${interval}= Get Substring ${interval} 0 -1 |
| 1088 | Should Contain ${result} ${interval} |
| 1089 | |
| 1090 | Set and Validate Group Interval |
| 1091 | [Documentation] Sets and validates group interval of pm data |
| 1092 | [Arguments] ${device_id} ${interval} ${group} |
| 1093 | ${rc} ${result}= Run and Return Rc and Output voltctl device pmconfig group set ${device_id} ${group} ${interval} |
| 1094 | Should Be Equal As Integers ${rc} 0 |
| 1095 | ${rc} ${result}= Run and Return Rc and Output voltctl device pmconfig group list ${device_id} | grep ${group} |
| 1096 | Should Be Equal As Integers ${rc} 0 |
| 1097 | log ${result} |
| 1098 | # workaround until unit will be printed out in voltctl - remove unit |
| 1099 | ${interval}= Get Substring ${interval} 0 -1 |
| 1100 | Should Contain ${result} ${interval} |
| 1101 | |
| 1102 | Read Group List |
| 1103 | [Documentation] Reads metric group list of given device |
| 1104 | [Arguments] ${device_id} |
| 1105 | ${rc} ${result}= Run and Return Rc and Output voltctl device pmconfig group list ${device_id} | grep -v GROUPNAME |
| 1106 | Should Be Equal As Integers ${rc} 0 |
| 1107 | ${group_list} Create List |
| 1108 | ${interval_dict} Create Dictionary |
| 1109 | @{output}= Split String ${result} \n |
| 1110 | FOR ${Line} IN @{output} |
| 1111 | @{words}= Split String ${Line} |
| 1112 | ${group}= Set Variable ${words[0]} |
| 1113 | ${interval}= Set Variable ${words[2]} |
| 1114 | Append To List ${group_list} ${group} |
| 1115 | Set To Dictionary ${interval_dict} ${group}=${interval} |
| 1116 | END |
| 1117 | [return] ${group_list} ${interval_dict} |
| 1118 | |
| 1119 | Read Group Metric List |
| 1120 | [Documentation] Reads group metric list of given device and group |
| 1121 | [Arguments] ${device_id} ${group} |
| 1122 | ${cmd}= Catenate voltctl device pmconfig groupmetric list ${device_id} ${group} | grep -v SAMPLEFREQ |
| 1123 | ${rc} ${result}= Run and Return Rc and Output ${cmd} |
| 1124 | Should Be Equal As Integers ${rc} 0 |
| 1125 | ${groupmetric_list} Create List |
| 1126 | @{output}= Split String ${result} \n |
| 1127 | FOR ${Line} IN @{output} |
| 1128 | @{words}= Split String ${Line} |
| 1129 | ${name}= Set Variable ${words[0]} |
| 1130 | ${type}= Set Variable ${words[1]} |
| 1131 | ${enabled}= Set Variable ${words[2]} |
| 1132 | ${subdict}= Create Dictionary type=${type} enabled=${enabled} |
| 1133 | ${dict}= Create Dictionary ${name}=${subdict} |
| 1134 | Append To List ${groupmetric_list} ${dict} |
| 1135 | END |
| 1136 | [return] ${groupmetric_list} |
| 1137 | |
| 1138 | Read Group Metric Dict |
| 1139 | [Documentation] Reads group metric list of given device and group |
| 1140 | [Arguments] ${device_id} ${group} |
| 1141 | ${cmd}= Catenate voltctl device pmconfig groupmetric list ${device_id} ${group} | grep -v SAMPLEFREQ |
| 1142 | ${rc} ${result}= Run and Return Rc and Output ${cmd} |
| 1143 | Should Be Equal As Integers ${rc} 0 |
| 1144 | ${groupmetric_dict} Create Dictionary |
| 1145 | @{output}= Split String ${result} \n |
| 1146 | FOR ${Line} IN @{output} |
| 1147 | @{words}= Split String ${Line} |
| 1148 | ${name}= Set Variable ${words[0]} |
| 1149 | ${type}= Set Variable ${words[1]} |
| 1150 | ${enabled}= Set Variable ${words[2]} |
| 1151 | ${subdict}= Create Dictionary type=${type} enabled=${enabled} |
| 1152 | Set To Dictionary ${groupmetric_dict} ${name}=${subdict} |
| 1153 | END |
| 1154 | [return] ${groupmetric_dict} |
TorstenThieme | 517b7ce | 2022-12-19 11:56:34 +0000 | [diff] [blame] | 1155 | |
| 1156 | # openonu-go-adapter OMCI counter statistics |
| 1157 | Get OMCI counter statistics |
| 1158 | [Documentation] Delivers the openonu-go-adapter OMCI counter statistics |
| 1159 | [Arguments] ${dev_id} |
| 1160 | ${rc} ${output}= Run and Return Rc and Output |
| 1161 | ... voltctl -c ${VOLTCTL_CONFIG} device getextval onu_omci_stats ${dev_id} |
| 1162 | [return] ${rc} ${output} |
| 1163 | |
| 1164 | Get OMCI counter statistics dictionary |
| 1165 | [Documentation] Delivers the openonu-go-adapter OMCI counter statistics as dictionary |
| 1166 | [Arguments] ${dev_id} |
| 1167 | ${rc} ${output}= Get OMCI counter statistics ${dev_id} |
| 1168 | # check rc |
| 1169 | &{output_dict}= Create Dictionary |
| 1170 | Return From Keyword If ${rc} != 0 ${rc} ${output_dict} |
| 1171 | @{Results}= Split String ${output} \n |
| 1172 | FOR ${Line} IN @{Results} |
| 1173 | ${matched}= Set Variable False |
| 1174 | @{words}= Split String ${Line} |
| 1175 | ${name}= Set Variable ${words[0]} |
| 1176 | ${value}= Set Variable ${words[1]} |
| 1177 | ${name}= Remove String ${name} : |
| 1178 | Set To Dictionary ${output_dict} ${name} ${value} |
| 1179 | END |
| 1180 | [return] ${rc} ${output_dict} |