src/net: add missing deps when moving between generations

The init_next_gen() function moves us to the next generation, as well as
intialize all data files for expected interfaces in that generation.

However, bridge and lag interfaces have dependendcies that need to be
moved as well.  It is only the test author that knows the expected new
state, so this function only sets up the desired state, without ever
looking at what any previous generation looked like.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-04-20 21:14:54 +02:00
committed by Tobias Waldekranz
parent 1c99e92312
commit 64804bee5d
3 changed files with 16 additions and 0 deletions
+2
View File
@@ -49,6 +49,8 @@ say "Verify moving a port from lag0 to br0"
del_lagport lag0 eth4
init_next_gen eth0 eth1 eth2 eth3 eth4 eth5 lag0 br0 vlan1
init_deps br0 eth1 eth2 eth3 lag0
init_deps lag0 eth5
add_brport br0 eth4
netdo
+2
View File
@@ -22,6 +22,7 @@ assert_iface br0
sep
say "Verify add another bridge port (eth3)"
init_next_gen eth0 eth1 eth2 br0
init_deps br0 eth0 eth1 eth2
create_iface eth3
add_brport br0 eth3
@@ -37,6 +38,7 @@ say "Verify delete a bridge port (eth1)"
del_brport br0 eth1
init_next_gen eth0 eth2 eth3 br0
init_deps br0 eth0 eth2 eth3
netdo
+12
View File
@@ -113,6 +113,18 @@ init_next_gen()
done
}
init_deps()
{
parent=$1
shift
mkdir -p "$NET_DIR/$gen/$parent/deps"
#shellcheck disable=SC2068
for iface in $@; do
ln -s "../../$iface" "$NET_DIR/$gen/$parent/deps/$iface"
done
}
setup()
{
say "Test start $(date)"