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 |
| 81 | ... ${VOLTCTL_CONFIG}; voltctl device list ${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 |
| 91 | ... ${VOLTCTL_CONFIG}; voltctl device list --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 |
| 101 | ... ${VOLTCTL_CONFIG}; voltctl device list ${arg} --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 |
| 111 | ... ${VOLTCTL_CONFIG}; voltctl device flows ${device_id} |
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 |
| 131 | ... ${VOLTCTL_CONFIG}; voltctl device flows ${device_id} |
| 132 | ${rc2} ${ports}= Run and Return Rc and Output |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 133 | ... ${VOLTCTL_CONFIG}; voltctl device port list ${device_id} |
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 |
| 141 | ${rc1} ${devices}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list |
| 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 |
| 149 | ... ${VOLTCTL_CONFIG}; voltctl device list -f Type=${type} -o json |
| 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) |
| 156 | ${rc1} ${devices}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl logicaldevice list -o json |
| 157 | Log ${devices} |
| 158 | Should Be Equal As Integers ${rc1} 0 |
| 159 | Return From Keyword ${devices} |
| 160 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 161 | Validate Device |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 162 | [Documentation] |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 163 | ... Parses the output of "voltctl device list" and inspects a device ${id}, specified as either |
| 164 | ... the serial number or device ID. Arguments are matched for device states of: "admin_state", |
| 165 | ... "oper_status", and "connect_status" |
| 166 | [Arguments] ${admin_state} ${oper_status} ${connect_status} |
| 167 | ... ${id}=${EMPTY} ${onu_reason}=${EMPTY} ${onu}=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 168 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json |
| 169 | Should Be Equal As Integers ${rc} 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 170 | ${jsondata}= To Json ${output} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 171 | ${length}= Get Length ${jsondata} |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 172 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 173 | FOR ${INDEX} IN RANGE 0 ${length} |
| 174 | ${value}= Get From List ${jsondata} ${INDEX} |
| 175 | ${astate}= Get From Dictionary ${value} adminstate |
| 176 | ${opstatus}= Get From Dictionary ${value} operstatus |
| 177 | ${cstatus}= Get From Dictionary ${value} connectstatus |
| 178 | ${sn}= Get From Dictionary ${value} serialnumber |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 179 | ${devId}= Get From Dictionary ${value} id |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 180 | ${mib_state}= Get From Dictionary ${value} reason |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 181 | ${matched}= Set Variable If '${sn}' == '${id}' or '${devId}' == '${id}' True False |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 182 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 183 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 184 | Should Be True ${matched} No match found for ${id} to validate device |
Matteo Scandolo | 5e10b28 | 2019-11-25 10:54:32 -0700 | [diff] [blame] | 185 | Log ${value} |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 186 | Should Be Equal '${astate}' '${admin_state}' Device ${sn} admin_state != ${admin_state} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 187 | ... values=False |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 188 | Should Be Equal '${opstatus}' '${oper_status}' Device ${sn} oper_status != ${oper_status} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 189 | ... values=False |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 190 | Should Be Equal '${cstatus}' '${connect_status}' Device ${sn} conn_status != ${connect_status} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 191 | ... values=False |
| 192 | Run Keyword If '${onu}' == 'True' Should Be Equal '${mib_state}' '${onu_reason}' |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 193 | ... Device ${sn} mib_state incorrect (${mib_state}) values=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 194 | |
| 195 | Validate OLT Device |
ubuntu | 6b6e7d4 | 2020-03-02 12:35:42 -0800 | [diff] [blame] | 196 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${id}=${EMPTY} |
| 197 | [Documentation] Parses the output of "voltctl device list" and inspects device ${id}, specified |
| 198 | ... as either its serial numbner or device ID. Match on OLT Serial number or Device Id and inspect states |
| 199 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${id} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 200 | |
| 201 | Validate ONU Devices |
| 202 | [Arguments] ${admin_state} ${oper_status} ${connect_status} ${List_ONU_Serial} |
Andy Bavier | f1f26ed | 2020-03-18 10:59:07 -0700 | [diff] [blame] | 203 | ... ${onu_reason}=omci-flows-pushed |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 204 | [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] | 205 | ... Iteratively match on each Serial number contained in ${List_ONU_Serial} and inspect |
| 206 | ... states including MIB state |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 207 | FOR ${serial_number} IN @{List_ONU_Serial} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 208 | Validate Device ${admin_state} ${oper_status} ${connect_status} ${serial_number} |
Andy Bavier | f1f26ed | 2020-03-18 10:59:07 -0700 | [diff] [blame] | 209 | ... onu_reason=${onu_reason} onu=True |
Debasish | 28130d0 | 2020-03-16 11:05:26 +0000 | [diff] [blame] | 210 | END |
| 211 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 212 | Validate Device Port Types |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 213 | [Documentation] |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 214 | ... 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] | 215 | [Arguments] ${device_id} ${pon_type} ${ethernet_type} ${all_active}=True |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 216 | ${rc} ${output}= Run and Return Rc and Output |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 217 | ... ${VOLTCTL_CONFIG}; voltctl device port list ${device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 218 | Should Be Equal As Integers ${rc} 0 |
| 219 | ${jsondata}= To Json ${output} |
| 220 | Log ${jsondata} |
| 221 | ${length}= Get Length ${jsondata} |
| 222 | FOR ${INDEX} IN RANGE 0 ${length} |
| 223 | ${value}= Get From List ${jsondata} ${INDEX} |
| 224 | ${astate}= Get From Dictionary ${value} adminstate |
| 225 | ${opstatus}= Get From Dictionary ${value} operstatus |
| 226 | ${type}= Get From Dictionary ${value} type |
Hema | f64d34c | 2020-03-25 00:40:17 +0530 | [diff] [blame] | 227 | 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] | 228 | Run Keyword If ${all_active} Should Be Equal '${opstatus}' 'ACTIVE' |
| 229 | ... Device ${device_id} port oper_status != ACTIVE values=False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 230 | Should Be True '${type}' == '${pon_type}' or '${type}' == '${ethernet_type}' |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 231 | ... Device ${device_id} port type is neither ${pon_type} or ${ethernet_type} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 232 | END |
| 233 | |
| 234 | Validate OLT Port Types |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 235 | [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] | 236 | [Arguments] ${pon_type} ${ethernet_type} |
| 237 | Validate Device Port Types ${olt_device_id} ${pon_type} ${ethernet_type} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 238 | |
| 239 | Validate ONU Port Types |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 240 | [Arguments] ${List_ONU_Serial} ${pon_type} ${ethernet_type} |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 241 | [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] | 242 | ... and matches the port types listed |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 243 | FOR ${serial_number} IN @{List_ONU_Serial} |
| 244 | ${onu_dev_id}= Get Device ID From SN ${serial_number} |
Andy Bavier | 90eb1a1 | 2020-03-26 11:54:35 -0700 | [diff] [blame] | 245 | # Only first UNI port is ACTIVE; the rest are in DISCOVERED operstatus |
| 246 | 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] | 247 | END |
| 248 | |
| 249 | Validate Device Flows |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 250 | [Arguments] ${device_id} ${flow_count}=${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 251 | [Documentation] Parses the output of voltctl device flows <device_id> and expects flow count > 0 |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 252 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device flows ${device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 253 | Should Be Equal As Integers ${rc} 0 |
| 254 | ${jsondata}= To Json ${output} |
| 255 | Log ${jsondata} |
| 256 | ${length}= Get Length ${jsondata} |
| 257 | Log 'Number of flows = ' ${length} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 258 | Run Keyword If '${flow_count}' == '${EMPTY}' Should Be True ${length} > 0 |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 259 | ... Number of flows for ${device_id} was 0 |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 260 | ... ELSE Should Be True ${length} == ${flow_count} |
| 261 | ... Number of flows for ${device_id} was not ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 262 | |
| 263 | Validate OLT Flows |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 264 | [Arguments] ${flow_count}=${EMPTY} |
| 265 | [Documentation] Parses the output of voltctl device flows ${olt_device_id} |
| 266 | ... and expects flow count == ${flow_count} |
| 267 | Validate Device Flows ${olt_device_id} ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 268 | |
| 269 | Validate ONU Flows |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 270 | [Arguments] ${List_ONU_Serial} ${flow_count}=${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 271 | [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] | 272 | ... and expects flow count == ${flow_count} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 273 | FOR ${serial_number} IN @{List_ONU_Serial} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 274 | ${onu_dev_id}= Get Device ID From SN ${serial_number} |
Hardik Windlass | a3d04b9 | 2020-02-17 15:06:05 +0000 | [diff] [blame] | 275 | Validate Device Flows ${onu_dev_id} ${flow_count} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 276 | END |
| 277 | |
| 278 | Validate Logical Device |
| 279 | [Documentation] Validate Logical Device is listed |
| 280 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl logicaldevice list -o json |
| 281 | Should Be Equal As Integers ${rc} 0 |
| 282 | ${jsondata}= To Json ${output} |
| 283 | Log ${jsondata} |
| 284 | ${length}= Get Length ${jsondata} |
| 285 | FOR ${INDEX} IN RANGE 0 ${length} |
| 286 | ${value}= Get From List ${jsondata} ${INDEX} |
| 287 | ${devid}= Get From Dictionary ${value} id |
| 288 | ${rootdev}= Get From Dictionary ${value} rootdeviceid |
| 289 | ${sn}= Get From Dictionary ${value} serialnumber |
| 290 | Exit For Loop |
| 291 | END |
| 292 | Should Be Equal '${rootdev}' '${olt_device_id}' Root Device does not match ${olt_device_id} values=False |
| 293 | Should Be Equal '${sn}' '${BBSIM_OLT_SN}' Logical Device ${sn} does not match ${BBSIM_OLT_SN} |
| 294 | ... values=False |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 295 | [Return] ${devid} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 296 | |
| 297 | Validate Logical Device Ports |
| 298 | [Arguments] ${logical_device_id} |
| 299 | [Documentation] Validate Logical Device Ports are listed and are > 0 |
| 300 | ${rc} ${output}= Run and Return Rc and Output |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 301 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice port list ${logical_device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 302 | Should Be Equal As Integers ${rc} 0 |
| 303 | ${jsondata}= To Json ${output} |
| 304 | Log ${jsondata} |
| 305 | ${length}= Get Length ${jsondata} |
| 306 | Should Be True ${length} > 0 Number of ports for ${logical_device_id} was 0 |
| 307 | |
| 308 | Validate Logical Device Flows |
| 309 | [Arguments] ${logical_device_id} |
| 310 | [Documentation] Validate Logical Device Flows are listed and are > 0 |
| 311 | ${rc} ${output}= Run and Return Rc and Output |
| 312 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice flows ${logical_device_id} -o json |
| 313 | Should Be Equal As Integers ${rc} 0 |
| 314 | ${jsondata}= To Json ${output} |
| 315 | Log ${jsondata} |
| 316 | ${length}= Get Length ${jsondata} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 317 | 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] | 318 | |
| 319 | Retrieve Peer List From OLT |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 320 | [Arguments] ${olt_peer_list} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 321 | [Documentation] Retrieve the list of peer device id list from port list |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 322 | ${rc} ${output}= Run and Return Rc and Output |
David K. Bainbridge | bd5ebd2 | 2020-02-04 10:01:18 -0800 | [diff] [blame] | 323 | ... ${VOLTCTL_CONFIG}; voltctl device port list ${olt_device_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 324 | Should Be Equal As Integers ${rc} 0 |
| 325 | ${jsondata}= To Json ${output} |
| 326 | Log ${jsondata} |
| 327 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 328 | ${matched}= Set Variable False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 329 | FOR ${INDEX} IN RANGE 0 ${length} |
| 330 | ${value}= Get From List ${jsondata} ${INDEX} |
| 331 | ${type}= Get From Dictionary ${value} type |
| 332 | ${peers}= Get From Dictionary ${value} peers |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 333 | ${matched}= Set Variable If '${type}' == 'PON_OLT' True False |
| 334 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 335 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 336 | 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] | 337 | ${length}= Get Length ${peers} |
| 338 | FOR ${INDEX} IN RANGE 0 ${length} |
| 339 | ${value}= Get From List ${peers} ${INDEX} |
| 340 | ${peer_id}= Get From Dictionary ${value} deviceid |
| 341 | Append To List ${olt_peer_list} ${peer_id} |
| 342 | END |
| 343 | |
| 344 | Validate OLT Peer Id List |
| 345 | [Arguments] ${olt_peer_id_list} |
| 346 | [Documentation] Match each entry in the ${olt_peer_id_list} against ONU device ids. |
| 347 | FOR ${peer_id} IN @{olt_peer_id_list} |
| 348 | Match OLT Peer Id ${peer_id} |
| 349 | END |
| 350 | |
| 351 | Match OLT Peer Id |
| 352 | [Arguments] ${olt_peer_id} |
| 353 | [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] | 354 | ${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] | 355 | Should Be Equal As Integers ${rc} 0 |
| 356 | ${jsondata}= To Json ${output} |
| 357 | Log ${jsondata} |
| 358 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 359 | ${matched}= Set Variable False |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 360 | FOR ${INDEX} IN RANGE 0 ${length} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 361 | ${value}= Get From List ${jsondata} ${INDEX} |
| 362 | ${devid}= Get From Dictionary ${value} id |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 363 | ${matched}= Set Variable If '${devid}' == '${olt_peer_id}' True False |
| 364 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 365 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 366 | 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] | 367 | |
| 368 | Validate ONU Peer Id |
| 369 | [Arguments] ${olt_device_id} ${List_ONU_Serial} |
| 370 | [Documentation] Match each ONU peer to that of the OLT device id |
| 371 | FOR ${onu_serial} IN @{List_ONU_Serial} |
| 372 | ${onu_dev_id}= Get Device ID From SN ${onu_serial} |
| 373 | Match ONU Peer Id ${onu_dev_id} |
| 374 | END |
| 375 | |
| 376 | Match ONU Peer Id |
| 377 | [Arguments] ${onu_dev_id} |
| 378 | [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] | 379 | ${rc} ${output}= Run and Return Rc and Output |
| 380 | ... ${VOLTCTL_CONFIG}; voltctl device port list ${onu_dev_id} -o json |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 381 | Should Be Equal As Integers ${rc} 0 |
| 382 | ${jsondata}= To Json ${output} |
| 383 | Log ${jsondata} |
| 384 | ${length}= Get Length ${jsondata} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 385 | ${matched}= Set Variable False |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 386 | FOR ${INDEX} IN RANGE 0 ${length} |
| 387 | ${value}= Get From List ${jsondata} ${INDEX} |
| 388 | ${type}= Get From Dictionary ${value} type |
| 389 | ${peers}= Get From Dictionary ${value} peers |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 390 | ${matched}= Set Variable If '${type}' == 'PON_ONU' True False |
| 391 | Exit For Loop If ${matched} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 392 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 393 | 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] | 394 | ${length}= Get Length ${peers} |
| 395 | FOR ${INDEX} IN RANGE 0 ${length} |
| 396 | ${value}= Get From List ${peers} ${INDEX} |
| 397 | ${peer_id}= Get From Dictionary ${value} deviceid |
| 398 | END |
| 399 | Should Be Equal '${peer_id}' '${olt_device_id}' |
| 400 | ... 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] | 401 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 402 | Get Device ID From SN |
| 403 | [Arguments] ${serial_number} |
| 404 | [Documentation] Gets the device id by matching for ${serial_number} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 405 | ${rc} ${id}= Run and Return Rc and Output |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 406 | ... ${VOLTCTL_CONFIG}; voltctl device list --filter=SerialNumber=${serial_number} --format='{{.Id}}' |
| 407 | Should Be Equal As Integers ${rc} 0 |
| 408 | Log ${id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 409 | [Return] ${id} |
| 410 | |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 411 | Get Logical Device ID From SN |
| 412 | [Arguments] ${serial_number} |
| 413 | [Documentation] Gets the device id by matching for ${serial_number} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 414 | ${rc} ${id}= Run and Return Rc and Output |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 415 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list --filter=SerialNumber=${serial_number} --format='{{.Id}}' |
| 416 | Should Be Equal As Integers ${rc} 0 |
| 417 | Log ${id} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 418 | [Return] ${id} |
| 419 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 420 | Build ONU SN List |
| 421 | [Arguments] ${serial_numbers} |
| 422 | [Documentation] Appends all ONU SNs to the ${serial_numbers} list |
| 423 | FOR ${INDEX} IN RANGE 0 ${num_onus} |
| 424 | Append To List ${serial_numbers} ${hosts.src[${INDEX}].onu} |
| 425 | END |
| 426 | |
| 427 | Get SN From Device ID |
| 428 | [Arguments] ${device_id} |
| 429 | [Documentation] Gets the device id by matching for ${device_id} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 430 | ${rc} ${sn}= Run and Return Rc and Output |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 431 | ... ${VOLTCTL_CONFIG}; voltctl device list --filter=Id=${device_id} --format='{{.SerialNumber}}' |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 432 | Should Be Equal As Integers ${rc} 0 |
Andy Bavier | 8fca045 | 2019-12-16 15:30:11 -0700 | [diff] [blame] | 433 | Log ${sn} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 434 | [Return] ${sn} |
| 435 | |
Scott Baker | 60e570d | 2020-02-02 22:10:13 -0800 | [diff] [blame] | 436 | Get Parent ID From Device ID |
| 437 | [Arguments] ${device_id} |
| 438 | [Documentation] Gets the device id by matching for ${device_id} |
| 439 | ${rc} ${pid}= Run and Return Rc and Output |
| 440 | ... ${VOLTCTL_CONFIG}; voltctl device list --filter=Id=${device_id} --format='{{.ParentId}}' |
| 441 | Should Be Equal As Integers ${rc} 0 |
| 442 | Log ${pid} |
| 443 | [Return] ${pid} |
| 444 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 445 | Validate Device Removed |
| 446 | [Arguments] ${id} |
| 447 | [Documentation] Verifys that device, ${serial_number}, has been removed |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 448 | ${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] | 449 | Should Be Equal As Integers ${rc} 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 450 | ${jsondata}= To Json ${output} |
| 451 | Log ${jsondata} |
| 452 | ${length}= Get Length ${jsondata} |
| 453 | @{ids}= Create List |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 454 | FOR ${INDEX} IN RANGE 0 ${length} |
| 455 | ${value}= Get From List ${jsondata} ${INDEX} |
| 456 | ${device_id}= Get From Dictionary ${value} id |
| 457 | Append To List ${ids} ${device_id} |
| 458 | END |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 459 | List Should Not Contain Value ${ids} ${id} |
Suchitra Vemuri | cd2f64f | 2020-02-18 18:30:27 -0800 | [diff] [blame] | 460 | |
| 461 | Reboot ONU |
| 462 | [Arguments] ${onu_id} ${src} ${dst} |
| 463 | [Documentation] Using voltctl command reboot ONU and verify that ONU comes up to running state |
| 464 | ${rc} ${devices}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device reboot ${onu_id} |
| 465 | Should Be Equal As Integers ${rc} 0 |
| 466 | Run Keyword and Ignore Error Wait Until Keyword Succeeds 60s 1s Validate Device |
| 467 | ... ENABLED DISCOVERED UNREACHABLE ${onu_id} onu=True |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 468 | |
| 469 | Assert ONUs in Voltha |
| 470 | [Arguments] ${count} |
| 471 | [Documentation] Check that a certain number of devices reached the ACTIVE/ENABLE state |
| 472 | ${rc1} ${devices}= Run and Return Rc and Output |
| 473 | ... ${VOLTCTL_CONFIG}; voltctl device list | grep -v OLT | grep ACTIVE | wc -l |
| 474 | Should Be Equal As Integers ${rc1} 0 |
| 475 | Should Be Equal As Integers ${devices} ${count} |
| 476 | |
| 477 | Wait for ONUs in VOLTHA |
| 478 | [Arguments] ${count} |
| 479 | [Documentation] Waits until a certain number of devices reached the ACTIVE/ENABLE state |
| 480 | Wait Until Keyword Succeeds 10m 5s Assert ONUs In Voltha ${count} |
| 481 | |
| 482 | Count Logical Devices flows |
| 483 | [Documentation] Count the flows across logical devices in VOLTHA |
| 484 | [Arguments] ${targetFlows} |
| 485 | ${output}= Get Logical Device List From Voltha |
| 486 | ${logical_devices}= To Json ${output} |
| 487 | ${total_flows}= Set Variable 0 |
| 488 | FOR ${device} IN @{logical_devices} |
| 489 | ${rc} ${flows}= Run and Return Rc and Output |
| 490 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice flows ${device['id']} | grep -v ID | wc -l |
| 491 | Should Be Equal As Integers ${rc} 0 |
| 492 | ${total_flows}= Evaluate ${total_flows} + ${flows} |
| 493 | END |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame^] | 494 | ${msg}= Format String Found {total_flows} flows of {targetFlows} expected |
| 495 | ... total_flows=${total_flows} targetFlows=${targetFlows} |
| 496 | Log ${msg} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 497 | Should Be Equal As Integers ${targetFlows} ${total_flows} |
| 498 | |
| 499 | Wait for Logical Devices flows |
| 500 | [Documentation] Waits until the flows have been provisioned in the logical device |
| 501 | [Arguments] ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 502 | ... ${withEapol} ${withDhcp} ${withIgmp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 503 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 504 | ... ${withEapol} ${withDhcp} ${withIgmp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 505 | Log ${targetFlows} |
| 506 | # TODO extend Validate Logical Device Flows to check the correct number of flows |
| 507 | Wait Until Keyword Succeeds 10m 5s Count Logical Devices flows ${targetFlows} |
| 508 | |
Matteo Scandolo | 616daab | 2020-05-13 11:49:24 -0700 | [diff] [blame^] | 509 | Count OpenOLT Device Flows |
| 510 | [Documentation] Count the flows across openolt devices in VOLTHA |
| 511 | [Arguments] ${targetFlows} |
| 512 | ${output}= Get Device List from Voltha by type openolt |
| 513 | ${devices}= To Json ${output} |
| 514 | ${total_flows}= Set Variable 0 |
| 515 | FOR ${device} IN @{devices} |
| 516 | ${rc} ${flows}= Run and Return Rc and Output |
| 517 | ... ${VOLTCTL_CONFIG}; voltctl device flows ${device['id']} | grep -v ID | wc -l |
| 518 | Should Be Equal As Integers ${rc} 0 |
| 519 | ${total_flows}= Evaluate ${total_flows} + ${flows} |
| 520 | END |
| 521 | ${msg}= Format String Found {total_flows} flows of {targetFlows} expected |
| 522 | ... total_flows=${total_flows} targetFlows=${targetFlows} |
| 523 | Log ${msg} |
| 524 | Should Be Equal As Integers ${targetFlows} ${total_flows} |
| 525 | |
| 526 | Wait for OpenOLT Devices flows |
| 527 | [Documentation] Waits until the flows have been provisioned in the openolt devices |
| 528 | [Arguments] ${workflow} ${uni_count} ${olt_count} ${provisioned} |
| 529 | ... ${withEapol} ${withDhcp} ${withIgmp} |
| 530 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
| 531 | ... ${withEapol} ${withDhcp} ${withIgmp} |
| 532 | # In the physical device we only have 2 data plane flows (on the PON) instead of 4 |
| 533 | ${targetFlows}= Evaluate ${targetFlows} - (${uni_count} * 2) |
| 534 | Log ${targetFlows} |
| 535 | Wait Until Keyword Succeeds 10m 5s Count OpenOLT Device Flows ${targetFlows} |