From ae0be2e74705252c77d752fc0678739343c91e4b Mon Sep 17 00:00:00 2001 From: Daniel Ding Date: Fri, 25 Jul 2025 18:56:57 +0800 Subject: [PATCH] fea: tests: add switch ut. --- tests/{access.ut => access.sh} | 29 +++++++---- tests/{macro.ut => macro.sh} | 18 +++++-- tests/run.sh | 4 +- tests/switch.sh | 88 ++++++++++++++++++++++++++++++++++ tests/switch.ut | 3 -- 5 files changed, 124 insertions(+), 18 deletions(-) rename tests/{access.ut => access.sh} (92%) rename tests/{macro.ut => macro.sh} (82%) create mode 100755 tests/switch.sh delete mode 100644 tests/switch.ut diff --git a/tests/access.ut b/tests/access.sh similarity index 92% rename from tests/access.ut rename to tests/access.sh index 400d575..c615732 100755 --- a/tests/access.ut +++ b/tests/access.sh @@ -1,13 +1,15 @@ # OpenLAN Access UT. -source $PWD/macro.ut +source $PWD/macro.sh -function setup() { +setup_net() { docker network inspect net1 || { docker network create net1 \ --driver=bridge --subnet=172.255.0.0/24 --gateway=172.255.0.1 } +} +setup_sw1() { mkdir -p /opt/openlan/sw1 mkdir -p /opt/openlan/sw1/etc/openlan/switch cat > /opt/openlan/sw1/etc/openlan/switch/switch.yaml < /opt/openlan/sw1/etc/openlan/access/t1.yaml < /opt/openlan/sw1/etc/openlan/access/t2.yaml < /opt/openlan/$name/etc/openlan/switch/switch.yaml < /opt/openlan/$name/etc/openlan/switch/switch.yaml <