From 38a894e43b2bb2a6f3046e9948182a5a0c61f949 Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Wed, 10 Apr 2024 18:43:25 +0900 Subject: [PATCH 1/6] sctp multihoming cicd added --- cicd/sctpmh/config.sh | 96 +++++++++++++++++++++++++++++++ cicd/sctpmh/input | 6 ++ cicd/sctpmh/rmconfig.sh | 32 +++++++++++ cicd/sctpmh/validation.sh | 14 +++++ cicd/sctpmh/validation1.sh | 61 ++++++++++++++++++++ cicd/sctpmh/validation2.sh | 93 ++++++++++++++++++++++++++++++ cicd/sctpmh/validation3.sh | 113 +++++++++++++++++++++++++++++++++++++ cicd/sctpmh/validation4.sh | 113 +++++++++++++++++++++++++++++++++++++ 8 files changed, 528 insertions(+) create mode 100755 cicd/sctpmh/config.sh create mode 100644 cicd/sctpmh/input create mode 100755 cicd/sctpmh/rmconfig.sh create mode 100755 cicd/sctpmh/validation.sh create mode 100755 cicd/sctpmh/validation1.sh create mode 100755 cicd/sctpmh/validation2.sh create mode 100755 cicd/sctpmh/validation3.sh create mode 100755 cicd/sctpmh/validation4.sh diff --git a/cicd/sctpmh/config.sh b/cicd/sctpmh/config.sh new file mode 100755 index 000000000..4f2f519ac --- /dev/null +++ b/cicd/sctpmh/config.sh @@ -0,0 +1,96 @@ +#!/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 ep1 +spawn_docker_host --dock-type host --dock-name r1 +spawn_docker_host --dock-type host --dock-name r2 +spawn_docker_host --dock-type host --dock-name r3 +spawn_docker_host --dock-type host --dock-name r4 +spawn_docker_host --dock-type host --dock-name sw1 +spawn_docker_host --dock-type host --dock-name sw2 +spawn_docker_host --dock-type host --dock-name user + +echo "#########################################" +echo "Connecting and configuring hosts" +echo "#########################################" + +connect_docker_hosts user r1 +connect_docker_hosts user r2 +connect_docker_hosts r1 sw1 +connect_docker_hosts r2 sw1 +connect_docker_hosts sw1 llb1 +connect_docker_hosts llb1 sw2 +connect_docker_hosts sw2 r3 +connect_docker_hosts sw2 r4 +connect_docker_hosts r3 ep1 +connect_docker_hosts r4 ep1 + +create_docker_host_cnbridge --host1 sw1 --host2 llb1 +create_docker_host_cnbridge --host1 sw1 --host2 r1 +create_docker_host_cnbridge --host1 sw1 --host2 r2 + +create_docker_host_cnbridge --host1 sw2 --host2 llb1 +create_docker_host_cnbridge --host1 sw2 --host2 r3 +create_docker_host_cnbridge --host1 sw2 --host2 r4 + +#node1 config +config_docker_host --host1 user --host2 r1 --ptype phy --addr 1.1.1.1/24 --gw 1.1.1.254 +config_docker_host --host1 user --host2 r2 --ptype phy --addr 2.2.2.1/24 +config_docker_host --host1 r1 --host2 user --ptype phy --addr 1.1.1.254/24 +config_docker_host --host1 r2 --host2 user --ptype phy --addr 2.2.2.254/24 + +create_docker_host_vlan --host1 llb1 --host2 sw1 --id 11 --ptype untagged +create_docker_host_vlan --host1 r1 --host2 sw1 --id 11 --ptype untagged +create_docker_host_vlan --host1 r2 --host2 sw1 --id 11 --ptype untagged +config_docker_host --host1 r1 --host2 sw1 --ptype vlan --id 11 --addr 11.11.11.253/24 --gw 11.11.11.1 +config_docker_host --host1 r2 --host2 sw1 --ptype vlan --id 11 --addr 11.11.11.254/24 --gw 11.11.11.1 +config_docker_host --host1 llb1 --host2 sw1 --ptype vlan --id 11 --addr 11.11.11.1/24 + +create_docker_host_vlan --host1 llb1 --host2 sw2 --id 10 --ptype untagged +create_docker_host_vlan --host1 r3 --host2 sw2 --id 10 --ptype untagged +create_docker_host_vlan --host1 r4 --host2 sw2 --id 10 --ptype untagged + +config_docker_host --host1 llb1 --host2 sw2 --ptype vlan --id 10 --addr 10.10.10.1/24 +config_docker_host --host1 r3 --host2 sw2 --ptype vlan --id 10 --addr 10.10.10.253/24 --gw 10.10.10.1 +config_docker_host --host1 r4 --host2 sw2 --ptype vlan --id 10 --addr 10.10.10.254/24 --gw 10.10.10.1 + +config_docker_host --host1 ep1 --host2 r3 --ptype phy --addr 31.31.31.1/24 --gw 31.31.31.254 +config_docker_host --host1 ep1 --host2 r4 --ptype phy --addr 32.32.32.1/24 +config_docker_host --host1 r3 --host2 ep1 --ptype phy --addr 31.31.31.254/24 +config_docker_host --host1 r4 --host2 ep1 --ptype phy --addr 32.32.32.254/24 + +$hexec user ip route change default via 1.1.1.254 +$hexec ep1 ip route change default via 31.31.31.254 + +# Backup paths in user +$hexec user ip route add 124.124.124.1/32 via 2.2.2.254 +$hexec user ip route add 125.125.125.1/32 via 2.2.2.254 +$hexec user ip route add 134.134.134.1/32 via 2.2.2.254 +$hexec user ip route add 135.135.135.1/32 via 2.2.2.254 + +$hexec ep1 ip route add 124.124.124.1/32 via 32.32.32.254 +$hexec ep1 ip route add 125.125.125.1/32 via 32.32.32.254 +$hexec ep1 ip route add 134.134.134.1/32 via 32.32.32.254 +$hexec ep1 ip route add 135.135.135.1/32 via 32.32.32.254 + +$hexec llb1 ip route add 1.1.1.0/24 via 11.11.11.253 +$hexec llb1 ip route add 2.2.2.0/24 via 11.11.11.254 + +$hexec llb1 ip route add 31.31.31.0/24 via 10.10.10.253 +$hexec llb1 ip route add 32.32.32.0/24 via 10.10.10.254 + +sleep 20 +##Create LB rule user->ep1 +create_lb_rule llb1 123.123.123.1 --secips=124.124.124.1,125.125.125.1 --sctp=2020:9999 --endpoints=31.31.31.1:1 --mode=fullnat + +##Create LB rule ep1->user +create_lb_rule llb1 133.133.133.1 --secips=134.134.134.1,135.135.135.1 --sctp=2020:9999 --endpoints=1.1.1.1:1 --mode=fullnat + +$dexec llb1 loxicmd create ep 1.1.1.1 --name=1.1.1.1_sctp_9999 --probetype=none +$dexec llb1 loxicmd create ep 31.31.31.1 --name=31.31.31.1_sctp_9999 --probetype=none diff --git a/cicd/sctpmh/input b/cicd/sctpmh/input new file mode 100644 index 000000000..6fb66a5e2 --- /dev/null +++ b/cicd/sctpmh/input @@ -0,0 +1,6 @@ + + + + + + diff --git a/cicd/sctpmh/rmconfig.sh b/cicd/sctpmh/rmconfig.sh new file mode 100755 index 000000000..dd68b07eb --- /dev/null +++ b/cicd/sctpmh/rmconfig.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +echo "#########################################" +echo "Removing testbed" +echo "#########################################" + +source ../common.sh + +disconnect_docker_hosts user r1 +disconnect_docker_hosts user r2 +disconnect_docker_hosts r1 sw1 +disconnect_docker_hosts r2 sw1 +disconnect_docker_hosts sw1 llb1 +disconnect_docker_hosts llb1 sw2 +disconnect_docker_hosts sw2 r3 +disconnect_docker_hosts sw2 r4 +disconnect_docker_hosts r3 ep1 +disconnect_docker_hosts r4 ep1 + +delete_docker_host llb1 +delete_docker_host user +delete_docker_host r1 +delete_docker_host r2 +delete_docker_host r3 +delete_docker_host r4 +delete_docker_host sw1 +delete_docker_host sw2 +delete_docker_host ep1 + +echo "#########################################" +echo "Removed testbed" +echo "#########################################" diff --git a/cicd/sctpmh/validation.sh b/cicd/sctpmh/validation.sh new file mode 100755 index 000000000..9e3fec23b --- /dev/null +++ b/cicd/sctpmh/validation.sh @@ -0,0 +1,14 @@ +#!/bin/bash +echo "SCTP Multihoming - Test case #1" +echo -e "*********************************************************************************" +./validation1.sh +echo -e "\n\n\nSCTP Multihoming - Test case #2" +echo -e "*********************************************************************************" +./validation2.sh +echo -e "\n\n\nSCTP Multihoming - Test case #3" +echo -e "*********************************************************************************" +./validation3.sh +echo -e "\n\n\nSCTP Multihoming - Test case #4" +echo -e "*********************************************************************************" +./validation4.sh +echo -e "\n\n\n*********************************************************************************" diff --git a/cicd/sctpmh/validation1.sh b/cicd/sctpmh/validation1.sh new file mode 100755 index 000000000..6043bf114 --- /dev/null +++ b/cicd/sctpmh/validation1.sh @@ -0,0 +1,61 @@ +#!/bin/bash +source ../common.sh + +echo -e "sctpmh: SCTP Multihoming Basic Test - Client & EP Uni-homed and LB is Multi-homed\n" +extIP="123.123.123.1" +port=2020 + +echo "SCTP Multihoming service sctp-lb -> $extIP:$port" +echo -e "------------------------------------------------------------------------------------\n" + +$hexec ep1 sctp_darn -H 0.0.0.0 -P 9999 -l 2>&1> /dev/null & + +sleep 10 +$hexec user stdbuf -oL sctp_darn -H 1.1.1.1 -h $extIP -p $port -s < input > user.out +sleep 3 + +exp="New connection, peer addresses +123.123.123.1:2020 +124.124.124.1:2020 +125.125.125.1:2020" + +res=`cat user.out | grep -A 3 "New connection, peer addresses"` +sudo rm -rf user.out +sudo pkill sctp_darn + +if [[ "$res" == "$exp" ]]; then + echo $res + echo -e "\nsctpmh SCTP Multihoming service Basic Test [OK]\n" +else + echo "sctpmh SCTP Multihoming service Basic Test [NOK]" + echo "Expected : $exp" + echo "Received : $res" + ## Dump some debug info + echo "system route-info" + echo -e "\nuser" + sudo ip netns exec user ip route + echo -e "\nr1" + sudo ip netns exec r1 ip route + echo -e "\nr2" + sudo ip netns exec r2 ip route + echo -e "\nllb1" + sudo ip netns exec llb1 ip route + echo -e "\nr3" + sudo ip netns exec r3 ip route + echo -e "\nr4" + sudo ip netns exec r4 ip route + echo "-----------------------------" + + echo -e "\nllb1 lb-info" + $dexec llb1 loxicmd get lb + echo "llb1 ep-info" + $dexec llb1 loxicmd get ep + echo "llb1 bpf-info" + $dexec llb1 ntc filter show dev eth0 ingress + echo "BFP trace -- " + sudo timeout 5 cat /sys/kernel/debug/tracing/trace_pipe + sudo killall -9 cat + echo "BFP trace -- " + exit 1 +fi +echo -e "------------------------------------------------------------------------------------\n\n\n" diff --git a/cicd/sctpmh/validation2.sh b/cicd/sctpmh/validation2.sh new file mode 100755 index 000000000..8b92fef37 --- /dev/null +++ b/cicd/sctpmh/validation2.sh @@ -0,0 +1,93 @@ +#!/bin/bash +source ../common.sh + +echo -e "sctpmh: SCTP Multihoming - Multipath Test, Client and LB Multihomed, EP is uni-homed\n" +extIP="123.123.123.1" +port=2020 + +echo "SCTP Multihoming service sctp-lb(Multipath traffic) -> $extIP:$port" +echo -e "------------------------------------------------------------------------------------\n" + +$hexec ep1 sctp_test -H 0.0.0.0 -P 9999 -l > ep1.out & +sleep 2 + +$hexec user stdbuf -oL sctp_test -H 1.1.1.1 -B 2.2.2.1 -P 20000 -h $extIP -p $port -s -m 100 -x 100000 > user.out & +sleep 1 +#Path counters +p1c_old=0 +p1c_new=0 +p2c_old=0 +p2c_new=0 +p3c_old=0 +p3c_new=0 + +for((i=0;i<100;i++)) do + fin=`tail -n 100 user.out | grep "Client: Sending packets.(100000/100000)"` + if [[ ! -z $fin ]]; then + fin=1 + echo "sctp_test done." + break; + fi + $dexec llb1 loxicmd get ct + echo -e "\n" + p1c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "123.123.123.1 | 1.1.1.1" | xargs | cut -d '|' -f 10) + p2c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "124.124.124.1 | 2.2.2.1" | xargs | cut -d '|' -f 10) + p3c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "125.125.125.1 | 1.1.1.1" | xargs | cut -d '|' -f 10) + + echo "Counters: $p1c_new $p2c_new $p3c_new" + + if [[ $p1c_new -gt $p1c_old ]]; then + echo "Path 1: 1.1.1.1 -> 123.123.123.1 [ACTIVE]" + p1=1 + else + echo "Path 1: 1.1.1.1 -> 123.123.123.1 [NOT ACTIVE]" + fi + + if [[ $p2c_new -gt $p2c_old ]]; then + echo "Path 2: 2.2.2.1 -> 124.124.124.1 [ACTIVE]" + p2=1 + else + echo "Path 2: 2.2.2.1 -> 124.124.124.1 [NOT ACTIVE]" + fi + + if [[ $p3c_new -gt $p3c_old ]]; then + echo "Path 3: 1.1.1.1 -> 125.125.125.1 [ACTIVE]" + p3=1 + else + echo "Path 3: 1.1.1.1 -> 125.125.125.1 [NOT ACTIVE]" + fi + p1c_old=$p1c_new + p2c_old=$p1c_new + p2c_old=$p1c_new + echo -e "\n" + sleep 5 +done + +#sudo rm -rf user.out +sudo pkill sctp_test +sudo rm *.out +if [[ $fin == 1 && $p1 == 1 && $p2 == 1 && $p3 == 1 ]]; then + echo "sctpmh SCTP Multihoming Multipath [OK]" +else + echo "sctpmh SCTP Multihoming Multipath [NOK]" + echo -e "\nuser" + sudo ip netns exec user ip route + echo -e "\nr1" + sudo ip netns exec r1 ip route + echo -e "\nr2" + sudo ip netns exec r2 ip route + echo -e "\nllb1" + sudo ip netns exec llb1 ip route + echo -e "\nr3" + sudo ip netns exec r3 ip route + echo -e "\nr4" + sudo ip netns exec r4 ip route + echo "-----------------------------" + + echo -e "\nllb1 lb-info" + $dexec llb1 loxicmd get lb + echo "llb1 ep-info" + $dexec llb1 loxicmd get ep + exit 1 +fi +echo -e "------------------------------------------------------------------------------------\n\n\n" diff --git a/cicd/sctpmh/validation3.sh b/cicd/sctpmh/validation3.sh new file mode 100755 index 000000000..fa3b308e4 --- /dev/null +++ b/cicd/sctpmh/validation3.sh @@ -0,0 +1,113 @@ +#!/bin/bash +source ../common.sh + +echo -e "sctpmh: SCTP Multihoming - Multipath Failover Test. Client and LB Multihomed, EP is uni-homed\n" +extIP="123.123.123.1" +port=2020 + +echo "SCTP Multihoming service sctp-lb(Multipath traffic) -> $extIP:$port" +echo -e "------------------------------------------------------------------------------------\n" + +echo -e "\nTraffic Flow: User -> LB -> EP " + +$hexec ep1 sctp_test -H 0.0.0.0 -P 9999 -l > ep1.out & +sleep 2 + +$hexec user stdbuf -oL sctp_test -H 1.1.1.1 -B 2.2.2.1 -P 20000 -h $extIP -p $port -s -m 100 -x 100000 > user.out & +sleep 5 +#Path counters +p1c_old=0 +p1c_new=0 +p2c_old=0 +p2c_new=0 +p3c_old=0 +p3c_new=0 +down=0 +code=0 +for((i=0;i<200;i++)) do + fin=`tail -n 100 user.out | grep "Client: Sending packets.(100000/100000)"` + if [[ ! -z $fin ]]; then + fin=1 + echo "sctp_test done." + break; + fi + $dexec llb1 loxicmd get ct + echo -e "\n" + p1c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "123.123.123.1 | 1.1.1.1" | xargs | cut -d '|' -f 10) + p2c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "124.124.124.1 | 2.2.2.1" | xargs | cut -d '|' -f 10) + p3c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "125.125.125.1 | 1.1.1.1" | xargs | cut -d '|' -f 10) + + echo "Counters: $p1c_new $p2c_new $p3c_new" + + if [[ $p1c_new -gt $p1c_old ]]; then + echo "Path 1: 1.1.1.1 -> 123.123.123.1 [ACTIVE]" + p1=1 + if [[ $down == 1 ]]; then + echo "This path shouldn't be ACTIVE" + code=1 + fi + echo "Turning off this path from User->LB" + $hexec user ip link set euserr1 down; + down=1 + p1c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "123.123.123.1 | 1.1.1.1" | xargs | cut -d '|' -f 10) + else + if [[ $down == 1 ]]; then + p1dok=1 + echo "Path 1: 1.1.1.1 -> 123.123.123.1 NOT ACTIVE - [OK]" + else + echo "Path 1: 1.1.1.1 -> 123.123.123.1 [NOT ACTIVE]" + fi + fi + + if [[ $p2c_new -gt $p2c_old ]]; then + echo "Path 2: 2.2.2.1 -> 124.124.124.1 [ACTIVE]" + p2=1 + else + echo "Path 2: 2.2.2.1 -> 124.124.124.1 [NOT ACTIVE]" + fi + + if [[ $p3c_new -gt $p3c_old ]]; then + echo "Path 3: 1.1.1.1 -> 125.125.125.1 [ACTIVE]" + p3=1 + else + echo "Path 3: 1.1.1.1 -> 125.125.125.1 [NOT ACTIVE]" + fi + p1c_old=$p1c_new + p2c_old=$p1c_new + p2c_old=$p1c_new + echo -e "\n" + sleep 5 +done + +sudo rm -rf *.out +sudo pkill sctp_test + +#Restore +$hexec user ip link set euserr1 up +$hexec user ip route add default via 1.1.1.254 + +if [[ $fin == 1 && $p1 == 1 && $p2 == 1 && $p3 == 1 && $p1dok == 1 && $code == 0 ]]; then + echo "sctpmh SCTP Multihoming Multipath Failover [OK]" +else + echo "sctpmh SCTP Multihoming Multipath Failover [NOK]" + echo -e "\nuser" + sudo ip netns exec user ip route + echo -e "\nr1" + sudo ip netns exec r1 ip route + echo -e "\nr2" + sudo ip netns exec r2 ip route + echo -e "\nllb1" + sudo ip netns exec llb1 ip route + echo -e "\nr3" + sudo ip netns exec r3 ip route + echo -e "\nr4" + sudo ip netns exec r4 ip route + echo "-----------------------------" + + echo -e "\nllb1 lb-info" + $dexec llb1 loxicmd get lb + echo "llb1 ep-info" + $dexec llb1 loxicmd get ep + exit 1 +fi +echo -e "------------------------------------------------------------------------------------\n\n\n" diff --git a/cicd/sctpmh/validation4.sh b/cicd/sctpmh/validation4.sh new file mode 100755 index 000000000..aef8b4c01 --- /dev/null +++ b/cicd/sctpmh/validation4.sh @@ -0,0 +1,113 @@ +#!/bin/bash +source ../common.sh + +echo -e "sctpmh: SCTP Multihoming - Multipath Failover Test. Client, LB and EP all Multihomed\n" +extIP="133.133.133.1" +port=2020 + +echo "SCTP Multihoming service sctp-lb(Multipath traffic) -> $extIP:$port" +echo -e "------------------------------------------------------------------------------------\n" + +echo -e "\nTraffic Flow: EP ---> LB ---> User" + +$hexec user sctp_test -H 1.1.1.1 -B 2.2.2.1 -P 9999 -l > user.out & +sleep 2 + +$hexec ep1 stdbuf -oL sctp_test -H 31.31.31.1 -B 32.32.32.1 -P 20000 -h $extIP -p $port -s -m 100 -x 100000 > ep1.out & +sleep 5 +#Path counters +p1c_old=0 +p1c_new=0 +p2c_old=0 +p2c_new=0 +p3c_old=0 +p3c_new=0 +down=0 +code=0 +for((i=0;i<200;i++)) do + fin=`tail -n 100 ep1.out | grep "Client: Sending packets.(100000/100000)"` + if [[ ! -z $fin ]]; then + fin=1 + echo "sctp_test done." + break; + fi + $dexec llb1 loxicmd get ct + echo -e "\n" + p1c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "133.133.133.1 | 31.31.31.1" | xargs | cut -d '|' -f 10) + p2c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "134.134.134.1 | 32.32.32.1" | xargs | cut -d '|' -f 10) + p3c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "135.135.135.1 | 31.31.31.1" | xargs | cut -d '|' -f 10) + + echo "Counters: $p1c_new $p2c_new $p3c_new" + + if [[ $p1c_new -gt $p1c_old ]]; then + echo "Path 1: 31.31.31.1 -> 133.133.133.1 -> 1.1.1.1 [ACTIVE]" + p1=1 + if [[ $down == 1 ]]; then + echo "This path shouldn't be ACTIVE" + code=1 + fi + echo -e "Turning off this path at User.\nEP----->LB--x-->User" + $hexec user ip link set euserr1 down; + down=1 + p1c_new=$(sudo docker exec -i llb1 loxicmd get ct | grep "133.133.133.1 | 31.31.31.1" | xargs | cut -d '|' -f 10) + else + if [[ $down == 1 ]]; then + p1dok=1 + echo "Path 1: 31.31.31.1 -> 133.133.133.1 -> 1.1.1.1 NOT ACTIVE - [OK]" + else + echo "Path 1: 31.31.31.1 -> 133.133.133.1 -> 1.1.1.1 [NOT ACTIVE]" + fi + fi + + if [[ $p2c_new -gt $p2c_old ]]; then + echo "Path 2: 32.32.32.1 -> 134.134.134.1 -> 2.2.2.1 [ACTIVE]" + p2=1 + else + echo "Path 2: 32.32.32.1 -> 134.134.134.1 -> 2.2.2.1 [NOT ACTIVE]" + fi + + if [[ $p3c_new -gt $p3c_old ]]; then + echo "Path 3: 31.31.31.1 -> 135.135.135.1 -> 1.1.1.1 [ACTIVE]" + p3=1 + else + echo "Path 3: 31.31.31.1 -> 135.135.135.1 -> 1.1.1.1 [NOT ACTIVE]" + fi + p1c_old=$p1c_new + p2c_old=$p1c_new + p2c_old=$p1c_new + echo -e "\n" + sleep 5 +done + +sudo rm -rf *.out +sudo pkill sctp_test + +#Restore +$hexec user ip link set euserr1 up +$hexec user ip route add default via 1.1.1.254 + +if [[ $fin == 1 && $p1 == 1 && $p2 == 1 && $p3 == 1 && $p1dok == 1 && $code == 0 ]]; then + echo "sctpmh SCTP Multihoming E2E Multipath Failover [OK]" +else + echo "sctpmh SCTP Multihoming E2E Multipath Failover [NOK]" + echo -e "\nuser" + sudo ip netns exec user ip route + echo -e "\nr1" + sudo ip netns exec r1 ip route + echo -e "\nr2" + sudo ip netns exec r2 ip route + echo -e "\nllb1" + sudo ip netns exec llb1 ip route + echo -e "\nr3" + sudo ip netns exec r3 ip route + echo -e "\nr4" + sudo ip netns exec r4 ip route + echo "-----------------------------" + + echo -e "\nllb1 lb-info" + $dexec llb1 loxicmd get lb + echo "llb1 ep-info" + $dexec llb1 loxicmd get ep + exit 1 +fi +echo -e "------------------------------------------------------------------------------------\n\n\n" From 8d9c984382f9b769088e7748a999ad411d1f5e3c Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Wed, 17 Apr 2024 16:46:19 +0900 Subject: [PATCH 2/6] Multiple sourceIP bind support added --- cicd/common/sctp_client | Bin 17608 -> 25608 bytes cicd/common/sctp_client.c | 88 ++++++++++++++++++++++++++++++++------ cicd/common/sctp_server | Bin 17768 -> 17768 bytes cicd/common/sctp_server.c | 9 ++-- 4 files changed, 80 insertions(+), 17 deletions(-) diff --git a/cicd/common/sctp_client b/cicd/common/sctp_client index a663bf0756478a02e158a2f434633ae2346115bc..69610a86a83e6e0260a24879c6373d4798183080 100755 GIT binary patch literal 25608 zcmeHv3wTu3z3-Zt>|}N(nM@vp5CRzx6x1ZV1qDffz@!F|(Lsjlc)Os-1Tk4}ZzyEsd?Ac^) z`L*!eR5_5ZK`YyH=2@3r?@x7XIMw%cq>T@H3NBkW+Ipj69@S8k9AfNHjw z<>GfHo53=HXK4z1rlKcvi4Z1d-i8ude>@`Ta=e=AFvqEJ@L1ph+ z$WdJW+DldQ25B!{JqOuBuRQ`=SL^q2`KEFr4VB=vus}V$p)iSfp|u&nLgg z2DPa*>o!w$93`5nPD&R^obq>_+R_&J@K4|Ed3f=~Z(eij7scNy_%BKa*(4siNM2Pj z;gt5`pLj(1?*QWAG?3V=DR-B>9(b*T(&Jr6Kr9$1V`Ccn`)TNI(7pJ#UJrvXp8hg8 zJRbcwY50GVhW>YH==0L(e=QCFzBKfA)6g$ZqyPFebgH27%3F|zektsF@o&8bK^RX@ zG7bHfH1yBY(BDi$za)*Hd(-egn1;RtbT9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Q}vu3aCFuW?_0~x{Roi zSy>TW4Y-VWIRc@2kqIK%>NowTeVpt)H|(qS3A5mAwJ2=I))jD#%;VF> zS_m0~VsBEvxQYpvm#Rw{@wnB(=v@ zO|9<=-E9Xl0;9~~PfHgXb{9Zy&{vh}{X1^;&3rHOFy9>a4KB}Sv!FYOpC{T@;X-VV z8sKy=&v4ic*Mr{?s-bw9=xM?2^S|!yHPEz76n64&g#B=IS-w->yLz+(Tz7)Emw5XZ zxVLN(-d781L}3oKo*-^3{6b-@T=!CGJ!wrL)ZzkW8(0{e%f;d@#7>6uE~!>jg7h3h zc^1Z*sa4MgRm|R}C~$bWyQ)^R&^L`=vp9!xN79#xCT4%s?2l@T$*Ucef9ARWjkm+R zwZadVi=KS^>~k7CO#i~s<4lL{6{1i{Ho_We&0Em25Gy2Gc%4fRQQIS}%oSj1Z8My& zT?fytnhNc!-h#r_li_=-C-ro#{<{EMZ3}wR*E9--JqGweozEGh&jWmPS_4Px{7${V zbXp3x>-<)|yso7|VSTB!NIONa(%03OW?}uQk46UtI9C5^dJq?$9=KXB!lJcKOPf;_ zU>UA`*4?Qgo$BW#Hy>E*%+jY?r?<@T`C6Y<-z8Y4g$)aZ5@>1gTSh;Ek2E}M-7cve zZI|F?L#b6i107x{Y%I0vCE)hLI)r+qN?v%ov2E)OzQ672>K)Ta))+4@sQU diff --git a/cicd/common/sctp_client.c b/cicd/common/sctp_client.c index 1db1b4196..bf69c90e5 100644 --- a/cicd/common/sctp_client.c +++ b/cicd/common/sctp_client.c @@ -16,10 +16,10 @@ int main(int argc, char* argv[]) { struct sockaddr_in servaddr = {0}; - struct sockaddr_in laddr = {0}; - int sockfd, in, flags; - char *saddr; - int sport, lport, error = 0, secs = 0; + struct sockaddr_in laddr[10] = {0}; + int sockfd, in, flags, count = 1; + char *saddr, *laddrs, *addr; + int sport, lport, error = 0, secs = 0, i = 0; struct sctp_status status = {0}; struct sctp_sndrcvinfo sndrcvinfo = {0}; struct sctp_event_subscribe events = {0}; @@ -29,13 +29,35 @@ int main(int argc, char* argv[]) socklen_t opt_len; socklen_t slen = (socklen_t) sizeof(struct sockaddr_in); - + if (argc < 5) { + printf("Usage: %s localaddr1<,localaddr2..> localport serverIP serverport \n", argv[0]); + exit(1); + } sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); lport = atoi(argv[2]); - - laddr.sin_family = AF_INET; - laddr.sin_addr.s_addr = inet_addr(argv[1]); - laddr.sin_port = lport?htons(lport):0; + laddrs = argv[1]; + memset(laddr, 0, sizeof(laddr)); + if (strstr(laddrs, ",")) { + i = 0; + addr = strtok(laddrs, ",\n"); + laddr[0].sin_family = AF_INET; + laddr[0].sin_port = lport?htons(lport):0; + laddr[0].sin_addr.s_addr = inet_addr(addr); + //printf("%s\n", addr); + addr = strtok(NULL, ",\n"); + while(addr != NULL) { + i++; + //printf("%s\n", addr); + laddr[i].sin_family = AF_INET; + laddr[i].sin_port = lport?htons(lport):0; + laddr[i].sin_addr.s_addr = inet_addr(addr); + addr = strtok(NULL, ",\n"); + } + } else { + laddr[0].sin_family = AF_INET; + laddr[0].sin_addr.s_addr = inet_addr(argv[1]); + laddr[0].sin_port = lport?htons(lport):0; + } //bind to local address error = bind(sockfd, (struct sockaddr *)&laddr, sizeof(struct sockaddr_in)); @@ -45,15 +67,31 @@ int main(int argc, char* argv[]) exit(1); } + int j = 1; + while(j <= i) { + error = sctp_bindx(sockfd,(struct sockaddr*) &laddr[j], j, SCTP_BINDX_ADD_ADDR); + if (error != 0) { + printf("\n\n\t\t***r: error adding addrs:" + " %s. ***\n", strerror(errno)); + exit(1); + } else { + //printf("Bind OK\n"); + } + j++; + } + //set the association options initmsg.sinit_num_ostreams = 1; setsockopt( sockfd, IPPROTO_SCTP, SCTP_INITMSG, &initmsg,sizeof(initmsg)); saddr = argv[3]; sport = atoi(argv[4]); - if (argv[5]) { + if (argc >=6 ) { /* Delay before exit */ secs = atoi(argv[5]); } + if (argc == 7) { /* count for sending 1pps*/ + count = atoi(argv[6]); + } bzero( (void *)&servaddr, sizeof(servaddr) ); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(sport); @@ -65,11 +103,25 @@ int main(int argc, char* argv[]) opt_len = (socklen_t) sizeof(struct sctp_status); getsockopt(sockfd, IPPROTO_SCTP, SCTP_STATUS, &status, &opt_len); - while(1) + fd_set fds; // will be checked for being ready to read + FD_ZERO(&fds); + FD_SET(sockfd, &fds); + struct timeval tv = { 0 }; + tv.tv_sec = 1; + tv.tv_usec = 0; + + while(count) { strncpy (msg, "hello", strlen("hello")); - //printf("Sending msg to server: %s", msg); sctp_sendmsg(sockfd, (const void *)msg, strlen(msg), NULL, 0,htonl(PPID), 0, 0 , 0, 0); + //printf("Sending msg to server: %s", msg); + // + int ret = select( sockfd + 1, &fds, NULL, NULL, &tv ); + if (ret <= 0) { + printf("Timeout\n"); + count--; + sleep(1); + } else if (FD_ISSET( sockfd, &fds )) { in = sctp_recvmsg(sockfd, (void*)buff, RECVBUFSIZE, (struct sockaddr *)&servaddr, @@ -79,7 +131,17 @@ int main(int argc, char* argv[]) buff[in] = 0; printf("%s",buff); fflush(stdout); - break; + count--; + if(!count) + break; + else { + printf("\n"); + fflush(stdout); + sleep(1); + } + } + } else { + break; } } if(secs) sleep(secs); diff --git a/cicd/common/sctp_server b/cicd/common/sctp_server index 6c37dd75f84686a147163c8f319a3d39c5eb4a30..7f6a07b155b24e2ae2f67c3c46582040855f89a4 100755 GIT binary patch delta 1027 zcmZ8gTS!z<6g@{R$46WvQBl)zC{l84)R{!Y^2S7Gz^F*m4<$&MKKv5&qYx(;4|%*? zK`v6^hy4`wH+6-v@G+7(NPejFkO-P7j5{esZ(nuW=Z+6*J`Ve=wbx#2AMR*9SnI() z6Hcg2LdLIF-HYpDQojzhHC+w19Cnr_Sv%|V-_^hIxz&!?HNi9$j}VdfoKZXXnK2$w z2UDAI^6)2J$Dk*2|F9yYmD-3zLx7DHa*zeJkL$WlXh7&X25p-pksa?7qI8SWk(TQj zfF?JiC7+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server.c index af3a49b0b..941ebc068 100644 --- a/cicd/common/sctp_server.c +++ b/cicd/common/sctp_server.c @@ -44,7 +44,6 @@ int main(int argc, char* argv[]) { if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) < 0) perror("setsockopt(SO_REUSEADDR) failed"); - i = 1; if (strstr(saddrs, ",")) { saddr = strtok(saddrs, ",\n"); laddr[0].sin_family = AF_INET; @@ -52,6 +51,7 @@ int main(int argc, char* argv[]) { laddr[0].sin_addr.s_addr = inet_addr(saddr); printf("%s\n", saddr); saddr = strtok(NULL, ",\n"); + i = 1; while(saddr != NULL) { printf("%s\n", saddr); laddr[i].sin_family = AF_INET; @@ -77,14 +77,15 @@ int main(int argc, char* argv[]) { " %s. ***\n", strerror(errno)); exit(1); } - - if (i > 1) { - error = sctp_bindx(sockfd,(struct sockaddr*) &laddr[1], i - 1, SCTP_BINDX_ADD_ADDR); + int j = 1; + while(j <= i) { + error = sctp_bindx(sockfd,(struct sockaddr*) &laddr[j], j - 1, SCTP_BINDX_ADD_ADDR); if (error != 0) { printf("\n\n\t\t***r: error adding addrs:" " %s. ***\n", strerror(errno)); exit(1); } + j++; } listen(sockfd, 1); From 3cd3bbf4b113a4f1e63df50b2ec0696c667ba067 Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Wed, 17 Apr 2024 16:47:07 +0900 Subject: [PATCH 3/6] bfd params validation check fixed --- pkg/loxinet/cluster.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/loxinet/cluster.go b/pkg/loxinet/cluster.go index 9561a0799..486bd4c3f 100644 --- a/pkg/loxinet/cluster.go +++ b/pkg/loxinet/cluster.go @@ -283,17 +283,17 @@ func (h *CIStateH) CIBFDSessionAdd(bm cmn.BFDMod) (int, error) { return -1, errors.New("cluster instance not found") } - ip := net.ParseIP(string(bm.RemoteIP)) + ip := net.ParseIP(bm.RemoteIP.String()) if ip == nil { return -1, errors.New("remoteIP address malformed") } - myIP := net.ParseIP(string(bm.SourceIP)) - if myIP == nil { - return -1, errors.New("source address malformed") - } - if !h.SpawnKa { + myIP := net.ParseIP(bm.SourceIP.String()) + if myIP == nil { + return -1, errors.New("source address malformed") + } + tk.LogIt(tk.LogInfo, "[CLUSTER] Cluster Instance %s starting BFD..\n", bm.Instance) h.SpawnKa = true From aaba9a30b3bbb92b9cab16175b4b97ef62d64b52 Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Wed, 17 Apr 2024 16:52:39 +0900 Subject: [PATCH 4/6] k3s install in ipvs mode --- cicd/k3s-sctpmh/config.sh | 6 +++++- cicd/k3s-sctpmh/rmconfig.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cicd/k3s-sctpmh/config.sh b/cicd/k3s-sctpmh/config.sh index dc5b7c815..9f04a35a9 100755 --- a/cicd/k3s-sctpmh/config.sh +++ b/cicd/k3s-sctpmh/config.sh @@ -101,6 +101,8 @@ $hexec r1 ip route add 20.20.20.1/32 via 11.11.11.11 # Route back to user sudo ip route add 11.11.11.0/24 via 14.14.14.1 sudo ip route add 123.123.123.0/24 via 14.14.14.1 +sudo ip route add 124.124.124.0/24 via 14.14.14.1 +sudo ip route add 125.125.125.0/24 via 14.14.14.1 # Change default route in llb1 $hexec llb1 ip route del default @@ -132,7 +134,9 @@ else echo "Start K3s installation" # Install k3s without external cloud-manager and disabled servicelb - curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.22.9+k3s1 INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - + sudo apt install ipset ipvsadm + curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable traefik,metrics-server,servicelb" K3S_KUBECONFIG_MODE="644" sh -s - server --kube-proxy-arg proxy-mode=ipvs + #curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.22.9+k3s1 INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - #curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - sleep 10 diff --git a/cicd/k3s-sctpmh/rmconfig.sh b/cicd/k3s-sctpmh/rmconfig.sh index 3aed216b0..79d14bd5e 100755 --- a/cicd/k3s-sctpmh/rmconfig.sh +++ b/cicd/k3s-sctpmh/rmconfig.sh @@ -44,7 +44,7 @@ if [[ -f "/usr/local/bin/k3s-uninstall.sh" ]]; then /usr/local/bin/k3s-uninstall.sh fi -sudo apt-get remove bird2 --yes +sudo apt-get remove bird2 ipvsadm ipset --yes docker image rm loxilb-io/sctp-server docker images -a | grep "loxilb-io" | awk '{print $3}' | xargs docker rmi echo "#########################################" From 0ed02d5cec5f5886a83f13579f7407acbc0e876c Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Wed, 17 Apr 2024 16:54:50 +0900 Subject: [PATCH 5/6] Host VM cleanup in rmconfig.sh --- cicd/k8s-calico-ipvs2-ha-ka-sync/rmconfig.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cicd/k8s-calico-ipvs2-ha-ka-sync/rmconfig.sh b/cicd/k8s-calico-ipvs2-ha-ka-sync/rmconfig.sh index 6cadc7e4e..4c990e5e0 100755 --- a/cicd/k8s-calico-ipvs2-ha-ka-sync/rmconfig.sh +++ b/cicd/k8s-calico-ipvs2-ha-ka-sync/rmconfig.sh @@ -4,3 +4,4 @@ vagrant destroy -f worker1 vagrant destroy -f master vagrant destroy -f llb1 vagrant destroy -f llb2 +vagrant destroy -f host From b8279c62f9e222690a4b65a17c1494da56291895 Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Wed, 17 Apr 2024 17:00:22 +0900 Subject: [PATCH 6/6] Added missing files for k3s-flannel-multus --- .../multus/multus-sctp-pod.yml | 20 +++++++++++++++++++ .../multus/multus-sctp-service.yml | 18 +++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 cicd/k3s-flannel-multus/multus/multus-sctp-pod.yml create mode 100644 cicd/k3s-flannel-multus/multus/multus-sctp-service.yml diff --git a/cicd/k3s-flannel-multus/multus/multus-sctp-pod.yml b/cicd/k3s-flannel-multus/multus/multus-sctp-pod.yml new file mode 100644 index 000000000..2b33d895f --- /dev/null +++ b/cicd/k3s-flannel-multus/multus/multus-sctp-pod.yml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Pod +metadata: + name: sctp-pod-01 + labels: + app: sctp-pod-01 + annotations: + k8s.v1.cni.cncf.io/networks: '[{ + "name": "macvlan1", + "default-route": ["4.0.6.149"] + }]' +spec: + containers: + - name: sctp-test + image: loxilbio/sctp-darn:latest + imagePullPolicy: Always + #command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 6 ; done"] + command: ["sctp_darn","-H", "0.0.0.0","-P", "9999", "-l"] + ports: + - containerPort: 9999 diff --git a/cicd/k3s-flannel-multus/multus/multus-sctp-service.yml b/cicd/k3s-flannel-multus/multus/multus-sctp-service.yml new file mode 100644 index 000000000..93f14ca9f --- /dev/null +++ b/cicd/k3s-flannel-multus/multus/multus-sctp-service.yml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: multus-sctp-service + annotations: + loxilb.io/num-secondary-networks: "2" + loxilb.io/multus-nets: macvlan1,macvlan2 + loxilb.io/lbmode: "fullnat" +spec: + externalTrafficPolicy: Local + loadBalancerClass: loxilb.io/loxilb + selector: + app: sctp-pod-01 + ports: + - port: 55002 + protocol: SCTP + targetPort: 9999 + type: LoadBalancer