Skip to content

Commit 708d4a2

Browse files
committed
loxilb-iogh-87 : sctpmh with seagull test suite cicd added
1 parent 4e121c2 commit 708d4a2

File tree

23 files changed

+1902
-6
lines changed

23 files changed

+1902
-6
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: SCTP-MH-LB-Seagull-Sanity-CI
2+
on:
3+
# schedule:
4+
# Runs "At 11:00 UTC every day-of-week"
5+
#- cron: '0 11 * * *'
6+
workflow_dispatch:
7+
inputs:
8+
testName:
9+
description: 'Test Run-Name'
10+
required: true
11+
default: 'sctpmh-seagull-sanity'
12+
jobs:
13+
test-runner:
14+
name: k8s-calico-incluster-sanity
15+
runs-on: [self-hosted, large]
16+
if: github.repository == 'loxilb-io/loxilb'
17+
&& github.event.inputs.tagName == ''
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
with:
22+
submodules: recursive
23+
24+
- name: Run the test
25+
run: |
26+
cd cicd/sctpmh-seagull
27+
./config.sh
28+
./validation.sh
29+
cd -
30+
31+
- name: Clean test-bed
32+
if: success() || failure()
33+
run: |
34+
cd cicd/sctpmh-seagull || true
35+
./rmconfig.sh
36+
cd -

