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} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 45 | Should Be Equal As Integers ${rc} 0 |
| 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} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 53 | Should Be Equal As Integers ${rc} 0 |
| 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} |
Suchitra Vemuri | 6db8941 | 2019-11-14 14:52:54 -0800 | [diff] [blame] | 60 | Should Be Equal As Integers ${rc} 0 |
| 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} |
Hardik Windlass | aaea340 | 2020-03-10 19:45:45 +0530 | [diff] [blame] | 67 | Should Be Equal As Integers ${rc} 0 |
| 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} |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 74 | Should Be Equal As Integers ${rc} 0 |
| 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 |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 82 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m 8MB ${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} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 86 | Run Keyword If len('${devices}') != 0 Should Be Equal As Integers ${rc} 0 |
| 87 | |
| 88 | Test Devices Disabled In Voltha |
| 89 | [Documentation] Tests to verify that all devices in VOLTHA are disabled |
| 90 | [Arguments] ${filter} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 91 | ${rc} ${count}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 92 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m 8MB --filter '${filter},AdminState!=DISABLED' -q | wc -l |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 93 | Should Be Equal As Integers ${rc} 0 |
| 94 | Should Be Equal As Integers ${count} 0 |
| 95 | |
| 96 | Delete Devices In Voltha |
| 97 | [Documentation] Disables all the known devices in voltha |
| 98 | [Arguments] ${filter} |
| 99 | ${arg}= Set Variable ${EMPTY} |
| 100 | ${arg}= Run Keyword If len('${filter}'.strip()) != 0 Set Variable --filter ${filter} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 101 | ${rc} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 102 | ... voltctl -c ${VOLTCTL_CONFIG} device list ${arg} -m 8MB --orderby Root -q | xargs echo -n |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 103 | Should Be Equal As Integers ${rc} 0 |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 104 | ${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] | 105 | ... voltctl -c ${VOLTCTL_CONFIG} device delete ${devices} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 106 | Run Keyword If len('${devices}') != 0 Should Be Equal As Integers ${rc} 0 |
| 107 | |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 108 | Get Device Flows from Voltha |
| 109 | [Arguments] ${device_id} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 110 | [Documentation] Gets device flows from VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 111 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 112 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${device_id} -m 8MB |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 113 | Should Be Equal As Integers ${rc} 0 |
| 114 | [Return] ${output} |
| 115 | |
| 116 | Get Logical Device Output from Voltha |
| 117 | [Arguments] ${device_id} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 118 | [Documentation] Gets logicaldevice flows and ports from VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 119 | ${rc1} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 120 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice flows ${device_id} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 121 | ${rc2} ${ports}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 122 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice port list ${device_id} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 123 | Log ${flows} |
| 124 | Log ${ports} |
| 125 | Should Be Equal As Integers ${rc1} 0 |
| 126 | Should Be Equal As Integers ${rc2} 0 |
| 127 | |
| 128 | Get Device Output from Voltha |
| 129 | [Arguments] ${device_id} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 130 | [Documentation] Gets device flows and ports from VOLTHA |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 131 | ${rc1} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 132 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${device_id} -m 8MB |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 133 | ${rc2} ${ports}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 134 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${device_id} -m 8MB |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 135 | Log ${flows} |
| 136 | Log ${ports} |
| 137 | Should Be Equal As Integers ${rc1} 0 |
| 138 | Should Be Equal As Integers ${rc2} 0 |
| 139 | |
Suchitra Vemuri | 1a970a6 | 2019-11-26 12:52:16 -0800 | [diff] [blame] | 140 | Get Device List from Voltha |
| 141 | [Documentation] Gets Device List Output from Voltha |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 142 | ${rc1} ${devices}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device list -m 8MB |
Suchitra Vemuri | 1a970a6 | 2019-11-26 12:52:16 -0800 | [diff] [blame] | 143 | Log ${devices} |
| 144 | Should Be Equal As Integers ${rc1} 0 |
| 145 | |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 146 | Get Device List from Voltha by type |
| 147 | [Documentation] Gets Device List Output from Voltha applying filtering by device type |
| 148 | [Arguments] ${type} |
| 149 | ${rc1} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 150 | ... voltctl -c ${VOLTCTL_CONFIG} device list -m 8MB -f Type=${type} -o json |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 151 | Log ${devices} |
| 152 | Should Be Equal As Integers ${rc1} 0 |
| 153 | Return From Keyword ${devices} |
| 154 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 155 | Get Logical Device List from Voltha |
| 156 | [Documentation] Gets Logical Device List Output from Voltha (in json format) |
Andrea Campanella | 80655eb | 2020-07-10 15:49:22 +0200 | [diff] [blame] | 157 | ${rc1} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 158 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice list -m 8MB -o json |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 159 | Log ${devices} |
| 160 | Should Be Equal As Integers ${rc1} 0 |
| 161 | Return From Keyword ${devices} |
| 162 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 163 | Validate Device |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 164 | [Documentation] |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 165 | ... Parses the output of "voltctl device list" and inspects a device ${id}, specified as either |
| 166 | ... the serial number or device ID. Arguments are matched for device states of: "admin_state", |
| 167 | ... "oper_status", and "connect_status" |
| 168 | [Arguments] ${admin_state} ${oper_status} ${connect_status} |
| 169 | ... ${id}=${EMPTY} ${onu_reason}=${EMPTY} ${onu}=False |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 170 | ${rc} ${output}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device list -m 8MB -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 171 | Should Be Equal As Integers ${rc} 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 172 | ${jsondata}= To Json ${output} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 173 | ${length}= Get Length ${jsondata} |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 174 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 175 | FOR ${INDEX} IN RANGE 0 ${length} |
| 176 | ${value}= Get From List ${jsondata} ${INDEX} |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 177 | ${jsonCamelCaseFieldnames}= Run Keyword And Return Status |
| 178 | ... Dictionary Should Contain Key ${value} adminState |
| 179 | ${astate}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 180 | ... Get From Dictionary ${value} adminState |
| 181 | ... ELSE |
| 182 | ... Get From Dictionary ${value} adminstate |
| 183 | ${opstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 184 | ... Get From Dictionary ${value} operStatus |
| 185 | ... ELSE |
| 186 | ... Get From Dictionary ${value} operstatus |
| 187 | ${cstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 188 | ... Get From Dictionary ${value} connectStatus |
| 189 | ... ELSE |
| 190 | ... Get From Dictionary ${value} connectstatus |
| 191 | ${sn}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 192 | ... Get From Dictionary ${value} serialNumber |
| 193 | ... ELSE |
| 194 | ... Get From Dictionary ${value} serialnumber |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 195 | ${devId}= Get From Dictionary ${value} id |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 196 | ${mib_state}= Get From Dictionary ${value} reason |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 197 | ${matched}= Set Variable If '${sn}' == '${id}' or '${devId}' == '${id}' True False |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 198 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 199 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 200 | Should Be True ${matched} No match found for ${id} to validate device |
Matteo Scandolo | 5e10b28 | 2019-11-25 10:54:32 -0700 | [diff] [blame] | 201 | Log ${value} |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 202 | Should Be Equal '${astate}' '${admin_state}' Device ${sn} admin_state != ${admin_state} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 203 | ... values=False |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 204 | Should Be Equal '${opstatus}' '${oper_status}' Device ${sn} oper_status != ${oper_status} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 205 | ... values=False |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 206 | Should Be Equal '${cstatus}' '${connect_status}' Device ${sn} conn_status != ${connect_status} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 207 | ... values=False |
| 208 | Run Keyword If '${onu}' == 'True' Should Be Equal '${mib_state}' '${onu_reason}' |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 209 | ... Device ${sn} mib_state incorrect (${mib_state}) values=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 210 | |
| 211 | Validate OLT Device |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 212 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${id}=${EMPTY} |
| 213 | [Documentation] Parses the output of "voltctl device list" and inspects device ${id}, specified |
| 214 | ... as either its serial numbner or device ID. Match on OLT Serial number or Device Id and inspect states |
| 215 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${id} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 216 | |
Suchitra Vemuri | a6879aa | 2020-11-03 11:03:11 -0800 | [diff] [blame] | 217 | Validate OLT Devices |
| 218 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${ids}=${EMPTY} |
| 219 | [Documentation] Parses the output of "voltctl device list" and inspects device ${id}, specified |
| 220 | ... as either its serial numbner or device ID. Match on OLT Serial number or Device Id and inspect states |
| 221 | FOR ${I} IN RANGE 0 ${olt_count} |
| 222 | ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn |
| 223 | ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number} |
| 224 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${olt_device_id} |
| 225 | END |
| 226 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 227 | Validate ONU Devices |
| 228 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${List_ONU_Serial} |
Andy Bavier | f1f26ed | 2020-03-18 10:59:07 -0700 | [diff] [blame] | 229 | ... ${onu_reason}=omci-flows-pushed |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 230 | [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] | 231 | ... Iteratively match on each Serial number contained in ${List_ONU_Serial} and inspect |
| 232 | ... states including MIB state |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 233 | FOR ${serial_number} IN @{List_ONU_Serial} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 234 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${serial_number} |
Andy Bavier | f1f26ed | 2020-03-18 10:59:07 -0700 | [diff] [blame] | 235 | ... onu_reason=${onu_reason} onu=True |
Debasish | 28130d0 | 2020-03-16 11:05:26 +0000 | [diff] [blame] | 236 | END |
| 237 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 238 | Validate Device Port Types |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 239 | [Documentation] |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 240 | ... 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] | 241 | [Arguments] ${device_id} ${pon_type} ${ethernet_type} ${all_active}=True |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 242 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 243 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${device_id} -m 8MB -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 244 | Should Be Equal As Integers ${rc} 0 |
| 245 | ${jsondata}= To Json ${output} |
| 246 | Log ${jsondata} |
| 247 | ${length}= Get Length ${jsondata} |
| 248 | FOR ${INDEX} IN RANGE 0 ${length} |
| 249 | ${value}= Get From List ${jsondata} ${INDEX} |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 250 | ${jsonCamelCaseFieldnames}= Run Keyword And Return Status |
| 251 | ... Dictionary Should Contain Key ${value} adminState |
| 252 | ${astate}= Run Keyword If ${jsonCamelCaseFieldNames} |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 253 | ... Get From Dictionary ${value} adminState |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 254 | ... ELSE |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 255 | ... Get From Dictionary ${value} adminstate |
Scott Baker | 780b65f | 2020-05-22 14:03:15 -0700 | [diff] [blame] | 256 | ${opstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 257 | ... Get From Dictionary ${value} operStatus |
| 258 | ... ELSE |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 259 | ... Get From Dictionary ${value} operstatus |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 260 | ${type}= Get From Dictionary ${value} type |
Hema | f64d34c | 2020-03-25 00:40:17 +0530 | [diff] [blame] | 261 | 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] | 262 | Run Keyword If ${all_active} Should Be Equal '${opstatus}' 'ACTIVE' |
| 263 | ... Device ${device_id} port oper_status != ACTIVE values=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 264 | Should Be True '${type}' == '${pon_type}' or '${type}' == '${ethernet_type}' |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 265 | ... Device ${device_id} port type is neither ${pon_type} or ${ethernet_type} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 266 | END |
| 267 | |
| 268 | Validate OLT Port Types |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 269 | [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] | 270 | [Arguments] ${pon_type} ${ethernet_type} |
| 271 | Validate Device Port Types ${olt_device_id} ${pon_type} ${ethernet_type} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 272 | |
| 273 | Validate ONU Port Types |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 274 | [Arguments] ${List_ONU_Serial} ${pon_type} ${ethernet_type} |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 275 | [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] | 276 | ... and matches the port types listed |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 277 | FOR ${serial_number} IN @{List_ONU_Serial} |
| 278 | ${onu_dev_id}= Get Device ID From SN ${serial_number} |
Andy Bavier | 90eb1a1 | 2020-03-26 11:54:35 -0700 | [diff] [blame] | 279 | # Only first UNI port is ACTIVE; the rest are in DISCOVERED operstatus |
| 280 | 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] | 281 | END |
| 282 | |
| 283 | Validate Device Flows |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 284 | [Arguments] ${device_id} ${flow_count}=${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 285 | [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] | 286 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 287 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${device_id} -m 8MB -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 288 | Should Be Equal As Integers ${rc} 0 |
| 289 | ${jsondata}= To Json ${output} |
| 290 | Log ${jsondata} |
| 291 | ${length}= Get Length ${jsondata} |
| 292 | Log 'Number of flows = ' ${length} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 293 | Run Keyword If '${flow_count}' == '${EMPTY}' Should Be True ${length} > 0 |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 294 | ... Number of flows for ${device_id} was 0 |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 295 | ... ELSE Should Be True ${length} == ${flow_count} |
| 296 | ... Number of flows for ${device_id} was not ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 297 | |
| 298 | Validate OLT Flows |
Suchitra Vemuri | a6879aa | 2020-11-03 11:03:11 -0800 | [diff] [blame] | 299 | [Arguments] ${flow_count}=${EMPTY} ${olt_device_id}=${EMPTY} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 300 | [Documentation] Parses the output of voltctl device flows ${olt_device_id} |
| 301 | ... and expects flow count == ${flow_count} |
| 302 | Validate Device Flows ${olt_device_id} ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 303 | |
| 304 | Validate ONU Flows |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 305 | [Arguments] ${List_ONU_Serial} ${flow_count}=${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 306 | [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] | 307 | ... and expects flow count == ${flow_count} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 308 | FOR ${serial_number} IN @{List_ONU_Serial} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 309 | ${onu_dev_id}= Get Device ID From SN ${serial_number} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 310 | Validate Device Flows ${onu_dev_id} ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 311 | END |
| 312 | |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 313 | Validate ONU Devices With Duration |
| 314 | [Documentation] |
| 315 | ... Parses the output of "voltctl device list" and inspects all devices ${List_ONU_Serial}, |
| 316 | ... Iteratively match on each Serial number contained in ${List_ONU_Serial} and inspect |
| 317 | ... states including MIB state. |
| 318 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${onu_reason} |
| 319 | ... ${List_ONU_Serial} ${startTime} ${print2console}=False ${output_file}=${EMPTY} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 320 | ... ${alternate_reason}=${EMPTY} |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 321 | ${rc} ${output}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device list -m 8MB -o json |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 322 | Should Be Equal As Integers ${rc} 0 |
| 323 | ${timeCurrent} = Get Current Date |
| 324 | ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number |
| 325 | ${jsondata}= To Json ${output} |
| 326 | ${length}= Get Length ${jsondata} |
| 327 | FOR ${INDEX} IN RANGE 0 ${length} |
| 328 | ${matched}= Set Variable False |
| 329 | ${value}= Get From List ${jsondata} ${INDEX} |
| 330 | ${jsonCamelCaseFieldnames}= Run Keyword And Return Status |
| 331 | ... Dictionary Should Contain Key ${value} adminState |
| 332 | ${astate}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 333 | ... Get From Dictionary ${value} adminState |
| 334 | ... ELSE |
| 335 | ... Get From Dictionary ${value} adminstate |
| 336 | ${opstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 337 | ... Get From Dictionary ${value} operStatus |
| 338 | ... ELSE |
| 339 | ... Get From Dictionary ${value} operstatus |
| 340 | ${cstatus}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 341 | ... Get From Dictionary ${value} connectStatus |
| 342 | ... ELSE |
| 343 | ... Get From Dictionary ${value} connectstatus |
| 344 | ${sn}= Run Keyword If ${jsonCamelCaseFieldNames} |
| 345 | ... Get From Dictionary ${value} serialNumber |
| 346 | ... ELSE |
| 347 | ... Get From Dictionary ${value} serialnumber |
| 348 | ${mib_state}= Get From Dictionary ${value} reason |
| 349 | ${onu_id}= Get Index From List ${List_ONU_Serial} ${sn} |
| 350 | ${matched}= Set Variable If -1 != ${onu_id} True False |
| 351 | ${matched}= Set Variable If '${astate}' == '${admin_state}' ${matched} False |
| 352 | ${matched}= Set Variable If '${opstatus}' == '${oper_status}' ${matched} False |
| 353 | ${matched}= Set Variable If '${cstatus}' == '${connect_status}' ${matched} False |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 354 | ${matched}= Set Variable If '${mib_state}' == '${onu_reason}' or '${mib_state}' == '${alternate_reason}' |
| 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= |
| 372 | ... voltctl device list -m 8MB -f Type=${type} -f Reason=${onu_reason} --format '{{.SerialNumber}}' |
| 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} |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 398 | ${cmd} Catenate voltctl -c ${VOLTCTL_CONFIG} device list --filter=Id=${onu_id} -m 8MB -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 | |
| 437 | |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 438 | Compare Lists |
| 439 | [Documentation] |
| 440 | ... Compares both lists and put all matches in the returned list |
| 441 | [Arguments] ${ListIterate} ${ListCompare} |
| 442 | @{list} = Create List |
| 443 | ${length} = Get Length ${ListIterate} |
| 444 | FOR ${INDEX} IN RANGE 0 ${length} |
| 445 | ${sn}= Get From List ${ListIterate} ${INDEX} |
| 446 | ${onu_id}= Get Index From List ${ListCompare} ${sn} |
| 447 | Run Keyword If -1 != ${onu_id} Append To List ${list} ${sn} |
| 448 | END |
| 449 | [Return] ${list} |
| 450 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 451 | Validate Logical Device |
| 452 | [Documentation] Validate Logical Device is listed |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 453 | ${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] | 454 | Should Be Equal As Integers ${rc} 0 |
| 455 | ${jsondata}= To Json ${output} |
| 456 | Log ${jsondata} |
| 457 | ${length}= Get Length ${jsondata} |
| 458 | FOR ${INDEX} IN RANGE 0 ${length} |
| 459 | ${value}= Get From List ${jsondata} ${INDEX} |
| 460 | ${devid}= Get From Dictionary ${value} id |
Scott Baker | 2ab2a0c | 2020-06-05 12:51:47 -0700 | [diff] [blame] | 461 | ${rootdev}= Get From Dictionary ${value} rootDeviceId |
| 462 | ${desc}= Get From Dictionary ${value} desc |
| 463 | ${sn}= Get From Dictionary ${desc} serialNum |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 464 | Exit For Loop |
| 465 | END |
| 466 | Should Be Equal '${rootdev}' '${olt_device_id}' Root Device does not match ${olt_device_id} values=False |
| 467 | Should Be Equal '${sn}' '${BBSIM_OLT_SN}' Logical Device ${sn} does not match ${BBSIM_OLT_SN} |
| 468 | ... values=False |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 469 | [Return] ${devid} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 470 | |
| 471 | Validate Logical Device Ports |
| 472 | [Arguments] ${logical_device_id} |
| 473 | [Documentation] Validate Logical Device Ports are listed and are > 0 |
| 474 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 475 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice port list ${logical_device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 476 | Should Be Equal As Integers ${rc} 0 |
| 477 | ${jsondata}= To Json ${output} |
| 478 | Log ${jsondata} |
| 479 | ${length}= Get Length ${jsondata} |
| 480 | Should Be True ${length} > 0 Number of ports for ${logical_device_id} was 0 |
| 481 | |
| 482 | Validate Logical Device Flows |
| 483 | [Arguments] ${logical_device_id} |
| 484 | [Documentation] Validate Logical Device Flows are listed and are > 0 |
| 485 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 486 | ... voltctl -c ${VOLTCTL_CONFIG} logicaldevice flows ${logical_device_id} -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} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 491 | 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] | 492 | |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 493 | Retrieve OLT PON Ports |
| 494 | [Arguments] ${olt_device_id} |
| 495 | [Documentation] Retrieves the list of PON ports from the OLT device |
| 496 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 497 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 498 | Should Be Equal As Integers ${rc} 0 |
| 499 | ${jsondata}= To Json ${output} |
| 500 | Log ${jsondata} |
| 501 | ${length}= Get Length ${jsondata} |
| 502 | ${olt_pon_list}= Create List |
| 503 | FOR ${INDEX} IN RANGE 0 ${length} |
| 504 | ${value}= Get From List ${jsondata} ${INDEX} |
| 505 | ${type}= Get From Dictionary ${value} type |
| 506 | ${portno}= Get From Dictionary ${value} portNo |
| 507 | ${peers}= Get From Dictionary ${value} peers |
| 508 | ${len_peers}= Get Length ${peers} |
| 509 | Run Keyword If '${type}' == 'PON_OLT' and ${len_peers} > 0 |
| 510 | ... Append To List ${olt_pon_list} ${portno} |
| 511 | END |
| 512 | [Return] ${olt_pon_list} |
| 513 | |
| 514 | Retrieve Peer List From OLT PON Port |
| 515 | [Arguments] ${olt_device_id} ${pon_port} |
| 516 | [Documentation] Retrieves the list of peer device ids list from the OLT PON port |
| 517 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 518 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 519 | Should Be Equal As Integers ${rc} 0 |
| 520 | ${jsondata}= To Json ${output} |
| 521 | Log ${jsondata} |
| 522 | ${length}= Get Length ${jsondata} |
| 523 | ${matched}= Set Variable False |
| 524 | FOR ${INDEX} IN RANGE 0 ${length} |
| 525 | ${value}= Get From List ${jsondata} ${INDEX} |
| 526 | ${type}= Get From Dictionary ${value} type |
| 527 | ${portno}= Get From Dictionary ${value} portNo |
| 528 | ${peers}= Get From Dictionary ${value} peers |
| 529 | ${matched}= Set Variable If '${type}' == 'PON_OLT' and '${portno}' == '${pon_port}' True False |
| 530 | Exit For Loop If ${matched} |
| 531 | END |
| 532 | Should Be True ${matched} No PON port found for OLT ${olt_device_id} |
| 533 | ${length}= Get Length ${peers} |
| 534 | ${olt_peer_list}= Create List |
| 535 | FOR ${INDEX} IN RANGE 0 ${length} |
| 536 | ${value}= Get From List ${peers} ${INDEX} |
| 537 | ${peer_id}= Get From Dictionary ${value} deviceId |
| 538 | Append To List ${olt_peer_list} ${peer_id} |
| 539 | END |
| 540 | [Return] ${olt_peer_list} |
| 541 | |
| 542 | Validate OLT PON Port Status |
| 543 | [Arguments] ${olt_device_id} ${pon_port} ${admin_state} ${oper_status} |
| 544 | [Documentation] Verifies the state of the PON port of the OLT |
| 545 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 546 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 547 | Should Be Equal As Integers ${rc} 0 |
| 548 | ${jsondata}= To Json ${output} |
| 549 | Log ${jsondata} |
| 550 | ${length}= Get Length ${jsondata} |
| 551 | ${matched}= Set Variable False |
| 552 | FOR ${INDEX} IN RANGE 0 ${length} |
| 553 | ${value}= Get From List ${jsondata} ${INDEX} |
| 554 | ${type}= Get From Dictionary ${value} type |
| 555 | ${portno}= Get From Dictionary ${value} portNo |
| 556 | ${astate}= Get From Dictionary ${value} adminState |
| 557 | ${opstatus}= Get From Dictionary ${value} operStatus |
| 558 | ${matched}= Set Variable If '${type}' == 'PON_OLT' and '${portno}' == '${pon_port}' True False |
| 559 | Exit For Loop If ${matched} |
| 560 | END |
| 561 | Should Be True ${matched} No PON port found for OLT ${olt_device_id} ${pon_port} |
| 562 | Log ${value} |
| 563 | Should Be Equal '${astate}' '${admin_state}' OLT PON Port admin_state != ${admin_state} |
| 564 | ... values=False |
| 565 | Should Be Equal '${opstatus}' '${oper_status}' OLT PON Port oper_status != ${oper_status} |
| 566 | ... values=False |
| 567 | |
| 568 | DisableOrEnable OLT PON Port |
| 569 | [Arguments] ${operation} ${olt_device_id} ${portno} |
| 570 | [Documentation] Disables or Enables the PON port of the OLT |
| 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 ${operation} ${olt_device_id} ${portno} |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 573 | Should Be Equal As Integers ${rc} 0 |
| 574 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 575 | Retrieve Peer List From OLT |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 576 | [Arguments] ${olt_peer_list} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 577 | [Documentation] Retrieve the list of peer device id list from port list |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 578 | ${rc} ${output}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 579 | ... voltctl -c ${VOLTCTL_CONFIG} device port list ${olt_device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 580 | Should Be Equal As Integers ${rc} 0 |
| 581 | ${jsondata}= To Json ${output} |
| 582 | Log ${jsondata} |
| 583 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 584 | ${matched}= Set Variable False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 585 | FOR ${INDEX} IN RANGE 0 ${length} |
| 586 | ${value}= Get From List ${jsondata} ${INDEX} |
| 587 | ${type}= Get From Dictionary ${value} type |
| 588 | ${peers}= Get From Dictionary ${value} peers |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 589 | ${matched}= Set Variable If '${type}' == 'PON_OLT' True False |
| 590 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 591 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 592 | 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] | 593 | ${length}= Get Length ${peers} |
| 594 | FOR ${INDEX} IN RANGE 0 ${length} |
| 595 | ${value}= Get From List ${peers} ${INDEX} |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 596 | ${peer_id}= Get From Dictionary ${value} deviceId |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 597 | Append To List ${olt_peer_list} ${peer_id} |
| 598 | END |
| 599 | |
| 600 | Validate OLT Peer Id List |
| 601 | [Arguments] ${olt_peer_id_list} |
| 602 | [Documentation] Match each entry in the ${olt_peer_id_list} against ONU device ids. |
| 603 | FOR ${peer_id} IN @{olt_peer_id_list} |
| 604 | Match OLT Peer Id ${peer_id} |
| 605 | END |
| 606 | |
| 607 | Match OLT Peer Id |
| 608 | [Arguments] ${olt_peer_id} |
| 609 | [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] | 610 | ${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] | 611 | Should Be Equal As Integers ${rc} 0 |
| 612 | ${jsondata}= To Json ${output} |
| 613 | Log ${jsondata} |
| 614 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 615 | ${matched}= Set Variable False |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 616 | FOR ${INDEX} IN RANGE 0 ${length} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 617 | ${value}= Get From List ${jsondata} ${INDEX} |
| 618 | ${devid}= Get From Dictionary ${value} id |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 619 | ${matched}= Set Variable If '${devid}' == '${olt_peer_id}' True False |
| 620 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 621 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 622 | 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] | 623 | |
| 624 | Validate ONU Peer Id |
| 625 | [Arguments] ${olt_device_id} ${List_ONU_Serial} |
| 626 | [Documentation] Match each ONU peer to that of the OLT device id |
| 627 | FOR ${onu_serial} IN @{List_ONU_Serial} |
| 628 | ${onu_dev_id}= Get Device ID From SN ${onu_serial} |
| 629 | Match ONU Peer Id ${onu_dev_id} |
| 630 | END |
| 631 | |
| 632 | Match ONU Peer Id |
| 633 | [Arguments] ${onu_dev_id} |
| 634 | [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] | 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 list ${onu_dev_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 637 | Should Be Equal As Integers ${rc} 0 |
| 638 | ${jsondata}= To Json ${output} |
| 639 | Log ${jsondata} |
| 640 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 641 | ${matched}= Set Variable False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 642 | FOR ${INDEX} IN RANGE 0 ${length} |
| 643 | ${value}= Get From List ${jsondata} ${INDEX} |
| 644 | ${type}= Get From Dictionary ${value} type |
| 645 | ${peers}= Get From Dictionary ${value} peers |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 646 | ${matched}= Set Variable If '${type}' == 'PON_ONU' True False |
| 647 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 648 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 649 | 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] | 650 | ${length}= Get Length ${peers} |
| 651 | FOR ${INDEX} IN RANGE 0 ${length} |
| 652 | ${value}= Get From List ${peers} ${INDEX} |
Hardik Windlass | 16cdf96 | 2020-04-29 15:26:50 +0530 | [diff] [blame] | 653 | ${peer_id}= Get From Dictionary ${value} deviceId |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 654 | END |
| 655 | Should Be Equal '${peer_id}' '${olt_device_id}' |
| 656 | ... 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] | 657 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 658 | Get Device ID From SN |
| 659 | [Arguments] ${serial_number} |
| 660 | [Documentation] Gets the device id by matching for ${serial_number} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 661 | ${rc} ${id}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 662 | ... voltctl -c ${VOLTCTL_CONFIG} device list --filter=SerialNumber=${serial_number} --format='{{.Id}}' |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 663 | Should Be Equal As Integers ${rc} 0 |
| 664 | Log ${id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 665 | [Return] ${id} |
| 666 | |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 667 | Get Logical Device ID From SN |
| 668 | [Arguments] ${serial_number} |
| 669 | [Documentation] Gets the device id by matching for ${serial_number} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 670 | ${rc} ${id}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 671 | ... 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] | 672 | Should Be Equal As Integers ${rc} 0 |
| 673 | Log ${id} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 674 | [Return] ${id} |
| 675 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 676 | Build ONU SN List |
Andrea Campanella | 6391f84 | 2020-11-16 10:01:18 +0100 | [diff] [blame] | 677 | [Arguments] ${serial_numbers} ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus} |
| 678 | [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] | 679 | FOR ${INDEX} IN RANGE 0 ${num_onus} |
Andrea Campanella | 6391f84 | 2020-11-16 10:01:18 +0100 | [diff] [blame] | 680 | Run Keyword IF "${olt_serial_number}"=="${hosts.src[${INDEX}].olt}" or "${olt_serial_number}"=="${EMPTY}" |
| 681 | ... Append To List ${serial_numbers} ${hosts.src[${INDEX}].onu} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 682 | END |
| 683 | |
| 684 | Get SN From Device ID |
| 685 | [Arguments] ${device_id} |
| 686 | [Documentation] Gets the device id by matching for ${device_id} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 687 | ${rc} ${sn}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 688 | ... voltctl -c ${VOLTCTL_CONFIG} device list --filter=Id=${device_id} --format='{{.SerialNumber}}' |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 689 | Should Be Equal As Integers ${rc} 0 |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 690 | Log ${sn} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 691 | [Return] ${sn} |
| 692 | |
Scott Baker | 60e570d | 2020-02-02 22:10:13 -0800 | [diff] [blame] | 693 | Get Parent ID From Device ID |
| 694 | [Arguments] ${device_id} |
| 695 | [Documentation] Gets the device id by matching for ${device_id} |
| 696 | ${rc} ${pid}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 697 | ... voltctl -c ${VOLTCTL_CONFIG} device list --filter=Id=${device_id} --format='{{.ParentId}}' |
Scott Baker | 60e570d | 2020-02-02 22:10:13 -0800 | [diff] [blame] | 698 | Should Be Equal As Integers ${rc} 0 |
| 699 | Log ${pid} |
| 700 | [Return] ${pid} |
| 701 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 702 | Validate Device Removed |
| 703 | [Arguments] ${id} |
| 704 | [Documentation] Verifys that device, ${serial_number}, has been removed |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 705 | ${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] | 706 | Should Be Equal As Integers ${rc} 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 707 | ${jsondata}= To Json ${output} |
| 708 | Log ${jsondata} |
| 709 | ${length}= Get Length ${jsondata} |
| 710 | @{ids}= Create List |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 711 | FOR ${INDEX} IN RANGE 0 ${length} |
| 712 | ${value}= Get From List ${jsondata} ${INDEX} |
| 713 | ${device_id}= Get From Dictionary ${value} id |
| 714 | Append To List ${ids} ${device_id} |
| 715 | END |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 716 | List Should Not Contain Value ${ids} ${id} |
Suchitra Vemuri | cd2f64f | 2020-02-18 18:30:27 -0800 | [diff] [blame] | 717 | |
| 718 | Reboot ONU |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 719 | [Arguments] ${onu_id} ${validate_device}=True |
Suchitra Vemuri | cd2f64f | 2020-02-18 18:30:27 -0800 | [diff] [blame] | 720 | [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] | 721 | ${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] | 722 | Should Be Equal As Integers ${rc} 0 |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 723 | Run Keyword If ${validate_device} Run Keyword And Continue On Failure Wait Until Keyword Succeeds |
| 724 | ... 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] | 725 | |
| 726 | Assert ONUs in Voltha |
| 727 | [Arguments] ${count} |
| 728 | [Documentation] Check that a certain number of devices reached the ACTIVE/ENABLE state |
| 729 | ${rc1} ${devices}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 730 | ... voltctl -c ${VOLTCTL_CONFIG} -m 8M device list | grep -v OLT | grep ACTIVE | wc -l |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 731 | Should Be Equal As Integers ${rc1} 0 |
| 732 | Should Be Equal As Integers ${devices} ${count} |
| 733 | |
| 734 | Wait for ONUs in VOLTHA |
| 735 | [Arguments] ${count} |
| 736 | [Documentation] Waits until a certain number of devices reached the ACTIVE/ENABLE state |
| 737 | Wait Until Keyword Succeeds 10m 5s Assert ONUs In Voltha ${count} |
| 738 | |
| 739 | Count Logical Devices flows |
| 740 | [Documentation] Count the flows across logical devices in VOLTHA |
| 741 | [Arguments] ${targetFlows} |
| 742 | ${output}= Get Logical Device List From Voltha |
| 743 | ${logical_devices}= To Json ${output} |
| 744 | ${total_flows}= Set Variable 0 |
| 745 | FOR ${device} IN @{logical_devices} |
| 746 | ${rc} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 747 | ... 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] | 748 | Should Be Equal As Integers ${rc} 0 |
| 749 | ${total_flows}= Evaluate ${total_flows} + ${flows} |
| 750 | END |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 751 | ${msg}= Format String Found {total_flows} flows of {targetFlows} expected |
| 752 | ... total_flows=${total_flows} targetFlows=${targetFlows} |
| 753 | Log ${msg} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 754 | Should Be Equal As Integers ${targetFlows} ${total_flows} |
| 755 | |
| 756 | Wait for Logical Devices flows |
| 757 | [Documentation] Waits until the flows have been provisioned in the logical device |
| 758 | [Arguments] ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 759 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 760 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 761 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 762 | Log ${targetFlows} |
| 763 | # TODO extend Validate Logical Device Flows to check the correct number of flows |
| 764 | Wait Until Keyword Succeeds 10m 5s Count Logical Devices flows ${targetFlows} |
| 765 | |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 766 | Count OpenOLT Device Flows |
| 767 | [Documentation] Count the flows across openolt devices in VOLTHA |
| 768 | [Arguments] ${targetFlows} |
| 769 | ${output}= Get Device List from Voltha by type openolt |
| 770 | ${devices}= To Json ${output} |
| 771 | ${total_flows}= Set Variable 0 |
| 772 | FOR ${device} IN @{devices} |
| 773 | ${rc} ${flows}= Run and Return Rc and Output |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 774 | ... 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] | 775 | Should Be Equal As Integers ${rc} 0 |
| 776 | ${total_flows}= Evaluate ${total_flows} + ${flows} |
| 777 | END |
| 778 | ${msg}= Format String Found {total_flows} flows of {targetFlows} expected |
| 779 | ... total_flows=${total_flows} targetFlows=${targetFlows} |
| 780 | Log ${msg} |
| 781 | Should Be Equal As Integers ${targetFlows} ${total_flows} |
| 782 | |
| 783 | Wait for OpenOLT Devices flows |
| 784 | [Documentation] Waits until the flows have been provisioned in the openolt devices |
| 785 | [Arguments] ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 786 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 787 | ${beforeFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
| 788 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 789 | # 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] | 790 | ${afterFlows}= Evaluate ${beforeFlows} - (${uni_count} * 2) |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 791 | # In the TT workflow we have multiple service, |
| 792 | # so we need to remove 6 flows per each UNI that are only on the ONU device |
| 793 | ${ttFlows}= Evaluate ${beforeFlows} - (${uni_count} * 6) |
| 794 | ${afterFlows}= Set Variable If $workflow=='tt' ${ttFlows} ${afterFlows} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 795 | ${targetFlows}= Set Variable If $provisioned=='true' ${afterFlows} ${beforeFlows} |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame] | 796 | Log ${targetFlows} |
Hardik Windlass | 2b37e71 | 2020-06-12 02:13:17 +0530 | [diff] [blame] | 797 | Wait Until Keyword Succeeds 10m 5s Count OpenOLT Device Flows ${targetFlows} |