forked from loxilb-io/loxilb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
loxilb-iogh-219 ipinip l3dsr cicd scripts added
- Loading branch information
1 parent
760a9af
commit 0cd2f4e
Showing
3 changed files
with
156 additions
and
0 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,75 @@ | ||
#!/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 | ||
|
||
#IPinIP Config | ||
$hexec llb1 ip link add name ipip0 type ipip local 31.31.31.254 remote 31.31.31.1 | ||
$hexec llb1 ip link set dev ipip0 up | ||
$hexec llb1 ip addr add 45.45.45.254/24 dev ipip0 | ||
$hexec llb1 ip route add 56.56.56.0/24 via 45.45.45.1 | ||
|
||
$hexec llb1 ip link add name ipip1 type ipip local 32.32.32.254 remote 32.32.32.1 | ||
$hexec llb1 ip link set dev ipip1 up | ||
$hexec llb1 ip addr add 46.46.46.254/24 dev ipip1 | ||
$hexec llb1 ip route add 57.57.57.0/24 via 46.46.46.1 | ||
|
||
$hexec llb1 ip link add name ipip2 type ipip local 33.33.33.254 remote 33.33.33.1 | ||
$hexec llb1 ip link set dev ipip2 up | ||
$hexec llb1 ip addr add 47.47.47.254/24 dev ipip2 | ||
$hexec llb1 ip route add 58.58.58.0/24 via 47.47.47.1 | ||
|
||
$hexec l3ep1 ip link add name ipip0 type ipip local 31.31.31.1 remote 31.31.31.254 | ||
$hexec l3ep1 ip link set dev ipip0 up | ||
$hexec l3ep1 ip addr add 45.45.45.1/24 dev ipip0 | ||
#$hexec l3ep1 ip route add 10.10.10.0/24 dev ipip0 | ||
$hexec l3ep1 ip addr add 56.56.56.1/32 dev lo | ||
$hexec l3ep1 ip addr add 20.20.20.1/32 dev lo | ||
|
||
$hexec l3ep2 ip link add name ipip0 type ipip local 32.32.32.1 remote 32.32.32.254 | ||
$hexec l3ep2 ip link set dev ipip0 up | ||
$hexec l3ep2 ip addr add 46.46.46.1/24 dev ipip0 | ||
#$hexec l3ep2 ip route add 10.10.10.0/24 dev ipip0 | ||
$hexec l3ep2 ip addr add 57.57.57.1/32 dev lo | ||
$hexec l3ep2 ip addr add 20.20.20.1/32 dev lo | ||
|
||
$hexec l3ep3 ip link add name ipip0 type ipip local 33.33.33.1 remote 33.33.33.254 | ||
$hexec l3ep3 ip link set dev ipip0 up | ||
$hexec l3ep3 ip addr add 47.47.47.1/24 dev ipip0 | ||
#$hexec l3ep3 ip route add 10.10.10.0/24 dev ipip0 | ||
$hexec l3ep3 ip addr add 58.58.58.1/32 dev lo | ||
$hexec l3ep3 ip addr add 20.20.20.1/32 dev lo | ||
|
||
sleep 5 | ||
create_lb_rule llb1 20.20.20.1 --select=hash --tcp=8080:8080 --endpoints=56.56.56.1:1,57.57.57.1:1,58.58.58.1:1 --mode=dsr |
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,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 "#########################################" |
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,63 @@ | ||
#!/bin/bash | ||
source ../common.sh | ||
echo SCENARIO-tcplbl3dsr | ||
$hexec l3ep1 socat -v -T0.05 tcp-l:8080,reuseaddr,fork system:"echo 'server1'; cat" >/dev/null 2>&1 & | ||
$hexec l3ep2 socat -v -T0.05 tcp-l:8080,reuseaddr,fork system:"echo 'server2'; cat" >/dev/null 2>&1 & | ||
$hexec l3ep3 socat -v -T0.05 tcp-l:8080,reuseaddr,fork system:"echo 'server3'; cat" >/dev/null 2>&1 & | ||
|
||
sleep 5 | ||
code=0 | ||
servArr=( "server1" "server2" "server3" ) | ||
ep=( "56.56.56.1" "57.57.57.1" "58.58.58.1" ) | ||
j=0 | ||
waitCount=0 | ||
while [ $j -le 2 ] | ||
do | ||
#res=$($hexec l3h1 curl --max-time 10 -s ${ep[j]}:8080) | ||
res=$($hexec l3h1 socat -T60 - TCP:${ep[j]}:8080,reuseaddr) | ||
#echo $res | ||
if [[ $res == "${servArr[j]}" ]] | ||
then | ||
echo "$res UP" | ||
j=$(( $j + 1 )) | ||
else | ||
echo "Waiting for ${servArr[j]}(${ep[j]})" | ||
waitCount=$(( $waitCount + 1 )) | ||
if [[ $waitCount == 10 ]]; | ||
then | ||
echo "All Servers are not UP" | ||
echo SCENARIO-tcplbl3dsr [FAILED] | ||
exit 1 | ||
fi | ||
fi | ||
sleep 1 | ||
done | ||
|
||
exp="" | ||
for i in {1..4} | ||
do | ||
for j in {0..2} | ||
do | ||
#res=$($hexec l3h1 curl --local-port 55001 --max-time 10 -s 20.20.20.1:2020) | ||
res=$($hexec l3h1 socat -T60 - TCP:20.20.20.1:8080,sp=55001,reuseaddr) | ||
echo $res | ||
if [[ $exp == "" ]] | ||
then | ||
exp=$res | ||
fi | ||
if [[ $exp != $res ]] | ||
then | ||
code=1 | ||
fi | ||
sleep 1 | ||
done | ||
done | ||
if [[ $code == 0 ]] | ||
then | ||
echo SCENARIO-tcplbl3dsr [OK] | ||
else | ||
echo SCENARIO-tcplbl3dsr [FAILED] | ||
fi | ||
sudo pkill -9 socat 2>&1 > /dev/null | ||
exit $code | ||
|