Skip to content

Commit 01cd4ba

Browse files
committed
tests: refactor common kinds/cli into shared kinds.yaml
1 parent 9c49a04 commit 01cd4ba

File tree

17 files changed

+144
-465
lines changed

17 files changed

+144
-465
lines changed

python-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pytest>=7.0.0
22
pytest-asyncio>=0.18.3
33
scapy>=2.4.5
4-
munet>=0.9.16
4+
munet>=0.10.17
55
pexpect>=4.8.0

tests/config/munet.yaml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ topology:
1313
ip: 10.0.2.254/24
1414
nodes:
1515
- name: h1
16-
kind: host
1716
connections:
1817
- to: mgmt0
1918
- to: net0
@@ -35,40 +34,6 @@ topology:
3534
# eth2 is router interconnect
3635
name: eth2
3736
- name: h2
38-
kind: host
3937
connections:
4038
- to: mgmt0
4139
- to: net2
42-
43-
kinds:
44-
- name: host
45-
cmd: |
46-
pwd
47-
ls
48-
ip addr
49-
tail -f /dev/null
50-
- name: linux
51-
qemu:
52-
kernel: "%CONFIGDIR%/../../output-linux/arch/x86/boot/bzImage"
53-
initrd: "%CONFIGDIR%/../../output-buildroot/images/rootfs.cpio.gz"
54-
cmdline-extra: "acpi=off nokaslr"
55-
memory: "2048M"
56-
kvm: true
57-
ncpu: 2
58-
console:
59-
timeout: 180
60-
volumes:
61-
- "%RUNDIR%/s:/tmp/qemu-sock"
62-
63-
cli:
64-
commands:
65-
- name: con
66-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/vcon0"
67-
format: "con HOST [HOST ...]"
68-
help: "open console on given hosts, * for all"
69-
new-window: true
70-
- name: mon
71-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/monitor"
72-
format: "mon HOST [HOST ...]"
73-
help: "open monitor on given hosts, * for all"
74-
new-window: true

tests/console/munet.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ topology:
55
- name: mgmt0
66
nodes:
77
- name: r1
8-
kind: linux
8+
kind: linux_cmd
99
connections: ["mgmt0"]
1010

1111
kinds:
12-
- name: linux
12+
- name: linux_cmd
1313
cmd: |
1414
qemu-system-x86_64 \
1515
-boot c \

tests/errors/munet.yaml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ topology:
1313
ip: 10.0.2.254/24
1414
nodes:
1515
- name: h1
16-
kind: host
1716
connections:
1817
- to: mgmt0
1918
- to: net0
@@ -35,46 +34,9 @@ topology:
3534
# eth2 is router interconnect
3635
name: eth2
3736
- name: h2
38-
kind: host
3937
cmd: |
4038
ip link set eth1 mtu 750
4139
tail -f /dev/null
4240
connections:
4341
- to: mgmt0
4442
- to: net2
45-
kinds:
46-
- name: host
47-
cmd: |
48-
ip addr
49-
ip link set eth1 mtu 9000
50-
tail -f /dev/null
51-
- name: linux
52-
qemu:
53-
kernel: "%CONFIGDIR%/../../output-linux/arch/x86/boot/bzImage"
54-
initrd: "%CONFIGDIR%/../../output-buildroot/images/rootfs.cpio.gz"
55-
cmdline-extra: "acpi=off nokaslr"
56-
memory: "2048M"
57-
kvm: true
58-
ncpu: 2
59-
console:
60-
timeout: 180
61-
volumes:
62-
- "%RUNDIR%/s:/tmp/qemu-sock"
63-
64-
cli:
65-
commands:
66-
- name: con
67-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/console"
68-
format: "con HOST [HOST ...]"
69-
help: "open console on given hosts, * for all"
70-
new-window: true
71-
- name: mon
72-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/monitor"
73-
format: "mon HOST [HOST ...]"
74-
help: "open monitor on given hosts, * for all"
75-
new-window: true
76-
- name: ssh
77-
exec: "ssh -i ../../root-key -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' {host.intf_addrs['eth0'].ip}"
78-
format: "ssh HOST [HOST ...]"
79-
help: "open ssh to given hosts, * for all"
80-
new-window: true

