Merge pull request #399 from TeruU/develop062001
The unit tests of SwitchStorageImpl
diff --git a/README.md b/README.md
index b10188e..8c0cc0a 100644
--- a/README.md
+++ b/README.md
@@ -31,12 +31,14 @@
1. Start zookeeper
- $ cd (ZOOKEEPER-INSTALL-DIR)/bin
-
- $ ./zkServer.sh start
+ $ cd (ONOS-INSTALL-DIR)/
+
+ $ ./start-zk.sh
2. Start cassandra
+ $ cd (ONOS-INSTALL-DIR)/
+
$ ./start-cassandra.sh start
1. Confirm cassandra is running
@@ -58,8 +60,8 @@
1. Start Zookeeper
- $ cd (ZOOKEEPER-INSTALL-DIR)/bin
-
+ $ cd (ONOS-INSTALL-DIR)/
+
$ ./zkServer.sh start
2. Start ONOS and Cassandra embedded
diff --git a/onos-embedded.sh b/onos-embedded.sh
index b5cfed6..fe0db44 100755
--- a/onos-embedded.sh
+++ b/onos-embedded.sh
@@ -1,9 +1,9 @@
#!/bin/sh
# Set paths
-FL_HOME=`dirname $0`
-FL_JAR="${FL_HOME}/target/floodlight.jar"
-FL_LOGBACK="${FL_HOME}/logback.xml"
+ONOS_HOME=`dirname $0`
+ONOS_JAR="${ONOS_HOME}/target/floodlight.jar"
+ONOS_LOGBACK="${ONOS_HOME}/logback.xml"
TITAN_CONFIG="/tmp/cassandra.titan"
CASSANDRA_CONFIG="/home/`whoami`/apache-cassandra-1.1.4/conf/cassandra.yaml"
@@ -17,15 +17,15 @@
#JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
# Set classpath to include titan libs
-#CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
-CLASSPATH="${FL_HOME}/lib/*.jar:${FL_HOME}/lib/titan/*.jar"
+#CLASSPATH=`echo ${ONOS_HOME}/lib/*.jar ${ONOS_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
+CLASSPATH="${ONOS_HOME}/lib/*.jar:${ONOS_HOME}/lib/titan/*.jar"
CASSANDRA_OPTS="-Dcom.sun.management.jmxremote.port=7199"
CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
# Create a logback file if required
-cat <<EOF_LOGBACK >${FL_LOGBACK}
+cat <<EOF_LOGBACK >${ONOS_LOGBACK}
<configuration scan="true" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
@@ -64,5 +64,5 @@
# Run floodlight
echo "Starting ONOS controller ..."
echo
-#java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${FL_JAR} -cf ./onos.properties
-java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -jar ${FL_JAR}
+#java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${ONOS_JAR} -cf ./onos.properties
+java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -jar ${ONOS_JAR}
diff --git a/scripts/runiperf.sh b/scripts/runiperf.sh
index 4e26bd2..6233986 100755
--- a/scripts/runiperf.sh
+++ b/scripts/runiperf.sh
@@ -2,11 +2,17 @@
import sys
import os
+ONOSDIR=os.getenv("HOME") + "/ONOS"
+IPERF=ONOSDIR + "/scripts/iperf"
+IPERFLOGDIR=ONOSDIR + "/web/log"
+
# Usage: flowid src_dpid dst_dpid params
def usage():
print "%s flowid src_dpid dst_dpid hw:svr|sw:svr|hw:client|sw:client <proto>/<duration>/<interval>/<samples>" % sys.argv[0]
sys.exit()
+
+
def main():
flowid = sys.argv[1]
src_dpid = sys.argv[2]
@@ -24,9 +30,16 @@
src_hostid=int(src_dpid.split(':')[-1], 16)
dst_hostid=int(dst_dpid.split(':')[-1], 16)
+ if (testbed == "SW"):
+ MRUN=ONOSDIR + "/test-network/mininet/mrun"
+ HOST_FMT="host%d.%d"
+ else:
+ MRUN=ONOSDIR + "$HOME/mininet/util/m"
+ HOST_FMT="g%sh%02d"
+
if (proto == "tcp"):
- if (testbed == "SW"):
- cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -t%s -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperf_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_hostid, duration, interval, samples, flowid, dst_nwid, dst_hostid)
+ mininet_host = HOST_FMT % (dst_nwid, dst_hostid)
+ cmd="%s %s \'%s -t%s -i%s -k%s -yJ -o %s/iperf_%s.out -c 192.168.%d.%d 2>&1 &\' &" % (MRUN, mininet_host, IPERF, src_hostid, duration, interval, samples, IPERFLOGDIR, flowid, dst_nwid, dst_hostid)
killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperf_%s.out\"' % (flowid)
print killcmd
print cmd
@@ -34,21 +47,18 @@
os.popen(cmd)
else:
if (server == 'S'):
- if (testbed == "SW"):
- cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -us -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfsvr_%s.out 2>&1 &' &" % (dst_hostid, interval, samples, flowid)
- else:
- cmd="~/mininet/util/m g%sh%02d '/home/ubuntu/ONOS/scripts/iperf -us -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfsvr_%s.out 2>&1 &' &" % (dst_nwid, dst_hostid, interval, samples, flowid)
+ mininet_host = HOST_FMT % (dst_nwid, dst_hostid)
+ cmd="%s %s \'%s -us -i%s -k%s -yJ -o %s/iperfsvr_%s.out 2>&1 &\' &" % (MRUN, mininet_host, IPERF, interval, samples, IPERFLOGDIR, flowid)
killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperfsvr_%s.out\"' % (flowid)
print killcmd
print cmd
else:
- if (testbed == "SW"):
- cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -u -t%s -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfclient_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_hostid, duration, interval, samples, flowid, dst_nwid, dst_hostid)
- else:
- cmd="~/mininet/util/m g%sh%02d '/home/ubuntu/ONOS/scripts/iperf -u -t%s -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfclient_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_nwid, src_hostid, duration, interval, samples, flowid, dst_nwid, dst_hostid )
+ mininet_host = HOST_FMT % (src_nwid, src_hostid)
+ cmd="%s %s \'%s -u -t%s -i%s -k%s -yJ -o %s/iperfclient_%s.out -c 192.168.%d.%d 2>&1 &\' &" % (MRUN, mininet_host, IPERF, duration, interval, samples, IPERFLOGDIR, flowid, dst_nwid, dst_hostid)
killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperfclient_%s.out\"' % (flowid)
print killcmd
print cmd
+
os.popen(killcmd)
os.popen(cmd)
diff --git a/start-cassandra.sh b/start-cassandra.sh
index 95cb1db..ffc21e4 100755
--- a/start-cassandra.sh
+++ b/start-cassandra.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# Set paths
-FL_HOME=`dirname $0`
+ONOS_HOME=`dirname $0`
CASSANDRA_DIR=${HOME}/apache-cassandra-1.2.4
LOGDIR=${HOME}/ONOS/onos-logs
CASSANDRA_LOG=$LOGDIR/cassandara.`hostname`.log
@@ -56,7 +56,7 @@
case "$1" in
start)
deldb
- cp $FL_HOME/cassandra.titan /tmp
+ cp $ONOS_HOME/conf/cassandra.titan /tmp
stop
start
;;
diff --git a/start-onos-embedded.sh b/start-onos-embedded.sh
index fa6bb3a..e75b696 100755
--- a/start-onos-embedded.sh
+++ b/start-onos-embedded.sh
@@ -1,7 +1,8 @@
#!/bin/bash
# Set paths
-ONOS_HOME=`dirname $0`
+#ONOS_HOME=`dirname $0`
+ONOS_HOME=${HOME}/ONOS
ONOS_JAR="${ONOS_HOME}/target/floodlight.jar"
ONOS_ONLY_JAR="${ONOS_HOME}/target/floodlight-only.jar"
ONOS_LOGBACK="${ONOS_HOME}/logback.xml"
@@ -91,6 +92,8 @@
#java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -jar ${ONOS_JAR} -cf ${ONOS_HOME}/onos.properties > /dev/null 2>&1 &
#java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp ${CLASSPATH} ${MAIN_CLASS} -cf ${ONOS_HOME}/onos.properties > /dev/n
+ # XXX MVN has to run at the project top dir..
+ cd ${ONOS_HOME}
${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos-embedded.properties" > ${LOGDIR}/onos.stdout 2>${LOGDIR}/onos.stderr &
echo "Waiting for ONOS to start..."
diff --git a/start-onos.sh b/start-onos.sh
index 56a8999..9e8d559 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -1,7 +1,8 @@
#!/bin/bash
# Set paths
-ONOS_HOME=`dirname $0`
+#ONOS_HOME=`dirname $0`
+ONOS_HOME=${HOME}/ONOS
ONOS_JAR="${ONOS_HOME}/target/floodlight.jar"
ONOS_ONLY_JAR="${ONOS_HOME}/target/floodlight-only.jar"
ONOS_LOGBACK="${ONOS_HOME}/logback.xml"
@@ -91,7 +92,8 @@
#java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -jar ${ONOS_JAR} -cf ${ONOS_HOME}/onos.properties > /dev/null 2>&1 &
#java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp ${CLASSPATH} ${MAIN_CLASS} -cf ${ONOS_HOME}/onos.properties > /dev/n
- echo "mvn exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos.properties\""
+ # XXX : MVN has to run at the project top dir
+ cd ${ONOS_HOME}
${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos.properties" > ${LOGDIR}/onos.stdout 2>${LOGDIR}/onos.stderr &
echo "Waiting for ONOS to start..."
diff --git a/start-zk.sh b/start-zk.sh
new file mode 100755
index 0000000..26db2fa
--- /dev/null
+++ b/start-zk.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# Set paths
+
+ONOS_HOME=`dirname $0`
+ZK_DIR=${HOME}/zookeeper-3.4.5
+ZK_CONF=${ONOS_HOME}/conf/zoo.cfg
+
+function start {
+ # Run Zookeeper with our configuration
+ echo "Starting Zookeeper"
+ $ZK_DIR/bin/zkServer.sh start $ZK_CONF
+}
+
+function stop {
+ # Kill the existing processes
+ pids=`jps -l | grep org.apache.zookeeper.server | awk '{print $1}'`
+ for p in ${pids}; do
+ if [ x$p != "x" ]; then
+ kill -KILL $p
+ echo "Killed existing prosess (pid: $p)"
+ fi
+ done
+}
+function status {
+ $ZK_DIR/bin/zkServer.sh status $ZK_CONF
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+esac
diff --git a/web/config.json.dev.1node b/web/config.json.dev.1node
new file mode 100644
index 0000000..580a136
--- /dev/null
+++ b/web/config.json.dev.1node
@@ -0,0 +1,26 @@
+{
+ "LB": false,
+ "TESTBED": "sw",
+ "ONOS_DEFAULT_HOST": "localhost",
+ "ONOS_GUI3_CONTROL_HOST": "http://localhost:9000",
+ "ONOS_GUI3_HOST": "http://localhost:9000",
+ "cluster_basename": "onosdev",
+ "controllers": [
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1"
+ ],
+ "core_switches": [
+ "00:00:00:00:00:00:01:01",
+ "00:00:00:00:00:00:01:02",
+ "00:00:00:00:00:00:01:03",
+ "00:00:00:00:00:00:01:04",
+ "00:00:00:00:00:00:01:05",
+ "00:00:00:00:00:00:01:06"
+ ]
+}
diff --git a/web/onos-topology.html b/web/onos-topology.html
index 72e9fc4..d72c0e1 100644
--- a/web/onos-topology.html
+++ b/web/onos-topology.html
@@ -52,8 +52,8 @@
<div id="topology"></div>
<script type="text/javascript" src="js/controller-status.js"></script>
<script type="text/javascript">
-controller_status("http://gui3.onlab.us:8081/controller_status");
-gui("http://gui3.onlab.us:8081/topology");
+controller_status("controller_status");
+gui("topology");
</script>
</svg>
</body>
diff --git a/web/ons-demo/data/controllers.json.dev b/web/ons-demo/data/controllers.json.dev
index 4abcf5a..b936d96 100644
--- a/web/ons-demo/data/controllers.json.dev
+++ b/web/ons-demo/data/controllers.json.dev
@@ -1,10 +1,10 @@
[
- "onosdevb1",
- "onosdevb2",
- "onosdevb3",
- "onosdevb4",
- "onosdevb5",
- "onosdevb6",
- "onosdevb7",
- "onosdevb8"
-]
\ No newline at end of file
+ "onosdev1",
+ "onosdev2",
+ "onosdev3",
+ "onosdev4",
+ "onosdev5",
+ "onosdev6",
+ "onosdev7",
+ "onosdev8"
+]
diff --git a/web/ons-demo/js/constants.js b/web/ons-demo/js/constants.js
index 51b3aa6..236d79a 100644
--- a/web/ons-demo/js/constants.js
+++ b/web/ons-demo/js/constants.js
@@ -2,7 +2,8 @@
timeout used by controller functions. after the timeout expires the "pending" action
is removed and the topology view is whatever is reported by the API
***************************************************************************************************/
-var pendingTimeout = 30000;
+/* var pendingTimeout = 30000; */
+var pendingTimeout = 60000;
/***************************************************************************************************
CSS names for the pallette of colors used by the topology view
@@ -27,4 +28,4 @@
edge: 6,
aggregation: 16,
core: 20
-}
\ No newline at end of file
+}
diff --git a/web/topology_rest.py b/web/topology_rest.py
index 6c2ea15..53f46bc 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -13,9 +13,9 @@
from flask import Flask, json, Response, render_template, make_response, request
-
CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
LINK_FILE=os.getenv("HOME") + "/ONOS/web/link.json"
+ONOSDIR=os.getenv("HOME") + "/ONOS"
## Global Var for ON.Lab local REST ##
RestIP="localhost"
@@ -373,7 +373,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
topo = {}
switches = []
@@ -439,7 +440,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
for v in parsedResult:
link = {}
@@ -479,7 +481,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
topo = {}
switches = []
@@ -526,7 +529,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
for v in parsedResult:
link = {}
@@ -565,7 +569,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
# print command
# print result
@@ -594,7 +599,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
devices = []
for v in parsedResult:
@@ -656,7 +662,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
debug("query_links %s" % command)
# pp.pprint(parsedResult)
@@ -672,7 +679,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
for p in linkResults:
if p.has_key('type') and p['type'] == "port":
@@ -697,14 +705,14 @@
@app.route("/controller_status")
def controller_status():
# onos_check="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh status | awk '{print $1}'"
- onos_check="cd; onos status %s | grep %s | awk '{print $2}'"
+ onos_check="cd; onos status | grep %s | awk '{print $2}'"
#cassandra_check="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-cassandra.sh status"
cont_status=[]
for i in controllers:
status={}
onos=os.popen(onos_check % i).read()[:-1]
- onos=os.popen(onos_check % (i, i.lower())).read()[:-1]
+# onos=os.popen(onos_check % (i, i.lower())).read()[:-1]
status["name"]=i
status["onos"]=onos
status["cassandra"]=0
@@ -724,8 +732,11 @@
# stop_onos="/home/admin/bin/onos stop %s > /tmp/debug " % (controller_name[-1:])
# print "Debug: Controller command %s called %s" % (cmd, controller_name)
else:
- start_onos="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh start" % (controller_name)
- stop_onos="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh stop" % (controller_name)
+ # No longer use -i to specify keys (use .ssh/config to specify it)
+ start_onos="ssh %s ONOS/start-onos.sh start" % (controller_name)
+ stop_onos="ssh %s ONOS/start-onos.sh stop" % (controller_name)
+# start_onos="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh start" % (controller_name)
+# stop_onos="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh stop" % (controller_name)
if cmd == "up":
result=os.popen(start_onos).read()
@@ -743,8 +754,8 @@
result=""
if (TESTBED == "sw"):
for i in range(1, len(controllers)):
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./ctrl-local.sh'" % (controllers[i])
- result += os.popen(cmd_string).read()
+ cmd_string="ssh %s 'cd ONOS/scripts; ./ctrl-local.sh'" % (controllers[i])
+ result += os.popen(cmd_string).read()
else:
cmd_string="cd; switch local > /tmp/watch"
result += os.popen(cmd_string).read()
@@ -753,7 +764,8 @@
result=""
if (TESTBED == "sw"):
for i in range(1, len(controllers)):
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./ctrl-add-ext.sh'" % (controllers[i])
+ cmd_string="ssh %s 'cd ONOS/scripts; ./ctrl-add-ext.sh'" % (controllers[i])
+# cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./ctrl-add-ext.sh'" % (controllers[i])
print "cmd is: "+cmd_string
result += os.popen(cmd_string).read()
else:
@@ -789,7 +801,8 @@
r = re.compile(':')
dpid = re.sub(r, '', dpid)
host=controllers[0]
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./switch.sh %s %s'" % (host, dpid, cmd)
+ cmd_string="ssh %s 'cd ONOS/scripts; ./switch.sh %s %s'" % (host, dpid, cmd)
+# cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./switch.sh %s %s'" % (host, dpid, cmd)
get_status="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./switch.sh %s'" % (host, dpid)
print "cmd_string"
@@ -829,7 +842,8 @@
else:
(port, dontcare) = get_link_ports(dpid, src_dpid)
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, dpid, port, cmd)
+# cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, dpid, port, cmd)
+ cmd_string="ssh %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, dpid, port, cmd)
print cmd_string
res=os.popen(cmd_string).read()
result = result + ' ' + res
@@ -936,7 +950,7 @@
host = controllers[hostid-1]
if (TESTBED == "sw"):
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, src_dpid, src_port, cmd)
+ cmd_string="ssh %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, src_dpid, src_port, cmd)
else:
if ( src_dpid == "00:00:00:08:a2:08:f9:01" ):
cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % ( dst_dpid, dst_port, cmd)
@@ -957,11 +971,17 @@
url ="%s/wm/flow/getsummary/%s/%s/json" % (host, 0, 0)
(code, result) = get_json(url)
parsedResult = json.loads(result)
- flow_nr = int(parsedResult[-1]['flowId'], 16)
+ if len(parsedResult) > 0:
+ if parsedResult[-1].has_key('flowId'):
+ flow_nr = int(parsedResult[-1]['flowId'], 16)
+ else:
+ flow_nr = -1 # first flow
+ print "first flow"
+
flow_nr += 1
- command = "/home/ubuntu/ONOS/web/add_flow.py -m onos %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (flow_nr, "dummy", src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC)
+ command = "%s/web/add_flow.py -m onos %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (ONOSDIR, flow_nr, "dummy", src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC)
flow_nr += 1
- command1 = "/home/ubuntu/ONOS/web/add_flow.py -m onos %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (flow_nr, "dummy", dst_dpid, dst_port, src_dpid, src_port, dstMAC, srcMAC)
+ command1 = "%s/web/add_flow.py -m onos %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (ONOSDIR, flow_nr, "dummy", dst_dpid, dst_port, src_dpid, src_port, dstMAC, srcMAC)
print "add flow: %s, %s" % (command, command1)
errcode = os.popen(command).read()
errcode1 = os.popen(command1).read()
@@ -973,7 +993,7 @@
#http://localhost:9000/gui/delflow/<flow_id>
@app.route("/gui/delflow/<flow_id>")
def del_flow(flow_id):
- command = "/home/ubuntu/ONOS/web/delete_flow.py %s" % (flow_id)
+ command = "%/web/delete_flow.py %s" % (ONOSDIR, flow_id)
print command
errcode = os.popen(command).read()
return errcode
@@ -1027,7 +1047,7 @@
if TESTBED == "hw":
cmd_string="dsh -w %s 'cd ONOS/scripts; " % dst_host
else:
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; " % dst_host
+ cmd_string="ssh %s 'cd ONOS/scripts; " % dst_host
cmd_string += "./runiperf.sh %d %s %s %s:%s %s/%s/%s/%s'" % (flowId, src_dpid, dst_dpid, TESTBED, "svr", protocol, duration, interval, samples)
print cmd_string
os.popen(cmd_string)
@@ -1035,7 +1055,7 @@
if TESTBED == "hw":
cmd_string="dsh -w %s 'cd ONOS/scripts; " % src_host
else:
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts;" % src_host
+ cmd_string="ssh %s 'cd ONOS/scripts;" % src_host
cmd_string+="./runiperf.sh %d %s %s %s:%s %s/%s/%s/%s'" % (flowId, src_dpid, dst_dpid, TESTBED, "client", protocol, duration, interval, samples)
print cmd_string
os.popen(cmd_string)