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-718 Added cicd for ipmasquerade #724

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions .github/workflows/advanced-lb-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ jobs:
./validation.sh
./rmconfig.sh
cd -
- run: |
cd cicd/ipmasquerade/
./config.sh
./validation.sh
./rmconfig.sh
cd -
#- run: |
# cd cicd/httpsproxy/
# ./config.sh
Expand Down
38 changes: 38 additions & 0 deletions cicd/ipmasquerade/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/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

sleep 5

#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

$dexec llb1 loxicmd create firewall --firewallRule="portName:ellb1l3ep1" --snat=10.10.10.254
18 changes: 18 additions & 0 deletions cicd/ipmasquerade/rmconfig.sh
Original file line number Diff line number Diff line change
@@ -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 "#########################################"
39 changes: 39 additions & 0 deletions cicd/ipmasquerade/validation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
source ../common.sh
echo SCENARIO-masquerade
$hexec l3h1 node ../common/tcp_server.js server1 &

sleep 15
code=0
servIP=( "10.10.10.1" )
servArr=( "server1" )
clientArr=( "l3ep1" "l3ep2" "l3ep3" )
j=0
waitCount=0

echo "Testing Service IP: ${servIP[0]}"
lcode=0
for i in {0..2}
do
for j in {0..2}
do
res=$($hexec ${clientArr[i]} curl --max-time 10 -s ${servIP[0]}:8080)
echo $res
if [[ $res != "${servArr[0]}" ]]
then
lcode=1
fi
sleep 1
done
done

if [[ $lcode == 0 ]]
then
echo SCENARIO-masquerade with ${servIP[0]} [OK]
else
echo SCENARIO-masquerade with ${servIP[0]} [FAILED]
code=1
fi

sudo killall -9 node 2>&1 > /dev/null
exit $code
Loading