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