diff --git a/.github/workflows/advanced-lb-sanity.yml b/.github/workflows/advanced-lb-sanity.yml index 4d6fd1fd..90bf3dbb 100644 --- a/.github/workflows/advanced-lb-sanity.yml +++ b/.github/workflows/advanced-lb-sanity.yml @@ -122,3 +122,8 @@ jobs: ./validation.sh ./rmconfig.sh cd - + - run: | + cd cicd/udplb-persist/ + ./config.sh + ./validation.sh + ./rmconfig.sh diff --git a/cicd/udplb-persist/config.sh b/cicd/udplb-persist/config.sh new file mode 100755 index 00000000..c10c06c7 --- /dev/null +++ b/cicd/udplb-persist/config.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +source ../common.sh + +echo "#########################################" +echo "Spawning all hosts" +echo "#########################################" + +spawn_docker_host --dock-type loxilb --dock-name llb1 +spawn_docker_host --dock-type host --dock-name l3h1 +spawn_docker_host --dock-type host --dock-name l3h2 +spawn_docker_host --dock-type host --dock-name l3h3 +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 l3h1 llb1 +connect_docker_hosts l3h2 llb1 +connect_docker_hosts l3h3 llb1 +connect_docker_hosts l3ep1 llb1 +connect_docker_hosts l3ep2 llb1 +connect_docker_hosts l3ep3 llb1 + + +#L3 config +config_docker_host --host1 l3h1 --host2 llb1 --ptype phy --addr 10.10.10.1/24 --gw 10.10.10.254 +config_docker_host --host1 l3h2 --host2 llb1 --ptype phy --addr 11.11.11.1/24 --gw 11.11.11.254 +config_docker_host --host1 l3h3 --host2 llb1 --ptype phy --addr 12.12.12.12/24 --gw 12.12.12.254 +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 l3h1 --ptype phy --addr 10.10.10.254/24 +config_docker_host --host1 llb1 --host2 l3h2 --ptype phy --addr 11.11.11.254/24 +config_docker_host --host1 llb1 --host2 l3h3 --ptype phy --addr 12.12.12.254/24 +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 20.20.20.1 --udp=2020:8080 --endpoints=31.31.31.1:1,32.32.32.1:1,33.33.33.1:1 --select=persist diff --git a/cicd/udplb-persist/rmconfig.sh b/cicd/udplb-persist/rmconfig.sh new file mode 100755 index 00000000..e90ec2d4 --- /dev/null +++ b/cicd/udplb-persist/rmconfig.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +source ../common.sh + +sudo pkill udp_server 2>&1 > /dev/null + +disconnect_docker_hosts l3h1 llb1 +disconnect_docker_hosts l3h2 llb1 +disconnect_docker_hosts l3h3 llb1 +disconnect_docker_hosts l3ep1 llb1 +disconnect_docker_hosts l3ep2 llb1 +disconnect_docker_hosts l3ep3 llb1 + +delete_docker_host llb1 +delete_docker_host l3h1 +delete_docker_host l3h2 +delete_docker_host l3h3 +delete_docker_host l3ep1 +delete_docker_host l3ep2 +delete_docker_host l3ep3 + +echo "#########################################" +echo "Deleted testbed" +echo "#########################################" diff --git a/cicd/udplb-persist/validation.sh b/cicd/udplb-persist/validation.sh new file mode 100755 index 00000000..78b5be32 --- /dev/null +++ b/cicd/udplb-persist/validation.sh @@ -0,0 +1,63 @@ +#!/bin/bash +source ../common.sh + +echo SCENARIO-udplb-persist +$hexec l3ep1 ../common/udp_server 8080 server1 & +$hexec l3ep2 ../common/udp_server 8080 server2 & +$hexec l3ep3 ../common/udp_server 8080 server3 & + +sleep 5 +code=0 +servArr=( "server1" "server2" "server3" ) +ep=( "31.31.31.1" "32.32.32.1" "33.33.33.1" ) +j=0 +waitCount=0 +while [ $j -le 2 ] +do + res=$($hexec l3h1 timeout 1 ../common/udp_client ${ep[j]} 8080) + #echo $res + if [[ $res == "${servArr[j]}" ]] + then + echo "$res UP" + j=$(( $j + 1 )) + else + echo "Waiting for ${servArr[j]}(${ep[j]})" + waitCount=$(( $waitCount + 1 )) + if [[ $waitCount == 10 ]]; + then + echo "All Servers are not UP" + echo SCENARIO-udplb-persist [FAILED] + sudo pkill udp_server 2>&1 > /dev/null + exit 1 + fi + + fi + sleep 1 +done + +for i in {1..3} +do +pres="" +echo -e "Persist Test for host$i" +for j in {0..2} +do + res=$($hexec l3h${i} timeout 1 ../common/udp_client 20.20.20.1 2020) + if [[ $pres == "" ]]; then + pres=$res + else + if [[ $res != $pres ]]; then + echo -e "Expected $pres Received : $res for host$i" + code=1 + fi + fi + echo -e $res + sleep 1 +done +done +if [[ $code == 0 ]] +then + echo SCENARIO-udplb-persist [OK] +else + echo SCENARIO-udplb-persist [FAILED] +fi +sudo pkill udp_server 2>&1 > /dev/null