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