tests/frags/munet.yaml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ topology:
1313
ip: 10.0.2.254/24
1414
nodes:
1515
- name: h1
16-
kind: host
1716
connections:
1817
- to: mgmt0
1918
- to: net0
@@ -35,43 +34,6 @@ topology:
3534
# eth2 is router interconnect
3635
name: eth2
3736
- name: h2
38-
kind: host
3937
connections:
4038
- to: mgmt0
4139
- to: net2
42-
kinds:
43-
- name: host
44-
cmd: |
45-
ip addr
46-
ip link set eth1 mtu 9000
47-
tail -f /dev/null
48-
- name: linux
49-
qemu:
50-
kernel: "%CONFIGDIR%/../../output-linux/arch/x86/boot/bzImage"
51-
initrd: "%CONFIGDIR%/../../output-buildroot/images/rootfs.cpio.gz"
52-
cmdline-extra: "acpi=off nokaslr"
53-
memory: "2048M"
54-
kvm: true
55-
ncpu: 2
56-
console:
57-
timeout: 180
58-
volumes:
59-
- "%RUNDIR%/s:/tmp/qemu-sock"
60-
61-
cli:
62-
commands:
63-
- name: con
64-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/console"
65-
format: "con HOST [HOST ...]"
66-
help: "open console on given hosts, * for all"
67-
new-window: true
68-
- name: mon
69-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/monitor"
70-
format: "mon HOST [HOST ...]"
71-
help: "open monitor on given hosts, * for all"
72-
new-window: true
73-
- name: ssh
74-
exec: "ssh -i ../../root-key -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' {host.intf_addrs['eth0'].ip}"
75-
format: "ssh HOST [HOST ...]"
76-
help: "open ssh to given hosts, * for all"
77-
new-window: true

tests/kinds.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
kinds:
2+
- name: linux
3+
gdb-cmd: "sudo -E gdb %CONFIGDIR%/../../output-linux/vmlinux"
4+
gdb-target-cmds: ["target remote %RUNDIR%/s/gdbserver"]
5+
gdb-run-cmds: ["c"]
6+
qemu:
7+
kernel: "%CONFIGDIR%/../../output-linux/arch/x86/boot/bzImage"
8+
initrd: "%CONFIGDIR%/../../output-buildroot/images/rootfs.cpio.gz"
9+
cmdline-extra: "acpi=off nokaslr"
10+
memory: "4096M"
11+
kvm: true
12+
ncpu: 4
13+
console:
14+
timeout: 180
15+
volumes:
16+
- "%RUNDIR%/s:/tmp/qemu-sock"
17+
18+
- name: trex_phy
19+
privileged: true
20+
# image: quay.io/chopps/trex:v2.98
21+
# cap_add:
22+
# - ALL
23+
# podman:
24+
# extra-args:
25+
# - --sysctl=net.ipv6.conf.all.disable_ipv6=1
26+
# - --sysctl=net.ipv6.conf.all.forwarding=0
27+
# - --sysctl=net.ipv6.conf.default.forwarding=0
28+
cmd: |
29+
cd /opt/trex/current
30+
./t-rex-64 --cfg /etc/trex_cfg.yaml -v 3 --no-termio --no-scapy-server --iom 0 -i
31+
tail -f /dev/null
32+
ports:
33+
- 8090:8090
34+
- 4500:4500
35+
- 4501:4501
36+
volumes:
37+
- "%CONFIGDIR%/trex_cfg_phy.yaml:/etc/trex_cfg.yaml"
38+
- "%CONFIGDIR%/../common:/common"
39+
- /dev/hugepages:/dev/hugepages
40+
# - /var/run/systemd/journal/socket:/var/run/systemd/journal/socket
41+
merge: ["volumes"]
42+
43+
- name: trex
44+
# image: quay.io/chopps/trex:v3.00
45+
cmd: |
46+
ip addr
47+
NETH=$(ls -d /sys/class/net/eth* | wc -l)
48+
TAPS=""
49+
for ((i=0; i<$NETH; i++)); do
50+
ip addr flush dev eth$i
51+
done
52+
cd /opt/trex/current
53+
./t-rex-64 --cfg /etc/trex_cfg.yaml -v 3 --no-termio --no-scapy-server --iom 0 -i
54+
tail -f /dev/null
55+
ports:
56+
- 8090:8090
57+
- 4500:4500
58+
- 4501:4501
59+
volumes:
60+
- "%CONFIGDIR%/trex_cfg.yaml:/etc/trex_cfg.yaml"
61+
- "%CONFIGDIR%/../common:/common"
62+
merge: ["volumes"]
63+
64+
cli:
65+
commands:
66+
- name: con
67+
exec-kind:
68+
- kind: linux
69+
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/vcon0"
70+
- kind: trex
71+
exec: "bash -c 'cd /opt/trex/current && ./trex-console'"
72+
format: "con HOST|TREX [HOST|TREX ...]"
73+
help: "open console on given hosts, * for all"
74+
new-window: true
75+
- name: mon
76+
exec-kind:
77+
- kind: linux
78+
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/monitor"
79+
- kind: trex
80+
exec: "bash -c 'cd /opt/trex/current && ./trex-console -r'"
81+
format: "mon HOST|TREX [HOST|TREX ...]"
82+
help: "open monitor on given hosts, * for all"
83+
new-window: true
84+
- name: xmon
85+
exec-kind:
86+
- kind: trex
87+
exec: "bash -c 'cd /opt/trex/current && ./trex-console -r -x'"
88+
format: "xmon TREX [TREX ...]"
89+
help: "open trex monitor using X11"
90+
new-window: false
91+
- name: ssh
92+
exec: "ssh -i ../../root-key -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' {host.intf_addrs['eth0'].ip}"
93+
format: "ssh HOST [HOST ...]"
94+
help: "open ssh to given hosts, * for all"
95+
new-window: true

