From c2c84883516ac666f4485930bf60dce5393d9a10 Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Tue, 19 Mar 2024 13:03:57 +0900 Subject: [PATCH] SCTP least connections CICD added --- .github/workflows/sctp-sanity-ubuntu-22.yml | 6 ++ .github/workflows/sctp-sanity.yml | 6 ++ cicd/common/sctp_client | Bin 17480 -> 17608 bytes cicd/common/sctp_client.c | 7 +- cicd/sctplblc/config.sh | 36 +++++++++ cicd/sctplblc/rmconfig.sh | 18 +++++ cicd/sctplblc/validation.sh | 83 ++++++++++++++++++++ 7 files changed, 155 insertions(+), 1 deletion(-) create mode 100755 cicd/sctplblc/config.sh create mode 100755 cicd/sctplblc/rmconfig.sh create mode 100755 cicd/sctplblc/validation.sh diff --git a/.github/workflows/sctp-sanity-ubuntu-22.yml b/.github/workflows/sctp-sanity-ubuntu-22.yml index 92b3e3cb5..32cb151fa 100644 --- a/.github/workflows/sctp-sanity-ubuntu-22.yml +++ b/.github/workflows/sctp-sanity-ubuntu-22.yml @@ -65,3 +65,9 @@ jobs: ./validation.sh ./rmconfig.sh cd - + - run: | + cd cicd/sctplblc/ + ./config.sh + ./validation.sh + ./rmconfig.sh + cd - diff --git a/.github/workflows/sctp-sanity.yml b/.github/workflows/sctp-sanity.yml index 07f9cf45a..7abdc3685 100644 --- a/.github/workflows/sctp-sanity.yml +++ b/.github/workflows/sctp-sanity.yml @@ -65,3 +65,9 @@ jobs: ./validation.sh ./rmconfig.sh cd - + - run: | + cd cicd/sctplblc/ + ./config.sh + ./validation.sh + ./rmconfig.sh + cd - diff --git a/cicd/common/sctp_client b/cicd/common/sctp_client index 7e1cfcb764c67d24ec71c82a526a7dbe4028c06a..a663bf0756478a02e158a2f434633ae2346115bc 100755 GIT binary patch delta 3122 zcmZ`*eQZ~yM?+f(UCAiz+qw6> z2O-+7<#X=&opaAQ@7&L;C+O8UP01yh62hCJGhz?*t^K)>E!4$q-(Ld4uw561!9jNf z#Y$ZgLyvM|HDrSmQI{?7P3nPPZ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BC7QfgZdKa#So)H=XzLxst`Y>MK z)vz`E8oHYe%V_3ra9KpW{QM0vonn&p5i%se(+!<;Eu2JU1?fR9d(0=3hpsaVk%$1- z8@5xtzZ+%zl0>7+B9k!eMJWtw<32hHv`Lnx`GafD_Jhd_R|_&Fiqg*-Hr=ZQkT*!vy=- zZp2Nk!TZ^pM+c!L;$7G?(_%<}5Bnl+I;LBFqRXQw--HPpzNZnHE@#xU3Rk!PpVhmV z*4l$wkQ$vuWDo59h1`1pWr<*#e1<1ha;#+#ci=il_;a_@fJq*?oh&BqI0rau=l14) z;iICrw}3`v&%0dP&+AgJY}9|C$9-0(mv#CtMwiU7sERzq+$FvkvEWm0ME^6Gh|07H zW|2Onk9Xw!D+ej;eZrl))Z(FV=ZTTrJHPx3&8=x&Mlm=2Z7~{$_u4{|VEoSzlefXQ zh<5V2HhCBVv5+{x(E;d%}FdOMz$Ku1)Zi5htxfc}ms?StbTKmQ*X0@N4) diff --git a/cicd/common/sctp_client.c b/cicd/common/sctp_client.c index ac6c012e4..1db1b4196 100644 --- a/cicd/common/sctp_client.c +++ b/cicd/common/sctp_client.c @@ -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}; @@ -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); @@ -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; diff --git a/cicd/sctplblc/config.sh b/cicd/sctplblc/config.sh new file mode 100755 index 000000000..ef0ffa96c --- /dev/null +++ b/cicd/sctplblc/config.sh @@ -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 diff --git a/cicd/sctplblc/rmconfig.sh b/cicd/sctplblc/rmconfig.sh new file mode 100755 index 000000000..9ea80577f --- /dev/null +++ b/cicd/sctplblc/rmconfig.sh @@ -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 "#########################################" diff --git a/cicd/sctplblc/validation.sh b/cicd/sctplblc/validation.sh new file mode 100755 index 000000000..c86f53ec0 --- /dev/null +++ b/cicd/sctplblc/validation.sh @@ -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 +