Merge pull request #377 from pgreyson/master
Bug fixes for iperf display
diff --git a/cluster-mgmt/bin/demo-reset-hw.sh b/cluster-mgmt/bin/demo-reset-hw.sh
index c5101a1..8c586f5 100755
--- a/cluster-mgmt/bin/demo-reset-hw.sh
+++ b/cluster-mgmt/bin/demo-reset-hw.sh
@@ -1,11 +1,27 @@
#! /bin/bash
DIR=${HOME}/ONOS
+echo "==== Reset Demo to the initial State ==="
+date
+start=`date +"%s"`
+echo "all link up.."
$DIR/scripts/all-linkup-hw.sh
+echo "link up done"
+
+echo "cleanup excess flows"
$DIR/web/delete_flow.py 201 300
-$DIR/web/clean_flow.py 201 300
+$DIR/web/clear_flow.py 201 300
+echo "cleanup excess flows done"
+echo "Adding 200 flows"
$DIR/web/add_flow.py -m onos -f $DIR/web/flowdef_demo_start.txt
+echo "done"
+echo "killing iperf"
+dsh -g onos 'sudo pkill -KILL iperf'
+echo "done"
+echo "kill onos at 5 and 7"
onos stop 5
onos stop 7
+echo "done"
+echo "bringup 1 2 3 4 6 8 if dead"
for i in 1 2 3 4 6 8; do
status=`onos status $i | grep instance | awk '{print $2}'`
echo "onos $i status $status"
@@ -13,5 +29,10 @@
onos start $i
fi
done
+echo "done"
+
sleep 2
switch local
+endt=`date +"%s"`
+(( delta = endt -start ))
+echo "finish: took $delta sec"
diff --git a/cluster-mgmt/bin/demo-scale-out-hw.sh b/cluster-mgmt/bin/demo-scale-out-hw.sh
index eb06c56..6a44c8d 100755
--- a/cluster-mgmt/bin/demo-scale-out-hw.sh
+++ b/cluster-mgmt/bin/demo-scale-out-hw.sh
@@ -1,7 +1,6 @@
#! /bin/bash
onos start 5
onos start 7
-sleep 2
-cd ONOS/web; ./add_flow.py -m onos -f flowdef_demo_add.txt
-sleep 3
-switch all
+switch local
+sleep 4
+cd ~/ONOS/web; ./add_flow.py -m onos -f flowdef_demo_add.txt &
diff --git a/scripts/demo-reset-sw.sh b/scripts/demo-reset-sw.sh
new file mode 100755
index 0000000..65a2ff1
--- /dev/null
+++ b/scripts/demo-reset-sw.sh
@@ -0,0 +1,23 @@
+#! /bin/bash
+basename=$ONOS_CLUSTER_BASENAME
+DIR=${HOME}/ONOS
+tstart=`date +"%s"`
+echo "All Link Up"
+$DIR/scripts/all-linkup.sh
+echo "Delete Flows"
+$DIR/web/delete_flow.py 201 300
+$DIR/web/clear_flow.py 201 300
+echo "Adding Flows"
+$DIR/web/add_flow.py -m onos -f $DIR/web/flowdef_demo_start.txt
+ssh -i ~/.ssh/onlabkey.pem ${basename}5 'ONOS/start-onos.sh stop'
+ssh -i ~/.ssh/onlabkey.pem ${basename}7 'ONOS/start-onos.sh stop'
+for i in 1 2 3 4 6 8; do
+ ssh -i ~/.ssh/onlabkey.pem ${basename}$i 'ONOS/start-onos.sh startifdown'
+done
+sleep 2
+for i in 1 2 3 4 5 6 7 8; do
+ ssh -i ~/.ssh/onlabkey.pem ${basename}$i 'cd ONOS/scripts; ./ctrl-local.sh'
+done
+tend=`date +"%s"`
+(( delta = tend - tstart ))
+echo "Demo Reset Done: took $delta sec"
diff --git a/scripts/demo-scale-out-sw.sh b/scripts/demo-scale-out-sw.sh
new file mode 100755
index 0000000..887a025
--- /dev/null
+++ b/scripts/demo-scale-out-sw.sh
@@ -0,0 +1,14 @@
+#! /bin/bash
+basename=$ONOS_CLUSTER_BASENAME
+DIR=${HOME}/ONOS
+start=`date +"%s"`
+echo "bring up two nodes"
+ssh -i ~/.ssh/onlabkey.pem ${basename}5 'ONOS/start-onos.sh start'
+ssh -i ~/.ssh/onlabkey.pem ${basename}7 'ONOS/start-onos.sh start'
+sleep 2
+echo "Adding more flows"
+$DIR/web/add_flow.py -m onos -f $DIR/web/flowdef_demo_add.txt
+endt=`date +"%s"`
+(( delta = endt -start ))
+echo "Scale Up Done: took $delta sec"
+
diff --git a/start-onos.sh b/start-onos.sh
index 7e23eaf..77accd0 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -127,6 +127,14 @@
check_db
start
;;
+ startifdown)
+ n=`jps -l |grep "net.floodlightcontroller.core.Main" | wc -l`
+ if [ $n == 0 ]; then
+ start
+ else
+ echo "$n instance of onos running"
+ fi
+ ;;
stop)
stop
;;
@@ -134,10 +142,10 @@
deldb
;;
status)
- n=`ps -edalf |grep java |grep logback.xml | wc -l`
+ n=`jps -l |grep "net.floodlightcontroller.core.Main" | wc -l`
echo "$n instance of onos running"
;;
*)
- echo "Usage: $0 {start|stop|restart|status}"
+ echo "Usage: $0 {start|stop|restart|status|startifdown}"
exit 1
esac
diff --git a/web/ons-demo/js/controller.js b/web/ons-demo/js/controller.js
index f9b4baf..fb516ae 100644
--- a/web/ons-demo/js/controller.js
+++ b/web/ons-demo/js/controller.js
@@ -108,6 +108,9 @@
function switchLocal() {
controllerFunctions.switchControllerCmd('local');
}
+function switchAll() {
+ controllerFunctions.switchControllerCmd('all');
+}
function resetNetwork() {
controllerFunctions.resetCmd();
diff --git a/web/topology_rest.py b/web/topology_rest.py
index 43865f1..9bb8b9e 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -229,8 +229,35 @@
resp = Response(result, status=200, mimetype='application/json')
return resp
+@app.route("/proxy/gui/reset")
+def proxy_gui_reset():
+ result = ""
+ try:
+ command = "curl -m 300 -s %s/gui/reset" % (ONOS_GUI3_CONTROL_HOST)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
-###### ONOS RESET API ##############################
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/scale")
+def proxy_gui_scale():
+ result = ""
+ try:
+ command = "curl -m 300 -s %s/gui/scale" % (ONOS_GUI3_CONTROL_HOST)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+###### ONOS REST API ##############################
## Worker Func ###
def get_json(url):
code = 200
@@ -692,17 +719,20 @@
def controller_status_change(cmd, controller_name):
if (TESTBED == "hw"):
start_onos="/home/admin/bin/onos start %s" % (controller_name[-1:])
+# start_onos="/home/admin/bin/onos start %s > /tmp/debug " % (controller_name[-1:])
stop_onos="/home/admin/bin/onos stop %s" % (controller_name[-1:])
+# 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)
if cmd == "up":
result=os.popen(start_onos).read()
- ret = "controller %s is up" % (controller_name)
+ ret = "controller %s is up: %s" % (controller_name, result)
elif cmd == "down":
result=os.popen(stop_onos).read()
- ret = "controller %s is down" % (controller_name)
+ ret = "controller %s is down: %s" % (controller_name, result)
return ret
@@ -716,7 +746,7 @@
cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./ctrl-local.sh'" % (controllers[i])
result += os.popen(cmd_string).read()
else:
- cmd_string="cd; switch local"
+ cmd_string="cd; switch local > /tmp/watch"
result += os.popen(cmd_string).read()
elif cmd =="all":
print "All aggr switches connects to all controllers except for core controller"
@@ -724,14 +754,31 @@
if (TESTBED == "sw"):
for i in range(0, len(controllers)):
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:
- cmd_string="cd; switch all"
+ cmd_string="/home/admin/bin/switch all > /tmp/watch"
result += os.popen(cmd_string).read()
return result
+@app.route("/gui/reset")
+def reset_demo():
+ if (TESTBED == "hw"):
+ cmd_string="cd ~/bin; ./demo-reset-hw.sh > /tmp/watch &"
+ else:
+ cmd_string="cd ~/ONOS/scripts; ./demo-reset-sw.sh > /tmp/watch &"
+ os.popen(cmd_string)
+ return "Reset"
+@app.route("/gui/scale")
+def scale_demo():
+ if (TESTBED == "hw"):
+ cmd_string="cd ~/bin; ~/bin/demo-scale-out-hw.sh > /tmp/watch &"
+ else:
+ cmd_string="cd ~/ONOS/scripts; ./demo-scale-out-sw.sh > /tmp/watch &"
+ os.popen(cmd_string)
+ return "scale"
@app.route("/gui/switch/<cmd>/<dpid>")
def switch_status_change(cmd, dpid):
@@ -1061,7 +1108,8 @@
# iperf_start(1,10,15)
# iperf_rate(1)
# switches()
- add_flow(1,2,3,4,5,6)
+# add_flow(1,2,3,4,5,6)
+ reset_demo()
else:
app.debug = True
app.run(threaded=True, host="0.0.0.0", port=9000)