Add a release pipeline including tests for Bird2 and VPP
This commit is contained in:
57
tests/01-vpp-bird/01-e2e-lab.robot
Normal file
57
tests/01-vpp-bird/01-e2e-lab.robot
Normal file
@@ -0,0 +1,57 @@
|
||||
*** Settings ***
|
||||
Library OperatingSystem
|
||||
Resource ../ssh.robot
|
||||
Resource ../common.robot
|
||||
|
||||
Suite Teardown Run Keyword Cleanup
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${lab-name} e2e-vpp
|
||||
${lab-file-name} e2e-lab/vpp.clab.yml
|
||||
${runtime} docker
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
Deploy ${lab-name} lab
|
||||
Log ${CURDIR}
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
|
||||
Pause to let OSPF converge
|
||||
Sleep 20s
|
||||
|
||||
Check BFD Adjacencies
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=vpp2 --cmd "birdc show bfd ses"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Match Regexp ${output} (?m)fe80::.*eth2.*Up
|
||||
Should Match Regexp ${output} (?m)10\.82\.98\..*eth2.*Up
|
||||
|
||||
Check OSPF IPv4 Adjacency
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=vpp1 --cmd "birdc show ospf nei ospf4"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Match Regexp ${output} (?m)Full/PtP.*eth2
|
||||
|
||||
Check OSPF IPv6 Adjacency
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=vpp2 --cmd "birdc show ospf nei ospf6"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Match Regexp ${output} (?m)Full/PtP.*eth2
|
||||
|
||||
Ensure client1 can ping client2
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client1 --cmd "ping -c 5 10.82.98.82"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Contain ${output} 5 packets transmitted, 4 packets received, 20% packet loss
|
||||
|
||||
*** Keywords ***
|
||||
Cleanup
|
||||
Run ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
|
||||
19
tests/01-vpp-bird/e2e-lab/config/vpp1/bird-local.conf
Normal file
19
tests/01-vpp-bird/e2e-lab/config/vpp1/bird-local.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
protocol bfd bfd1 {
|
||||
interface "eth2" { interval 100 ms; multiplier 30; };
|
||||
}
|
||||
|
||||
protocol ospf v2 ospf4 {
|
||||
ipv4 { import all; export all; };
|
||||
area 0 {
|
||||
interface "loop0" { stub yes; };
|
||||
interface "eth2" { type pointopoint; cost 10; bfd on; };
|
||||
};
|
||||
}
|
||||
|
||||
protocol ospf v3 ospf6 {
|
||||
ipv6 { import all; export all; };
|
||||
area 0 {
|
||||
interface "loop0" { stub yes; };
|
||||
interface "eth2" { type pointopoint; cost 10; bfd on; };
|
||||
};
|
||||
}
|
||||
16
tests/01-vpp-bird/e2e-lab/config/vpp1/vppcfg.yaml
Normal file
16
tests/01-vpp-bird/e2e-lab/config/vpp1/vppcfg.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
interfaces:
|
||||
eth1:
|
||||
description: "To client1"
|
||||
mtu: 1500
|
||||
lcp: eth1
|
||||
addresses: [10.82.98.65/28, 2001:db8:8298:101::1/64]
|
||||
eth2:
|
||||
description: "To vpp2"
|
||||
mtu: 9216
|
||||
lcp: eth2
|
||||
addresses: [10.82.98.16/31, 2001:db8:8298:1::1/64]
|
||||
loopbacks:
|
||||
loop0:
|
||||
description: "vpp1"
|
||||
lcp: loop0
|
||||
addresses: [10.82.98.0/32, 2001:db8:8298::/128]
|
||||
19
tests/01-vpp-bird/e2e-lab/config/vpp2/bird-local.conf
Normal file
19
tests/01-vpp-bird/e2e-lab/config/vpp2/bird-local.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
protocol bfd bfd1 {
|
||||
interface "eth2" { interval 100 ms; multiplier 30; };
|
||||
}
|
||||
|
||||
protocol ospf v2 ospf4 {
|
||||
ipv4 { import all; export all; };
|
||||
area 0 {
|
||||
interface "loop0" { stub yes; };
|
||||
interface "eth2" { type pointopoint; cost 10; bfd on; };
|
||||
};
|
||||
}
|
||||
|
||||
protocol ospf v3 ospf6 {
|
||||
ipv6 { import all; export all; };
|
||||
area 0 {
|
||||
interface "loop0" { stub yes; };
|
||||
interface "eth2" { type pointopoint; cost 10; bfd on; };
|
||||
};
|
||||
}
|
||||
16
tests/01-vpp-bird/e2e-lab/config/vpp2/vppcfg.yaml
Normal file
16
tests/01-vpp-bird/e2e-lab/config/vpp2/vppcfg.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
interfaces:
|
||||
eth1:
|
||||
description: "To client2"
|
||||
mtu: 1500
|
||||
lcp: eth1
|
||||
addresses: [10.82.98.81/28, 2001:db8:8298:102::1/64]
|
||||
eth2:
|
||||
description: "To vpp1"
|
||||
mtu: 9216
|
||||
lcp: eth2
|
||||
addresses: [10.82.98.17/31, 2001:db8:8298:1::2/64]
|
||||
loopbacks:
|
||||
loop0:
|
||||
description: "vpp2"
|
||||
lcp: loop0
|
||||
addresses: [10.82.98.1/32, 2001:db8:8298::1/128]
|
||||
38
tests/01-vpp-bird/e2e-lab/vpp.clab.yml
Normal file
38
tests/01-vpp-bird/e2e-lab/vpp.clab.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: e2e-vpp
|
||||
|
||||
topology:
|
||||
kinds:
|
||||
fdio_vpp:
|
||||
image: ${IMAGE}
|
||||
startup-config: config/__clabNodeName__/vppcfg.yaml
|
||||
binds:
|
||||
- config/__clabNodeName__/bird-local.conf:/config/bird/bird-local.conf:ro
|
||||
linux:
|
||||
image: alpine:latest
|
||||
|
||||
nodes:
|
||||
vpp1:
|
||||
kind: fdio_vpp
|
||||
vpp2:
|
||||
kind: fdio_vpp
|
||||
client1:
|
||||
kind: linux
|
||||
exec:
|
||||
- ip link set address 00:c1:ab:00:00:01 dev eth1
|
||||
- ip addr add 10.82.98.66/28 dev eth1
|
||||
- ip route add 10.82.98.0/24 via 10.82.98.65
|
||||
- ip addr add 2001:db8:8298:101::2/64 dev eth1
|
||||
- ip route add 2001:db8:8298::/48 via 2001:db8:8298:101::1
|
||||
client2:
|
||||
kind: linux
|
||||
exec:
|
||||
- ip link set address 00:c1:ab:00:00:02 dev eth1
|
||||
- ip addr add 10.82.98.82/28 dev eth1
|
||||
- ip route add 10.82.98.0/24 via 10.82.98.81
|
||||
- ip addr add 2001:db8:8298:102::2/64 dev eth1
|
||||
- ip route add 2001:db8:8298::/48 via 2001:db8:8298:102::1
|
||||
|
||||
links:
|
||||
- endpoints: ["vpp1:eth2", "vpp2:eth2"]
|
||||
- endpoints: ["client1:eth1", "vpp1:eth1"]
|
||||
- endpoints: ["client2:eth1", "vpp2:eth1"]
|
||||
58
tests/02-vpp-frr/01-e2e-lab.robot
Normal file
58
tests/02-vpp-frr/01-e2e-lab.robot
Normal file
@@ -0,0 +1,58 @@
|
||||
*** Settings ***
|
||||
Library OperatingSystem
|
||||
Resource ../ssh.robot
|
||||
Resource ../common.robot
|
||||
|
||||
Suite Teardown Run Keyword Cleanup
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${lab-name} e2e-vpp
|
||||
${lab-file-name} e2e-lab/vpp.clab.yml
|
||||
${runtime} docker
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
Deploy ${lab-name} lab
|
||||
Log ${CURDIR}
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
|
||||
Pause to let OSPF converge
|
||||
Sleep 20s
|
||||
|
||||
Check BFD Adjacencies
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=vpp1 --cmd "vtysh -c 'show bfd peers brief'"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Match Regexp ${output} (?m)10\.82\.98\..*10\.82\.98\..*up
|
||||
Should Match Regexp ${output} (?m)fe80::.*fe80::.*up
|
||||
|
||||
Check OSPF IPv4 Adjacency
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=vpp1 --cmd "vtysh -c 'show ip ospf nei'"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Match Regexp ${output} (?m)Full/.*eth2
|
||||
|
||||
Check OSPF IPv6 Adjacency
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=vpp2 --cmd "vtysh -c 'show ipv6 ospf nei'"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Match Regexp ${output} (?m)Full/.*eth2
|
||||
|
||||
Ensure client1 can ping client2
|
||||
${rc} ${output} = Run And Return Rc And Output
|
||||
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client1 --cmd "ping -c 5 10.82.98.82"
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Contain ${output} 5 packets transmitted, 4 packets received, 20% packet loss
|
||||
|
||||
|
||||
*** Keywords ***
|
||||
Cleanup
|
||||
Run ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
|
||||
31
tests/02-vpp-frr/e2e-lab/config/vpp1/frr.conf
Normal file
31
tests/02-vpp-frr/e2e-lab/config/vpp1/frr.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
frr version 10.3
|
||||
frr defaults traditional
|
||||
hostname vpp1
|
||||
log syslog informational
|
||||
service integrated-vtysh-config
|
||||
!
|
||||
ip router-id 10.82.98.0
|
||||
!
|
||||
interface eth2
|
||||
ip ospf area 0
|
||||
ip ospf bfd
|
||||
ip ospf cost 10
|
||||
ip ospf network point-to-point
|
||||
ipv6 ospf6 area 0
|
||||
ipv6 ospf6 bfd
|
||||
ipv6 ospf6 cost 10
|
||||
ipv6 ospf6 network point-to-point
|
||||
exit
|
||||
!
|
||||
interface loop0
|
||||
ip ospf passive
|
||||
exit
|
||||
!
|
||||
router ospf
|
||||
redistribute connected
|
||||
exit
|
||||
!
|
||||
router ospf6
|
||||
redistribute connected
|
||||
exit
|
||||
!
|
||||
16
tests/02-vpp-frr/e2e-lab/config/vpp1/vppcfg.yaml
Normal file
16
tests/02-vpp-frr/e2e-lab/config/vpp1/vppcfg.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
interfaces:
|
||||
eth1:
|
||||
description: "To client1"
|
||||
mtu: 1500
|
||||
lcp: eth1
|
||||
addresses: [10.82.98.65/28, 2001:db8:8298:101::1/64]
|
||||
eth2:
|
||||
description: "To vpp2"
|
||||
mtu: 9216
|
||||
lcp: eth2
|
||||
addresses: [10.82.98.16/31, 2001:db8:8298:1::1/64]
|
||||
loopbacks:
|
||||
loop0:
|
||||
description: "vpp1"
|
||||
lcp: loop0
|
||||
addresses: [10.82.98.0/32, 2001:db8:8298::/128]
|
||||
31
tests/02-vpp-frr/e2e-lab/config/vpp2/frr.conf
Normal file
31
tests/02-vpp-frr/e2e-lab/config/vpp2/frr.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
frr version 10.3
|
||||
frr defaults traditional
|
||||
hostname vpp2
|
||||
log syslog informational
|
||||
service integrated-vtysh-config
|
||||
!
|
||||
ip router-id 10.82.98.1
|
||||
!
|
||||
interface eth2
|
||||
ip ospf area 0
|
||||
ip ospf bfd
|
||||
ip ospf cost 10
|
||||
ip ospf network point-to-point
|
||||
ipv6 ospf6 area 0
|
||||
ipv6 ospf6 bfd
|
||||
ipv6 ospf6 cost 10
|
||||
ipv6 ospf6 network point-to-point
|
||||
exit
|
||||
!
|
||||
interface loop0
|
||||
ip ospf passive
|
||||
exit
|
||||
!
|
||||
router ospf
|
||||
redistribute connected
|
||||
exit
|
||||
!
|
||||
router ospf6
|
||||
redistribute connected
|
||||
exit
|
||||
!
|
||||
16
tests/02-vpp-frr/e2e-lab/config/vpp2/vppcfg.yaml
Normal file
16
tests/02-vpp-frr/e2e-lab/config/vpp2/vppcfg.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
interfaces:
|
||||
eth1:
|
||||
description: "To client2"
|
||||
mtu: 1500
|
||||
lcp: eth1
|
||||
addresses: [10.82.98.81/28, 2001:db8:8298:102::1/64]
|
||||
eth2:
|
||||
description: "To vpp1"
|
||||
mtu: 9216
|
||||
lcp: eth2
|
||||
addresses: [10.82.98.17/31, 2001:db8:8298:1::2/64]
|
||||
loopbacks:
|
||||
loop0:
|
||||
description: "vpp2"
|
||||
lcp: loop0
|
||||
addresses: [10.82.98.1/32, 2001:db8:8298::1/128]
|
||||
41
tests/02-vpp-frr/e2e-lab/vpp.clab.yml
Normal file
41
tests/02-vpp-frr/e2e-lab/vpp.clab.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
name: e2e-vpp
|
||||
|
||||
topology:
|
||||
kinds:
|
||||
fdio_vpp:
|
||||
image: ${IMAGE}
|
||||
startup-config: config/__clabNodeName__/vppcfg.yaml
|
||||
binds:
|
||||
- config/__clabNodeName__/frr.conf:/config/frr/frr.conf:ro
|
||||
env:
|
||||
BIRD_ENABLED: false
|
||||
FRR_ENABLED: true
|
||||
linux:
|
||||
image: alpine:latest
|
||||
|
||||
nodes:
|
||||
vpp1:
|
||||
kind: fdio_vpp
|
||||
vpp2:
|
||||
kind: fdio_vpp
|
||||
client1:
|
||||
kind: linux
|
||||
exec:
|
||||
- ip link set address 00:c1:ab:00:00:01 dev eth1
|
||||
- ip addr add 10.82.98.66/28 dev eth1
|
||||
- ip route add 10.82.98.0/24 via 10.82.98.65
|
||||
- ip addr add 2001:db8:8298:101::2/64 dev eth1
|
||||
- ip route add 2001:db8:8298::/48 via 2001:db8:8298:101::1
|
||||
client2:
|
||||
kind: linux
|
||||
exec:
|
||||
- ip link set address 00:c1:ab:00:00:02 dev eth1
|
||||
- ip addr add 10.82.98.82/28 dev eth1
|
||||
- ip route add 10.82.98.0/24 via 10.82.98.81
|
||||
- ip addr add 2001:db8:8298:102::2/64 dev eth1
|
||||
- ip route add 2001:db8:8298::/48 via 2001:db8:8298:102::1
|
||||
|
||||
links:
|
||||
- endpoints: ["vpp1:eth2", "vpp2:eth2"]
|
||||
- endpoints: ["client1:eth1", "vpp1:eth1"]
|
||||
- endpoints: ["client2:eth1", "vpp2:eth1"]
|
||||
2
tests/common.robot
Normal file
2
tests/common.robot
Normal file
@@ -0,0 +1,2 @@
|
||||
*** Variables ***
|
||||
${CLAB_BIN} containerlab
|
||||
2
tests/requirements.txt
Normal file
2
tests/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
robotframework
|
||||
robotframework-sshlibrary
|
||||
45
tests/rf-run.sh
Executable file
45
tests/rf-run.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
# Run Robot Framework tests for vpp-containerlab.
|
||||
# Arguments:
|
||||
# $1 - container runtime: [docker, podman]
|
||||
# $2 - test suite path (directory or .robot file)
|
||||
#
|
||||
# Environment variables:
|
||||
# CLAB_BIN - path to containerlab binary (default: containerlab)
|
||||
# IMAGE - docker image to use in topology (must be set)
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "${CLAB_BIN}" ]; then
|
||||
CLAB_BIN=containerlab
|
||||
fi
|
||||
|
||||
if [ -z "${IMAGE}" ]; then
|
||||
echo "ERROR: IMAGE environment variable must be set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
mkdir -p "${SCRIPT_DIR}/out"
|
||||
|
||||
source "${SCRIPT_DIR}/.venv/bin/activate"
|
||||
|
||||
function get_logname() {
|
||||
path=$1
|
||||
filename=$(basename "$path")
|
||||
if [[ "$filename" == *.* ]]; then
|
||||
dirname=$(dirname "$path")
|
||||
basename=$(basename "$path" | cut -d. -f1)
|
||||
echo "${dirname##*/}-${basename}"
|
||||
else
|
||||
echo "${filename}"
|
||||
fi
|
||||
}
|
||||
|
||||
robot --consolecolors on -r none \
|
||||
--variable CLAB_BIN:"${CLAB_BIN}" \
|
||||
--variable runtime:"$1" \
|
||||
-l "${SCRIPT_DIR}/out/$(get_logname $2)-$1-log" \
|
||||
--output "${SCRIPT_DIR}/out/$(get_logname $2)-$1-out.xml" \
|
||||
"$2"
|
||||
44
tests/ssh.robot
Normal file
44
tests/ssh.robot
Normal file
@@ -0,0 +1,44 @@
|
||||
*** Settings ***
|
||||
Library SSHLibrary
|
||||
|
||||
|
||||
*** Keywords ***
|
||||
Login via SSH with username and password
|
||||
[Arguments]
|
||||
... ${address}=${None}
|
||||
... ${port}=22
|
||||
... ${username}=${None}
|
||||
... ${password}=${None}
|
||||
# seconds to try and successfully login
|
||||
... ${try_for}=4
|
||||
... ${conn_timeout}=3
|
||||
FOR ${i} IN RANGE ${try_for}
|
||||
SSHLibrary.Open Connection ${address} timeout=${conn_timeout}
|
||||
${status}= Run Keyword And Return Status SSHLibrary.Login ${username} ${password}
|
||||
IF ${status} BREAK
|
||||
Sleep 1s
|
||||
END
|
||||
IF $status!=True
|
||||
Fail Unable to connect to ${address} via SSH in ${try_for} attempts
|
||||
END
|
||||
Log Exited the loop.
|
||||
|
||||
Login via SSH with public key
|
||||
[Arguments]
|
||||
... ${address}=${None}
|
||||
... ${port}=22
|
||||
... ${username}=${None}
|
||||
... ${keyfile}=${None}
|
||||
... ${try_for}=4
|
||||
... ${conn_timeout}=3
|
||||
FOR ${i} IN RANGE ${try_for}
|
||||
SSHLibrary.Open Connection ${address} timeout=${conn_timeout}
|
||||
${status}= Run Keyword And Return Status SSHLibrary.Login With Public Key
|
||||
... ${username} ${keyfile}
|
||||
IF ${status} BREAK
|
||||
Sleep 1s
|
||||
END
|
||||
IF $status!=True
|
||||
Fail Unable to connect to ${address} via SSH in ${try_for} attempts
|
||||
END
|
||||
Log Exited the loop.
|
||||
Reference in New Issue
Block a user