Skip to content

Commit fef1de8

Browse files
committed
added robot tests covering segment routing proxy functionality and added also some fixes of previous tests
Signed-off-by: Filip Gschwandtner <[email protected]>
1 parent a3bd544 commit fef1de8

15 files changed

+418
-61
lines changed

tests/robot/libraries/etcdctl.robot

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,13 @@ Put TAPv2 Interface With IP
505505
${data}= Replace Variables ${data}
506506
Put Json ${uri} ${data}
507507

508+
Put TAPv2 Interface With 2 IPs
509+
[Arguments] ${node} ${name} ${mac} ${ip} ${second_ip} ${host_if_name} ${prefix}=24 ${second_prefix}=24 ${mtu}=9000 ${enabled}=true ${vrf}=0
510+
${data}= OperatingSystem.Get File ${CURDIR}/../resources/tapv2_interface_with_two_ips.json
511+
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/interface/${name}
512+
${data}= Replace Variables ${data}
513+
Put Json ${uri} ${data}
514+
508515
Put STN Rule
509516
[Arguments] ${node} ${interface} ${ip} ${rule_name}
510517
${data}= OperatingSystem.Get File ${CURDIR}/../resources/stn_rule.json
@@ -518,12 +525,36 @@ Delete STN Rule
518525
${out}= Delete key ${uri}
519526
[Return] ${out}
520527

