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