-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from nik-netlox/main
SCTP MH CICD
- Loading branch information
Showing
9 changed files
with
350 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: SCTP-MH-LB-Sanity-CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
inputs: | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
tags: | ||
description: 'SCTP MH LB Sanity' | ||
|
||
jobs: | ||
build: | ||
name: sctpmh-lb-sanity | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-python@v2 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.18.0' | ||
- run: sudo apt-get update | ||
- run: sudo apt-get -y install clang-10 llvm libelf-dev gcc-multilib libpcap-dev linux-tools-$(uname -r) elfutils dwarves git libbsd-dev bridge-utils unzip build-essential bison flex iperf iproute2 nodejs socat ethtool curl | ||
- run: | | ||
git clone --recurse-submodules https://github.com/loxilb-io/iproute2 iproute2-main | ||
cd iproute2-main/libbpf/src/ | ||
sudo make install | ||
mkdir build | ||
DESTDIR=build OBJDIR=build make install | ||
cd - | ||
cd iproute2-main/ | ||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:`pwd`/libbpf/src/ && LIBBPF_FORCE=on LIBBPF_DIR=`pwd`/libbpf/src/build ./configure && make && sudo cp -f tc/tc /usr/local/sbin/ntc && cd - | ||
- run: loxilb-ebpf/utils/mkllb_bpffs.sh | ||
- run: sudo -E env "PATH=$PATH" make | ||
- run: sudo -E env "PATH=$PATH" make test | ||
- run: docker pull ghcr.io/loxilb-io/loxilb:latest | ||
- run: docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest | ||
- run: pwd && ls && sudo -E env "PATH=$PATH" make docker-cp | ||
- run: docker exec -dit loxilb mkllb_bpffs | ||
- run: id=`docker ps -f name=loxilb | cut -d " " -f 1 | grep -iv "CONTAINER"` && docker commit $id ghcr.io/loxilb-io/loxilb:latest | ||
- run: docker stop loxilb && docker rm loxilb | ||
- run: | | ||
cd cicd/sctpmh/ | ||
./config.sh | ||
./validation.sh | ||
./rmconfig.sh | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/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]" >&2 | ||
exit 1; | ||
fi | ||
sleep 5 | ||
fi | ||
done | ||
} | ||
|
||
function checkSync() { | ||
count=1 | ||
sync=0 | ||
while [[ $count -le 5 ]] ; do | ||
echo -e "\nStatus at MASTER:$master\n" >&2 | ||
$dexec $master loxicmd get ct | grep est >&2 | ||
|
||
echo -e "\nStatus at BACKUP:$backup\n" >&2 | ||
$dexec $backup loxicmd get ct | grep est >&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 0 | ||
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.