Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
UltraInstinct14 authored Mar 19, 2024
2 parents 60d13f1 + 7000c77 commit 8e60502
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/sctp-sanity-ubuntu-22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ jobs:
./validation.sh
./rmconfig.sh
cd -
- run: |
cd cicd/sctplblc/
./config.sh
./validation.sh
./rmconfig.sh
cd -
6 changes: 6 additions & 0 deletions .github/workflows/sctp-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ jobs:
./validation.sh
./rmconfig.sh
cd -
- run: |
cd cicd/sctplblc/
./config.sh
./validation.sh
./rmconfig.sh
cd -
Binary file modified cicd/common/sctp_client
Binary file not shown.
7 changes: 6 additions & 1 deletion cicd/common/sctp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int argc, char* argv[])
struct sockaddr_in laddr = {0};
int sockfd, in, flags;
char *saddr;
int sport, lport, error = 0;
int sport, lport, error = 0, secs = 0;
struct sctp_status status = {0};
struct sctp_sndrcvinfo sndrcvinfo = {0};
struct sctp_event_subscribe events = {0};
Expand Down Expand Up @@ -51,6 +51,9 @@ int main(int argc, char* argv[])

saddr = argv[3];
sport = atoi(argv[4]);
if (argv[5]) {
secs = atoi(argv[5]);
}
bzero( (void *)&servaddr, sizeof(servaddr) );
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(sport);
Expand All @@ -75,9 +78,11 @@ int main(int argc, char* argv[])
{
buff[in] = 0;
printf("%s",buff);
fflush(stdout);
break;
}
}
if(secs) sleep(secs);

close(sockfd);
return 0;
Expand Down
36 changes: 36 additions & 0 deletions cicd/sctplblc/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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 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 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 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 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
sleep 5
create_lb_rule llb1 20.20.20.1 --sctp=2020:8080 --endpoints=31.31.31.1:1,32.32.32.1:1,33.33.33.1:1 --select lc
18 changes: 18 additions & 0 deletions cicd/sctplblc/rmconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

source ../common.sh

disconnect_docker_hosts l3h1 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 l3ep1
delete_docker_host l3ep2
delete_docker_host l3ep3

echo "#########################################"
echo "Deleted testbed"
echo "#########################################"
83 changes: 83 additions & 0 deletions cicd/sctplblc/validation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash
source ../common.sh
echo SCENARIO-sctplb-lc

servArr=( "server1" "server2" "server3" )
ep=( "31.31.31.1" "32.32.32.1" "33.33.33.1" )

$hexec l3ep1 ../common/sctp_server ${ep[0]} 8080 server1 >/dev/null 2>&1 &
$hexec l3ep2 ../common/sctp_server ${ep[1]} 8080 server2 >/dev/null 2>&1 &
$hexec l3ep3 ../common/sctp_server ${ep[2]} 8080 server3 >/dev/null 2>&1 &

sleep 5
code=0
j=0
waitCount=0
while [ $j -le 2 ]
do
res=$($hexec l3h1 timeout 10 ../common/sctp_client 10.10.10.1 0 ${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-sctplb-lc [FAILED]
sudo pkill sctp_server >/dev/null 2>&1
exit 1
fi

fi
sleep 1
done

for i in {1..2}
do
for j in {0..2}
do
res=$($hexec l3h1 timeout 10 ../common/sctp_client 10.10.10.1 0 20.20.20.1 2020)
echo -e $res
if [[ $res != "${servArr[0]}" ]]
then
code=1
fi
sleep 1
done
done

echo "Holding connection at"
$hexec l3h1 ../common/sctp_client 10.10.10.1 0 20.20.20.1 2020 20 &
sleep 1

echo -e "\n\nTesting Service IP: 20.20.20.1"
code=0
for i in {1..2}
do
for j in {0..2}
do
res=$($hexec l3h1 timeout 10 ../common/sctp_client 10.10.10.1 0 20.20.20.1 2020)
echo -e $res
if [[ $res != "${servArr[1]}" ]]
then
code=1
fi
sleep 1
done
done

sudo pkill sctp_server >/dev/null 2>&1
sudo killall -9 ncat >/dev/null 2>&1
rm -f nohup.out >/dev/null 2>&1
if [[ $code == 0 ]]
then
echo SCENARIO-sctplb-lc [OK]
else
echo SCENARIO-sctplb-lc [FAILED]
fi
exit $code

0 comments on commit 8e60502

Please sign in to comment.