go.ligato.io/vpp-agent/v3@v3.5.0/tests/robot/libraries/etcdctl.robot (about) 1 [Documentation] Keywords for working with VPP Ctl container 2 3 *** Settings *** 4 Library String 5 6 Library etcdctl.py 7 Library vpp_term.py 8 *** Variables *** 9 10 *** Keywords *** 11 12 Put Json 13 [Arguments] ${key} ${json} 14 ${command}= Set Variable ${DOCKER_COMMAND} exec etcd etcdctl put ${key} '${json}' 15 ${out}= Execute On Machine docker ${command} log=false 16 [Return] ${out} 17 18 Read Key 19 [Arguments] ${key} ${prefix}=false 20 ${command}= Set Variable ${DOCKER_COMMAND} exec etcd etcdctl get ${key} --write-out="simple" --prefix="${prefix}" 21 ${out}= Execute On Machine docker ${command} log=false 22 ${length}= Get Length ${out} 23 #${out}= Remove Empty Lines ${out} 24 #@{ret}= Run Keyword Unless ${length} == 0 Split String ${out} { 1 25 ${ret}= Run Keyword Unless ${length} == 0 Split To Lines ${out} 26 #${length}= Get Length ${ret} 27 #${out}= Run Keyword Unless ${length}== 0 Set Variable \{@{ret}[1] 28 #${out0}= Run Keyword Unless ${length}== 0 set Variable \{@{ret}[0] 29 ${out0}= Run Keyword Unless ${length}== 0 Remove Keys ${ret} 30 [Return] ${out0} 31 32 Delete Key 33 [Arguments] ${key} 34 ${command}= Set Variable ${DOCKER_COMMAND} exec etcd etcdctl del ${key} 35 ${out}= Execute On Machine docker ${command} log=false 36 [Return] ${out} 37 38 Get ETCD Dump 39 [Arguments] ${machine}=docker 40 ${command}= Set Variable ${DOCKER_COMMAND} exec etcd etcdctl get --prefix="true" "" 41 ${out}= Execute On Machine ${machine} ${command} log=false 42 [Return] ${out} 43 44 Put Memif Interface 45 [Arguments] ${node} ${name} ${mac} ${master} ${id} ${socket}=memif.sock ${mtu}=1500 ${vrf}=0 ${enabled}=true 46 ${socket}= Set Variable ${${node}_MEMIF_SOCKET_FOLDER}/${socket} 47 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/memif_interface.json 48 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 49 ${data}= Replace Variables ${data} 50 Put Json ${uri} ${data} 51 52 Put Memif Interface With IP 53 [Arguments] ${node} ${name} ${mac} ${master} ${id} ${ip} ${prefix}=24 ${socket}=memif.sock ${mtu}=1500 ${vrf}=0 ${enabled}=true 54 ${socket}= Set Variable ${${node}_MEMIF_SOCKET_FOLDER}/${socket} 55 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/memif_interface_with_ip.json 56 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 57 ${data}= Replace Variables ${data} 58 Put Json ${uri} ${data} 59 60 Put Veth Interface 61 [Arguments] ${node} ${name} ${mac} ${peer} ${enabled}=true 62 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/veth_interface.json 63 ${uri}= Set Variable /vnf-agent/${node}/config/linux/interfaces/${AGENT_VER}/interface/${name} 64 ${data}= Replace Variables ${data} 65 Put Json ${uri} ${data} 66 67 Put Veth Interface And Namespace 68 [Arguments] ${node} ${name} ${namespace} ${mac} ${peer} ${enabled}=true 69 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/veth_interface.json 70 ${uri}= Set Variable /vnf-agent/${node}/config/linux/interfaces/${AGENT_VER}/interface/${name} 71 ${data}= Replace Variables ${data} 72 Put Json ${uri} ${data} 73 74 Put Veth Interface With IP 75 [Arguments] ${node} ${name} ${mac} ${peer} ${ip} ${prefix}=24 ${mtu}=1500 ${vrf}=0 ${enabled}=true 76 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/veth_interface_with_ip.json 77 ${uri}= Set Variable /vnf-agent/${node}/config/linux/interfaces/${AGENT_VER}/interface/${name} 78 ${data}= Replace Variables ${data} 79 Put Json ${uri} ${data} 80 81 Put Veth Interface With IP And Namespace 82 [Arguments] ${node} ${name} ${namespace} ${mac} ${peer} ${ip} ${prefix}=24 ${mtu}=1500 ${enabled}=true 83 Log Many ${node} ${name} ${namespace} ${mac} ${peer} ${ip} ${prefix} ${mtu} ${enabled} 84 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/veth_interface_with_ip_and_ns.json 85 ${uri}= Set Variable /vnf-agent/${node}/config/linux/interfaces/${AGENT_VER}/interface/${name} 86 Log Many ${data} ${uri} 87 ${data}= Replace Variables ${data} 88 Log ${data} 89 Put Json ${uri} ${data} 90 91 Put Afpacket Interface 92 [Arguments] ${node} ${name} ${mac} ${host_int} ${mtu}=1500 ${enabled}=true ${vrf}=0 93 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/afpacket_interface.json 94 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 95 ${data}= Replace Variables ${data} 96 Put Json ${uri} ${data} 97 98 Put VXLan Interface 99 [Arguments] ${node} ${name} ${src} ${dst} ${vni} ${enabled}=true ${vrf}=0 100 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/vxlan_interface.json 101 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 102 ${data}= Replace Variables ${data} 103 Put Json ${uri} ${data} 104 105 Put Bridge Domain 106 [Arguments] ${node} ${name} ${ints} ${flood}=true ${unicast}=true ${forward}=true ${learn}=true ${arp_term}=true 107 ${interfaces}= Create Interfaces Json From List ${ints} 108 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/bridge_domain.json 109 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/l2/${AGENT_VER}/bridge-domain/${name} 110 ${data}= Replace Variables ${data} 111 Put Json ${uri} ${data} 112 113 Put Loopback Interface 114 [Arguments] ${node} ${name} ${mac} ${mtu}=1500 ${enabled}=true ${vrf}=0 115 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/loopback_interface.json 116 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 117 ${data}= Replace Variables ${data} 118 Put Json ${uri} ${data} 119 120 Put Loopback Interface With IP 121 [Arguments] ${node} ${name} ${mac} ${ip} ${prefix}=24 ${mtu}=1500 ${vrf}=0 ${enabled}=true 122 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/loopback_interface_with_ip.json 123 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 124 ${data}= Replace Variables ${data} 125 Put Json ${uri} ${data} 126 127 Put Physical Interface With IP 128 [Arguments] ${node} ${name} ${ip} ${prefix}=24 ${mtu}=1500 ${enabled}=true 129 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/physical_interface_with_ip.json 130 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 131 ${data}= Replace Variables ${data} 132 Put Json ${uri} ${data} 133 134 Get VPP Interface State 135 [Arguments] ${node} ${interface} 136 ${key}= Set Variable /vnf-agent/${node}/vpp/status/${AGENT_VER}/interface/${interface} 137 ${out}= Read Key ${key} 138 [Return] ${out} 139 140 Get VPP Interface State As Json 141 [Arguments] ${node} ${interface} 142 ${key}= Set Variable /vnf-agent/${node}/vpp/status/${AGENT_VER}/interface/${interface} 143 ${data}= Read Key ${key} 144 ${data}= Set Variable If '''${data}'''=="" {} ${data} 145 ${output}= Evaluate json.loads('''${data}''') json 146 [Return] ${output} 147 148 Get VPP Interface Config As Json 149 [Arguments] ${node} ${interface} 150 ${key}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${interface} 151 ${data}= Read Key ${key} 152 ${data}= Set Variable If '''${data}'''=="" {} ${data} 153 ${output}= Evaluate json.loads('''${data}''') json 154 [Return] ${output} 155 156 Get VPP NAT44 Config As Json 157 [Arguments] ${node} ${name}=None 158 ${key}= Set Variable /vnf-agent/${node}/config/vpp/nat/${AGENT_VER}/dnat44/${name} 159 ${data}= Read Key ${key} 160 ${data}= Set Variable If '''${data}'''=="" {} ${data} 161 ${output}= Evaluate json.loads('''${data}''') json 162 [Return] ${output} 163 164 Get VPP NAT44 Global Config As Json 165 [Arguments] ${node} 166 ${key}= Set Variable /vnf-agent/${node}/config/vpp/nat/${AGENT_VER}/nat44-global 167 ${data}= Read Key ${key} 168 ${data}= Set Variable If '''${data}'''=="" {} ${data} 169 ${output}= Evaluate json.loads('''${data}''') json 170 [Return] ${output} 171 172 Get Linux Interface Config As Json 173 [Arguments] ${node} ${name} 174 ${key}= Set Variable /vnf-agent/${node}/config/linux/interfaces/${AGENT_VER}/interface/${name} 175 ${data}= Read Key ${key} 176 ${data}= Set Variable If '''${data}'''=="" {} ${data} 177 ${output}= Evaluate json.loads('''${data}''') json 178 [Return] ${output} 179 180 Get Interface Internal Name 181 [Arguments] ${node} ${interface} 182 ${name}= Set Variable ${EMPTY} 183 ${empty_dict}= Create Dictionary 184 ${state}= Get VPP Interface State As Json ${node} ${interface} 185 ${length}= Get Length ${state} 186 ${name}= Run Keyword If ${length} != 0 Set Variable ${state["internal_name"]} 187 [Return] ${name} 188 189 Get Interface Sw If Index 190 [Arguments] ${node} ${interface} 191 ${state}= Get VPP Interface State As Json ${node} ${interface} 192 ${sw_if_index}= Set Variable ${state["if_index"]} 193 [Return] ${sw_if_index} 194 195 Get Bridge Domain ID 196 [Arguments] ${node} ${bd_name} 197 ${bds_dump}= Execute On Machine docker curl -sX GET http://localhost:9191/dump/vpp/v2/bd 198 ${bds_json}= Evaluate json.loads('''${bds_dump}''') json 199 :FOR ${bd} IN @{bds_json} 200 \ ${data}= Set Variable ${bd['bridge_domain']} 201 \ ${meta}= Set Variable ${bd['bridge_domain_meta']} 202 \ Return From Keyword If "${data["name"]}" == "${bd_name}" ${meta['bridge_domain_id']} 203 [Return] 0 204 205 Put TAP Unnumbered Interface 206 [Arguments] ${node} ${name} ${mac} ${unnumbered} ${interface_with_ip_name} ${host_if_name} ${mtu}=1500 ${enabled}=true 207 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/tap_interface_unnumbered.json 208 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 209 ${data}= Replace Variables ${data} 210 Put Json ${uri} ${data} 211 212 213 Put Static Fib Entry 214 [Arguments] ${node} ${bd_name} ${mac} ${outgoing_interface} ${static}=true 215 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/static_fib.json 216 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/l2/${AGENT_VER}/fib/${bd_name}/mac/${mac} 217 ${data}= Replace Variables ${data} 218 Put Json ${uri} ${data} 219 220 Create IPsec With SA And Json 221 [Arguments] ${node} ${interface} ${file_name} ${sa_index} ${spi} ${crypto_key} ${integ_key} 222 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/${file_name} 223 ${data}= replace variables ${data} 224 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/ipsec/${AGENT_VER}/sa/${sa_index} 225 ${out}= Put Json ${uri} ${data} 226 227 Create IPsec With SPD And Json 228 [Arguments] ${node} ${spd_index} ${file_name} ${interface_name} ${remote_addr} ${local_addr} ${sa_index_1} ${sa_index_2} 229 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/${file_name} 230 ${data}= replace variables ${data} 231 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/ipsec/${AGENT_VER}/spd/${spd_index} 232 ${out}= Put Json ${uri} ${data} 233 234 Delete Bridge Domain 235 [Arguments] ${node} ${name} 236 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/l2/${AGENT_VER}/bridge-domain/${name} 237 ${out}= Delete key ${uri} 238 [Return] ${out} 239 240 Delete VPP Interface 241 [Arguments] ${node} ${name} 242 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 243 ${out}= Delete key ${uri} 244 [Return] ${out} 245 246 Delete Linux Interface 247 [Arguments] ${node} ${name} 248 ${uri}= Set Variable /vnf-agent/${node}/config/linux/interfaces/${AGENT_VER}/interface/${name} 249 ${out}= Delete key ${uri} 250 [Return] ${out} 251 252 Delete Route 253 [Arguments] ${node} ${id} ${ip} ${prefix} 254 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/route/vrf/${id}/dst/${ip}/${prefix} 255 ${out}= Delete key ${uri} 256 [Return] ${out} 257 258 Delete Routes 259 [Arguments] ${node} ${id} 260 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/route/vrf/${id}/dst 261 ${command}= Set Variable ${DOCKER_COMMAND} exec etcd etcdctl del --prefix="true" ${uri} 262 ${out}= Execute On Machine docker ${command} log=false 263 [Return] ${out} 264 265 Delete IPsec 266 [Arguments] ${node} ${prefix} ${name} 267 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/ipsec/${AGENT_VER}/${prefix}/${name} 268 ${out}= Delete key ${uri} 269 [Return] ${out} 270 271 Delete Dnat 272 [Arguments] ${node} ${name} 273 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/nat/${AGENT_VER}/dnat44/${name} 274 ${out}= Delete key ${uri} 275 [Return] ${out} 276 277 Delete Nat Global 278 [Arguments] ${node} 279 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/nat/${AGENT_VER}/nat44-global 280 ${out}= Delete key ${uri} 281 [Return] ${out} 282 283 etcd: Get ETCD Tree 284 [Arguments] ${key} 285 ${command}= Set Variable ${DOCKER_COMMAND} exec etcd etcdctl get --prefix="true" ${key} 286 ${out}= Execute On Machine docker ${command} log=false 287 [Return] ${out} 288 289 Put Veth Interface Via Linux Plugin 290 [Arguments] ${node} ${namespace} ${name} ${host_if_name} ${mac} ${peer} ${ip} ${prefix}=24 ${mtu}=1500 ${enabled}=true 291 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/linux_veth_interface.json 292 ${uri}= Set Variable /vnf-agent/${node}/config/linux/interfaces/${AGENT_VER}/interface/${name} 293 ${data}= Replace Variables ${data} 294 Put Json ${uri} ${data} 295 296 Put Linux Route 297 [Arguments] ${node} ${namespace} ${interface} ${ip} ${next_hop} ${prefix}=24 ${metric}=100 298 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/linux_static_route.json 299 ${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${ip}/${prefix}/${interface} 300 ${data}= Replace Variables ${data} 301 Put Json ${uri} ${data} 302 303 Put Default Linux Route 304 [Arguments] ${node} ${namespace} ${interface} ${next_hop} ${metric}=100 ${ipv6}=${FALSE} 305 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/linux_default_static_route.json 306 ${destination}= Set Variable If ${ipv6} ::/0 0.0.0.0/0 307 ${destination_network}= Set Variable If ${ipv6} 0:0:0:0:0:0:0:0/0 0.0.0.0/0 308 ${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${destination}/${interface} 309 ${data}= Replace Variables ${data} 310 Put Json ${uri} ${data} 311 312 Delete Linux Route 313 [Arguments] ${node} ${interface} ${ip} ${prefix}=24 314 ${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${ip}/${prefix}/${interface} 315 ${out}= Delete key ${uri} 316 [Return] ${out} 317 318 Get Linux Route As Json 319 [Arguments] ${node} ${interface} ${ip} ${prefix}=24 320 ${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${ip}/${prefix}/${interface} 321 ${data}= Read Key ${uri} 322 ${data}= Set Variable If '''${data}'''=="" {} ${data} 323 ${output}= Evaluate json.loads('''${data}''') json 324 [Return] ${output} 325 326 Put ARP 327 [Arguments] ${node} ${interface} ${ipv4} ${MAC} ${static} 328 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/arp.json 329 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/arp/${interface}/${ipv4} 330 ${data}= Replace Variables ${data} 331 Put Json ${uri} ${data} 332 333 Get ARP As Json 334 [Arguments] ${node} ${interface} 335 ${key}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/arp/${interface} 336 ${data}= Read Key ${key} 337 ${data}= Set Variable If '''${data}'''=="" {} ${data} 338 ${output}= Evaluate json.loads('''${data}''') json 339 [Return] ${output} 340 341 Set L4 Features On Node 342 [Arguments] ${node} ${enabled} 343 [Documentation] Enable [disable] L4 features by setting ${enabled} to true [false]. 344 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/enable-l4.json 345 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/l4/features/feature 346 ${data}= Replace Variables ${data} 347 Put Json ${uri} ${data} 348 349 Delete ARP 350 [Arguments] ${node} ${interface} ${ipv4} 351 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/arp/${interface}/${ipv4} 352 ${out}= Delete key ${uri} 353 [Return] ${out} 354 355 Put Linux ARP With Namespace 356 [Arguments] ${node} ${interface} ${arpname} ${ipv4} ${MAC} ${nsname} ${nstype} 357 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/arp_linux.json 358 ${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/arp/${interface}/${ipv4} 359 ${data}= Replace Variables ${data} 360 Put Json ${uri} ${data} 361 362 Put Linux ARP 363 [Arguments] ${node} ${interface} ${ipv4} ${MAC} 364 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/arp_linux.json 365 ${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/arp/${interface}/${ipv4} 366 ${data}= Replace Variables ${data} 367 Put Json ${uri} ${data} 368 369 Delete Linux ARP 370 [Arguments] ${node} ${interface} ${ipv4} 371 ${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/arp/${interface}/${ipv4} 372 ${out}= Delete key ${uri} 373 [Return] ${out} 374 375 Put L2XConnect 376 [Arguments] ${node} ${rx_if} ${tx_if} 377 [Documentation] Put L2 Xconnect config json to etcd. 378 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/l2xconnect.json 379 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/l2/${AGENT_VER}/xconnect/${rx_if} 380 ${data}= Replace Variables ${data} 381 Put Json ${uri} ${data} 382 383 Delete L2XConnect 384 [Arguments] ${node} ${rx_if} 385 [Documentation] Delete L2 Xconnect config json from etcd. 386 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/l2/${AGENT_VER}/xconnect/${rx_if} 387 ${out}= Delete key ${uri} 388 [Return] ${out} 389 390 Put TAPv2 Interface With IP 391 [Arguments] ${node} ${name} ${mac} ${ip} ${host_if_name} ${prefix}=24 ${mtu}=1500 ${enabled}=true ${vrf}=0 392 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/tapv2_interface_with_ip.json 393 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 394 ${data}= Replace Variables ${data} 395 Put Json ${uri} ${data} 396 397 Put TAPv2 Interface With 2 IPs 398 [Arguments] ${node} ${name} ${mac} ${ip} ${second_ip} ${host_if_name} ${prefix}=24 ${second_prefix}=24 ${mtu}=1500 ${enabled}=true ${vrf}=0 399 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/tapv2_interface_with_two_ips.json 400 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/interfaces/${name} 401 ${data}= Replace Variables ${data} 402 Put Json ${uri} ${data} 403 404 Put STN Rule 405 [Arguments] ${node} ${interface} ${ip} 406 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/stn_rule.json 407 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/stn/${AGENT_VER}/rule/${interface}/ip/${ip} 408 ${data}= Replace Variables ${data} 409 Put Json ${uri} ${data} 410 411 Delete STN Rule 412 [Arguments] ${node} ${interface} ${ip} 413 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/stn/${AGENT_VER}/rule/${interface}/ip/${ip} 414 ${out}= Delete key ${uri} 415 [Return] ${out} 416 417 Put Local SID With Base End function 418 [Arguments] ${node} ${sidAddress} ${installationVrfId} 419 [Documentation] Add json to etcd that configurates local SID with base end function. 420 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_base_end_function.json 421 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 422 ${data}= Replace Variables ${data} 423 Put Json ${uri} ${data} 424 425 Put Local SID With End.X function 426 [Arguments] ${node} ${sidAddress} ${installationVrfId} ${outinterface} ${nexthop} ${psp} 427 [Documentation] Add json to etcd that configurates local SID with X end function. 428 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_x_end_function.json 429 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 430 ${data}= Replace Variables ${data} 431 Put Json ${uri} ${data} 432 433 Put Local SID With End.T function 434 [Arguments] ${node} ${sidAddress} ${installationVrfId} ${vrfid} ${psp} 435 [Documentation] Add json to etcd that configurates local SID with T end function. 436 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_t_end_function.json 437 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 438 ${data}= Replace Variables ${data} 439 Put Json ${uri} ${data} 440 441 Put Local SID With End.DT4 function 442 [Arguments] ${node} ${sidAddress} ${installationVrfId} ${vrfid} 443 [Documentation] Add json to etcd that configurates local SID with DT4 end function. 444 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_dt4_end_function.json 445 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 446 ${data}= Replace Variables ${data} 447 Put Json ${uri} ${data} 448 449 Put Local SID With End.DT6 function 450 [Arguments] ${node} ${sidAddress} ${installationVrfId} ${vrfid} 451 [Documentation] Add json to etcd that configurates local SID with DT6 end function. 452 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_dt6_end_function.json 453 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 454 ${data}= Replace Variables ${data} 455 Put Json ${uri} ${data} 456 457 Put Local SID With End.DX2 function 458 [Arguments] ${node} ${sidAddress} ${installationVrfId} ${outinterface} ${vlantag}=0 459 [Documentation] Add json to etcd that configurates local SID with DX2 end function. 460 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_dx2_end_function.json 461 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 462 ${data}= Replace Variables ${data} 463 Put Json ${uri} ${data} 464 465 Put Local SID With End.DX4 function 466 [Arguments] ${node} ${sidAddress} ${installationVrfId} ${outinterface} ${nexthop} 467 [Documentation] Add json to etcd that configurates local SID with DX4 end function. 468 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_dx4_end_function.json 469 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 470 ${data}= Replace Variables ${data} 471 Put Json ${uri} ${data} 472 473 Put Local SID With End.DX6 function 474 [Arguments] ${node} ${sidAddress} ${installationVrfId} ${outinterface} ${nexthop} 475 [Documentation] Add json to etcd that configurates local SID with DX6 end function. 476 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_dx6_end_function.json 477 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 478 ${data}= Replace Variables ${data} 479 Put Json ${uri} ${data} 480 481 Put Local SID With End.AD function 482 [Arguments] ${node} ${sidAddress} ${outinterface} ${ininterface} ${l3serviceaddress}= 483 [Documentation] Add json to etcd that configurates local SID with AD end function (dynamic SR-proxy). 484 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_ad_end_function.json 485 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 486 ${data}= Replace Variables ${data} 487 Put Json ${uri} ${data} 488 489 Delete Local SID 490 [Arguments] ${node} ${sidAddress} 491 [Documentation] Delete Local SID config json from etcd. 492 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/localsid/${sidAddress} 493 ${out}= Delete key ${uri} 494 [Return] ${out} 495 496 Put SRv6 Policy 497 [Arguments] ${node} ${bsid} ${installationVrfId} ${srhEncapsulation} ${sprayBehaviour} ${segmentlists} 498 [Documentation] Add SRv6 Policy config json to etcd. 499 # compute segment lists part of json 500 ${SLTemplate}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_policy_segmentlist.json 501 ${segmentlists}= Copy List ${segmentlists} # creating defensive copy to not alter global segmentlists variable 502 ${segmentListCount} Get Length ${segmentlists} 503 :FOR ${i} IN RANGE ${segmentListCount} 504 \ ${segmentlist}= Set Variable ${segmentlists[${i}]} 505 \ ${segments}= Get Slice From List ${segmentlist} 1 # segments = segment list without weight 506 \ ${segmentsStr}= Convert List To JSON string @{segments} 507 \ ${segmentlistStr}= Replace Variables ${SLTemplate} 508 \ Set List Value ${segmentlists} ${i} ${segmentlistStr} # using local copy of segmentlists as storage for computed segment list json strings 509 ${segmentlistsStr}= Evaluate ",".join($segmentlists) 510 # get it all together into policy json template 511 ${PolicyTemplate}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_policy.json 512 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/policy/${bsid} 513 ${data}= Replace Variables ${PolicyTemplate} 514 Put Json ${uri} ${data} 515 516 Convert List To JSON string 517 [Arguments] @{list} 518 [Documentation] Converts list to JSON compatible string (list items quoted and delimited by comma). No square brackets surrounding output included. 519 ${list}= Evaluate ['"'+item+'"' for item in $list] 520 ${jsonStr}= Evaluate ",".join($list) 521 [Return] ${jsonStr} 522 523 Delete SRv6 Policy 524 [Arguments] ${node} ${bsid} 525 [Documentation] Delete SRv6 policy config json from etcd. 526 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/policy/${bsid} 527 ${out}= Delete key ${uri} 528 [Return] ${out} 529 530 Put SRv6 L3 Steering 531 [Arguments] ${node} ${name} ${bsid} ${installationVrfId} ${prefixAddress} 532 [Documentation] Add SRv6 steering config json to etcd. 533 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_steering_l3.json 534 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/steering/${name} 535 ${data}= Replace Variables ${data} 536 Put Json ${uri} ${data} 537 538 Put SRv6 L2 Steering 539 [Arguments] ${node} ${name} ${bsid} ${interfaceName} 540 [Documentation] Add SRv6 steering config json to etcd. 541 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_steering_l2.json 542 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/steering/${name} 543 ${data}= Replace Variables ${data} 544 Put Json ${uri} ${data} 545 546 Delete SRv6 Steering 547 [Arguments] ${node} ${name} 548 [Documentation] Delete SRv6 steering config json from etcd. 549 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/srv6/${AGENT_VER}/steering/${name} 550 ${out}= Delete key ${uri} 551 [Return] ${out} 552 553 Create VRF Table 554 [Arguments] ${node} ${id} ${protocol} ${label}= 555 [Documentation] Add VRF table config json to etcd. 556 ${protocol}= Convert To Uppercase ${protocol} 557 ${protocolEnumValue}= Run Keyword If '${protocol}'=='IPV6' Set Variable 1 558 ... ELSE Set Variable 0 #IPv4 559 ${data}= OperatingSystem.Get File ${CURDIR}/../resources/vrf.json 560 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/vrf-table/id/${id}/protocol/${protocol} 561 ${data}= Replace Variables ${data} 562 Put Json ${uri} ${data} 563 564 Delete VRF Table 565 [Arguments] ${node} ${id} ${protocol} 566 [Documentation] Delete VRF table config json from etcd. 567 ${protocol}= Convert To Uppercase ${protocol} 568 ${uri}= Set Variable /vnf-agent/${node}/config/vpp/${AGENT_VER}/vrf-table/id/${id}/protocol/${protocol} 569 ${out}= Delete key ${uri} 570 [Return] ${out}