go.ligato.io/vpp-agent/v3@v3.5.0/tests/robot/libraries/vpp_term.robot (about) 1 [Documentation] Keywords for working with VPP terminal 2 3 *** Settings *** 4 Library Collections 5 Library vpp_term.py 6 7 *** Variables *** 8 ${interface_timeout}= 15s 9 ${terminal_timeout}= 30s 10 11 *** Keywords *** 12 13 vpp_term: Check VPP Terminal 14 [Arguments] ${node} 15 [Documentation] Check terminal on node ${node} 16 # using telnet does not work with latest VPP 17 #${command}= Set Variable telnet 0 ${${node}_VPP_HOST_PORT} 18 ${command}= Set Variable docker exec -it ${node} vppctl -s localhost:${${node}_VPP_PORT} 19 ${out}= Write To Machine ${node}_term ${command} 20 Should Contain ${out} ${${node}_VPP_TERM_PROMPT} 21 [Return] ${out} 22 23 vpp_term: Open VPP Terminal 24 [Arguments] ${node} 25 [Documentation] Wait for VPP terminal on node ${node} or timeout 26 wait until keyword succeeds ${terminal_timeout} 5s vpp_term: Check VPP Terminal ${node} 27 28 vpp_term: Issue Command 29 [Arguments] ${node} ${command} ${delay}=${SSH_READ_DELAY}s 30 ${failed_it}= Create List 31 :FOR ${it_num} IN RANGE 1 6 32 \ ${result} ${out}= Run Keyword And Ignore Error Write To Machine Until String ${node}_term ${command} ${${node}_VPP_TERM_PROMPT} delay=${delay} 33 \ Run Keyword If '${result}'=='FAIL' Append To List ${failed_it} ${it_num} 34 \ Run Keyword If '${result}'=='FAIL' Log Warning, no match found #vpp console output! WARN 35 \ Exit For Loop If '${result}'=='PASS' 36 Run Keyword And Ignore Error Should Be Empty ${failed_it} msg='Fail in this checks ${failed_it}' 37 # ${out}= Write To Machine Until String ${node}_term ${command} ${${node}_VPP_TERM_PROMPT} delay=${delay} 38 ## Should Contain ${out} ${${node}_VPP_TERM_PROMPT} 39 [Return] ${out} 40 41 vpp_term: Exit VPP Terminal 42 [Arguments] ${node} 43 ${ctrl_d} Evaluate chr(int(4)) 44 ${command}= Set Variable ${ctrl_d} 45 ${out}= Write To Machine ${node}_term ${command} 46 [Return] ${out} 47 48 vppp_term: Show Vpp Logging 49 [Arguments] ${node} 50 [Documentation] Show interfaces through vpp terminal 51 ${out}= vpp_term: Issue Command ${node} sh logging 52 [Return] ${out} 53 54 vpp_term: Show Runtime 55 [Arguments] ${node} 56 [Documentation] Show runtime through vpp terminal 57 ${out}= vpp_term: Issue Command ${node} show runtime 58 [Return] ${out} 59 60 vpp_term: Show Interfaces 61 [Arguments] ${node} ${interface}=${EMPTY} 62 [Documentation] Show interfaces through vpp terminal 63 ${out}= vpp_term: Issue Command ${node} sh int ${interface} 64 [Return] ${out} 65 66 vpp_term: Show Interfaces Address 67 [Arguments] ${node} ${interface}=${EMPTY} 68 [Documentation] Show interfaces address through vpp terminal 69 ${out}= vpp_term: Issue Command ${node} sh int addr ${interface} 70 [Return] ${out} 71 72 vpp_term: Show Hardware 73 [Arguments] ${node} ${interface}=${EMPTY} 74 [Documentation] Show interfaces hardware through vpp terminal 75 ${out}= vpp_term: Issue Command ${node} show hardware ${interface} 76 [Return] ${out} 77 78 vpp_term: Show IP Fib 79 [Arguments] ${node} ${ip}=${EMPTY} 80 [Documentation] Show IP fib output 81 ${out}= vpp_term: Issue Command ${node} show ip fib ${ip} 82 [Return] ${out} 83 84 vpp_term: Show IP6 Fib 85 [Arguments] ${node} ${ip}=${EMPTY} 86 [Documentation] Show IP fib output 87 ${out}= vpp_term: Issue Command ${node} show ip6 fib ${ip} 88 [Return] ${out} 89 90 vpp_term: Show IP Fib Table 91 [Arguments] ${node} ${id} 92 [Documentation] Show IP fib output for VRF table defined in input 93 ${out}= vpp_term: Issue Command ${node} show ip fib table ${id} 94 [Return] ${out} 95 96 vpp_term: Show IP6 Fib Table 97 [Arguments] ${node} ${id} 98 [Documentation] Show IP fib output for VRF table defined in input 99 ${out}= vpp_term: Issue Command ${node} show ip6 fib table ${id} 100 [Return] ${out} 101 102 vpp_term: Show L2fib 103 [Arguments] ${node} 104 [Documentation] Show verbose l2fib output 105 ${out}= vpp_term: Issue Command ${node} show l2fib verbose 106 [Return] ${out} 107 108 vpp_term: Show Bridge-Domain Detail 109 [Arguments] ${node} ${id}=1 110 [Documentation] Show detail of bridge-domain 111 ${out}= vpp_term: Issue Command ${node} show bridge-domain ${id} detail 112 [Return] ${out} 113 114 vpp_term: Show IPsec 115 [Arguments] ${node} 116 [Documentation] Show IPsec output 117 ${out}= vpp_term: Issue Command ${node} show ipsec all 118 [Return] ${out} 119 120 vpp_term: Check Ping 121 [Arguments] ${node} ${ip} ${count}=5 122 ${out}= vpp_term: Issue Command ${node} ping ${ip} repeat ${count} delay=10s 123 Should Contain ${out} from ${ip} 124 Should Not Contain ${out} 100% packet loss 125 126 vpp_term: Check Ping6 127 [Arguments] ${node} ${ip} ${count}=5 128 ${out}= vpp_term: Issue Command ${node} ping ${ip} repeat ${count} delay=10s 129 Should Contain ${out} from ${ip} 130 Should Not Contain ${out} 100% packet loss 131 132 vpp_term: Check Ping Within Interface 133 [Arguments] ${node} ${ip} ${source} ${count}=5 134 ${out}= vpp_term: Issue Command ${node} ping ${ip} source ${source} repeat ${count} delay=10s 135 Should Contain ${out} from ${ip} 136 Should Not Contain ${out} 100% packet loss 137 138 vpp_term: Check No Ping Within Interface 139 [Arguments] ${node} ${ip} ${source} ${count}=5 140 ${out}= vpp_term: Issue Command ${node} ping ${ip} source ${source} repeat ${count} delay=10s 141 Should Not Contain ${out} from ${ip} 142 Should Contain ${out} 100% packet loss 143 144 vpp_term: Check Interface Is Present 145 [Arguments] ${node} ${mac} 146 [Documentation] Checking if specified interface with mac exists in VPP 147 ${ints}= vpp_term: Show Hardware ${node} 148 ${result}= Run Keyword And Return Status Should Contain ${ints} ${mac} 149 Should Be Equal ${result} ${TRUE} values=False msg=Interface with MAC address ${mac} not present on VPP. 150 151 vpp_term: Check Interface Is Not Present 152 [Arguments] ${node} ${mac} 153 [Documentation] Checking if specified interface with mac exists in VPP 154 ${ints}= vpp_term: Show Hardware ${node} 155 ${result}= Run Keyword And Return Status Should Contain ${ints} ${mac} 156 Should Be Equal ${result} ${FALSE} values=False msg=Interface with MAC address ${mac} is present on VPP but shouldn't. 157 158 vpp_term: Interface Is Created 159 [Arguments] ${node} ${mac} 160 Wait Until Keyword Succeeds ${interface_timeout} 3s vpp_term: Check Interface Is Present ${node} ${mac} 161 162 vpp_term: Interface Is Deleted 163 [Arguments] ${node} ${mac} 164 Wait Until Keyword Succeeds ${interface_timeout} 3s vpp_term: Check Interface Is Not Present ${node} ${mac} 165 166 vpp_term: Interface Exists 167 [Arguments] ${node} ${mac} 168 vpp_term: Check Interface Is Present ${node} ${mac} 169 170 vpp_term: Interface Not Exists 171 [Arguments] ${node} ${mac} 172 vpp_term: Check Interface Is Not Present ${node} ${mac} 173 174 vpp_term: Check Interface UpDown Status 175 [Arguments] ${node} ${interface} ${status}=1 176 [Documentation] Checking up/down state of specified internal interface 177 ${internal_index}= vat_term: Get Interface Index agent_vpp_1 ${interface} 178 ${interfaces}= vat_term: Interfaces Dump agent_vpp_1 179 ${int_state}= Get Interface State ${interfaces} ${internal_index} 180 ${enabled}= Set Variable ${int_state["admin_up_down"]} 181 Should Be Equal As Integers ${enabled} ${status} 182 183 vpp_term: Get Interface IPs 184 [Arguments] ${node} ${interface} 185 ${int_addr}= vpp_term: Show Interfaces Address ${node} ${interface} 186 @{ipv4_list}= Find IPV4 In Text ${int_addr} 187 [Return] ${ipv4_list} 188 189 vpp_term: Get Interface IP6 IPs 190 [Arguments] ${node} ${interface} 191 [Documentation] Get all IPv6 addresses for the specified interface. 192 ${int_addr}= vpp_term: Show Interfaces Address ${node} ${interface} 193 @{ipv6_list}= Find IPV6 In Text ${int_addr} 194 # Remove link-local address as it is hardware-dependent 195 :FOR ${address} IN @{ipv6_list} 196 \ Run Keyword If ${address.startswith('fd80:')} Remove Values From List ${ipv6_list} ${address} 197 [Return] ${ipv6_list} 198 199 vpp_term: Get Interface MAC 200 [Arguments] ${node} ${interface} 201 ${sh_h}= vpp_term: Show Hardware ${node} ${interface} 202 ${mac}= Find MAC In Text ${sh_h} 203 [Return] ${mac} 204 205 vpp_term: Interface Is Enabled 206 [Arguments] ${node} ${interface} 207 Wait Until Keyword Succeeds ${interface_timeout} 3s vpp_term: Check Interface UpDown Status ${node} ${interface} 208 209 vpp_term: Interface Is Disabled 210 [Arguments] ${node} ${interface} 211 Wait Until Keyword Succeeds ${interface_timeout} 3s vpp_term: Check Interface UpDown Status ${node} ${interface} 0 212 213 vpp_term: Interface Is Up 214 [Arguments] ${node} ${interface} 215 vpp_term: Check Interface UpDown Status ${node} ${interface} 216 217 vpp_term: Interface Is Down 218 [Arguments] ${node} ${interface} 219 vpp_term: Check Interface UpDown Status ${node} ${interface} 0 220 221 vpp_term: Show Memif 222 [Arguments] ${node} ${interface}=${EMPTY} 223 [Documentation] Show memif interfaces through vpp terminal 224 ${out}= vpp_term: Issue Command ${node} sh memif ${interface} 225 [Return] ${out} 226 227 vpp_term: Check Memif Interface State 228 [Arguments] ${node} ${name} @{desired_state} 229 ${internal_name}= Get Interface Internal Name ${node} ${name} 230 ${memif_info}= vpp_term: Show Memif ${node} ${internal_name} 231 ${memif_state}= Parse Memif Info ${memif_info} 232 ${ipv4_list}= vpp_term: Get Interface IPs ${node} ${internal_name} 233 ${ipv6_list}= vpp_term: Get Interface IP6 IPs ${node} ${internal_name} 234 ${mac}= vpp_term: Get Interface MAC ${node} ${internal_name} 235 ${actual_state}= Create List mac=${mac} 236 :FOR ${ip} IN @{ipv4_list} 237 \ Append To List ${actual_state} ipv4=${ip} 238 :FOR ${ip} IN @{ipv6_list} 239 \ Append To List ${actual_state} ipv6=${ip} 240 Append To List ${actual_state} @{memif_state} 241 List Should Contain Sub List ${actual_state} ${desired_state} 242 [Return] ${actual_state} 243 244 vpp_term: Check TAP Interface State 245 [Arguments] ${node} ${name} @{desired_state} 246 Sleep 10s Time to let etcd to get state of newly setup tap interface. 247 ${internal_name}= Get Interface Internal Name ${node} ${name} 248 ${interface}= vpp_term: Show Interfaces ${node} ${internal_name} 249 ${state}= Set Variable up 250 ${status}= Evaluate "${state}" in """${interface}""" 251 ${tap_int_state}= Set Variable If ${status}==True ${state} down 252 ${ipv4}= vpp_term: Get Interface IPs ${node} ${internal_name} 253 ${ipv4_string}= Get From List ${ipv4} 0 254 ${mac}= vpp_term: Get Interface MAC ${node} ${internal_name} 255 ${actual_state}= Create List mac=${mac} ipv4=${ipv4_string} state=${tap_int_state} 256 List Should Contain Sub List ${actual_state} ${desired_state} 257 [Return] ${actual_state} 258 259 vpp_term: Check TAP IP6 Interface State 260 [Arguments] ${node} ${name} @{desired_state} 261 [Documentation] Get operational state of the specified interface and compare with expected state. 262 Sleep 10s Time to let etcd to get state of newly setup tap interface. 263 ${internal_name}= Get Interface Internal Name ${node} ${name} 264 ${interface}= vpp_term: Show Interfaces ${node} ${internal_name} 265 ${state}= Set Variable up 266 ${status}= Evaluate "${state}" in """${interface}""" 267 ${tap_int_state}= Set Variable If ${status}==True ${state} down 268 ${ipv6}= vpp_term: Get Interface IP6 IPs ${node} ${internal_name} 269 ${ipv6_string}= Get From List ${ipv6} 0 270 ${mac}= vpp_term: Get Interface MAC ${node} ${internal_name} 271 ${actual_state}= Create List mac=${mac} ipv6=${ipv6_string} state=${tap_int_state} 272 List Should Contain Sub List ${actual_state} ${desired_state} 273 [Return] ${actual_state} 274 275 vpp_term: Add Route 276 [Arguments] ${node} ${destination_ip} ${prefix} ${next_hop_ip} 277 [Documentation] Add ip route through vpp terminal. 278 vpp_term: Issue Command ${node} ip route add ${destination_ip}/${prefix} via ${next_hop_ip} 279 280 vpp_term: Show ARP 281 [Arguments] ${node} 282 [Documentation] Show ARPs through vpp terminal 283 ${out}= vpp_term: Issue Command ${node} show ip arp 284 #OperatingSystem.Create File ${REPLY_DATA_FOLDER}/reply_arp.json ${out} 285 [Return] ${out} 286 287 vpp_term: Check ARP 288 [Arguments] ${node} ${interface} ${ipv4} ${MAC} ${presence} 289 [Documentation] Check ARPs presence on interface 290 ${out}= vpp_term: Show ARP ${node} 291 ${internal_name}= Get Interface Internal Name ${node} ${interface} 292 ${status}= Run Keyword If '${internal_name}'!='${None}' Parse ARP ${out} ${internal_name} ${ipv4} ${MAC} ELSE Set Variable False 293 Should Be Equal As Strings ${status} ${presence} 294 295 vpp_term: Show IPv6 Neighbor 296 [Arguments] ${node} 297 [Documentation] Show Neighbbor list through vpp terminal 298 ${out}= vpp_term: Issue Command ${node} show ip6 neighbors 299 #OperatingSystem.Create File ${REPLY_DATA_FOLDER}/reply_arp.json ${out} 300 [Return] ${out} 301 302 vpp_term: Check IPv6 Neighbor 303 [Arguments] ${node} ${interface} ${ip_address} ${mac_address} ${presence} 304 [Documentation] Check IPv6 neighbor presence on interface 305 ${out}= vpp_term: Show IPv6 neighbor ${node} 306 ${internal_name}= Get Interface Internal Name ${node} ${interface} 307 ${status}= Run Keyword If '${internal_name}'!='${None}' Parse Neighbor ${out} ${internal_name} ${ip_address} ${mac_address} ELSE Set Variable False 308 Should Be Equal As Strings ${status} ${presence} 309 310 311 vpp_term: Set IPv6 neighbor 312 [Arguments] ${node} ${interface} ${ipv6} ${MAC} 313 [Documentation] Sets IPv6 neighbors 314 vpp_term: Issue Command ${node} set ip6 neighbor ${interface} ${ipv6} ${MAC} 315 316 vpp_term: Set ARP 317 [Arguments] ${node} ${interface} ${ipv4} ${MAC} 318 [Documentation] Sets ARP (IPv4 neighbors) 319 vpp_term: Issue Command ${node} set ip arp ${interface} ${ipv4} ${MAC} 320 321 vpp_term: Show Interface Mode 322 [Arguments] ${node} 323 [Documentation] vpp_term: Show Interfaces Mode 324 ${out}= vpp_term: Issue Command ${node} show mode 325 [Return] ${out} 326 327 vpp_term: Check TAPv2 Interface State 328 [Arguments] ${node} ${name} @{desired_state} 329 Sleep 10s Time to let etcd to get state of newly setup tapv2 interface. 330 ${internal_name}= Get Interface Internal Name ${node} ${name} 331 ${interface}= vpp_term: Show Interfaces ${node} ${internal_name} 332 ${state}= Set Variable up 333 ${status}= Evaluate "${state}" in """${interface}""" 334 ${tap_int_state}= Set Variable If ${status}==True ${state} down 335 ${ipv4}= vpp_term: Get Interface IPs ${node} ${internal_name} 336 ${ipv4_string}= Get From List ${ipv4} 0 337 ${mac}= vpp_term: Get Interface MAC ${node} ${internal_name} 338 ${actual_state}= Create List mac=${mac} ipv4=${ipv4_string} state=${tap_int_state} 339 List Should Contain Sub List ${actual_state} ${desired_state} 340 [Return] ${actual_state} 341 342 vpp_term: Check TAPv2 IP6 Interface State 343 [Arguments] ${node} ${name} @{desired_state} 344 Sleep 10s Time to let etcd to get state of newly setup tapv2 interface. 345 ${internal_name}= Get Interface Internal Name ${node} ${name} 346 ${interface}= vpp_term: Show Interfaces ${node} ${internal_name} 347 ${state}= Set Variable up 348 ${status}= Evaluate "${state}" in """${interface}""" 349 ${tap_int_state}= Set Variable If ${status}==True ${state} down 350 ${ipv6}= vpp_term: Get Interface IP6 IPs ${node} ${internal_name} 351 ${ipv6_string}= Get From List ${ipv6} 0 352 ${mac}= vpp_term: Get Interface MAC ${node} ${internal_name} 353 ${actual_state}= Create List mac=${mac} ipv6=${ipv6_string} state=${tap_int_state} 354 List Should Contain Sub List ${actual_state} ${desired_state} 355 [Return] ${actual_state} 356 357 vpp_term: Show Trace 358 [Arguments] ${node} 359 [Documentation] vpp_term: Show Trace 360 ${out}= vpp_term: Issue Command ${node} show trace 361 [Return] ${out} 362 363 vpp_term: Clear Trace 364 [Arguments] ${node} 365 [Documentation] vpp_term: Clear Trace 366 ${out}= vpp_term: Issue Command ${node} clear trace 367 [Return] ${out} 368 369 vpp_term: Add Trace Memif 370 [Arguments] ${node} ${count}=10 371 [Documentation] vpp_term: Add Trace for memif interfaces 372 ${out}= vpp_term: Issue Command ${node} trace add memif-input ${count} 373 [Return] ${out} 374 375 vpp_term: Show STN Rules 376 [Arguments] ${node} 377 [Documentation] Show STN Rules 378 ${out}= vpp_term: Issue Command ${node} show stn rules 379 [Return] ${out} 380 381 vpp_term: Check STN Rule State 382 [Arguments] ${node} ${interface} ${ip} 383 [Documentation] Check STN Rules 384 ${out}= vpp_term: Show STN Rules ${node} 385 ${internal_name}= Get Interface Internal Name ${node} ${interface} 386 ${ip_address} ${iface} ${next_node} Parse STN Rule ${out} 387 Should Be Equal As Strings ${ip} ${ip_address} 388 Should Be Equal As Strings ${internal_name} ${iface} 389 390 vpp_term: Check STN Rule Deleted 391 [Arguments] ${node} ${interface} ${ip} 392 [Documentation] Check STN Rules 393 ${out}= vpp_term: Show STN Rules ${node} 394 ${internal_name}= Get Interface Internal Name ${node} ${interface} 395 Should Not Contain ${out} ${ip} 396 Should Not Contain ${out} ${internal_name} 397 398 vpp_term: Add Trace Afpacket 399 [Arguments] ${node} ${count}=10 400 [Documentation] vpp_term: Add Trace for afpacket interfaces 401 ${out}= vpp_term: Issue Command ${node} trace add af-packet-input ${count} 402 [Return] ${out} 403 404 vpp_term: Set VPP Tracing And Debugging 405 [Arguments] ${node} 406 [Documentation] vpp_term: Add More Tracing and debugging 407 ${out}= vpp_term: Issue Command ${node} clear hardware 408 ${out}= vpp_term: Issue Command ${node} clear interface 409 ${out}= vpp_term: Issue Command ${node} clear error 410 ${out}= vpp_term: Issue Command ${node} clear run 411 ${out}= vpp_term: Issue Command ${node} api trace on 412 ${out}= vpp_term: Issue Command ${node} api trace post-mortem-on 413 [Return] ${out} 414 415 vpp_term: Dump Trace 416 [Arguments] ${node} 417 [Documentation] vpp_term: Dump VPP Trace 418 ${out}= vpp_term: Issue Command ${node} api trace save apitrace.trc 419 [Return] ${out} 420 421 422 vpp_term: Check Local SID Presence 423 [Arguments] ${node} ${sidAddress} ${endFunctionType} ${fibtable}= ${interface}= ${nexthop}= ${serviceaddress}= ${outinterface}= ${ininterface}= 424 [Documentation] Checking if specified local sid exists or will show up (parameters contains union of all END function parameters to be able to cover them all) 425 #${terminal_timeout} 426 Wait Until Keyword Succeeds 5x 2s vpp_term: Local SID exists node=${node} sidAddress=${sidAddress} endFunctionType=${endFunctionType} fibtable=${fibtable} interface=${interface} nexthop=${nexthop} serviceaddress=${serviceaddress} outinterface=${outinterface} ininterface=${ininterface} 427 428 vpp_term: Local SID exists 429 [Arguments] ${node} ${sidAddress} ${endFunctionType} ${fibtable} ${interface} ${nexthop} ${serviceaddress} ${outinterface} ${ininterface} 430 [Documentation] Checking if specified local sid exists (parameters contains union of all END function parameters to be able to cover them all) 431 ${localsidsStr}= vpp_term: Show Local SIDs ${node} 432 Create File /tmp/srv6_sh_sr_localsid_output.txt ${localsidsStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 433 ${localsidsStr}= OperatingSystem.Get File /tmp/srv6_sh_sr_localsid_output.txt 434 ${localsidsStr}= Basic_Operations.Replace_Rn_N ${localsidsStr} #FIX for BUG with New Line 435 ${localsidsStr}= Convert To Lowercase ${localsidsStr} 436 ${matchdata}= Set Variable ${EMPTY} 437 ${matchdata}= Run Keyword If '${endFunctionType}' == 'BASE' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_output_match.txt ELSE Set Variable ${matchdata} 438 ${matchdata}= Run Keyword If '${endFunctionType}' == 'X' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_x_output_match.txt ELSE Set Variable ${matchdata} 439 ${matchdata}= Run Keyword If '${endFunctionType}' == 'T' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_t_output_match.txt ELSE Set Variable ${matchdata} 440 ${matchdata}= Run Keyword If '${endFunctionType}' == 'DT4' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_dt4_output_match.txt ELSE Set Variable ${matchdata} 441 ${matchdata}= Run Keyword If '${endFunctionType}' == 'DT6' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_dt6_output_match.txt ELSE Set Variable ${matchdata} 442 ${matchdata}= Run Keyword If '${endFunctionType}' == 'DX4' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_dx4_output_match.txt ELSE Set Variable ${matchdata} 443 ${matchdata}= Run Keyword If '${endFunctionType}' == 'DX6' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_dx6_output_match.txt ELSE Set Variable ${matchdata} 444 ${matchdata}= Run Keyword If '${endFunctionType}' == 'AD' OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_end_ad_output_match.txt ELSE Set Variable ${matchdata} 445 ${matchdata}= Replace Variables ${matchdata} 446 ${matchdata}= Convert To Lowercase ${matchdata} 447 Should Contain ${localsidsStr} ${matchdata} 448 449 vpp_term: Show Local SIDs 450 [Arguments] ${node} 451 [Documentation] Show locasids through vpp terminal 452 ${out}= vpp_term: Issue Command ${node} sh sr localsids 453 [Return] ${out} 454 455 vpp_term: Check DNAT exists 456 [Arguments] ${node} ${dnat_file} #${interface} ${address} 457 [Documentation] Checking if specified dnat exists 458 ${localsidsStr}= vpp_term: Show DNAT Static Mapping ${node} 459 Create File /tmp/dnat_config_output.txt ${localsidsStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 460 ${localsidsStr}= OperatingSystem.Get File /tmp/dnat_config_output.txt 461 ${localsidsStr}= Basic_Operations.Replace_Rn_N ${localsidsStr} #FIX for BUG with New Line 462 ${localsidsStr}= Convert To Lowercase ${localsidsStr} 463 ${matchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crud/test_data/${dnat_file} 464 ${matchdata}= Replace Variables ${matchdata} 465 ${matchdata}= Convert To Lowercase ${matchdata} 466 Should Contain ${localsidsStr} ${matchdata} 467 468 vpp_term: Show DNAT Static Mapping 469 [Arguments] ${node} 470 [Documentation] Show locasids through vpp terminal 471 ${out}= vpp_term: Issue Command ${node} sh nat44 static mappings 472 [Return] ${out} 473 474 vpp_term: Check DNAT Global exists 475 [Arguments] ${node} ${dnat_file} #${interface} ${address} 476 [Documentation] Checking if specified dnat exists 477 ${localsidsStr}= vpp_term: Show DNAT Global Config ${node} 478 Create File /tmp/dnat_config_output.txt ${localsidsStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 479 ${localsidsStr}= OperatingSystem.Get File /tmp/dnat_config_output.txt 480 ${localsidsStr}= Basic_Operations.Replace_Rn_N ${localsidsStr} #FIX for BUG with New Line 481 ${localsidsStr}= Convert To Lowercase ${localsidsStr} 482 ${matchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crud/test_data/${dnat_file} 483 ${matchdata}= Replace Variables ${matchdata} 484 ${matchdata}= Convert To Lowercase ${matchdata} 485 Should Contain ${localsidsStr} ${matchdata} 486 487 vpp_term: Show DNAT Global Config 488 [Arguments] ${node} 489 [Documentation] Show locasids through vpp terminal 490 ${out}= vpp_term: Issue Command ${node} sh nat44 interfaces 491 [Return] ${out} 492 493 vpp_term: Check Local SID Deleted 494 [Arguments] ${node} ${sidAddress} 495 [Documentation] Checking if specified local sid will be(or already is) deleted 496 Wait Until Keyword Succeeds 5x 2s vpp_term: Local SID doesnt exist node=${node} sidAddress=${sidAddress} 497 498 vpp_term: Local SID doesnt exist 499 [Arguments] ${node} ${sidAddress} 500 [Documentation] Checking if specified local sid doesnt exist 501 ${localsidsStr}= vpp_term: Show Local SIDs agent_vpp_1 502 Create File /tmp/srv6_sh_sr_localsid_output.txt ${localsidsStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 503 ${localsidsStr}= OperatingSystem.Get File /tmp/srv6_sh_sr_localsid_output.txt 504 ${localsidsStr}= Convert To Lowercase ${localsidsStr} 505 ${matchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_localsid_output_no_match.txt 506 ${matchdata}= Replace Variables ${matchdata} 507 ${matchdata}= Convert To Lowercase ${matchdata} 508 Should Not Contain ${localsidsStr} ${matchdata} 509 510 vpp_term: Check SRv6 Policy Presence 511 [Arguments] ${node} ${bsid} ${fibtable} ${behaviour} ${type} ${index} ${segmentlists} 512 [Documentation] Checking if specified SRv6 policy exists or will show up 513 #${terminal_timeout} 514 Wait Until Keyword Succeeds 5x 2s vpp_term: SRv6 Policy exists node=${node} bsid=${bsid} fibtable=${fibtable} behaviour=${behaviour} type=${type} index=${index} segmentlists=${segmentlists} 515 516 vpp_term: SRv6 Policy exists 517 [Arguments] ${node} ${bsid} ${fibtable} ${behaviour} ${type} ${index} ${segmentlists} 518 [Documentation] Checking if specified SRv6 policy exists 519 ${policyStr}= vpp_term: Show SRv6 policies ${node} 520 Create File /tmp/srv6_sh_sr_policies_output.txt ${policyStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 521 ${policyStr}= OperatingSystem.Get File /tmp/srv6_sh_sr_policies_output.txt 522 ${policyStr}= Basic_Operations.Replace_Rn_N ${policyStr} #FIX for BUG with New Line 523 ${policyStr}= Convert To Lowercase ${policyStr} 524 ${policyregexpmatchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_policies_output_regexp_match.txt 525 ${policyregexpmatchdata}= Replace Variables ${policyregexpmatchdata} 526 ${policyregexpmatchdata}= Convert To Lowercase ${policyregexpmatchdata} 527 ${segmentlistsregexpmatchdata}= Set Variable ${EMPTY} 528 :FOR ${segmentlist} IN @{segmentlists} 529 \ ${segmentlistregexpmatchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_policy_segments_output_regexp_match.txt 530 \ ${segmentlistregexpmatchdata}= Replace Variables ${segmentlistregexpmatchdata} 531 \ ${segmentlistregexpmatchdata}= Convert To Lowercase ${segmentlistregexpmatchdata} 532 \ ${segmentlistsregexpmatchdata}= Catenate SEPARATOR= ${segmentlistsregexpmatchdata} (?=\[^v\]* ${segmentlistregexpmatchdata} ) 533 ${segmentCount}= Get Length ${segmentlists} 534 # using these facts for creating regexp (also using (?=...) groups to check segment list in any order): 535 # 1. "v" can't be in segment list part, but it is in beginning of next policy ("behaVior") 536 # 2. "weight" in each segment list and non "w" characters around it to count segments 537 # 3. "-----" is policy delimiter (but unfortunatelly "-" is part of segment list -> using "v" from fact 1.) 538 ${regexp}= Catenate SEPARATOR= ${policyregexpmatchdata} ${segmentlistsregexpmatchdata} (\[^vw\]*weight\[^vw\]*){${segmentCount}}----- 539 Should Match Regexp ${policyStr} ${regexp} 540 541 vpp_term: Show SRv6 policies 542 [Arguments] ${node} 543 [Documentation] Show SRv6 policies through vpp terminal 544 ${out}= vpp_term: Issue Command ${node} sh sr policies 545 [Return] ${out} 546 547 vpp_term: Check SRv6 Policy Nonexistence 548 [Arguments] ${node} ${bsid} 549 [Documentation] Checking if specified SRv6 policy doesn't exist (or will be deleted soon) 550 Wait Until Keyword Succeeds 5x 2s vpp_term: SRv6 Policy doesnt exist node=${node} bsid=${bsid} 551 552 vpp_term: SRv6 Policy doesnt exist 553 [Arguments] ${node} ${bsid} 554 [Documentation] Checking if specified SRv6 policy doesnt exist 555 ${policyStr}= vpp_term: Show SRv6 policies ${node} 556 Create File /tmp/srv6_sh_sr_policies_output.txt ${policyStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 557 ${policyStr}= OperatingSystem.Get File /tmp/srv6_sh_sr_policies_output.txt 558 ${policyStr}= Convert To Lowercase ${policyStr} 559 ${matchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_policies_output_no_match.txt 560 ${matchdata}= Replace Variables ${matchdata} 561 ${matchdata}= Convert To Lowercase ${matchdata} 562 Should Not Contain ${policyStr} ${matchdata} 563 564 vpp_term: Check SRv6 Steering Presence 565 [Arguments] ${node} ${bsid} ${prefixAddress} 566 [Documentation] Checking if specified steering exists or will show up 567 #${terminal_timeout} 568 Wait Until Keyword Succeeds 5x 2s vpp_term: SRv6 Steering exists node=${node} bsid=${bsid} prefixAddress=${prefixAddress} 569 570 vpp_term: SRv6 Steering exists 571 [Arguments] ${node} ${bsid} ${prefixAddress} 572 [Documentation] Checking if specified steering exists 573 ${steeringStr}= vpp_term: Show SRv6 steering policies ${node} 574 Create File /tmp/srv6_sh_sr_steerings_output.txt ${steeringStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 575 ${steeringStr}= OperatingSystem.Get File /tmp/srv6_sh_sr_steerings_output.txt 576 ${steeringStr}= Convert To Lowercase ${steeringStr} 577 ${matchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_steering_output_match.txt 578 ${matchdata}= Replace Variables ${matchdata} 579 ${matchdata}= Convert To Lowercase ${matchdata} 580 Should Contain ${steeringStr} ${matchdata} 581 582 vpp_term: Show SRv6 steering policies 583 [Arguments] ${node} 584 [Documentation] Show SRv6 steering policies through vpp terminal 585 ${out}= vpp_term: Issue Command ${node} sh sr steering-policies 586 [Return] ${out} 587 588 vpp_term: Check SRv6 Steering NonExistence 589 [Arguments] ${node} ${bsid} ${prefixAddress} 590 [Documentation] Checking if specified steering is deleted (or soon will be deleted) 591 #${terminal_timeout} 592 Wait Until Keyword Succeeds 5x 2s vpp_term: SRv6 Steering doesnt exist node=${node} bsid=${bsid} prefixAddress=${prefixAddress} 593 594 vpp_term: SRv6 Steering doesnt exist 595 [Arguments] ${node} ${bsid} ${prefixAddress} 596 [Documentation] Checking if specified steering doesnt exist 597 ${steeringStr}= vpp_term: Show SRv6 steering policies ${node} 598 Create File /tmp/srv6_sh_sr_steerings_output.txt ${steeringStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string 599 ${steeringStr}= OperatingSystem.Get File /tmp/srv6_sh_sr_steerings_output.txt 600 ${steeringStr}= Convert To Lowercase ${steeringStr} 601 ${matchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crudIPv6/test_data/srv6_sh_sr_steering_output_match.txt 602 ${matchdata}= Replace Variables ${matchdata} 603 ${matchdata}= Convert To Lowercase ${matchdata} 604 Should Not Contain ${steeringStr} ${matchdata}