| Joey Armstrong | 9fadcbe | 2024-01-17 19:00:37 -0500 | [diff] [blame] | 1 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 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. |
| 14 | # vgc common functions |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Library for various utilities |
| 18 | Library SSHLibrary |
| 19 | Library String |
| 20 | Library DateTime |
| 21 | Library Process |
| 22 | Library Collections |
| 23 | Library RequestsLibrary |
| 24 | Library OperatingSystem |
| 25 | |
| 26 | *** Variables *** |
| 27 | @{connection_list} |
| 28 | ${alias} VGC_SSH |
| 29 | ${ssh_read_timeout} 60s |
| 30 | ${ssh_prompt} karaf@root > |
| 31 | ${ssh_regexp_prompt} REGEXP:k.*a.*r.*a.*f.*@.*r.*o.*o.*t.* .*>.* |
| 32 | ${regexp_prompt} (?ms)(.*)k(.*)a(.*)r(.*)a(.*)f(.*)@(.*)r(.*)o(.*)o(.*)t(.*) (.*)>(.*) |
| 33 | ${ssh_width} 400 |
| 34 | ${disable_highlighter} setopt disable-highlighter |
| 35 | # ${keep_alive_interval} is set to 0s means sending the keepalive packet is disabled! |
| 36 | ${keep_alive_interval} 0s |
| 37 | ${INFRA_DT_NAMESPACE} infra |
| 38 | |
| 39 | |
| 40 | *** Keywords *** |
| 41 | Create VGC Session |
| 42 | [Documentation] Creates a VGC session |
| 43 | Create Session VGC http://${VGC_REST_IP}:${VGC_REST_PORT}/vgc/v1 |
| 44 | |
| 45 | Validate OLT Device in VGC |
| 46 | # FIXME use volt-olts to check that the OLT is VGC |
| 47 | [Arguments] ${serial_number} |
| 48 | [Documentation] Checks if olt has been connected to VGC |
| 49 | Create VGC Session |
| 50 | ${resp}= Get Request VGC devices |
| 51 | Log ${resp} |
| 52 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 53 | Should Not Be Empty ${jsondata['devices']} No devices data found in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 54 | ${length}= Get Length ${jsondata['devices']} |
| 55 | @{serial_numbers}= Create List |
| 56 | ${matched}= Set Variable False |
| 57 | FOR ${INDEX} IN RANGE 0 ${length} |
| 58 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 59 | ${of_id}= Get From Dictionary ${value} id |
| 60 | ${sn}= Get From Dictionary ${value} serial |
| 61 | ${matched}= Set Variable If '${sn}' == '${serial_number}' True False |
| 62 | Exit For Loop If ${matched} |
| 63 | END |
| 64 | Should Be True ${matched} No match for ${serial_number} found |
| 65 | [Return] ${of_id} |
| 66 | |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 67 | Verify meters response |
| 68 | [Arguments] ${meter_json_resp} ${us_cir} ${us_cbs} |
| 69 | ${meter_json_Length} Get Length ${meter_json_resp['bands']} |
| 70 | FOR ${I} IN RANGE 0 ${meter_json_Length} |
| 71 | ${burst_size}= Get From Dictionary ${meter_json_resp['bands'][${I}]} burstSize |
| 72 | ${rate}= Get From Dictionary ${meter_json_resp['bands'][${I}]} rate |
| 73 | Log ${rate} |
| 74 | Log ${burst_size} |
| 75 | ${matched}= Evaluate '${rate}' == '${us_cir}' and '${burst_size}' == '${us_cbs}' |
| 76 | Exit For Loop If ${matched} |
| 77 | END |
| 78 | [Return] ${matched} |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 79 | |
| 80 | |
| 81 | Validate Deleted Device Cleanup In VGC |
| 82 | [Arguments] ${ip} ${port} ${olt_serial_number} ${olt_of_id} ${maclearning_enabled}=False |
| 83 | [Documentation] The keyword verifies that ports, flows, meters, subscribers, dhcp are all cleared in VGC |
| 84 | # Verify Ports are Removed |
| 85 | ${ports}= Get Request VGC devices/ports |
| 86 | ${port_json_resp}= To Json ${ports.content} |
| 87 | Should Not Contain ${port_json_resp} ${olt_of_id} Ports have not been removed from VGC after cleanup |
| 88 | # Verify Subscribers are Removed |
| 89 | ${sub}= Get Request VGC programmed-subscribers |
| 90 | ${sub_json_resp}= To Json ${sub.content} |
| 91 | Should Not Contain ${sub_json_resp} ${olt_of_id} Subscriber have not been removed from VGC after cleanup |
| 92 | # Verify Flows are Removed |
| 93 | ${flows}= Get Request VGC flows |
| 94 | ${flow_json_resp}= To Json ${flows.content} |
| 95 | Should Not Contain ${flow_json_resp} ${olt_of_id} Flows have not been removed from VGC after cleanup |
| 96 | # Verify Meters are Removed |
| 97 | ${meter}= Get Request VGC meters |
| 98 | ${meter_json_resp}= To Json ${meter.content} |
| 99 | Should Not Contain ${meter_json_resp} ${olt_of_id} Meter have not been removed from VGC after cleanup |
| 100 | # Verify AAA-Users are Removed |
| 101 | # ${aaa}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 102 | #... aaa-users ${olt_of_id} |
| 103 | # ${aaa_count}= Get Line Count ${aaa} |
| 104 | #Should Be Equal As Integers ${aaa_count} 0 AAA Users have not been removed from ONOS after cleanup |
| 105 | # Verify Dhcp-Allocations are Removed |
| 106 | ${dhcp}= Get Request VGC allocations/${olt_of_id} |
| 107 | ${dhcp_json_resp}= To Json ${dhcp.content} |
| 108 | ${dhcp_count} = Get Length ${dhcp_json_resp} |
| 109 | #Should Be Equal ${dhcp_json_resp} ${None} DHCP Allocations have not been removed from VGC after cleanup |
| 110 | Should Be Equal As Integers ${dhcp_count} 0 DHCP Allocations have not been removed from VGC after cleanup |
| 111 | # Verify MAC Learner Mappings are Removed |
| 112 | # ${mac}= Run Keyword If ${maclearning_enabled} Execute ONOS CLI Command use single connection ${ip} ${port} |
| 113 | # ... mac-learner-get-mapping | grep -v INFO |
| 114 | # ${mac_count}= Run Keyword If ${maclearning_enabled} Get Line Count ${mac} |
| 115 | # ... ELSE Set Variable 0 |
| 116 | # Should Be Equal As Integers ${mac_count} 0 Client MAC Learner Mappings have not been removed from ONOS after cleanup |
| 117 | |
| 118 | |
| 119 | Get NNI Port in VGC |
| 120 | [Arguments] ${olt_of_id} |
| 121 | [Documentation] Retrieves NNI port for the OLT in VGC |
| 122 | ${resp}= Get Request VGC devices/${olt_of_id}/ports |
| 123 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 124 | Should Not Be Empty ${jsondata['ports']} No ports data found for OLT ${olt_of_id} in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 125 | ${length}= Get Length ${jsondata['ports']} |
| 126 | @{ports}= Create List |
| 127 | ${matched}= Set Variable False |
| 128 | FOR ${INDEX} IN RANGE 0 ${length} |
| 129 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 130 | ${annotations}= Get From Dictionary ${value} annotations |
| 131 | ${nni_port}= Get From Dictionary ${value} port |
| 132 | ${nniPortName}= Catenate SEPARATOR= nni- ${nni_port} |
| 133 | ${portName}= Get From Dictionary ${annotations} portName |
| 134 | ${matched}= Set Variable If '${portName}' == '${nniPortName}' True False |
| 135 | Exit For Loop If ${matched} |
| 136 | END |
| 137 | Should Be True ${matched} No match for NNI found for ${olt_of_id} |
| 138 | [Return] ${nni_port} |
| 139 | |
| 140 | |
| 141 | |
| 142 | Get ONU Port in VGC |
| 143 | [Arguments] ${onu_serial_number} ${olt_of_id} ${onu_uni_id}=1 |
| 144 | [Documentation] Retrieves ONU port for the ONU in VGC |
| 145 | ${onu_serial_number}= Catenate SEPARATOR=- ${onu_serial_number} ${onu_uni_id} |
| 146 | ${resp}= Get Request VGC devices/${olt_of_id}/ports |
| 147 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 148 | Should Not Be Empty ${jsondata['ports']} No ports data found for OLT ${olt_of_id} in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 149 | ${length}= Get Length ${jsondata['ports']} |
| 150 | @{ports}= Create List |
| 151 | ${matched}= Set Variable False |
| 152 | FOR ${INDEX} IN RANGE 0 ${length} |
| 153 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 154 | ${annotations}= Get From Dictionary ${value} annotations |
| 155 | ${onu_port}= Get From Dictionary ${value} port |
| 156 | ${portName}= Get From Dictionary ${annotations} portName |
| 157 | ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False |
| 158 | Exit For Loop If ${matched} |
| 159 | END |
| 160 | Should Be True ${matched} No match for ${onu_serial_number} found |
| 161 | [Return] ${onu_port} |
| 162 | |
| 163 | |
| 164 | |
| 165 | Verify UNI Port Is Enabled |
| 166 | [Arguments] ${onu_name} ${onu_uni_id}=1 |
| 167 | [Documentation] Verifies if the ONU's UNI port is enabled in VGC |
| 168 | ${onu_serial_number}= Catenate SEPARATOR=- ${onu_name} ${onu_uni_id} |
| 169 | ${resp}= Get Request VGC devices/ports |
| 170 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 171 | Should Not Be Empty ${jsondata['ports']} No devices ports data in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 172 | ${length}= Get Length ${jsondata['ports']} |
| 173 | @{ports}= Create List |
| 174 | ${matched}= Set Variable False |
| 175 | FOR ${INDEX} IN RANGE 0 ${length} |
| 176 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 177 | ${annotations}= Get From Dictionary ${value} annotations |
| 178 | ${onu_port}= Get From Dictionary ${value} port |
| 179 | ${portName}= Get From Dictionary ${annotations} portName |
| 180 | ${portstatus}= Get From Dictionary ${value} isEnabled |
| 181 | ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False |
| 182 | Exit For Loop If ${matched} |
| 183 | END |
| 184 | Should Be True ${matched} No match for ${onu_serial_number} found |
| 185 | Should be Equal ${portstatus} ${True} |
| 186 | |
| 187 | |
| 188 | Verify UNI Port Is Disabled |
| 189 | [Arguments] ${ip} ${port} ${onu_name} ${onu_uni_id}=1 |
| 190 | [Documentation] Verifies if the ONU's UNI port is enabled in VGC |
| 191 | ${onu_serial_number}= Catenate SEPARATOR=- ${onu_name} ${onu_uni_id} |
| 192 | ${resp}= Get Request VGC devices/ports |
| 193 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 194 | Should Not Be Empty ${jsondata['ports']} No devices ports data in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 195 | ${length}= Get Length ${jsondata['ports']} |
| 196 | @{ports}= Create List |
| 197 | ${matched}= Set Variable False |
| 198 | FOR ${INDEX} IN RANGE 0 ${length} |
| 199 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 200 | ${annotations}= Get From Dictionary ${value} annotations |
| 201 | ${onu_port}= Get From Dictionary ${value} port |
| 202 | ${portName}= Get From Dictionary ${annotations} portName |
| 203 | ${portstatus}= Get From Dictionary ${value} isEnabled |
| 204 | ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False |
| 205 | Exit For Loop If ${matched} |
| 206 | END |
| 207 | Should Be True ${matched} No match for ${onu_serial_number} found |
| 208 | Should be Equal ${portstatus} ${False} |
| 209 | |
| 210 | Close All VGC SSH Connections |
| 211 | [Documentation] Close all VGC Connection and clear connection list. |
| 212 | SSHLibrary.Close All Connections |
| 213 | @{connection_list} Create List |
| 214 | |
| 215 | |
| 216 | |
| 217 | Verify Subscriber Access Flows Added For ONU DT in VGC |
| 218 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${s_tag} |
| 219 | [Documentation] Verifies if the Subscriber Access Flows are added in VGC for the ONU |
| 220 | # Get all flows from VGC |
| 221 | ${resp}= Get Request VGC flows/${olt_of_id} |
| 222 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 223 | Should Not Be Empty ${jsondata['flows']} No flows data found for OLT ${olt_of_id} in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 224 | # Verify upstream table=0 flow |
| 225 | ${length}= Get Length ${jsondata['flows']} |
| 226 | @{flows}= Create List |
| 227 | ${matched}= Set Variable False |
| 228 | FOR ${INDEX} IN RANGE 0 ${length} |
| 229 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 230 | ${tableid}= Get Table Id From Flow ${flow} |
| 231 | ${inport}= Get In Port From Flow ${flow} |
| 232 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 233 | ${outport}= Get Out Port From Flow ${flow} |
| 234 | ${matched}= Set Variable If |
| 235 | ... '${tableid}' == '0' and '${inport}' == '${onu_port}' and '${vlanvid}' == '4096' and '${outport}' == '1' |
| 236 | ... True False |
| 237 | Exit For Loop If ${matched} |
| 238 | END |
| 239 | Should Be True ${matched} No match for upstream table 0 flow found |
| 240 | # Verify upstream table=1 flow |
| 241 | ${matched1}= Set Variable False |
| 242 | FOR ${INDEX} IN RANGE 0 ${length} |
| 243 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 244 | ${inport}= Get In Port From Flow ${flow} |
| 245 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 246 | ${outport}= Get Out Port From Flow ${flow} |
| 247 | ${subtype}= Get Subtype From Flow ${flow} |
| 248 | ${vlanid}= Get Vlan Id From Flow ${flow} |
| 249 | ${res1}= Evaluate '${inport}' == '${onu_port}' |
| 250 | ${res2}= Evaluate '${vlanvid}' == '4096' and '${outport}' == '${nni_port}' |
| 251 | ${res3}= Evaluate '${subtype}' == 'VLAN_PUSH' and '${vlanid}' == '${s_tag}' |
| 252 | ${matched1}= Set Variable If ${res1} and ${res2} and ${res3} True False |
| 253 | Exit For Loop If ${matched1} |
| 254 | END |
| 255 | Should Be True ${matched1} No match for upstream table 1 flow found |
| 256 | # Verify downstream table=0 flow |
| 257 | ${matched2}= Set Variable False |
| 258 | FOR ${INDEX} IN RANGE 0 ${length} |
| 259 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 260 | ${inport}= Get In Port From Flow ${flow} |
| 261 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 262 | ${outport}= Get Out Port From Flow ${flow} |
| 263 | ${subtype}= Get Subtype From Flow ${flow} |
| 264 | ${res1}= Evaluate '${inport}' == '${nni_port}' |
| 265 | ${res2}= Evaluate '${vlanvid}' == '${s_tag}' and '${outport}' == '1' |
| 266 | ${res3}= Evaluate '${subtype}' == 'VLAN_POP' |
| 267 | ${matched2}= Set Variable If ${res1} and ${res2} and ${res3} True False |
| 268 | Exit For Loop If ${matched2} |
| 269 | END |
| 270 | Should Be True ${matched2} No match for downstream table 0 flow found |
| 271 | # Verify downstream table=1 flow |
| 272 | ${matched3}= Set Variable False |
| 273 | FOR ${INDEX} IN RANGE 0 ${length} |
| 274 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 275 | ${inport}= Get In Port From Flow ${flow} |
| 276 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 277 | ${outport}= Get Out Port From Flow ${flow} |
| 278 | ${matched3}= Set Variable If |
| 279 | ... '${inport}' == '${nni_port}' and '${vlanvid}' == '4096' and '${outport}' == '${onu_port}' |
| 280 | ... True False |
| 281 | Exit For Loop If ${matched3} |
| 282 | END |
| 283 | Should Be True ${matched3} "No match for downstream table 1 flow found" |
| 284 | |
| 285 | Verify Subscriber Access Flows Added for DT FTTB |
| 286 | [Arguments] ${olt_of_id} ${onu_port} ${nni_port} ${s_tag} ${c_tag} |
| 287 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 288 | # Get all flows from VGC |
| 289 | ${resp}= Get Request VGC flows/${olt_of_id} |
| 290 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 291 | Should Not Be Empty ${jsondata['flows']} No ports data found for OLT ${olt_of_id} in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 292 | # Upstream |
| 293 | # ONU |
| 294 | ${length}= Get Length ${jsondata['flows']} |
| 295 | @{flows}= Create List |
| 296 | ${matched}= Set Variable False |
| 297 | FOR ${INDEX} IN RANGE 0 ${length} |
| 298 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 299 | ${tableid}= Get Table Id From Flow ${flow} |
| 300 | ${inport}= Get In Port From Flow ${flow} |
| 301 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 302 | ${outport}= Get Out Port From Flow ${flow} |
| 303 | ${matched}= Set Variable If |
| 304 | ... '${inport}' == '${onu_port}' and '${vlanvid}' == '${c_tag}' and '${outport}' == '1' |
| 305 | ... True False |
| 306 | Exit For Loop If ${matched} |
| 307 | END |
| 308 | Should Be True ${matched} No match for upstream ONU flow found |
| 309 | # OLT |
| 310 | ${matched1}= Set Variable False |
| 311 | FOR ${INDEX} IN RANGE 0 ${length} |
| 312 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 313 | ${inport}= Get In Port From Flow ${flow} |
| 314 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 315 | ${outport}= Get Out Port From Flow ${flow} |
| 316 | ${vlanid}= Get Vlan Id From Flow For Fttb ${flow} |
| 317 | ${res1}= Evaluate '${inport}' == '${onu_port}' |
| 318 | ${res2}= Evaluate '${vlanvid}' == '${c_tag}' and '${vlanid}' == '${s_tag}' |
| 319 | ${res3}= Evaluate '${outport}' == '${nni_port}' |
| 320 | ${matched1}= Set Variable If ${res1} and ${res2} and ${res3} True False |
| 321 | Exit For Loop If ${matched1} |
| 322 | END |
| 323 | Should Be True ${matched1} No match for upstream OLT found |
| 324 | # Downstream |
| 325 | # OLT |
| 326 | ${matched2}= Set Variable False |
| 327 | FOR ${INDEX} IN RANGE 0 ${length} |
| 328 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 329 | ${inport}= Get In Port From Flow ${flow} |
| 330 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 331 | ${outport}= Get Out Port From Flow ${flow} |
| 332 | ${vlanid}= Get Vlan Id From Flow For Fttb ${flow} |
| 333 | ${res1}= Evaluate '${inport}' == '${nni_port}' |
| 334 | ${res2}= Evaluate '${vlanvid}' == '${s_tag}' and '${vlanid}' == '${c_tag}' |
| 335 | ${res3}= Evaluate '${outport}' == '1' |
| 336 | ${matched2}= Set Variable If ${res1} and ${res2} and ${res3} True False |
| 337 | Exit For Loop If ${matched2} |
| 338 | END |
| 339 | Should Be True ${matched2} No match for downstream OLT found |
| 340 | # ONU |
| 341 | ${matched3}= Set Variable False |
| 342 | FOR ${INDEX} IN RANGE 0 ${length} |
| 343 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 344 | ${inport}= Get In Port From Flow ${flow} |
| 345 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 346 | ${tableid}= Get Table Id From Flow ${flow} |
| 347 | ${outport}= Get Out Port From Flow ${flow} |
| 348 | ${vlanid}= Get Vlan Id From Flow For Fttb ${flow} |
| 349 | ${res1}= Evaluate '${inport}' == '${nni_port}' |
| 350 | ${res2}= Evaluate '${vlanvid}' == '${c_tag}' and '${outport}' == '${onu_port}' |
| 351 | ${matched3}= Set Variable If ${res1} and ${res2} True False |
| 352 | Exit For Loop If ${matched3} |
| 353 | END |
| 354 | Should Be True ${matched3} No match for downstream ONU found |
| 355 | |
| 356 | Verify DPU MGMT Flows Added for DT FTTB |
| 357 | [Arguments] ${olt_of_id} ${onu_port} ${nni_port} ${s_tag} ${c_tag} |
| 358 | [Documentation] Verifies if the DPU MGMT Flows are added in VGC for the ONU |
| 359 | # Get all flows from VGC |
| 360 | ${resp}= Get Request VGC flows/${olt_of_id} |
| 361 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 362 | Should Not Be Empty ${jsondata['flows']} No ports data found for OLT ${olt_of_id} in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 363 | # Upstream |
| 364 | # ONU |
| 365 | ${length}= Get Length ${jsondata['flows']} |
| 366 | @{flows}= Create List |
| 367 | ${matched}= Set Variable False |
| 368 | FOR ${INDEX} IN RANGE 0 ${length} |
| 369 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 370 | ${tableid}= Get Table Id From Flow ${flow} |
| 371 | ${inport}= Get In Port From Flow ${flow} |
| 372 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 373 | ${vlanid}= Get Vlan Id From Flow For Fttb ${flow} |
| 374 | ${outport}= Get Out Port From Flow ${flow} |
| 375 | ${res1}= Evaluate '${inport}' == '${onu_port}' |
| 376 | ${res2}= Evaluate '${vlanvid}' == '${c_tag}' and '${vlanid}' == '${s_tag}' |
| 377 | ${res3}= Evaluate '${outport}' == '1' |
| 378 | ${matched}= Set Variable If ${res1} and ${res2} and ${res3} True False |
| 379 | Exit For Loop If ${matched} |
| 380 | END |
| 381 | Should Be True ${matched} No match for upstream ONU flow found |
| 382 | # OLT |
| 383 | ${matched1}= Set Variable False |
| 384 | FOR ${INDEX} IN RANGE 0 ${length} |
| 385 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 386 | ${inport}= Get In Port From Flow ${flow} |
| 387 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 388 | ${outport}= Get Out Port From Flow ${flow} |
| 389 | ${vlanid}= Get Vlan Id From Flow For Fttb ${flow} |
| 390 | ${matched1}= Set Variable If |
| 391 | ... '${inport}' == '${onu_port}' and '${vlanvid}' == '${s_tag}' and '${outport}' == '${nni_port}' |
| 392 | ... True False |
| 393 | ${matched1}= Set Variable If ${res1} and ${res2} and ${res3} True False |
| 394 | Log To Console "bbb",'${inport}' == '${onu_port}' '${vlanvid}' == '${s_tag}' '${outport}' == '${nni_port}' |
| 395 | Exit For Loop If ${matched1} |
| 396 | END |
| 397 | Should Be True ${matched1} No match for upstream OLT found |
| 398 | # Downstream |
| 399 | # OLT |
| 400 | ${matched2}= Set Variable False |
| 401 | FOR ${INDEX} IN RANGE 0 ${length} |
| 402 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 403 | ${inport}= Get In Port From Flow ${flow} |
| 404 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 405 | ${outport}= Get Out Port From Flow ${flow} |
| 406 | ${vlanid}= Get Vlan Id From Flow For Fttb ${flow} |
| 407 | ${matched3}= Set Variable If |
| 408 | ... '${inport}' == '${nni_port}' and '${vlanvid}' == '${s_tag}' and '${outport}' == '1' |
| 409 | ... True False |
| 410 | Exit For Loop If ${matched3} |
| 411 | END |
| 412 | Should Be True ${matched3} No match for downstream OLT found |
| 413 | # ONU |
| 414 | ${matched4}= Set Variable False |
| 415 | FOR ${INDEX} IN RANGE 0 ${length} |
| 416 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 417 | ${inport}= Get In Port From Flow ${flow} |
| 418 | ${vlanvid}= Get Vlan VId From Flow ${flow} |
| 419 | ${tableid}= Get Table Id From Flow ${flow} |
| 420 | ${outport}= Get Out Port From Flow ${flow} |
| 421 | ${vlanid}= Get Vlan Id From Flow For Fttb ${flow} |
| 422 | ${res1}= Evaluate '${inport}' == '${nni_port}' |
| 423 | ${res2}= Evaluate '${vlanvid}' == '${s_tag}' and '${vlanid}' == '${c_tag}' |
| 424 | ${res3}= Evaluate '${outport}' == '${onu_port}' |
| 425 | ${matched4}= Set Variable If ${res1} and ${res2} and ${res3} True False |
| 426 | Exit For Loop If ${matched4} |
| 427 | END |
| 428 | Should Be True ${matched4} No match for downstream ONU found |
| 429 | |
| 430 | Verify VGC Flows Added for DT FTTB |
| 431 | [Arguments] ${olt_of_id} ${onu_port} ${nni_port} ${service} |
| 432 | [Documentation] Verifies if the Flows are added in ONOS for the ONU |
| 433 | ${num_services}= Get Length ${service} |
| 434 | FOR ${I} IN RANGE 0 ${num_services} |
| 435 | ${service_name}= Set Variable ${service[${I}]['name']} |
| Guru Prasanna | 0ae8e69 | 2025-05-02 15:03:40 +0530 | [diff] [blame] | 436 | ${dpustag}= Set Variable ${service[0]['s_tag']} |
| 437 | ${dpuctag}= Set Variable ${service[0]['c_tag']} |
| 438 | ${stag}= Set Variable ${service[1]['s_tag']} |
| 439 | ${ctag}= Set Variable ${service[1]['c_tag']} |
| rbodapat | fe5bb15 | 2025-03-17 11:34:42 +0530 | [diff] [blame] | 440 | Run Keyword If '${service_name}' == 'FTTB_SUBSCRIBER_TRAFFIC' Run Keywords |
| 441 | Verify Subscriber Access Flows Added for DT FTTB ${olt_of_id} ${onu_port} ${nni_port} ${stag} ${ctag} |
| Guru Prasanna | 0ae8e69 | 2025-05-02 15:03:40 +0530 | [diff] [blame] | 442 | Verify DPU MGMT Flows Added for DT FTTB ${olt_of_id} ${onu_port} ${nni_port} ${dpustag} ${dpuctag} |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 443 | END |
| 444 | |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 445 | Add Subscriber Details |
| 446 | [Documentation] Adds a particular subscriber |
| 447 | [Arguments] ${of_id} ${onu_port} |
| 448 | ${resp}= Post Request VGC services/${of_id}/${onu_port} |
| 449 | Log ${resp} |
| 450 | Should Be Equal As Strings ${resp.status_code} 200 |
| 451 | |
| 452 | Remove Subscriber Access |
| 453 | [Documentation] Removes a particular subscriber |
| 454 | [Arguments] ${of_id} ${onu_port} |
| 455 | ${resp}= Delete Request VGC services/${of_id}/${onu_port} |
| 456 | Log ${resp} |
| 457 | Should Be Equal As Strings ${resp.status_code} 200 |
| 458 | |
| 459 | Send File To VGC |
| 460 | [Documentation] Send the content of the file to VGC to selected section of configuration |
| 461 | ... using Post Request |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 462 | [Arguments] ${CONFIG_FILE} ${dest} #${section}=${EMPTY} |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 463 | ${Headers}= Create Dictionary Content-Type application/json |
| 464 | ${File_Data}= OperatingSystem.Get File ${CONFIG_FILE} |
| 465 | Log ${Headers} |
| 466 | Log ${File_Data} |
| 467 | ${resp}= Post Request VGC |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 468 | ... ${dest} headers=${Headers} data=${File_Data} |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 469 | Should Be Equal As Strings ${resp.status_code} 200 |
| 470 | |
| 471 | Verify No Pending Flows For ONU |
| 472 | [Arguments] ${ip} ${port} ${onu_port} |
| 473 | [Documentation] Verifies that there are no flows "PENDING" state for the ONU in VGC |
| 474 | ${resp}= Get Request VGC flows/pending |
| 475 | ${jsondata}= To Json ${resp.content} |
| 476 | ${length}= Get Length ${jsondata['flows']} |
| 477 | ${matched}= Set Variable False |
| 478 | FOR ${INDEX} IN RANGE 0 ${length} |
| 479 | ${flow}= Get From List ${jsondata['flows']} ${INDEX} |
| 480 | ${inport}= Get In Port From Flow ${flow} |
| 481 | ${matched}= Run Keyword If '${inport}' == '${onu_port}' Set Variable ${TRUE} |
| 482 | Exit For Loop If ${matched} |
| 483 | END |
| 484 | Should Be Equal ${matched} False No match for pending flow found |
| 485 | |
| 486 | Get Pending Flow Count |
| 487 | [Documentation] Get the count for flows "PENDING" state for the ONU in VGC |
| 488 | ${resp}= Get Request VGC flows/pending |
| 489 | ${jsondata}= To Json ${resp.content} |
| 490 | ${length}= Get Length ${jsondata['flows']} |
| 491 | [Return] ${length} |
| 492 | |
| 493 | Get In Port From Flow |
| 494 | [Documentation] Fetches the port Record for IN_PORT |
| 495 | [Arguments] ${flow} |
| 496 | ${selector}= Get From Dictionary ${flow} selector |
| 497 | ${len}= Get Length ${selector['criteria']} |
| 498 | ${matched}= Set Variable False |
| 499 | FOR ${INDEX} IN RANGE 0 ${len} |
| 500 | ${criteria}= Get From List ${selector['criteria']} ${INDEX} |
| 501 | ${type}= Get From Dictionary ${criteria} type |
| 502 | ${port}= Run Keyword If '${type}' == 'IN_PORT' Get From Dictionary ${criteria} port |
| 503 | ${matched}= Set Variable If '${type}' == 'IN_PORT' True False |
| 504 | Exit For Loop If ${matched} |
| 505 | END |
| 506 | [Return] ${port} |
| 507 | |
| 508 | |
| 509 | |
| 510 | Get Vlan VId From Flow |
| 511 | [Documentation] Fetches the vlan Id |
| 512 | [Arguments] ${flow} |
| 513 | ${selector}= Get From Dictionary ${flow} selector |
| 514 | ${len}= Get Length ${selector['criteria']} |
| 515 | ${matched}= Set Variable False |
| 516 | ${vlanid}= Set Variable |
| 517 | FOR ${INDEX} IN RANGE 0 ${len} |
| 518 | ${criteria}= Get From List ${selector['criteria']} ${INDEX} |
| 519 | ${type}= Get From Dictionary ${criteria} type |
| 520 | ${vlanid}= Run Keyword If '${type}' == 'VLAN_VID' Get From Dictionary ${criteria} vlanId |
| 521 | ${matched}= Set Variable If '${type}' == 'VLAN_VID' True False |
| 522 | Exit For Loop If ${matched} |
| 523 | END |
| 524 | [Return] ${vlanid} |
| 525 | |
| 526 | |
| 527 | Get Out Port From Flow |
| 528 | [Documentation] Fetches the port for OUTPUT |
| 529 | [Arguments] ${flow} |
| 530 | ${treatment}= Get From Dictionary ${flow} treatment |
| 531 | ${len}= Get Length ${treatment['instructions']} |
| 532 | ${matched}= Set Variable False |
| 533 | FOR ${INDEX} IN RANGE 0 ${len} |
| 534 | ${instructions}= Get From List ${treatment['instructions']} ${INDEX} |
| 535 | ${type}= Get From Dictionary ${instructions} type |
| 536 | ${outport}= Run Keyword If '${type}' == 'OUTPUT' Get From Dictionary ${instructions} port |
| 537 | ${matched}= Set Variable If '${type}' == 'OUTPUT' True False |
| 538 | Exit For Loop If ${matched} |
| 539 | END |
| 540 | [Return] ${outport} |
| 541 | |
| 542 | |
| 543 | Get Subtype From Flow |
| 544 | [Documentation] Fetches the L2MODIFICATION subtype |
| 545 | [Arguments] ${flow} |
| 546 | ${treatment}= Get From Dictionary ${flow} treatment |
| 547 | ${len}= Get Length ${treatment['instructions']} |
| 548 | ${matched}= Set Variable False |
| 549 | FOR ${INDEX} IN RANGE 0 ${len} |
| 550 | ${instructions}= Get From List ${treatment['instructions']} ${INDEX} |
| 551 | ${type}= Get From Dictionary ${instructions} type |
| 552 | ${subtype}= Run Keyword If '${type}' == 'L2MODIFICATION' Get From Dictionary ${instructions} subtype |
| 553 | ${matched}= Set Variable If '${type}' == 'L2MODIFICATION' True False |
| 554 | Exit For Loop If ${matched} |
| 555 | END |
| 556 | [Return] ${subtype} |
| 557 | |
| 558 | Get Vlan Id From Flow For Fttb |
| 559 | [Documentation] Fetch the VLAN id for L2MODIFICATION |
| 560 | [Arguments] ${flow} |
| 561 | ${treatment}= Get From Dictionary ${flow} treatment |
| 562 | ${len}= Get Length ${treatment['instructions']} |
| 563 | ${matched}= Set Variable False |
| 564 | FOR ${INDEX} IN RANGE 0 ${len} |
| 565 | ${instructions}= Get From List ${treatment['instructions']} ${INDEX} |
| 566 | ${type}= Get From Dictionary ${instructions} type |
| 567 | ${subtype}= Run Keyword If '${type}' == 'L2MODIFICATION' Get From Dictionary ${instructions} subtype |
| 568 | ${vlanId}= Run Keyword If '${type}' == 'L2MODIFICATION' and '${subtype}' == 'VLAN_SET' |
| 569 | ... Get From Dictionary ${instructions} vlanId |
| 570 | ${matched}= Set Variable If '${type}' == 'L2MODIFICATION' and '${subtype}' == 'VLAN_SET' True False |
| 571 | Exit For Loop If ${matched} |
| 572 | END |
| 573 | [Return] ${vlanId} |
| 574 | |
| 575 | Get Table Id From Flow |
| 576 | [Documentation] Fetch the TableId |
| 577 | [Arguments] ${flow} |
| 578 | ${tableid}= Get From Dictionary ${flow} tableId |
| 579 | [Return] ${tableid} |
| 580 | |
| 581 | Get Vlan Id From Flow |
| 582 | [Documentation] Fetch the VLAN id for L2MODIFICATION |
| 583 | [Arguments] ${flow} |
| 584 | ${treatment}= Get From Dictionary ${flow} treatment |
| 585 | ${len}= Get Length ${treatment['instructions']} |
| 586 | ${matched}= Set Variable False |
| 587 | FOR ${INDEX} IN RANGE 0 ${len} |
| 588 | ${instructions}= Get From List ${treatment['instructions']} ${INDEX} |
| 589 | ${type}= Get From Dictionary ${instructions} type |
| 590 | ${subtype}= Run Keyword If '${type}' == 'L2MODIFICATION' Get From Dictionary ${instructions} subtype |
| 591 | ${vlanId}= Run Keyword If '${type}' == 'L2MODIFICATION' and '${subtype}' == 'VLAN_ID' |
| 592 | ... Get From Dictionary ${instructions} vlanId |
| 593 | ${matched}= Set Variable If '${type}' == 'L2MODIFICATION' and '${subtype}' == 'VLAN_ID' True False |
| 594 | Exit For Loop If ${matched} |
| 595 | END |
| 596 | [Return] ${vlanId} |
| 597 | |
| 598 | Get Subscribers for a Particular Service |
| 599 | [Documentation] Filters the subscriber for a particular service |
| 600 | [Arguments] ${olt_of_id} ${subscriber_json} ${filter} |
| 601 | ${subscribers_info}= Get From Dictionary ${subscriber_json} subscribers |
| 602 | ${num_subscribers}= Get Length ${subscribers_info} |
| 603 | ${subscriber_list} Create List |
| 604 | Return From Keyword If '${filter}' == '${EMPTY}' ${subscribers_info} |
| 605 | FOR ${INDEX} IN RANGE 0 ${num_subscribers} |
| 606 | ${subscriber}= Get From List ${subscribers_info} ${INDEX} |
| 607 | ${res1}= Evaluate '${olt_of_id}' == '${subscriber["location"]}' |
| 608 | ${tag_subscriber_info}= Get From Dictionary ${subscriber} tagInfo |
| 609 | ${ServiceName}= Get From Dictionary ${tag_subscriber_info} serviceName |
| 610 | ${res2}= Evaluate '${filter}' == '${ServiceName}' |
| 611 | Run Keyword If ${res1} and ${res2} |
| 612 | ... Append To List ${subscriber_list} ${subscriber} |
| 613 | ${matched}= Set Variable If ${res1} and ${res2} True False |
| 614 | Exit For Loop If ${matched} |
| 615 | END |
| 616 | Should Be True ${matched} No matching subscriber for OLT |
| 617 | [Return] ${subscriber_list} |
| 618 | |
| 619 | Get Programmed Subscribers |
| 620 | [Arguments] ${olt_of_id} ${onu_port} ${filter}=${EMPTY} |
| 621 | [Documentation] Retrieves the subscriber details at a given location |
| 622 | ${programmed_sub}= Get Request VGC programmed-subscribers |
| 623 | ${programmed_sub_json_resp}= To Json ${programmed_sub.content} |
| 624 | ${filtered_subscriber_list}= Get Subscribers for a Particular Service ${olt_of_id} ${programmed_sub_json_resp} |
| 625 | ... ${filter} |
| 626 | [Return] ${filtered_subscriber_list} |
| 627 | |
| 628 | Verify Programmed Subscribers DT FTTB |
| 629 | [Arguments] ${olt_of_id} ${onu_port} ${service} |
| 630 | [Documentation] Verifies the subscriber is present at a given location |
| 631 | ${num_services}= Get Length ${service} |
| 632 | FOR ${I} IN RANGE 0 ${num_services} |
| 633 | ${service_name}= Set Variable ${service[${I}]['name']} |
| 634 | ${programmed_subscriber}= Get Programmed Subscribers ${olt_of_id} ${onu_port} |
| 635 | ... ${service_name} |
| 636 | Log ${programmed_subscriber} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 637 | Should Not Be Empty ${programmed_subscriber} No programmed subscribers found for ${service_name} |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 638 | END |
| 639 | |
| 640 | Verify Meters in VGC Ietf |
| 641 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${filter}=${EMPTY} |
| 642 | [Documentation] Verifies the meters with BW Ietf format (currently, DT workflow uses this format) |
| 643 | ${programmed_sub_json_resp}= Get Programmed Subscribers ${olt_of_id} ${onu_port} |
| 644 | ... ${filter} |
| 645 | Log ${programmed_sub_json_resp} |
| 646 | ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name |
| 647 | ... ${programmed_sub_json_resp} |
| 648 | # Get upstream bandwidth profile details |
| 649 | ${us_cir} ${us_cbs} ${us_pir} ${us_pbs} ${us_gir} Get Bandwidth Profile Details Ietf Rest |
| 650 | ... ${us_bw_profile} |
| 651 | # Verify meter for upstream bandwidth profile |
| 652 | ${meter}= Get Request VGC meters |
| 653 | ${meter_json_resp}= To Json ${meter.content} |
| 654 | Log ${meter_json_resp} |
| 655 | ${rate} ${burst_size} Get Meter Param In Details |
| 656 | ... ${meter_json_resp} 1 |
| 657 | Log ${rate} |
| 658 | Log ${burst_size} |
| 659 | # for cir & cbs |
| 660 | ${matched}= Set Variable If '${rate}' == '${us_cir}' and '${burst_size}' == '${us_cbs}' True False |
| 661 | Should Be True ${matched} |
| 662 | ${res1}= Evaluate '${rate}' == '${us_cir}' and '${burst_size}' == '${us_cbs}' |
| 663 | #for pir & pbs |
| 664 | ${rate} ${burst_size} Get Meter Param In Details |
| 665 | ... ${meter_json_resp} 2 |
| 666 | ${matched}= Set Variable If '${rate}' == '${us_pir}' and '${burst_size}' == '${us_pbs}' True False |
| 667 | Should Be True ${matched} |
| 668 | ${res2}= Evaluate '${rate}' == '${us_pir}' and '${burst_size}' == '${us_pbs}' |
| 669 | #for gir |
| 670 | Run Keyword if ${us_gir} != 0 Validate Guarenteed Information Rate ${us_gir} ${meter_json_resp} |
| 671 | # Get downstream bandwidth profile details |
| 672 | ${ds_cir} ${ds_cbs} ${ds_pir} ${ds_pbs} ${ds_gir} Get Bandwidth Profile Details Ietf Rest |
| 673 | ... ${ds_bw_profile} |
| 674 | # Verify meter for downstream bandwidth profile |
| 675 | ${meter}= Get Request VGC meters |
| 676 | ${meter_json_resp}= To Json ${meter.content} |
| 677 | Log ${meter_json_resp} |
| 678 | ${rate} ${burst_size} Get Meter Param In Details |
| 679 | ... ${meter_json_resp} 1 |
| 680 | Log ${rate} |
| 681 | Log ${burst_size} |
| 682 | # for cir & cbs |
| 683 | ${matched}= Set Variable If '${rate}' == '${ds_cir}' and '${burst_size}' == '${ds_cbs}' True False |
| 684 | Should Be True ${matched} |
| 685 | #for pir & pbs |
| 686 | ${rate} ${burst_size} Get Meter Param In Details |
| 687 | ... ${meter_json_resp} 2 |
| 688 | ${matched}= Set Variable If '${rate}' == '${ds_pir}' and '${burst_size}' == '${ds_pbs}' True False |
| 689 | Should Be True ${matched} |
| 690 | #for gir |
| 691 | Run Keyword If ${ds_gir} != 0 |
| 692 | ... Validate Guarenteed Information Rate ${ds_gir} ${meter_json_resp} |
| 693 | |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 694 | Verify Meters in VGC Ietf For FTTB Subscribers |
| 695 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${filter}=${EMPTY} |
| 696 | [Documentation] Verifies the meters with BW Ietf format for FTTB Subscriber (currently, DT workflow uses this format) |
| 697 | ${programmed_sub_json_resp}= Get Programmed Subscribers ${olt_of_id} ${onu_port} |
| 698 | ... ${filter} |
| 699 | Log ${programmed_sub_json_resp} |
| 700 | ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name |
| 701 | ... ${programmed_sub_json_resp} |
| 702 | # Get upstream bandwidth profile details |
| 703 | ${us_cir} ${us_cbs} ${us_pir} ${us_pbs} ${us_gir} Get Bandwidth Profile Details Ietf Rest |
| 704 | ... ${us_bw_profile} |
| 705 | # Verify meter for upstream bandwidth profile |
| 706 | ${meter}= Get Request VGC meters |
| 707 | ${meter_json_resp}= To Json ${meter.content} |
| 708 | ${meters}= Get From Dictionary ${meter_json_resp} meters |
| 709 | Log ${meter_json_resp} |
| 710 | Log ${meters} |
| 711 | ${meter_length} Get Length ${meters} |
| 712 | FOR ${i} IN RANGE ${meter_length} |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 713 | ${matched}= Verify meters response ${meters[${i}]} ${us_cir} ${us_cbs} |
| 714 | Exit For Loop If ${matched} |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 715 | END |
| 716 | Should Be True ${matched} |
| 717 | #for pir & pbs |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 718 | FOR ${i} IN RANGE ${meter_length} |
| 719 | ${matched}= Verify meters response ${meters[${i}]} ${us_pir} ${us_pbs} |
| 720 | Exit For Loop If ${matched} |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 721 | END |
| 722 | Should Be True ${matched} |
| 723 | #for gir |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 724 | FOR ${i} IN RANGE ${meter_length} |
| 725 | ${matched}= Run Keyword if ${us_gir} != 0 Validate Guarenteed Information Rate For FTTB ${us_gir} ${meters[${i}]} |
| 726 | Exit For Loop If ${matched} |
| 727 | END |
| 728 | Should Be True ${matched} |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 729 | ${ds_cir} ${ds_cbs} ${ds_pir} ${ds_pbs} ${ds_gir} Get Bandwidth Profile Details Ietf Rest |
| 730 | ... ${ds_bw_profile} |
| 731 | ${meter}= Get Request VGC meters |
| 732 | ${meter_json_resp}= To Json ${meter.content} |
| 733 | Log ${meter_json_resp} |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 734 | ${meters}= Get From Dictionary ${meter_json_resp} meters |
| 735 | Log ${meter_json_resp} |
| 736 | Log ${meters} |
| 737 | FOR ${i} IN RANGE ${meter_length} |
| 738 | ${matched}= Verify meters response ${meters[${i}]} ${ds_cir} ${ds_cbs} |
| 739 | Exit For Loop If ${matched} |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 740 | END |
| 741 | Should Be True ${matched} |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 742 | # for cir & cbs |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 743 | FOR ${i} IN RANGE ${meter_length} |
| 744 | ${matched}= Verify meters response ${meters[${i}]} ${ds_pir} ${ds_pbs} |
| 745 | Exit For Loop If ${matched} |
| 746 | END |
| 747 | Should Be True ${matched} |
| 748 | FOR ${i} IN RANGE ${meter_length} |
| 749 | ${matched}= Run Keyword if ${us_gir} != 0 Validate Guarenteed Information Rate For FTTB ${ds_gir} ${meters[${i}]} |
| 750 | Exit For Loop If ${matched} |
| 751 | END |
| 752 | Should Be True ${matched} |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 753 | |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 754 | Validate Guarenteed Information Rate |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 755 | [Documentation] Validate gir for both upstream and downstream meters |
| 756 | [Arguments] ${gir} ${meter_json_resp} |
| 757 | ${rate} ${burst_size} Get Meter Param In Details |
| 758 | ... ${meter_json_resp} 3 |
| 759 | ${matched}= Set Variable If '${rate}' == '${gir}' and '${burst_size}' == '0' True False |
| 760 | Should Be True ${matched} |
| 761 | [Return] ${matched} |
| 762 | |
| 763 | Validate Guarenteed Information Rate For FTTB |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 764 | [Documentation] Validate gir for both upstream and downstream meters |
| 765 | [Arguments] ${gir} ${meter_json_resp} |
| Guru Prasanna | 6dcd8a2 | 2025-05-08 01:28:20 +0530 | [diff] [blame] | 766 | ${burst_size}= Get From Dictionary ${meter_json_resp['bands'][2]} burstSize |
| 767 | ${rate}= Get From Dictionary ${meter_json_resp['bands'][2]} rate |
| Abhay Kumar | 107b03b | 2026-01-30 07:20:08 +0000 | [diff] [blame^] | 768 | # ${matched}= Set Variable If '${rate}' == '${gir}' and '${burst_size}' == '0' True False |
| 769 | ${matched}= Evaluate ${rate} == ${gir} and ${burst_size} == 0 |
| 770 | # Should Be True ${matched} |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 771 | [Return] ${matched} |
| 772 | |
| 773 | Get Bandwidth Profile Details Ietf Rest |
| 774 | [Arguments] ${bw_profile_id} |
| 775 | [Documentation] Retrieves the details of the given Ietf standard based bandwidth profile using REST API |
| 776 | ${bw_profile_id}= Remove String ${bw_profile_id} ' " |
| 777 | ${resp}= Get Request VGC profiles/${bw_profile_id} |
| 778 | Log ${resp} |
| 779 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 780 | Should Not Be Empty ${jsondata} Could not find data for bandwidth profile ${bw_profile_id} in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 781 | ${matched}= Set Variable False |
| 782 | ${bw_id}= Get From Dictionary ${jsondata} id |
| 783 | ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False |
| 784 | ${pir}= Get From Dictionary ${jsondata} pir |
| 785 | ${pbs}= Get From Dictionary ${jsondata} pbs |
| 786 | ${cir}= Get From Dictionary ${jsondata} cir |
| 787 | ${cbs}= Get From Dictionary ${jsondata} cbs |
| 788 | ${gir}= Get From Dictionary ${jsondata} gir |
| 789 | Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id} |
| 790 | [Return] ${cir} ${cbs} ${pir} ${pbs} ${gir} |
| 791 | |
| 792 | |
| 793 | Get Upstream and Downstream Bandwidth Profile Name |
| 794 | [Arguments] ${programmed_sub} |
| 795 | [Documentation] Retrieves the upstream and downstream bandwidth profile name |
| 796 | ... from the programmed subscriber |
| 797 | ${length}= Get Length ${programmed_sub} |
| 798 | ${matched}= Set Variable False |
| 799 | FOR ${INDEX} IN RANGE 0 ${length} |
| 800 | ${value}= Get From List ${programmed_sub} ${INDEX} |
| 801 | ${tagInfo_id}= Get From Dictionary ${value} tagInfo |
| 802 | Log ${tagInfo_id} |
| 803 | ${us_bw_profile}= Get From Dictionary ${tagInfo_id} upstreamBandwidthProfile |
| 804 | Log ${us_bw_profile} |
| 805 | ${ds_bw_profile}= Get From Dictionary ${tagInfo_id} downstreamBandwidthProfile |
| 806 | Log ${ds_bw_profile} |
| 807 | END |
| 808 | [Return] ${us_bw_profile} ${ds_bw_profile} |
| 809 | |
| 810 | Verify Subscriber Access Flows Added Count DT |
| 811 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
| 812 | [Documentation] Matches for total number of subscriber access flows added for all onus |
| 813 | ${resp}= Get Request VGC flows/${olt_of_id} |
| 814 | ${jsondata}= To Json ${resp.content} |
| 815 | ${access_flows_added_count}= Get Length ${jsondata['flows']} |
| 816 | Should Be Equal As Integers ${access_flows_added_count} ${expected_flows} |
| 817 | |
| 818 | Get Meter Param In Details |
| 819 | [Arguments] ${meter_json} ${length} |
| 820 | [Documentation] Retrieves the meter rate state burst-size |
| 821 | ${metername}= Get From Dictionary ${meter_json} meters |
| 822 | Log ${metername} |
| 823 | ${value}= Get From List ${metername} 0 |
| 824 | ${bands_info}= Get From Dictionary ${value} bands |
| 825 | Log ${bands_info} |
| 826 | FOR ${INDEX} IN RANGE 0 ${length} |
| 827 | ${value}= Get From List ${bands_info} ${INDEX} |
| 828 | ${burst_size}= Get From Dictionary ${value} burstSize |
| 829 | ${rate}= Get From Dictionary ${value} rate |
| 830 | END |
| 831 | [Return] ${rate} ${burst_size} |
| 832 | |
| 833 | Delete Subscribers And BW Profile In VGC |
| 834 | [Documentation] Delete Subscribers and bw profile In VGC |
| 835 | Create VGC Session |
| 836 | ${resp}= Get Request VGC programmed-subscribers |
| 837 | Log ${resp} |
| 838 | ${jsondata}= To Json ${resp.content} |
| 839 | ${length}= Get Length ${jsondata['subscribers']} |
| 840 | @{serial_numbers}= Create List |
| 841 | FOR ${INDEX} IN RANGE 0 ${length} |
| 842 | ${value}= Get From List ${jsondata['subscribers']} ${INDEX} |
| 843 | ${taginfo}= Get From Dictionary ${value} tagInfo |
| 844 | ${service_id}= Get From Dictionary ${taginfo} serviceName |
| 845 | ${upstream_bw_id}= Get From Dictionary ${taginfo} upstreamBandwidthProfile |
| 846 | ${downstream_bw_id}= Get From Dictionary ${taginfo} downstreamBandwidthProfile |
| 847 | Delete Request VGC subscribers/${service_id} |
| 848 | Delete Request VGC profiles/${upstream_bw_id} |
| 849 | Delete Request VGC profiles/${downstream_bw_id} |
| 850 | END |
| 851 | |
| 852 | Deactivate Subscribers In VGC |
| 853 | [Documentation] Deactivate Subscribers In VGC |
| 854 | Create VGC Session |
| 855 | ${resp}= Get Request VGC devices/ports |
| 856 | Log ${resp} |
| 857 | ${jsondata}= To Json ${resp.content} |
| 858 | ${length}= Get Length ${jsondata['ports']} |
| 859 | FOR ${INDEX} IN RANGE 0 ${length} |
| 860 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 861 | ${annotations}= Get From Dictionary ${value} annotations |
| 862 | ${portname}= Get From Dictionary ${annotations} portName |
| 863 | Delete Request VGC services/${portname} |
| 864 | END |
| 865 | |
| 866 | Verify Device Flows Removed |
| 867 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 868 | [Documentation] Verifies all flows are removed from the device |
| 869 | ${resp}= Get Request VGC flows/${olt_of_id} |
| 870 | ${jsondata}= To Json ${resp.content} |
| 871 | ${flow_count}= Get Length ${jsondata['flows']} |
| 872 | Should Be Equal As Integers ${flow_count} 0 Flows not removed |
| 873 | |
| 874 | Device Is Available In VGC |
| Akash Soni | 35cafc3 | 2023-12-20 12:48:08 +0530 | [diff] [blame] | 875 | [Arguments] ${olt_of_id} ${available}=True |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 876 | [Documentation] Validates the device exists and it has the expected availability in VGC |
| 877 | ${resp}= Get Request VGC devices |
| 878 | ${jsondata}= To Json ${resp.content} |
| Cristina de Francisco | c4cfd7e | 2023-10-09 10:55:08 +0200 | [diff] [blame] | 879 | Should Not Be Empty ${jsondata['devices']} No devices data found in VGC |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 880 | ${length}= Get Length ${jsondata['devices']} |
| 881 | ${matched}= Set Variable False |
| 882 | FOR ${INDEX} IN RANGE 0 ${length} |
| 883 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 884 | ${of_id}= Get From Dictionary ${value} id |
| 885 | ${availability}= Get From Dictionary ${value} available |
| 886 | Log ${olt_of_id} |
| 887 | Log ${of_id} |
| Akash Soni | 35cafc3 | 2023-12-20 12:48:08 +0530 | [diff] [blame] | 888 | ${matched}= Set Variable If '${of_id}' == '${olt_of_id}' and '${availability}' True False |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 889 | Exit For Loop If ${matched} |
| 890 | END |
| 891 | Should Be True ${matched} No match for '${olt_of_id}' found |
| bharat raj | 58488b3 | 2023-05-11 22:46:18 +0530 | [diff] [blame] | 892 | |