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