Merge pull request #366 from pgreyson/master
Display flow counts through core/core links. New confirm dialog.
diff --git a/scripts/runiperf.sh b/scripts/runiperf.sh
index 3df4fb0..7066bc6 100755
--- a/scripts/runiperf.sh
+++ b/scripts/runiperf.sh
@@ -4,14 +4,15 @@
# Usage: flowid src_dpid dst_dpid params
def usage():
- print "%s flowid src_dpid dst_dpid svr|client <proto>/<duration>/<interval>/<samples>" % sys.argv[0]
+ 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]
dst_dpid = sys.argv[3]
- server = sys.argv[4].upper()[0]
+ (testbed,server) = sys.argv[4].upper().split(':')
+ server = server[0]
params = sys.argv[5].split('/')
proto = params[0]
duration = params[1]
@@ -24,23 +25,27 @@
dst_hostid=int(dst_dpid.split(':')[-1], 16)
if (proto == "tcp"):
-# 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)
- cmd="${HOME}/ONOS/test-network/mininet/mrun host%d \'/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)
- killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperf_%s.out\"' % (flowid)
- print killcmd
- print cmd
- os.popen(killcmd)
- os.popen(cmd)
+ 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)
+ killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperf_%s.out\"' % (flowid)
+ print killcmd
+ print cmd
+ os.popen(killcmd)
+ os.popen(cmd)
else:
if (server == 'S'):
-# 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)
- cmd="${HOME}/ONOS/test-network/mininet/mrun host%d \'/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)
+ 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)
killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperfsvr_%s.out\"' % (flowid)
print killcmd
print cmd
else:
- cmd="${HOME}/ONOS/test-network/mininet/mrun host%d \'/home/ubuntu/ONOS/scripts/iperf -l 1000 -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)
-# cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -l 1000 -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)
+ 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 + 1)
killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperfclient_%s.out\"' % (flowid)
print killcmd
print cmd
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
index 4de2cbc..4d00443 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -7,15 +7,12 @@
import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
-import java.util.TreeMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import net.floodlightcontroller.core.IFloodlightProviderService;
@@ -59,7 +56,6 @@
import org.openflow.protocol.OFType;
import org.openflow.protocol.action.OFAction;
import org.openflow.protocol.action.OFActionOutput;
-import org.openflow.util.HexString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,8 +65,8 @@
public GraphDBConnection conn;
protected IRestApiService restApi;
- protected IFloodlightProviderService floodlightProvider;
- protected ITopoRouteService topoRouteService;
+ protected volatile IFloodlightProviderService floodlightProvider;
+ protected volatile ITopoRouteService topoRouteService;
protected FloodlightModuleContext context;
protected OFMessageDamper messageDamper;
@@ -99,11 +95,8 @@
private static Logger log = LoggerFactory.getLogger(FlowManager.class);
// The periodic task(s)
- private final ScheduledExecutorService mapReaderScheduler =
- Executors.newScheduledThreadPool(1);
-
- private final ScheduledExecutorService shortestPathReconcileScheduler =
- Executors.newScheduledThreadPool(1);
+ private ScheduledExecutorService mapReaderScheduler;
+ private ScheduledExecutorService shortestPathReconcileScheduler;
final Runnable mapReader = new Runnable() {
public void run() {
@@ -386,15 +379,15 @@
}
};
- final ScheduledFuture<?> mapReaderHandle =
- mapReaderScheduler.scheduleAtFixedRate(mapReader, 3, 3, TimeUnit.SECONDS);
+ //final ScheduledFuture<?> mapReaderHandle =
+ //mapReaderScheduler.scheduleAtFixedRate(mapReader, 3, 3, TimeUnit.SECONDS);
- final ScheduledFuture<?> shortestPathReconcileHandle =
- shortestPathReconcileScheduler.scheduleAtFixedRate(shortestPathReconcile, 3, 3, TimeUnit.SECONDS);
+ //final ScheduledFuture<?> shortestPathReconcileHandle =
+ //shortestPathReconcileScheduler.scheduleAtFixedRate(shortestPathReconcile, 3, 3, TimeUnit.SECONDS);
@Override
public void init(String conf) {
- conn = GraphDBConnection.getInstance(conf);
+ conn = GraphDBConnection.getInstance(conf);
}
public void finalize() {
@@ -449,6 +442,9 @@
// TODO: An ugly hack!
String conf = "/tmp/cassandra.titan";
this.init(conf);
+
+ mapReaderScheduler = Executors.newScheduledThreadPool(1);
+ shortestPathReconcileScheduler = Executors.newScheduledThreadPool(1);
}
private long getNextFlowEntryId() {
@@ -471,10 +467,15 @@
@Override
public void startUp(FloodlightModuleContext context) {
- restApi.addRestletRoutable(new FlowWebRoutable());
-
- // Initialize the Flow Entry ID generator
- nextFlowEntryIdPrefix = randomGenerator.nextInt();
+ restApi.addRestletRoutable(new FlowWebRoutable());
+
+ // Initialize the Flow Entry ID generator
+ nextFlowEntryIdPrefix = randomGenerator.nextInt();
+
+ mapReaderScheduler.scheduleAtFixedRate(
+ mapReader, 3, 3, TimeUnit.SECONDS);
+ shortestPathReconcileScheduler.scheduleAtFixedRate(
+ shortestPathReconcile, 3, 3, TimeUnit.SECONDS);
}
/**
diff --git a/web/topology_rest.py b/web/topology_rest.py
index 7bbf7ce..976737c 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -691,8 +691,8 @@
@app.route("/gui/controller/<cmd>/<controller_name>")
def controller_status_change(cmd, controller_name):
if (TESTBED == "hw"):
- start_onos="cd; onos start %s" % (controller_name[-1:])
- stop_onos="cd; onos stop %s" % (controller_name[-1:])
+ start_onos="/home/admin/bin/onos start %s" % (controller_name[-1:])
+ stop_onos="/home/admin/bin/onos stop %s" % (controller_name[-1:])
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)
@@ -864,11 +864,11 @@
cmd = 'up'
result=""
host = controllers[0]
- cmd_string="~/ONOS/scripts/link.sh %s %s %s " % (src_dpid, port1, cmd)
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % (src_dpid, port1, cmd)
print cmd_string
res=os.popen(cmd_string).read()
result = result + ' ' + res
- cmd_string="~/ONOS/scripts/link.sh %s %s %s " % (dst_dpid, port2, cmd)
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % (dst_dpid, port2, cmd)
print cmd_string
res=os.popen(cmd_string).read()
result = result + ' ' + res
@@ -892,9 +892,9 @@
cmd_string="ssh -i ~/.ssh/onlabkey.pem %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.sh %s %s %s " % ( dst_dpid, dst_port, cmd)
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % ( dst_dpid, dst_port, cmd)
else:
- cmd_string="~/ONOS/scripts/link.sh %s %s %s " % ( src_dpid, src_port, cmd)
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % ( src_dpid, src_port, cmd)
print cmd_string
result=os.popen(cmd_string).read()
@@ -957,34 +957,46 @@
src_host = controllers[0]
else:
hostid=int(src_dpid.split(':')[-2])
- src_host = controllers[hostid-1]
+ if TESTBED == "hw":
+ src_host = "mininet%i" % hostid
+ else:
+ src_host = controllers[hostid-1]
if dst_dpid in core_switches:
dst_host = controllers[0]
else:
hostid=int(dst_dpid.split(':')[-2])
- dst_host = controllers[hostid-1]
+ if TESTBED == "hw":
+ dst_host = "mininet%i" % hostid
+ else:
+ dst_host = controllers[hostid-1]
-# /runiperf.sh <flowid> <src_dpid> <dst_dpid> svr|client <proto>/<duration>/<interval>/<samples>
+# /runiperf.sh <flowid> <src_dpid> <dst_dpid> hw:svr|sw:svr|hw:client|sw:client <proto>/<duration>/<interval>/<samples>
protocol="udp"
interval=0.1
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./runiperf.sh %d %s %s %s %s/%s/%s/%s'" % (dst_host, flowId, src_dpid, dst_dpid, "svr", protocol, duration, interval, samples)
+ if TESTBED == "hw":
+ cmd_string="dsh -w %s 'cd ONOS/scripts; " % dst_host
+ else:
+ cmd_string="ssh -i ~/.ssh/onlabkey.pem %s '" % 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)
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./runiperf.sh %d %s %s %s %s/%s/%s/%s'" % (src_host, flowId, src_dpid, dst_dpid, "client", protocol, duration, interval, samples)
+ if TESTBED == "hw":
+ cmd_string="dsh -w %s 'cd ONOS/scripts; " % src_host
+ else:
+ cmd_string="ssh -i ~/.ssh/onlabkey.pem %s'" % 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)
return cmd_string
+
#* Get Iperf Throughput
#http://localhost:9000/gui/iperf/rate/<flow_id>
@app.route("/gui/iperf/rate/<flow_id>")
def iperf_rate(flow_id):
- if (TESTBED == "hw"):
- return "{}"
-
try:
command = "curl -s \'http://%s:%s/wm/flow/get/%s/json\'" % (RestIP, RestPort, flow_id)
print command
@@ -1005,9 +1017,12 @@
dst_port = parsedResult['dataPath']['dstPort']['port']['value']
if dst_dpid in core_switches:
- host = controllers[0]
+ host = controllers[0]
else:
- hostid=int(dst_dpid.split(':')[-2])
+ hostid=int(dst_dpid.split(':')[-2])
+ if TESTBED == "hw":
+ host = "mininet%i" % hostid
+ else:
host = controllers[hostid-1]
try:
@@ -1024,7 +1039,6 @@
resp = Response(result, status=200, mimetype='application/json')
return resp
-
if __name__ == "__main__":
random.seed()
read_config()