From c0d7203152b67f49184417f737b93a313df51850 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 27 Dec 2024 22:57:32 +0900 Subject: [PATCH] chore:updated iperf3 scale cicd --- cicd/iperf3lb/config.sh | 50 +++++++++++++++++++++++++++++++++++++ cicd/iperf3lb/rmconfig.sh | 25 +++++++++++++++++++ cicd/iperf3lb/validation.sh | 44 ++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100755 cicd/iperf3lb/config.sh create mode 100755 cicd/iperf3lb/rmconfig.sh create mode 100755 cicd/iperf3lb/validation.sh diff --git a/cicd/iperf3lb/config.sh b/cicd/iperf3lb/config.sh new file mode 100755 index 00000000..d01610f6 --- /dev/null +++ b/cicd/iperf3lb/config.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +source ../common.sh + +echo "#########################################" +echo "Spawning all hosts" +echo "#########################################" + +NUM_HOSTS=30 + +spawn_docker_host --dock-type loxilb --dock-name llb1 + +# Loop to create and configure 100 hosts +for i in $(seq 1 $NUM_HOSTS); do + host="l3h$i" + ip="$((i)).$((i)).$((i)).1" + gateway="$((i)).$((i)).$((i)).254" + + # Spawn a host + spawn_docker_host --dock-type host --dock-name "$host" + + # Connect host to llb1 + connect_docker_hosts "$host" llb1 + + # Configure the host + config_docker_host --host1 "$host" --host2 llb1 --ptype phy --addr "$ip"/24 --gw "$gateway" + config_docker_host --host1 llb1 --host2 "$host" --ptype phy --addr "$gateway"/24 +done + +spawn_docker_host --dock-type host --dock-name l3ep1 +spawn_docker_host --dock-type host --dock-name l3ep2 +spawn_docker_host --dock-type host --dock-name l3ep3 + +echo "#########################################" +echo "Connecting and configuring hosts" +echo "#########################################" + +connect_docker_hosts l3ep1 llb1 +connect_docker_hosts l3ep2 llb1 +connect_docker_hosts l3ep3 llb1 + +config_docker_host --host1 l3ep1 --host2 llb1 --ptype phy --addr 31.31.31.1/24 --gw 31.31.31.254 +config_docker_host --host1 l3ep2 --host2 llb1 --ptype phy --addr 32.32.32.1/24 --gw 32.32.32.254 +config_docker_host --host1 l3ep3 --host2 llb1 --ptype phy --addr 33.33.33.1/24 --gw 33.33.33.254 +config_docker_host --host1 llb1 --host2 l3ep1 --ptype phy --addr 31.31.31.254/24 +config_docker_host --host1 llb1 --host2 l3ep2 --ptype phy --addr 32.32.32.254/24 +config_docker_host --host1 llb1 --host2 l3ep3 --ptype phy --addr 33.33.33.254/24 + +# Create LB rule +$dexec llb1 loxicmd create lb 150.150.150.1 --tcp=2020:8001-8100 --endpoints=31.31.31.1:1,32.32.32.1:1 --select=persist --mode=onearm --inatimeout=40 diff --git a/cicd/iperf3lb/rmconfig.sh b/cicd/iperf3lb/rmconfig.sh new file mode 100755 index 00000000..2d1194f3 --- /dev/null +++ b/cicd/iperf3lb/rmconfig.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +source ../common.sh + +sudo pkill -9 iperf3 2>&1 > /dev/null + +disconnect_docker_hosts l3ep1 llb1 +disconnect_docker_hosts l3ep2 llb1 +disconnect_docker_hosts l3ep3 llb1 + +NUM_HOSTS=30 +for i in $(seq 1 $NUM_HOSTS); do + host="l3h$i" + disconnect_docker_hosts $host llb1 + delete_docker_host $host +done + +delete_docker_host llb1 +delete_docker_host l3ep1 +delete_docker_host l3ep2 +delete_docker_host l3ep3 + +echo "#########################################" +echo "Deleted testbed" +echo "#########################################" diff --git a/cicd/iperf3lb/validation.sh b/cicd/iperf3lb/validation.sh new file mode 100755 index 00000000..8bb2217a --- /dev/null +++ b/cicd/iperf3lb/validation.sh @@ -0,0 +1,44 @@ +#!/bin/bash +source ../common.sh + +rm -fr port*.log +echo SCENARIO-udplb-iperf3 +for ((i=1;i<3;i++)) +do +for ((port=8001;port<=8100;port++)) +do +$hexec l3ep$i iperf3 -s -p $port --logfile port$port-ep$i.log 2>&1 >> /dev/null & +done +done + +echo "Waiting for servers to start..." +sleep 30 + +NUM_HOSTS=30 +rm -fr iperf-*.log +for ((i=1;i<=$NUM_HOSTS;i++)) +do +$hexec l3h$i iperf3 -c 150.150.150.1 -p 2020 -u -t20 --logfile iperf-$i.log --forceflush & +done + +echo "Waiting for tests to finish..." +sleep 60 +code=0 +for file in iperf*.log; do + if grep -q "connected" "$file"; then + echo "Pass:'connected' found in $file." + else + echo "Fail: 'connected' not found in $file." + code=1 + fi +done +if [[ $code != 0 ]]; then + echo "SCENARIO-udplb-iperf3 [FAILED]" +else + echo "SCENARIO-udplb-iperf3 [OK]" +fi + +sudo pkill -9 iperf3 2>&1 > /dev/null +rm -fr iperf-*.log +rm -fr port*.log +exit $code