tests/manual/tcpdump/munet_phy.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ topology:
4040
ip: 10.0.2.4/24
4141

4242
kinds:
43-
- name: host
44-
cmd: |
45-
pwd
46-
ls
47-
ip addr
48-
tail -f /dev/null
4943
- name: linux
5044
qemu:
5145
kernel: "%CONFIGDIR%/../../../output-linux/arch/x86/boot/bzImage"

tests/manual/tcpdump/tcpdump.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ async def _test_iperf(unet, astepf, ipsec_intf):
3535
# await setup_policy_tun(unet, mode="iptfs", iptfs_opts="reorder-window 5")
3636
# await setup_policy_tun(unet, mode="iptfs", iptfs_opts="dont-frag reorder-window 0")
3737
# await setup_policy_tun(unet, mode="iptfs", iptfs_opts="dont-frag reorder-window 5")
38-
if "IPTFS_MODE" in os.environ:
39-
mode = os.environ["IPTFS_MODE"]
38+
mode = os.environ.get("IPTFS_MODE", None)
39+
if mode is not None:
4040
logging.info("Using IPTFS_MODE envvar value: %s", mode)
41-
opts = os.environ.get("IPTFS_OPTS", None)
42-
if opts:
43-
logging.info("Using IPTFS_OPTS envvar value: %s", opts)
44-
await setup_policy_tun(
45-
unet, mode=mode, ipsec_intf=ipsec_intf, iptfs_opts=opts
46-
)
47-
else:
48-
await setup_policy_tun(unet, ipsec_intf=ipsec_intf, mode=mode)
4941
else:
50-
await setup_policy_tun(unet, ipsec_intf=ipsec_intf, mode="iptfs")
42+
mode = "iptfs"
43+
44+
opts = os.environ.get("IPTFS_OPTS", None)
45+
if opts is not None:
46+
logging.info("Using IPTFS_OPTS envvar value: %s", opts)
47+
else:
48+
opts = ""
49+
50+
await setup_policy_tun(unet, mode=mode, ipsec_intf=ipsec_intf, iptfs_opts=opts)
5151

5252
# Let's open an iperf3 process on h2.
5353
iperf3 = False

tests/phynic/munet.yaml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,3 @@ topology:
3838
- to: r2
3939
hostintf: "enp27s0f1"
4040
ip: 10.0.2.4/24
41-
42-
kinds:
43-
- name: host
44-
cmd: |
45-
pwd
46-
ls
47-
ip addr
48-
tail -f /dev/null
49-
- name: linux
50-
qemu:
51-
kernel: "%CONFIGDIR%/../../output-linux/arch/x86/boot/bzImage"
52-
initrd: "%CONFIGDIR%/../../output-buildroot/images/rootfs.cpio.gz"
53-
cmdline-extra: "acpi=off nokaslr"
54-
memory: "2048M"
55-
kvm: true
56-
ncpu: 4
57-
58-
cli:
59-
commands:
60-
- name: con
61-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/console"
62-
format: "con HOST [HOST ...]"
63-
help: "open console on given hosts, * for all"
64-
new-window: true
65-
- name: mon
66-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/monitor"
67-
format: "mon HOST [HOST ...]"
68-
help: "open monitor on given hosts, * for all"
69-
new-window: true

tests/simplenet/munet.yaml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ topology:
1313
ip: 10.0.2.254/24
1414
nodes:
1515
- name: h1
16-
kind: host
1716
connections:
1817
- to: mgmt0
1918
- to: net0
@@ -35,40 +34,6 @@ topology:
3534
# eth2 is router interconnect
3635
name: eth2
3736
- name: h2
38-
kind: host
3937
connections:
4038
- to: mgmt0
4139
- to: net2
42-
43-
kinds:
44-
- name: host
45-
cmd: |
46-
pwd
47-
ls
48-
ip addr
49-
tail -f /dev/null
50-
- name: linux
51-
qemu:
52-
kernel: "%CONFIGDIR%/../../output-linux/arch/x86/boot/bzImage"
53-
initrd: "%CONFIGDIR%/../../output-buildroot/images/rootfs.cpio.gz"
54-
cmdline-extra: "acpi=off nokaslr"
55-
memory: "2048M"
56-
kvm: true
57-
ncpu: 2
58-
console:
59-
timeout: 180
60-
volumes:
61-
- "%RUNDIR%/s:/tmp/qemu-sock"
62-
63-
cli:
64-
commands:
65-
- name: con
66-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/vcon0"
67-
format: "con HOST [HOST ...]"
68-
help: "open console on given hosts, * for all"
69-
new-window: true
70-
- name: mon
71-
exec: "socat /dev/stdin,rawer,escape=0x1d,,echo=0,icanon=0 unix-connect:/tmp/qemu-sock/monitor"
72-
format: "mon HOST [HOST ...]"
73-
help: "open monitor on given hosts, * for all"
74-
new-window: true

0 commit comments

Comments
 (0)