Skip to content

Commit

Permalink
Merge pull request #905 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
PR - added cicd for udplb with source persistence
  • Loading branch information
UltraInstinct14 authored Dec 14, 2024
2 parents 59c8b30 + 88c8956 commit b7b1959
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/advanced-lb-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,8 @@ jobs:
./validation.sh
./rmconfig.sh
cd -
- run: |
cd cicd/udplb-persist/
./config.sh
./validation.sh
./rmconfig.sh
45 changes: 45 additions & 0 deletions cicd/udplb-persist/config.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions cicd/udplb-persist/rmconfig.sh
Original file line number Diff line number Diff line change
@@ -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 "#########################################"
63 changes: 63 additions & 0 deletions cicd/udplb-persist/validation.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b7b1959

Please sign in to comment.