Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-87 : sctpmh CICD test suites updated #802

Merged
merged 7 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/sctpmh-seagull-sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: SCTP-MH-LB-Seagull-Sanity-CI
on:
# schedule:
# Runs "At 11:00 UTC every day-of-week"
#- cron: '0 11 * * *'
workflow_dispatch:
inputs:
testName:
description: 'Test Run-Name'
required: true
default: 'sctpmh-seagull-sanity'
jobs:
test-runner:
name: k8s-calico-incluster-sanity
runs-on: [self-hosted, large]
if: github.repository == 'loxilb-io/loxilb'
&& github.event.inputs.tagName == ''
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Run the test
run: |
cd cicd/sctpmh-seagull
./config.sh
./validation.sh
cd -

- name: Clean test-bed
if: success() || failure()
run: |
cd cicd/sctpmh-seagull || true
./rmconfig.sh
cd -
2 changes: 1 addition & 1 deletion cicd/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ function create_lb_rule() {
return
fi

hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
if [[ $hook != *"tc_packet_func"* ]]; then
echo "ERROR : No hook point found";
exit 1
Expand Down
2 changes: 1 addition & 1 deletion cicd/docker-k3s-calico/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ function create_lb_rule() {
echo "$1: loxicmd create lb ${args[*]}"
$dexec $1 loxicmd create lb ${args[*]}

hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
if [[ $hook != *"tc_packet_func"* ]]; then
echo "ERROR : No hook point found";
exit 1
Expand Down
2 changes: 1 addition & 1 deletion cicd/docker-k3s-cilium/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ function create_lb_rule() {
echo "$1: loxicmd create lb ${args[*]}"
$dexec $1 loxicmd create lb ${args[*]}

hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
if [[ $hook != *"tc_packet_func"* ]]; then
echo "ERROR : No hook point found";
exit 1
Expand Down
2 changes: 1 addition & 1 deletion cicd/k0s-incluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ function create_lb_rule() {
echo "$1: loxicmd create lb ${args[*]}"
$dexec $1 loxicmd create lb ${args[*]}

hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_func)
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
if [[ $hook != *"tc_packet_func"* ]]; then
echo "ERROR : No hook point found";
exit 1
Expand Down
4 changes: 2 additions & 2 deletions cicd/microk8s-incluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ function create_lb_rule() {
echo "$1: loxicmd create lb ${args[*]}"
$dexec $1 loxicmd create lb ${args[*]}

hook=$($dexec llb1 tc filter show dev eth0 ingress | grep tc_packet_hook)
if [[ $hook != *"tc_packet_hook"* ]]; then
hook=$($dexec $1 tc filter show dev eth0 ingress | grep tc_packet_func)
if [[ $hook != *"tc_packet_func"* ]]; then
echo "ERROR : No hook point found";
exit 1
fi
Expand Down
1 change: 1 addition & 0 deletions cicd/sctpmh-seagull/.vagrant/bundler/global.sol
TrekkieCoder marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +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"}
9 changes: 9 additions & 0 deletions cicd/sctpmh-seagull/.vagrant/rgloader/loader.rb
TrekkieCoder marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.

if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
27 changes: 27 additions & 0 deletions cicd/sctpmh-seagull/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

#box_name = (ENV['VAGRANT_BOX'] || "ubuntu/focal64")
box_name = (ENV['VAGRANT_BOX'] || "sysnet4admin/Ubuntu-k8s")
box_version = "0.7.1"
Vagrant.configure("2") do |config|
config.vm.box = "#{box_name}"
config.vm.box_version = "#{box_version}"

if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end

config.vm.define "bastion" do |bastion|
bastion.vm.hostname = 'bastion'
#bastion.vm.network :private_network, ip: "4.0.5.3", :netmask => "255.255.255.0"
bastion.vm.network :private_network, ip: "4.0.4.3", :netmask => "255.255.255.0"
bastion.vm.provision :shell, :path => "bastion.sh"
bastion.vm.provider :virtualbox do |vbox|
vbox.customize ["modifyvm", :id, "--memory", 8196]
vbox.customize ["modifyvm", :id, "--cpus", 12]
#vbox.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
#vbox.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
end
end
end
12 changes: 12 additions & 0 deletions cicd/sctpmh-seagull/bastion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apt-get update
apt-get install -y software-properties-common curl wget lksctp-tools jq
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce
echo "blacklist sctp" >> /etc/modprobe.d/blacklist.conf
echo "install sctp /bin/false" >> /etc/modprobe.d/blacklist.conf

echo "Rebooting Now!"
reboot
"
134 changes: 134 additions & 0 deletions cicd/sctpmh-seagull/check_ha.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#!/bin/bash

master="llb1"
backup="llb2"

function check_ha() {
while : ; do
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')
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')
count=0
if [[ $status1 == "MASTER" && $status2 == "BACKUP" ]];
then
master="llb1"
backup="llb2"
break
elif [[ $status2 == "MASTER" && $status1 == "BACKUP" ]];
then
master="llb2"
backup="llb1"
break
else
count=$(( $count + 1 ))
if [[ $count -ge 20 ]]; then
echo "KA llb1-$status1, llb2-$status2 [NOK] - Exiting" >&2
exit 1;
fi
echo "KA llb1-$status1, llb2-$status2 [NOK]" >&2
sleep 5
fi
done
}

function checkSync() {
count=1
sync=0
while [[ $count -le 5 ]] ; do
echo -e "\nStatus at MASTER:$master\n" >&2
ct=`$dexec $master loxicmd get ct | grep est`
echo "${ct//'\n'/$'\n'}" >&2

echo -e "\nStatus at BACKUP:$backup\n" >&2
ct=`$dexec $backup loxicmd get ct | grep est`
echo "${ct//'\n'/$'\n'}" >&2

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)
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)

if [[ $nres1 == 0 ]]; then
echo -e "No active connections in Master:$master. Exiting!" >&2
return 2
fi

if [[ $nres1 == $nres2 && $nres1 != 0 ]]; then
echo -e "\nConnections sync successful!!!\n" >&2
sync=1
break;
fi
echo -e "\nConnections sync pending.. Let's wait a little more..\n" >&2
count=$(( $count + 1 ))
sleep 2
done

if [[ $sync == 0 ]]; then
echo -e "\nConnection Sync failed\n" >&2
return 0
fi
echo "$sync"
}

function restart_mloxilb() {
if [[ $master == "llb1" ]]; then
pat="cluster=172.17.0.3"
copts=" --cluster=172.17.0.3"
self=" --self=0"
ka=" --ka=172.17.0.3:172.17.0.2"
else
pat="cluster=172.17.0.2"
copts=" --cluster=172.17.0.2"
self=" --self=1"
ka=" --ka=172.17.0.2:172.17.0.3"
fi
echo "Restarting MASTER: $master"
pid=$(docker exec -i $master ps -aef | grep $pat | xargs | cut -d ' ' -f 2)
echo "Killing $pid" >&2
docker exec -dt $master kill -9 $pid
docker exec -dt $master ip link del llb0
docker exec -dt $master nohup /root/loxilb-io/loxilb/loxilb $copts $self $ka > /dev/null &
pid=$(docker exec -i $master ps -aef | grep $pat | xargs | cut -d ' ' -f 2)
echo "New loxilb pid: $pid" >&2
}

function restart_loxilbs() {
if [[ $master == "llb1" ]]; then
mpat="cluster=172.17.0.3"
mcopts=" --cluster=172.17.0.3"
mself=" --self=0"
mka=" --ka=172.17.0.3:172.17.0.2"

bpat="cluster=172.17.0.2"
bcopts=" --cluster=172.17.0.2"
bself=" --self=1"
bka=" --ka=172.17.0.2:172.17.0.3"
else
mpat="cluster=172.17.0.2"
mcopts=" --cluster=172.17.0.2"
mself=" --self=1"
mka=" --ka=172.17.0.2:172.17.0.3"

bpat="cluster=172.17.0.3"
bcopts=" --cluster=172.17.0.3"
bself=" --self=0"
bka=" --ka=172.17.0.3:172.17.0.2"
fi
echo "Restarting $master"
pid=$(docker exec -i $master ps -aef | grep $mpat | xargs | cut -d ' ' -f 2)
echo "Killing $mpid" >&2
docker exec -dt $master kill -9 $pid
docker exec -dt $master ip link del llb0
docker exec -dt $master nohup /root/loxilb-io/loxilb/loxilb $mcopts $mself $mka > /dev/null &
pid=$(docker exec -i $master ps -aef | grep $mpat | xargs | cut -d ' ' -f 2)
echo "New loxilb pid: $pid" >&2

echo "Restarting $backup"
pid=$(docker exec -i $backup ps -aef | grep $bpat | xargs | cut -d ' ' -f 2)
echo "Killing $pid" >&2
docker exec -dt $backup kill -9 $pid
docker exec -dt $backup ip link del llb0
docker exec -dt $backup nohup /root/loxilb-io/loxilb/loxilb $bcopts $bself $bka > /dev/null &
pid=$(docker exec -i $backup ps -aef | grep $bpat | xargs | cut -d ' ' -f 2)
echo "New loxilb pid: $pid" >&2

}


Loading
Loading