521-
Put Local SID
528+
Put Local SID With Base End function
529+
[Arguments] ${node} ${localsidName} ${sidAddress} ${fibtable}
530+
[Documentation] Add json to etcd that configurates local SID with base end function.
531+
${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_base_end_function.json
532+
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/srv6/localsid/${localsidName}
533+
${data}= Replace Variables ${data}
534+
Put Json ${uri} ${data}
535+
536+
Put Local SID With End.DX4 function
522537
[Arguments] ${node} ${localsidName} ${sidAddress} ${fibtable} ${outinterface} ${nexthop}
523-
[Documentation] Add Local SID config json to etcd.
524-
${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid.json
525-
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/srv6/localsid/${localsidName}
526-
${data}= Replace Variables ${data}
538+
[Documentation] Add json to etcd that configurates local SID with DX4 end function.
539+
${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_dx4_end_function.json
540+
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/srv6/localsid/${localsidName}
541+
${data}= Replace Variables ${data}
542+
Put Json ${uri} ${data}
543+
544+
Put Local SID With End.DX6 function
545+
[Arguments] ${node} ${localsidName} ${sidAddress} ${fibtable} ${outinterface} ${nexthop}
546+
[Documentation] Add json to etcd that configurates local SID with DX6 end function.
547+
${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_dx6_end_function.json
548+
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/srv6/localsid/${localsidName}
549+
${data}= Replace Variables ${data}
550+
Put Json ${uri} ${data}
551+
552+
Put Local SID With End.AD function
553+
[Arguments] ${node} ${localsidName} ${sidAddress} ${serviceaddress} ${outinterface} ${ininterface}
554+
[Documentation] Add json to etcd that configurates local SID with AD end function (dynamic SR-proxy).
555+
${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_local_sid_with_ad_end_function.json
556+
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/srv6/localsid/${localsidName}
557+
${data}= Replace Variables ${data}
527558
Put Json ${uri} ${data}
528559

529560
Delete Local SID
@@ -551,11 +582,21 @@ Delete SRv6 Policy
551582
Put SRv6 Policy Segment
552583
[Arguments] ${node} ${name} ${policyName} ${policyBSID} ${weight} ${segmentlist}
553584
[Documentation] Add SRv6 Policy Segment config json to etcd.
554-
length should be ${segmentlist} 3
555-
${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_policy_segment.json
556-
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/srv6/policy/${policyName}/segment/${name}
557-
${data}= Replace Variables ${data}
558-
Put Json ${uri} ${data}
585+
${segmentlistStr}= Convert List To JSON string @{segmentlist}
586+
${data}= OperatingSystem.Get File ${CURDIR}/../resources/srv6_policy_segment.json
587+
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/srv6/policy/${policyName}/segment/${name}
588+
${data}= Replace Variables ${data}
589+
Put Json ${uri} ${data}
590+
591+
Convert List To JSON string
592+
[Arguments] @{list}
593+
[Documentation] Converts list to JSON compatible string (list items quoted and delimited by comma). No square brackets surrounding output included.
594+
${jsonStr} Set Variable ${EMPTY}
595+
:FOR ${item} IN @{list}
596+
\ ${jsonStr}= Run Keyword If '${jsonStr}'!='${EMPTY}' Catenate ${jsonStr} ,
597+
\ ... ELSE Set Variable ${jsonStr}
598+
\ ${jsonStr}= Catenate ${jsonStr} "${item}"
599+
[Return] ${jsonStr}
559600

560601
Delete SRv6 Policy Segment
561602
[Arguments] ${node} ${name} ${policyName}

tests/robot/libraries/linux.robot

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ linux: Interface Not Exists
6464
linux: Check Interface Presence ${node} ${mac} ${FALSE}
6565

6666
linux: Check Ping
67-
[Arguments] ${node} ${ip}
68-
${out}= Execute In Container ${node} ping -c 5 ${ip}
67+
[Arguments] ${node} ${ip} ${count}=5
68+
${out}= Execute In Container ${node} ping -c ${count} ${ip}
6969
Should Contain ${out} from ${ip}
7070
Should Not Contain ${out} 100% packet loss
7171

7272
linux: Check Ping6
73-
[Arguments] ${node} ${ip}
74-
${out}= Execute In Container ${node} ping6 -c 5 ${ip}
75-
Should Contain ${out} from ${ip}
73+
[Arguments] ${node} ${ip} ${count}=5
74+
${out}= Execute In Container ${node} ping6 -c ${count} ${ip}
75+
Should Contain ${out} from ${ip} ignore_case=True
7676
Should Not Contain ${out} 100% packet loss
7777

7878
linux: Run TCP Ping Server On Node
@@ -122,9 +122,11 @@ linux: Check Processes on Node
122122
${out}= Execute In Container ${node} ps aux
123123

124124
linux: Set Host TAP Interface
125-
[Arguments] ${node} ${host_if_name} ${ip} ${prefix}
125+
[Arguments] ${node} ${host_if_name} ${ip} ${prefix} ${mac}= ${second_ip}= ${second_prefix}=
126126
${out}= Execute In Container ${node} ip link set dev ${host_if_name} up
127127
${out}= Execute In Container ${node} ip addr add ${ip}/${prefix} dev ${host_if_name}
128+
Run Keyword If "${second_ip}" != "" Execute In Container ${node} ip addr add ${second_ip}/${second_prefix} dev ${host_if_name}
129+
Run Keyword If "${mac}" != "" Execute In Container ${node} ip link set ${host_if_name} address ${mac}
128130

129131
linux: Add Route
130132
[Arguments] ${node} ${destination_ip} ${prefix} ${next_hop_ip}

tests/robot/libraries/pretty_keywords.robot

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Create ${type} ${name} On ${node} With IP ${ip}, MAC ${mac}, Key ${key} And ${so
2626
${type}= Set Variable if "${type}"=="Master" true false
2727
${out}= Put Memif Interface With IP ${node} ${name} ${mac} ${type} ${key} ${ip} socket=${socket}
2828

29+
Create ${type} ${name} On ${node} With Prefixed IP ${ip}/${prefix}, MAC ${mac}, Key ${key} And ${socket} Socket
30+
${type}= Set Variable if "${type}"=="Master" true false
31+
${out}= Put Memif Interface With IP ${node} ${name} ${mac} ${type} ${key} ${ip} prefix=${prefix} socket=${socket}
32+
2933
Create ${type} ${name} On ${node} With Vrf ${vrf}, IP ${ip}, MAC ${mac}, Key ${key} And ${socket} Socket
3034
${type}= Set Variable if "${type}"=="Master" true false
3135
${out}= Put Memif Interface With IP ${node} ${name} ${mac} ${type} ${key} ${ip} socket=${socket} vrf=${vrf}
@@ -53,6 +57,12 @@ Create Route On ${node} With IP ${ip}/${prefix} With Next Hop VRF ${next_hop_vrf
5357
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/vrf/${id}/fib/${ip}/${prefix}
5458
${out}= Put Json ${uri} ${data}
5559

60+
Create Route On ${node} With IP ${ip}/${prefix} With Vrf Id ${id} With Interface ${interface} And Next Hop ${next_hop}
61+
${data}= OperatingSystem.Get File ${CURDIR}/../../robot/resources/static_route_with_interface.json
62+
${data}= replace variables ${data}
63+
${uri}= Set Variable /vnf-agent/${node}/vpp/config/v1/vrf/${id}/fib/${ip}/${prefix}/${next_hop}
64+
${out}= Put Json ${uri} ${data}
65+
5666
Delete IPsec On ${node} With Prefix ${prefix} And Name ${name}
5767
Delete IPsec ${node} ${prefix} ${name}
5868

tests/robot/libraries/setup-teardown.robot

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,16 @@ Get ETCD Dump
122122
[Return] ${out}
123123

124124
Take ETCD Snapshots
125-
[Arguments] ${tag} ${machine}=docker
126-
${dump}= Get ETCD Dump ${machine}
127-
Append To File ${RESULTS_FOLDER}/etcd_dump-${tag}.txt ${dump}
128-
Append To File ${RESULTS_FOLDER_SUITE}/etcd_dump-${tag}.txt ${dump}
129-
${errors}= Get Lines Containing String ${dump} /error/
130-
${status}= Run Keyword And Return Status Should Be Empty ${errors}
131-
Run Keyword If ${status}==False Log Errors detected in keys: ${errors} level=WARN
132-
125+
[Arguments] ${tag} ${machine}=docker
126+
${dump}= Get ETCD Dump ${machine}
127+
Append To File ${RESULTS_FOLDER}/etcd_dump-${tag}.txt ${dump}
128+
Append To File ${RESULTS_FOLDER_SUITE}/etcd_dump-${tag}.txt ${dump}
129+
${errors}= Get Lines Containing String ${dump} /error/
130+
${errorscount}= Get Line Count ${errors}
131+
${nullerrors}= Get Regexp Matches ${dump} /error/.*\nnull\n
132+
${nullerrorscount}= Get Length ${nullerrors}
133+
Run Keyword If ${errorscount} > 0 and ${errorscount} != ${nullerrorscount} Log Errors detected in keys: ${errors} level=WARN
134+
133135
Create Next Snapshot Prefix
134136
${prefix}= Evaluate str(${snapshot_num}).zfill(3)
135137
${snapshot_num}= Evaluate ${snapshot_num}+1

tests/robot/libraries/vpp_term.robot

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,16 @@ vpp_term: Check ARP
275275
${status}= Run Keyword If '${internal_name}'!='${None}' Parse ARP ${out} ${internal_name} ${ipv4} ${MAC} ELSE Set Variable False
276276
Should Be Equal As Strings ${status} ${presence}
277277

278+
vpp_term: Set IPv6 neighbor
279+
[Arguments] ${node} ${interface} ${ipv6} ${MAC}
280+
[Documentation] Sets IPv6 neighbors
281+
vpp_term: Issue Command ${node} set ip6 neighbor ${interface} ${ipv6} ${MAC}
282+
283+
vpp_term: Set ARP
284+
[Arguments] ${node} ${interface} ${ipv4} ${MAC}
285+
[Documentation] Sets ARP (IPv4 neighbors)
286+
vpp_term: Issue Command ${node} set ip arp ${interface} ${ipv4} ${MAC}
287+
278288
vpp_term: Show Application Namespaces
279289
[Arguments] ${node}
280290
[Documentation] Show application namespaces through vpp terminal
@@ -339,14 +349,18 @@ vpp_term: Show Trace
339349
${out}= vpp_term: Issue Command ${node} show trace
340350
[Return] ${out}
341351

352+
vpp_term: Clear Trace
353+
[Arguments] ${node}
354+
[Documentation] vpp_term: Clear Trace
355+
${out}= vpp_term: Issue Command ${node} clear trace
356+
[Return] ${out}
342357

343358
vpp_term: Add Trace Memif
344-
[Arguments] ${node}
359+
[Arguments] ${node} ${count}=10
345360
[Documentation] vpp_term: Add Trace for memif interfaces
346-
${out}= vpp_term: Issue Command ${node} trace add memif-input 10
361+
${out}= vpp_term: Issue Command ${node} trace add memif-input ${count}
347362
[Return] ${out}
348363

349-
350364
vpp_term: Show STN Rules
351365
[Arguments] ${node}
352366
[Documentation] Show STN Rules
@@ -371,9 +385,9 @@ vpp_term: Check STN Rule Deleted
371385
Should Not Contain ${out} ${internal_name}
372386

373387
vpp_term: Add Trace Afpacket
374-
[Arguments] ${node}
388+
[Arguments] ${node} ${count}=10
375389
[Documentation] vpp_term: Add Trace for afpacket interfaces
376-
${out}= vpp_term: Issue Command ${node} trace add af-packet-input 10
390+
${out}= vpp_term: Issue Command ${node} trace add af-packet-input ${count}
377391
[Return] ${out}
378392

379393
vpp_term: Set VPP Tracing And Debugging
@@ -400,6 +414,12 @@ vpp_term: Check Local SID Presence
400414
#${terminal_timeout}
401415
Wait Until Keyword Succeeds 5x 2s vpp_term: Local SID exists node=${node} sidAddress=${sidAddress} interface=${interface} nexthop=${nexthop}
402416

417+
vpp_term: Check SR-Proxy Local SID Presence
418+
[Arguments] ${node} ${sidAddress} ${serviceaddress} ${outinterface} ${ininterface}
419+
[Documentation] Checking if specified local sid with SR-Proxy functionality (End.AD) exists or will show up
420+
#${terminal_timeout}
421+
Wait Until Keyword Succeeds 5x 2s vpp_term: SR-Proxy Local SID exists node=${node} sidAddress=${sidAddress} serviceaddress=${serviceaddress} outinterface=${outinterface} ininterface=${ininterface}
422+
403423
vpp_term: Local SID exists
404424
[Arguments] ${node} ${sidAddress} ${interface} ${nexthop}
405425
[Documentation] Checking if specified local sid exists
@@ -413,6 +433,19 @@ vpp_term: Local SID exists
413433
${matchdata}= Convert To Lowercase ${matchdata}
414434
Should Contain ${localsidsStr} ${matchdata}
415435

436+
vpp_term: SR-Proxy Local SID exists
437+
[Arguments] ${node} ${sidAddress} ${serviceaddress} ${outinterface} ${ininterface}
438+
[Documentation] Checking if specified SR-Proxy local sid exists
439+
${localsidsStr}= vpp_term: Show Local SIDs ${node}
440+
Create File /tmp/srv6_sh_sr_localsid_proxy_output.txt ${localsidsStr} #FIXME remove dirty trick with saving string to file just to be able to match substring in string
441+
${localsidsStr}= OperatingSystem.Get File /tmp/srv6_sh_sr_localsid_proxy_output.txt
442+
${localsidsStr}= Basic_Operations.Replace_Rn_N ${localsidsStr} #FIX for BUG with New Line
443+
${localsidsStr}= Convert To Lowercase ${localsidsStr}
444+
${matchdata}= OperatingSystem.Get File ${CURDIR}/../suites/crud/test_data/srv6_sh_sr_localsid_proxy_output_match.txt
445+
${matchdata}= Replace Variables ${matchdata}
446+
${matchdata}= Convert To Lowercase ${matchdata}
447+
Should Contain ${localsidsStr} ${matchdata}
448+
416449
vpp_term: Show Local SIDs
417450
[Arguments] ${node}
418451
[Documentation] Show locasids through vpp terminal
@@ -506,7 +539,7 @@ vpp_term: SRv6 Steering exists
506539
vpp_term: Show SRv6 steering policies
507540
[Arguments] ${node}
508541
[Documentation] Show SRv6 steering policies through vpp terminal
509-
${out}= vpp_term: Issue Command ${node} sh sr steering policies
542+
${out}= vpp_term: Issue Command ${node} sh sr steering-policies
510543
[Return] ${out}
511544

512545
vpp_term: Check SRv6 Steering NonExistence
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"sid": "${sidAddress}",
3+
"end_function_AD": {
4+
"service_address":"${serviceaddress}",
5+
"outgoing_interface":"${outinterface}",
6+
"incoming_interface":"${ininterface}"
7+
}
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sid": "${sidAddress}",
3+
"fib_table_id": ${fibtable},
4+
"base_end_function": {
5+
}
6+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"sid": "${sidAddress}",
3+
"fib_table_id": ${fibtable},
4+
"end_function_DX4": {
5+
"outgoing_interface":"${outinterface}",
6+
"next_hop":"${nexthop}"
7+
}
8+
}

tests/robot/resources/srv6_policy_segment.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"policy_bsid": "${policyBSID}",
33
"weight":${weight},
44
"segments":[
5-
"${segmentlist[0]}",
6-
"${segmentlist[1]}",
7-
"${segmentlist[2]}"
5+
${segmentlistStr}
86
]
97
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"vrf_id": ${id},
3+
"description": "Static route",
4+
"dst_ip_addr": "${ip}/${prefix}",
5+
"next_hop_addr": "${next_hop}",
6+
"outgoing_interface": "${interface}"
7+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "${name}",
3+
"type": 3,
4+
"enabled": ${enabled},
5+
"phys_address": "${mac}",
6+
"mtu": ${mtu},
7+
"vrf": ${vrf},
8+
"ip_addresses": [
9+
"${ip}/${prefix}",
10+
"${second_ip}/${second_prefix}"
11+
],
12+
"tap": {
13+
"version": 2,
14+
"host_if_name": "${host_if_name}"
15+
}
16+
}

0 commit comments

Comments
 (0)