...
 
Commits (2)
No preview for this file type
......@@ -22,8 +22,8 @@ BUFFSIZE = 4096
class Client(cmd.Cmd, object):
prompt = 'HP4$ '
intro = 'HP4 Controller Client'
prompt = 'HP4PLUS$ '
intro = 'HP4PLUS Controller Client'
def __init__(self, user='admin', ip='localhost', port=33333,
debug=False, histfile=".client-history", **kwargs):
......@@ -360,7 +360,7 @@ class ChainSliceManager(SliceManager):
self.debug_print(resp)
class Administrator(Client):
prompt = 'HP4# '
prompt = 'HP4PLUS# '
def __init__(self, **kwargs):
super(Administrator, self).__init__(**kwargs)
......
......@@ -116,10 +116,10 @@ class Controller(object):
json = parameters[7]
ports = parameters[8:]
else:
json = '/home/' + getpass.getuser() + '/hp4-src/hp4/hp4.json'
hjp_check = Path('hp4controller/hp4_json_path')
json = '/home/' + getpass.getuser() + '/hp4plus/hp4/hp4.json'
hjp_check = Path('centralcontroller/hp4_json_path')
if hjp_check.is_file():
with open('hp4controller/hp4_json_path', 'r') as hjp:
with open('centralcontroller/hp4_json_path', 'r') as hjp:
json = hjp.readline()[:-1]
ports = parameters[7:]
......
from hp4controller.p4command import P4Command
from hp4controller.virtualdevice.p4rule import P4Rule
from hp4controller.errors import AddRuleError, ModRuleError, DeleteRuleError
from hp4controller.errors import MCastError, SendCommandError
from centralcontroller.p4command import P4Command
from centralcontroller.virtualdevice.p4rule import P4Rule
from centralcontroller.errors import AddRuleError, ModRuleError, DeleteRuleError
from centralcontroller.errors import MCastError, SendCommandError
from sswitch_CLI import SimpleSwitchAPI
......
from hp4controller.virtualdevice.virtualdevice import VirtualDevice
from hp4controller.virtualdevice.p4rule import P4Rule
from hp4controller.virtualdevice.interpret import Interpretation
from hp4controller.p4command import P4Command
from hp4controller.errors import AddRuleError, LoadError, VirtnetError
from centralcontroller.virtualdevice.virtualdevice import VirtualDevice
from centralcontroller.virtualdevice.p4rule import P4Rule
from centralcontroller.virtualdevice.interpret import Interpretation
from centralcontroller.p4command import P4Command
from centralcontroller.errors import AddRuleError, LoadError, VirtnetError
import copy
......
import virtualdevice
from hp4controller.p4command import P4Command
from hp4controller.errors import InterpretError
from centralcontroller.p4command import P4Command
from centralcontroller.errors import InterpretError
from p4rule import P4Rule
import json
......@@ -365,7 +365,7 @@ class Interpretation():
class InterpretationGuide():
def __init__(self, ig_path):
# key method: ~/hp4-src/p4c-hp4/controller.py::DPMUServer::parse_json
# key method: ~/hp4plus/p4c-hp4/controller.py::DPMUServer::parse_json
self.templates_match = {} # {(native_table, native_action): P4Command}
self.templates_prims = {} # {(native_table, native_action): [P4Command]}
with open(ig_path) as json_data:
......
from hp4controller.p4command import P4Command
from centralcontroller.p4command import P4Command
from p4rule import P4Rule
from interpret import Interpretation, InterpretationGuide, Interpreter
from hp4controller.compilers import p4_hp4
from hp4controller.compilers.compiler import CodeRepresentation
from centralcontroller.compilers import p4_hp4
from centralcontroller.compilers.compiler import CodeRepresentation
import re
import code
......@@ -168,7 +168,7 @@ class VirtualDevice():
"""
def interpret(self, p4command):
# key method: ~/hp4-src/p4c-hp4/controller.py::DPMUServer::translate
# key method: ~/hp4plus/p4c-hp4/controller.py::DPMUServer::translate
p4commands = []
native_table = p4command.attributes['table']
......
#!/bin/bash
python -m central-controller.clients.client $@
python -m centralcontroller.clients.client $@
......@@ -5,12 +5,12 @@ then
echo "configuring controller for cloudlab execution"
printf "#!/bin/bash\n\n" > tests/ssh_vals.sh
printf "user=$1\n" >> tests/ssh_vals.sh
echo "/opt/hp4plus/hp4/hp4.json" > central-controller/hp4_json_path
echo "/opt/hp4plus/hp4/hp4.json" > centralcontroller/hp4_json_path
if [[ $# -gt 1 ]]
then
printf "nodes=( $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} )\n" >> tests/ssh_vals.sh
fi
else
echo "configuring controller for local (e.g., mininet) execution"
rm -f central-controller/hp4_json_path
rm -f centralcontroller/hp4_json_path
fi
#!/bin/bash
python -u -m central-controller.controller $@
python -u -m centralcontroller.controller $@
No preview for this file type
#define VIBRANT_FLAG 0x020101010101
header_type vibrant_t {
fields {
flag : 48;
hKeyIndex : 64; // choose 8
}
}
header_type ethernet_t {
fields {
dstAddr : 48;
srcAddr : 48;
etherType : 16;
}
}
header_type could_be_ipv4_t {
fields {
unused : 96;
srcAddr : 32;
dstAddr: 32;
}
}
header_type intrinsic_metadata_t {
fields {
ingress_global_timestamp : 48;
lf_field_list : 8;
mcast_grp : 16;
egress_rid : 16;
resubmit_flag : 8;
recirculate_flag : 8;
}
}
header vibrant_t vibrant;
header ethernet_t ethernet;
header could_be_ipv4_t could_be_ipv4;
metadata intrinsic_metadata_t intrinsic_metadata;
parser start {
extract(ethernet);
extract(could_be_ipv4);
return select(current(0, 48)) {
VIBRANT_FLAG : parse_vibrant;
default: ingress;
}
}
parser parse_vibrant {
extract(vibrant);
return ingress;
}
action vibrant_present() { }
action vibrant_not_present() { }
table check_vibrant {
reads {
vibrant : valid;
}
actions {
vibrant_present;
vibrant_not_present;
}
}
action a_decrypt(k1, k2, k3, k4) {
bit_xor(ethernet.dstAddr, ethernet.dstAddr, k1);
bit_xor(ethernet.srcAddr, ethernet.srcAddr, k2);
bit_xor(could_be_ipv4.dstAddr, could_be_ipv4.dstAddr, k3);
bit_xor(could_be_ipv4.srcAddr, could_be_ipv4.srcAddr, k4);
}
table decrypt {
reads {
vibrant.hKeyIndex : ternary;
}
actions {
a_decrypt;
}
}
action a_strip_vibrant() {
remove_header(vibrant);
}
table strip_vibrant {
actions {
a_strip_vibrant;
}
}
control ingress {
apply(check_vibrant) {
vibrant_present {
apply(decrypt);
apply(strip_vibrant);
}
}
}
#define VIBRANT_FLAG 0x020101010101
header_type vibrant_t {
fields {
flag : 48;
hKeyIndex : 64; // choose 8
}
}
header_type ethernet_t {
fields {
dstAddr : 48;
srcAddr : 48;
etherType : 16;
}
}
header_type could_be_ipv4_t {
fields {
unused : 96;
srcAddr : 32;
dstAddr: 32;
}
}
header_type intrinsic_metadata_t {
fields {
ingress_global_timestamp : 48;
lf_field_list : 8;
mcast_grp : 16;
egress_rid : 16;
resubmit_flag : 8;
recirculate_flag : 8;
}
}
header vibrant_t vibrant;
header ethernet_t ethernet;
header could_be_ipv4_t could_be_ipv4;
metadata intrinsic_metadata_t intrinsic_metadata;
parser start {
extract(ethernet);
extract(could_be_ipv4);
return select(current(0, 48)) {
VIBRANT_FLAG : parse_vibrant;
default: ingress;
}
}
parser parse_vibrant {
extract(vibrant);
return ingress;
}
action a_add_vibrant() {
add_header(vibrant);
modify_field(vibrant.flag, VIBRANT_FLAG);
modify_field_rng_uniform(vibrant.hKeyIndex, 0, 0xFFFFFFFFFFFFFFFF);
}
action _no_op() {
}
table check_egress {
reads {
standard_metadata.egress_spec : exact;
}
actions {
a_add_vibrant;
_no_op;
}
}
action a_encrypt(k1, k2, k3, k4) {
bit_xor(ethernet.dstAddr, ethernet.dstAddr, k1);
bit_xor(ethernet.srcAddr, ethernet.srcAddr, k2);
bit_xor(could_be_ipv4.dstAddr, could_be_ipv4.dstAddr, k3);
bit_xor(could_be_ipv4.srcAddr, could_be_ipv4.srcAddr, k4);
}
action a_mod_epoch_and_encrypt(new_epoch, k1, k2, k3, k4) {
modify_field(vibrant.hKeyIndex, new_epoch);
bit_xor(ethernet.dstAddr, ethernet.dstAddr, k1);
bit_xor(ethernet.srcAddr, ethernet.srcAddr, k2);
bit_xor(could_be_ipv4.dstAddr, could_be_ipv4.dstAddr, k3);
bit_xor(could_be_ipv4.srcAddr, could_be_ipv4.srcAddr, k4);
}
table encrypt {
reads {
vibrant.hKeyIndex : ternary;
}
actions {
a_encrypt;
a_mod_epoch_and_encrypt;
}
}
control ingress {
apply(check_egress) {
a_add_vibrant {
apply(encrypt);
}
}
}
#define VIBRANT_FLAG 0x020101010101
header_type vibrant_t {
fields {
flag : 48;
hKeyIndex : 64; // choose 8
}
}
header_type ethernet_t {
fields {
dstAddr : 48;
srcAddr : 48;
etherType : 16;
}
}
header_type ipv4_t {
fields {
version : 4;
ihl : 4;
diffserv : 8;
totalLen : 16;
identification : 16;
flags : 3;
fragOffset : 13;
ttl : 8;
protocol : 8;
hdrChecksum : 16;
srcAddr : 32;
dstAddr: 32;
}
}
// This allows us to decrypt and switch/route using temp fields so
// no need to re-encrypt before transmission, as we would have to
// if we decrypted to parsed representation fields:
header_type meta_t {
fields {
eth_dstAddr : 48;
eth_srcAddr : 48;
ipv4_dstAddr : 32;
ipv4_srcAddr : 32;
}
}
header_type intrinsic_metadata_t {
fields {
ingress_global_timestamp : 48;
lf_field_list : 8;
mcast_grp : 16;
egress_rid : 16;
resubmit_flag : 8;
recirculate_flag : 8;
}
}
header vibrant_t vibrant;
header ethernet_t ethernet;
header ipv4_t ipv4;
metadata meta_t meta;
metadata intrinsic_metadata_t intrinsic_metadata;
parser start {
extract(ethernet);
return select(ethernet.etherType) {
0x0800 : parse_ipv4;
default: ingress;
}
}
parser parse_ipv4 {
extract(ipv4);
return select(current(0, 48)) {
VIBRANT_FLAG : parse_vibrant;
default: ingress;
}
}
parser parse_vibrant {
extract(vibrant);
return ingress;
}
action vibrant_present() { }
action vibrant_not_present() { }
table check_vibrant {
reads {
vibrant : valid;
}
actions {
vibrant_present;
vibrant_not_present;
}
}
action a_decrypt(k1, k2, k3, k4) {
bit_xor(meta.eth_dstAddr, ethernet.dstAddr, k1);
bit_xor(meta.eth_srcAddr, ethernet.srcAddr, k2);
bit_xor(meta.ipv4_dstAddr, ipv4.dstAddr, k3);
bit_xor(meta.ipv4_srcAddr, ipv4.srcAddr, k4);
}
table decrypt {
reads {
vibrant.hKeyIndex : ternary;
}
actions {
a_decrypt;
}
}
action local(port) {
modify_field(standard_metadata.egress_spec, port);
}
action not_local(port) {
modify_field(standard_metadata.egress_spec, port);
}
action broadcast(mcast) {
modify_field(intrinsic_metadata.mcast_grp, mcast);
}
action _drop() {
drop();
}
table dmac {
reads {
meta.eth_dstAddr : exact;
}
actions {
local;
not_local;
broadcast;
_drop;
}
}
action a_strip_vibrant() {
modify_field(ethernet.dstAddr, meta.eth_dstAddr);
modify_field(ethernet.srcAddr, meta.eth_srcAddr);
modify_field(ipv4.dstAddr, meta.ipv4_dstAddr);
modify_field(ipv4.srcAddr, meta.ipv4_srcAddr);
remove_header(vibrant);
}
table strip_vibrant {
actions {
a_strip_vibrant;
}
}
table dmac2 {
reads {
ethernet.dstAddr : exact;
}
actions {
local;
not_local;
broadcast;
_drop;
}
}
action a_add_vibrant() {
add_header(vibrant);
modify_field(vibrant.flag, VIBRANT_FLAG);
modify_field_rng_uniform(vibrant.hKeyIndex, 0, 0xFFFFFFFFFFFFFFFF);
}
action _no_op() { }
table add_vibrant {
reads {
ipv4 : valid;
}
actions {
a_add_vibrant;
_no_op;
}
}
action a_encrypt(k1, k2, k3, k4) {
bit_xor(ethernet.dstAddr, ethernet.dstAddr, k1);
bit_xor(ethernet.srcAddr, ethernet.srcAddr, k2);
bit_xor(ipv4.dstAddr, ipv4.dstAddr, k3);
bit_xor(ipv4.srcAddr, ipv4.srcAddr, k4);
}
action a_mod_epoch_and_encrypt(new_epoch, k1, k2, k3, k4) {
modify_field(vibrant.hKeyIndex, new_epoch);
bit_xor(ethernet.dstAddr, ethernet.dstAddr, k1);
bit_xor(ethernet.srcAddr, ethernet.srcAddr, k2);
bit_xor(ipv4.dstAddr, ipv4.dstAddr, k3);
bit_xor(ipv4.srcAddr, ipv4.srcAddr, k4);
}
table encrypt {
reads {
vibrant.hKeyIndex : ternary;
}
actions {
a_encrypt;
a_mod_epoch_and_encrypt;
}
}
control ingress {
apply(check_vibrant) {
vibrant_present {
apply(decrypt);
apply(dmac) {
local {
apply(strip_vibrant);
}
}
}
vibrant_not_present {
apply(dmac2) {
not_local {
apply(add_vibrant) {
a_add_vibrant {
apply(encrypt);
}
}
}
}
}
}
}
/*
table filter_egress {
actions {
_drop;
}
}
control egress {
if(standard_metadata.egress_port == standard_metadata.ingress_port) {
apply(filter_egress);
}
}
*/
No preview for this file type
#!/bin/bash
macs=( "00:04:00:00:00:01"
"00:04:00:00:00:02"
"00:04:00:00:00:03"
"00:04:00:00:00:04"
"00:04:00:00:00:05"
"00:04:00:00:00:06")
hnames=( "node-5"
"node-6"
"node-7"
"node-8"
"node-9"
"node-10" )
ips=( "10.10.5.1/16"
"10.10.6.1/16"
"10.10.7.1/16"
"10.10.8.1/16"
"10.10.9.1/16"
"10.10.10.1/16" )
hname="$(hostname | tr "." " " | awk '{print $1}')"
for i in `seq 0 5`; do
if [ "$hname" == ${hnames[$i]} ]
then
ip=${ips[$i]}
mac=${macs[$i]}
break
fi
done
while read x
do
ipaddr="$(echo $x | awk '{print $4}')"
if [ "$ipaddr" == "$ip" ]
then
iface="$(echo $x | awk '{print $2}')"
sudo ifconfig $iface down
sudo ifconfig $iface hw ether $mac
sudo ifconfig $iface up
echo "updated MAC for $ipaddr to $mac"
break
fi
done <<< "$(ip -o -4 addr show)"
#!/bin/bash
#
# iface_setup.sh
#
# Setup a set of interfaces to be used with a model
#
# Usage:
# iface_setup iface_1 [ iface_2 ... ]
#
# The script performs the necessary setup on the interfaces to tbe used with
# a switch model. This typical setup includes the following:
# -- No protocols should be setup on the interface. This means not assigning
# any protocol addresses (neither IPv4, nor IPv6) to the interface.
# -- This will prevent the standard Linux stack from forwarding
# packets between these interfaces (especially if you can't globally
# disable IP routing)
# -- In case of IPv6, this will also prevent Linux stack from
# sending ICMPv6 router advertizement messages periodically
# -- Disable all HW acceleration on the interfaces
# -- This is critical, otherwise you will see strange behavior that
# depends on protocols, packet size and timing. For example, in
# case of TCP, HW acceleration might result in the model receiving
# one huge (e.g. 10K bytes long) TCP packet instead of 10 1K packets
# The problem is that the model will not be able to send such a long
# packet out.
#
# Uncomment for debugging
#set -x
MTU=1600
function print_help() {
cat <<EOF
Usage:
sudo iface_setup.sh [-h] [-m mtu] iface_0 [ iface_1 ... ]
Options:
-h, --help Print this message
-m mtu, --mtu mtu Set the specified MTU on all specified interfaces
EOF
}
function help_mtu() {
cat <<EOF
ERROR: Failed to set MTU to $MTU on interface $iface
Different interfaces support different maximum MTU settings.
Find out what's appropriate for interface $iface and use
-m <mtu> parameter when running this script
EOF
}
function help_root() {
cat <<EOF
ERROR: This script is supposed to be run as root, e.g. using sudo
EOF
}
function interface_configure() {
iface=$1; shift
ip link set dev $iface up
if [ $? -ne 0 ]; then
return 1
fi
ip address flush dev $iface
sysctl net.ipv6.conf.$iface.disable_ipv6=1 &> /dev/null
ip link set dev $iface up mtu $MTU
if [ $? -ne 0 ]; then
help_mtu
return 1
fi
TOE_OPTIONS="rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash"
for TOE_OPTION in $TOE_OPTIONS; do
/sbin/ethtool --offload $iface "$TOE_OPTION" off &> /dev/null
done
return 0
}
#
# Main
#
# Parse options
opts=`getopt -o m:h -l help -lmtu: -- "$@"`
if [ $? != 0 ]; then
# Option parsing failed, probably due to unknown options
print_help
exit 1
fi
eval set -- "$opts"
while true; do
case "$1" in
-h|--help) print_help; exit 0;;
-m|--mtu) MTU=$2; shift 2;;
--) shift; break;;
esac
done
if [ $# -lt 1 ]; then
# No interfaces has been specified
print_help
exit 1
fi
# Check that we are running as root
if [ $UID -ne 0 ]; then
help_root
exit 1
fi
for iface in "$@"; do
interface_configure $iface
if [ $? -ne 0 ]; then
exit 1
fi
echo "Interface $iface configured"
done
#!/bin/bash
controllerpid="$(pgrep -f "hp4controller.controller")"
if [ -n "$controllerpid" ]
then
sudo kill -SIGINT $controllerpid
else
echo "could not find pid"
fi
#!/bin/bash
hp4pid="$(pgrep -f "/simple_switch/simple_switch")"
if [ -n "$hp4pid" ]
then
sudo kill $hp4pid
else
echo "could not find pid"
fi
#!/bin/bash
cd /opt/hp4-src/hp4
./run_cli.sh 9090 < hp4commands.txt
#!/bin/bash
sudo /opt/rs/kill_hp4.sh
sudo /opt/rs/start.sh
#!/bin/bash
iface1=""
iface2=""
iface3=""
iface4=""
#command="sudo /opt/bmv2/targets/simple_switch/simple_switch "
while read x
do
ipaddr="$(echo $x | awk '{print $4}')"
if [ "$ipaddr" == "10.10.1.2/16" ]
then
iface1="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.2.2/16" ]
then
iface2="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.3.2/16" ]
then
iface3="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.4.2/16" ]
then
iface4="$(echo $x | awk '{print $2}')"
fi
done <<< "$(ip -o -4 addr show)"
if [ -n "$iface1" ]
then
sudo echo $iface1 > iface1
fi
if [ -n "$iface2" ]
then
sudo echo $iface2 > iface2
fi
if [ -n "$iface3" ]
then
sudo echo $iface3 > iface3
fi
if [ -n "$iface4" ]
then
sudo echo $iface4 > iface4
fi
#!/bin/bash
iface0=""
iface1=""
iface2=""
#command="sudo /opt/bmv2/targets/simple_switch/simple_switch "
while read x
do
ipaddr="$(echo $x | awk '{print $4}')"
if [ "$ipaddr" == "10.10.1.1/16" ]
then
iface0="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.5.2/16" ]
then
iface1="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.6.2/16" ]
then
iface2="$(echo $x | awk '{print $2}')"
fi
done <<< "$(ip -o -4 addr show)"
if [ -n "$iface0" ]
then
sudo echo $iface0 > iface0
fi
if [ -n "$iface1" ]
then
sudo echo $iface1 > iface1
fi
if [ -n "$iface2" ]
then
sudo echo $iface2 > iface2
fi
#!/bin/bash
iface0=""
iface1=""
iface2=""
#command="sudo /opt/bmv2/targets/simple_switch/simple_switch "
while read x
do
ipaddr="$(echo $x | awk '{print $4}')"
if [ "$ipaddr" == "10.10.2.1/16" ]
then
iface0="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.7.2/16" ]
then
iface1="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.8.2/16" ]
then
iface2="$(echo $x | awk '{print $2}')"
fi
done <<< "$(ip -o -4 addr show)"
if [ -n "$iface0" ]
then
sudo echo $iface0 > iface0
fi
if [ -n "$iface1" ]
then
sudo echo $iface1 > iface1
fi
if [ -n "$iface2" ]
then
sudo echo $iface2 > iface2
fi
#!/bin/bash
iface0=""
iface1=""
#command="sudo /opt/bmv2/targets/simple_switch/simple_switch "
while read x
do
ipaddr="$(echo $x | awk '{print $4}')"
if [ "$ipaddr" == "10.10.3.1/16" ]
then
iface0="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.9.2/16" ]
then
iface1="$(echo $x | awk '{print $2}')"
fi
done <<< "$(ip -o -4 addr show)"
if [ -n "$iface0" ]
then
sudo echo $iface0 > iface0
fi
if [ -n "$iface1" ]
then
sudo echo $iface1 > iface1
fi
#!/bin/bash
iface0=""
iface1=""
#command="sudo /opt/bmv2/targets/simple_switch/simple_switch "
while read x
do
ipaddr="$(echo $x | awk '{print $4}')"
if [ "$ipaddr" == "10.10.4.1/16" ]
then
iface0="$(echo $x | awk '{print $2}')"
elif [ "$ipaddr" == "10.10.10.2/16" ]
then
iface1="$(echo $x | awk '{print $2}')"
fi
done <<< "$(ip -o -4 addr show)"
if [ -n "$iface0" ]
then
sudo echo $iface0 > iface0
fi
if [ -n "$iface1" ]
then
sudo echo $iface1 > iface1
fi
#!/bin/bash
cd /opt/hp4-src
sudo git reset --hard
sudo git pull
cd /opt/hp4-ctrl
sudo git reset --hard
sudo git pull
hname="$(hostname | tr "." " " | awk '{print $1}')"
if [ "$hname" == "node-0" ] ||
[ "$hname" == "node-1" ] ||
[ "$hname" == "node-2" ] ||
[ "$hname" == "node-3" ] ||
[ "$hname" == "node-4" ]
then
/opt/hp4-ctrl/vibrant-eval/remote-scripts/start_hp4.sh
elif [ "$hname" == "node-5" ] ||
[ "$hname" == "node-6" ] ||
[ "$hname" == "node-7" ] ||
[ "$hname" == "node-8" ] ||
[ "$hname" == "node-9" ] ||
[ "$hname" == "node-10" ]
then
/opt/hp4-ctrl/vibrant-eval/remote-scripts/h_config.sh
fi
#!/bin/bash
cd /opt
script_path=/opt/hp4-ctrl/vibrant-eval/remote-scripts
# get and configure interfaces
hname="$(hostname | tr "." " " | awk '{print $1}')"
if [ "$hname" == "node-0" ]
then
sudo $script_path/s0_get_ifaces.sh
elif [ "$hname" == "node-1" ]
then
sudo $script_path/s1_get_ifaces.sh
elif [ "$hname" == "node-2" ]
then
sudo $script_path/s2_get_ifaces.sh
elif [ "$hname" == "node-3" ]
then
sudo $script_path/s3_get_ifaces.sh
elif [ "$hname" == "node-4" ]
then
sudo $script_path/s4_get_ifaces.sh
fi
# start simple switch with hp4
ifacescommand=( sudo $script_path/iface_setup.sh )
hp4command=( sudo nohup /opt/bmv2/targets/simple_switch/simple_switch )
ifaces=(iface0 iface1 iface2 iface3 iface4)
for i in `seq 0 4`; do
if [ -s ${ifaces[$i]} ]
then
ifacescommand+=( "$(cat ${ifaces[$i]})" )
hp4command+=( -i "$i@$(cat ${ifaces[$i]})" )
fi
done
echo "${ifacescommand[@]}"
"${ifacescommand[@]}"
hp4command+=( /opt/hp4-src/hp4/hp4.json )
echo "${hp4command[@]}"
"${hp4command[@]}" 2> /dev/null &
sleep 5
sudo sh -c "nohup ${script_path}/prep_hp4.sh > prep_hp4.out 2> /dev/null &"
#!/bin/bash
cd /home/ubuntu/hp4-src/hp4
gnome-terminal --window-with-profile=mininet --geometry=80x20+0+0 --command="bash -c \"tty > /tmp/pts_mininet; exec bash\"" &
sleep 0.2
cd /home/ubuntu/hp4-ctrl
gnome-terminal --window-with-profile=controller --geometry=90x30+800+0 --command="bash -c \"tty > /tmp/pts_controller; exec bash\"" &
sleep 0.2
gnome-terminal --window-with-profile=admin --geometry=80x20+0+415 --command="bash -c \"tty > /tmp/pts_admin; exec bash\"" &
sleep 0.2
cd /home/ubuntu/hp4-src/hp4
gnome-terminal --window-with-profile=bmv2_CLI --geometry=80x20+0+805 --command="bash -c \"tty > /tmp/pts_bmv2_cli; exec bash\"" &
sleep 0.2
cd /home/ubuntu/hp4-ctrl
gnome-terminal --geometry=90x30+800+600 --command="bash -c \"tty > /tmp/pts_slice_manager; exec bash\"" &
sleep 0.2
cd /home/ubuntu/hp4-ctrl/tests
gnome-terminal --window-with-profile=tests --geometry=80x20+1200+400 &
sleep 0.2
cd /home/ubuntu/hp4-ctrl
gnome-terminal --geometry=90x30+1000+800 --command="bash -c \"tty > /tmp/pts_slice_manager_saturn; exec bash\"" &
#!/bin/bash
pids=" $(pidof gnome-terminal) "
if [ "$pids" = " " ]; then
echo "There is no program named '$0' opened at the moment."
exit 1
fi
wmctrl -lp | while read identity desktop_number PID window_title; do
if [ "${pids/ $PID }" != "$pids" ]; then
wmctrl -ic $identity
fi
done
#!/bin/bash
pids=" $(pidof gnome-terminal) "
if [ "$pids" = " " ]; then
echo "There is no program named '$0' opened at the moment."
exit 1
fi
wmctrl -lp | while read identity desktop_number PID window_title; do
if [ "${pids/ $PID }" != "$pids" ]; then
wmctrl -ia $identity
fi
done