Skip to content

Commit 0477d9c

Browse files
ibot3stgraber
authored andcommitted
tests: Add test for routed NIC with VRF
Signed-off-by: Jakob Mueller <me@jakobm.de>
1 parent b3946e3 commit 0477d9c

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/suites/container_devices_nic_routed.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,36 @@ test_container_devices_nic_routed() {
217217
ip -4 route show table 100 | grep "192.0.2.1${ipRand}"
218218
ip -6 route show table 101 | grep "2001:db8::1${ipRand}"
219219

220+
# Undo settings
221+
incus stop -f "${ctName}"
222+
incus config device unset "${ctName}" eth0 vlan
223+
incus config device unset "${ctName}" eth0 ipv4.host_table
224+
incus config device unset "${ctName}" eth0 ipv6.host_table
225+
226+
# Add VRF
227+
ip link add test_vrf type vrf table 120
228+
229+
# Check nic interface not in the vrf
230+
! ip link show master test_vrf | grep "veth"
231+
232+
# Configure VRF on nic
233+
incus config device set "${ctName}" eth0 vrf="test_vrf"
234+
incus start "${ctName}"
235+
236+
# Check nic interface is in the vrf
237+
ip link show master test_vrf | grep "veth"
238+
239+
# Check routes are in the vrf
240+
ip -4 route show vrf test_vrf | grep "192.0.2.1${ipRand}"
241+
ip -6 route show vrf test_vrf | grep "2001:db8::1${ipRand}"
242+
243+
# Check no routes in the main table
244+
! ip -4 route show table main | grep "192.0.2.1${ipRand}"
245+
! ip -6 route show table main | grep "2001:db8::1${ipRand}"
246+
247+
# Delete test VRF
248+
ip link delete test_vrf
249+
220250
# Check volatile cleanup on stop.
221251
incus stop -f "${ctName}"
222252
if incus config show "${ctName}" | grep volatile.eth0 | grep -v volatile.eth0.hwaddr | grep -v volatile.eth0.name ; then

0 commit comments

Comments
 (0)