|
@ -383,7 +383,7 @@ var fields = endpoint_tmp.split(':'); |
|
|
var mypath = process.cwd() |
|
|
var mypath = process.cwd() |
|
|
|
|
|
|
|
|
var swarmlab_config_template = ` |
|
|
var swarmlab_config_template = ` |
|
|
DEV_NAME=wg0 |
|
|
DEV_NAME=swarmlab0 |
|
|
INTERFACE_IP=${INTERFACE_IP}/16 |
|
|
INTERFACE_IP=${INTERFACE_IP}/16 |
|
|
INTERFACE_IProute=${INTERFACE_IP} |
|
|
INTERFACE_IProute=${INTERFACE_IP} |
|
|
ENDPOINT_IP=${endpoint} |
|
|
ENDPOINT_IP=${endpoint} |
|
@ -447,14 +447,14 @@ var swarmlab_swarm_template = ` |
|
|
|
|
|
|
|
|
var swarmlab_swarm_join_template = ` |
|
|
var swarmlab_swarm_join_template = ` |
|
|
function swarmlab_ifup() { |
|
|
function swarmlab_ifup() { |
|
|
swarmlab=$(/bin/bash ${mypath}/hybrid/connect/status.sh wg0 | jq .swarmlab) |
|
|
swarmlab=$(/bin/bash ${mypath}/hybrid/connect/status.sh swarmlab0 | jq .swarmlab) |
|
|
tempswarm="\${swarmlab%\\"}" |
|
|
tempswarm="\${swarmlab%\\"}" |
|
|
tempswarm="\${tempswarm#\\"}" |
|
|
tempswarm="\${tempswarm#\\"}" |
|
|
swarmlab=$tempswarm |
|
|
swarmlab=$tempswarm |
|
|
echo $swarmlab |
|
|
echo $swarmlab |
|
|
} |
|
|
} |
|
|
function hybrid_ifup() { |
|
|
function hybrid_ifup() { |
|
|
hybrid=$(/bin/bash ${mypath}/hybrid/connect/status.sh wg0 | jq .hybrid) |
|
|
hybrid=$(/bin/bash ${mypath}/hybrid/connect/status.sh swarmlab0 | jq .hybrid) |
|
|
tempswarm1="\${hybrid%\\"}" |
|
|
tempswarm1="\${hybrid%\\"}" |
|
|
tempswarm1="\${tempswarm1#\\"}" |
|
|
tempswarm1="\${tempswarm1#\\"}" |
|
|
hybrid=$tempswarm1 |
|
|
hybrid=$tempswarm1 |
|
@ -464,11 +464,11 @@ function hybrid_ifup() { |
|
|
hybrid=$(hybrid_ifup) |
|
|
hybrid=$(hybrid_ifup) |
|
|
if [ $hybrid == 'NotOnline' ]; then |
|
|
if [ $hybrid == 'NotOnline' ]; then |
|
|
/bin/bash ${mypath}/hybrid/connect/swarmlab-connect.sh |
|
|
/bin/bash ${mypath}/hybrid/connect/swarmlab-connect.sh |
|
|
echo "Start wg0 network interface" |
|
|
echo "Start swarmlab0 network interface" |
|
|
sleep 3 |
|
|
sleep 3 |
|
|
hybrid1=$(hybrid_ifup) |
|
|
hybrid1=$(hybrid_ifup) |
|
|
if [ $hybrid1 == 'NotOnline' ]; then |
|
|
if [ $hybrid1 == 'NotOnline' ]; then |
|
|
echo "Failed to start wg0 network interface" |
|
|
echo "Failed to start swarmlab0 network interface" |
|
|
else |
|
|
else |
|
|
echo "Swarmlab hybrid $hybrid" |
|
|
echo "Swarmlab hybrid $hybrid" |
|
|
fi |
|
|
fi |
|
@ -498,7 +498,7 @@ fi |
|
|
|
|
|
|
|
|
var swarmlab_swarm_leave_template = ` |
|
|
var swarmlab_swarm_leave_template = ` |
|
|
function hybrid_ifup() { |
|
|
function hybrid_ifup() { |
|
|
hybrid=$(/bin/bash ${mypath}/hybrid/connect/status.sh wg0 | jq .hybrid) |
|
|
hybrid=$(/bin/bash ${mypath}/hybrid/connect/status.sh swarmlab0 | jq .hybrid) |
|
|
tempswarm1="\${hybrid%\\"}" |
|
|
tempswarm1="\${hybrid%\\"}" |
|
|
tempswarm1="\${tempswarm1#\\"}" |
|
|
tempswarm1="\${tempswarm1#\\"}" |
|
|
hybrid=$tempswarm1 |
|
|
hybrid=$tempswarm1 |
|
@ -509,8 +509,8 @@ hybrid=$(hybrid_ifup) |
|
|
if [ $hybrid == 'NotOnline' ]; then |
|
|
if [ $hybrid == 'NotOnline' ]; then |
|
|
echo "Swarmlab hybrid $hybrid" |
|
|
echo "Swarmlab hybrid $hybrid" |
|
|
else |
|
|
else |
|
|
ip link set wg0 down |
|
|
ip link set swarmlab0 down |
|
|
ip link del wg0 |
|
|
ip link del swarmlab0 |
|
|
sleep 3 |
|
|
sleep 3 |
|
|
hybrid1=$(hybrid_ifup) |
|
|
hybrid1=$(hybrid_ifup) |
|
|
if [ $hybrid1 == 'NotOnline' ]; then |
|
|
if [ $hybrid1 == 'NotOnline' ]; then |
|
@ -565,7 +565,7 @@ function create_project(swarmlabname,project){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function myserverStatus(){ |
|
|
function myserverStatus(){ |
|
|
var serverStatus = '/bin/bash ./hybrid/connect/status.sh wg0'; |
|
|
var serverStatus = '/bin/bash ./hybrid/connect/status.sh swarmlab0'; |
|
|
exec(serverStatus, (err, stdout, stderr) => { |
|
|
exec(serverStatus, (err, stdout, stderr) => { |
|
|
if (err) { |
|
|
if (err) { |
|
|
console.error(`exec error: ${err}`); |
|
|
console.error(`exec error: ${err}`); |
|
|