cicd/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ function create_lb_rule() {
561561
return
562562
fi
563563

564-
hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
564+
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
565565
if [[ $hook != *"tc_packet_func"* ]]; then
566566
echo "ERROR : No hook point found";
567567
exit 1

cicd/docker-k3s-calico/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ function create_lb_rule() {
536536
echo "$1: loxicmd create lb ${args[*]}"
537537
$dexec $1 loxicmd create lb ${args[*]}
538538

539-
hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
539+
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
540540
if [[ $hook != *"tc_packet_func"* ]]; then
541541
echo "ERROR : No hook point found";
542542
exit 1

cicd/docker-k3s-cilium/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ function create_lb_rule() {
536536
echo "$1: loxicmd create lb ${args[*]}"
537537
$dexec $1 loxicmd create lb ${args[*]}
538538

539-
hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
539+
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
540540
if [[ $hook != *"tc_packet_func"* ]]; then
541541
echo "ERROR : No hook point found";
542542
exit 1

cicd/k0s-incluster/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ function create_lb_rule() {
536536
echo "$1: loxicmd create lb ${args[*]}"
537537
$dexec $1 loxicmd create lb ${args[*]}
538538

539-
hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
539+
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
540540
if [[ $hook != *"tc_packet_func"* ]]; then
541541
echo "ERROR : No hook point found";
542542
exit 1

cicd/microk8s-incluster/common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@ function create_lb_rule() {
536536
echo "$1: loxicmd create lb ${args[*]}"
537537
$dexec $1 loxicmd create lb ${args[*]}
538538

539-
hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_hook)
540-
if [[ $hook != *"tc_packet_hook"* ]]; then
539+
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
540+
if [[ $hook != *"tc_packet_func"* ]]; then
541541
echo "ERROR : No hook point found";
542542
exit 1
543543
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"dependencies":[["vagrant-disksize",["= 0.1.3"]],["net-ssh",[">= 2.6.5","< 8.0.0"]],["net-scp",[">= 1.1"]],["log4r",["~> 1.1"]],["vagrant-scp",["= 0.5.9"]]],"checksum":"d41cdc087dc2595e62da764647bfcacc91965875ce15159c44cdee684a184f69","vagrant_version":"2.3.7"}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file loads the proper rgloader/loader.rb file that comes packaged
2+
# with Vagrant so that encoded files can properly run with Vagrant.
3+
4+
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
5+
require File.expand_path(
6+
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
7+
else
8+
raise "Encoded files can't be read outside of the Vagrant installer."
9+
end

cicd/sctpmh-seagull/Vagrantfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
#box_name = (ENV['VAGRANT_BOX'] || "ubuntu/focal64")
5+
box_name = (ENV['VAGRANT_BOX'] || "sysnet4admin/Ubuntu-k8s")
6+
box_version = "0.7.1"
7+
Vagrant.configure("2") do |config|
8+
config.vm.box = "#{box_name}"
9+
config.vm.box_version = "#{box_version}"
10+
11+
if Vagrant.has_plugin?("vagrant-vbguest")
12+
config.vbguest.auto_update = false
13+
end
14+
15+
config.vm.define "bastion" do |bastion|
16+
bastion.vm.hostname = 'bastion'
17+
#bastion.vm.network :private_network, ip: "4.0.5.3", :netmask => "255.255.255.0"
18+
bastion.vm.network :private_network, ip: "4.0.4.3", :netmask => "255.255.255.0"
19+
bastion.vm.provision :shell, :path => "bastion.sh"
20+
bastion.vm.provider :virtualbox do |vbox|
21+
vbox.customize ["modifyvm", :id, "--memory", 8196]
22+
vbox.customize ["modifyvm", :id, "--cpus", 12]
23+
#vbox.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
24+
#vbox.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
25+
end
26+
end
27+
end

cicd/sctpmh-seagull/bastion.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apt-get update
2+
apt-get install -y software-properties-common curl wget lksctp-tools jq
3+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4+
add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5+
apt-get update
6+
apt-get install -y docker-ce
7+
echo "blacklist sctp" >> /etc/modprobe.d/blacklist.conf
8+
echo "install sctp /bin/false" >> /etc/modprobe.d/blacklist.conf
9+
10+
echo "Rebooting Now!"
11+
reboot
12+
"

cicd/sctpmh-seagull/check_ha.sh

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#!/bin/bash
2+
3+
master="llb1"
4+
backup="llb2"
5+
6+
function check_ha() {
7+
while : ; do
8+
status1=$($hexec llb1 curl -sX 'GET' 'http://0.0.0.0:11111/netlox/v1/config/cistate/all' -H 'accept: application/json' | jq -r '.Attr[0].state')
9+
status2=$($hexec llb2 curl -sX 'GET' 'http://0.0.0.0:11111/netlox/v1/config/cistate/all' -H 'accept: application/json' | jq -r '.Attr[0].state')
10+
count=0
11+
if [[ $status1 == "MASTER" && $status2 == "BACKUP" ]];
12+
then
13+
master="llb1"
14+
backup="llb2"
15+
break
16+
elif [[ $status2 == "MASTER" && $status1 == "BACKUP" ]];
17+
then
18+
master="llb2"
19+
backup="llb1"
20+
break
21+
else
22+
count=$(( $count + 1 ))
23+
if [[ $count -ge 20 ]]; then
24+
echo "KA llb1-$status1, llb2-$status2 [NOK]" >&2
25+
exit 1;
26+
fi
27+
sleep 5
28+
fi
29+
done
30+
}
31+
32+
function checkSync() {
33+
count=1
34+
sync=0
35+
while [[ $count -le 5 ]] ; do
36+
echo -e "\nStatus at MASTER:$master\n" >&2
37+
#$dexec $master loxicmd get ct | grep est >&2
38+
ct=`$dexec $master loxicmd get ct | grep est`
39+
echo "${ct//'\n'/$'\n'}" >&2
40+
41+
echo -e "\nStatus at BACKUP:$backup\n" >&2
42+
ct=`$dexec $backup loxicmd get ct | grep est`
43+
echo "${ct//'\n'/$'\n'}" >&2
44+
45+
nres1=$($hexec $master curl -sX 'GET' 'http://0.0.0.0:11111/netlox/v1/config/conntrack/all' -H 'accept: application/json' | grep -ow "\"conntrackState\":\"est\"" | wc -l)
46+
nres2=$($hexec $backup curl -sX 'GET' 'http://0.0.0.0:11111/netlox/v1/config/conntrack/all' -H 'accept: application/json' | grep -ow "\"conntrackState\":\"est\"" | wc -l)
47+
48+
if [[ $nres1 == 0 ]]; then
49+
echo -e "No active connections in Master:$master. Exiting!" >&2
50+
return 2
51+
fi
52+
53+
if [[ $nres1 == $nres2 && $nres1 != 0 ]]; then
54+
echo -e "\nConnections sync successful!!!\n" >&2
55+
sync=1
56+
break;
57+
fi
58+
echo -e "\nConnections sync pending.. Let's wait a little more..\n" >&2
59+
count=$(( $count + 1 ))
60+
sleep 2
61+
done
62+
63+
if [[ $sync == 0 ]]; then
64+
echo -e "\nConnection Sync failed\n" >&2
65+
return 0
66+
fi
67+
echo "$sync"
68+
}
69+
70+
function restart_mloxilb() {
71+
if [[ $master == "llb1" ]]; then
72+
pat="cluster=172.17.0.3"
73+
copts=" --cluster=172.17.0.3"
74+
self=" --self=0"
75+
ka=" --ka=172.17.0.3:172.17.0.2"
76+
else
77+
pat="cluster=172.17.0.2"
78+
copts=" --cluster=172.17.0.2"
79+
self=" --self=1"
80+
ka=" --ka=172.17.0.2:172.17.0.3"
81+
fi
82+
echo "Restarting MASTER: $master"
83+
pid=$(docker exec -i $master ps -aef | grep $pat | xargs | cut -d ' ' -f 2)
84+
echo "Killing $pid" >&2
85+
docker exec -dt $master kill -9 $pid
86+
docker exec -dt $master ip link del llb0
87+
docker exec -dt $master nohup /root/loxilb-io/loxilb/loxilb $copts $self $ka > /dev/null &
88+
pid=$(docker exec -i $master ps -aef | grep $pat | xargs | cut -d ' ' -f 2)
89+
echo "New loxilb pid: $pid" >&2
90+
}
91+
92+
function restart_loxilbs() {
93+
if [[ $master == "llb1" ]]; then
94+
mpat="cluster=172.17.0.3"
95+
mcopts=" --cluster=172.17.0.3"
96+
mself=" --self=0"
97+
mka=" --ka=172.17.0.3:172.17.0.2"
98+
99+
bpat="cluster=172.17.0.2"
100+
bcopts=" --cluster=172.17.0.2"
101+
bself=" --self=1"
102+
bka=" --ka=172.17.0.2:172.17.0.3"
103+
else
104+
mpat="cluster=172.17.0.2"
105+
mcopts=" --cluster=172.17.0.2"
106+
mself=" --self=1"
107+
mka=" --ka=172.17.0.2:172.17.0.3"
108+
109+
bpat="cluster=172.17.0.3"
110+
bcopts=" --cluster=172.17.0.3"
111+
bself=" --self=0"
112+
bka=" --ka=172.17.0.3:172.17.0.2"
113+
fi
114+
echo "Restarting $master"
115+
pid=$(docker exec -i $master ps -aef | grep $mpat | xargs | cut -d ' ' -f 2)
116+
echo "Killing $mpid" >&2
117+
docker exec -dt $master kill -9 $pid
118+
docker exec -dt $master ip link del llb0
119+
docker exec -dt $master nohup /root/loxilb-io/loxilb/loxilb $mcopts $mself $mka > /dev/null &
120+
pid=$(docker exec -i $master ps -aef | grep $mpat | xargs | cut -d ' ' -f 2)
121+
echo "New loxilb pid: $pid" >&2
122+
123+
echo "Restarting $backup"
124+
pid=$(docker exec -i $backup ps -aef | grep $bpat | xargs | cut -d ' ' -f 2)
125+
echo "Killing $pid" >&2
126+
docker exec -dt $backup kill -9 $pid
127+
docker exec -dt $backup ip link del llb0
128+
docker exec -dt $backup nohup /root/loxilb-io/loxilb/loxilb $bcopts $bself $bka > /dev/null &
129+
pid=$(docker exec -i $backup ps -aef | grep $bpat | xargs | cut -d ' ' -f 2)
130+
echo "New loxilb pid: $pid" >&2
131+
132+
}
133+
134+

0 commit comments

Comments
 (0)