Merge branch 'master' of github.com:OPENNETWORKINGLAB/ONOS
Conflicts:
web/topology_rest.py
diff --git a/scripts/showdpid.sh b/scripts/showdpid.sh
index 91281a1..db0adbc 100755
--- a/scripts/showdpid.sh
+++ b/scripts/showdpid.sh
@@ -13,5 +13,6 @@
done
echo $url
for s in $switches; do
+ echo -n "$s : "
sudo ovs-ofctl show $s |grep dpid
done
diff --git a/scripts/showflow.sh b/scripts/showflow.sh
index 757c69d..5b6fb34 100755
--- a/scripts/showflow.sh
+++ b/scripts/showflow.sh
@@ -7,11 +7,21 @@
echo $ip
}
-url=""
-for c in $controller; do
- url="$url tcp:`host2ip $c`:6633"
-done
-echo $url
+function cdpid (){
+# dpid=echo $1 | awk '{printf("%s%s:%s%s:%s%s:%s%s:%s%s:%s%s:%s%s:%s%s",$1[0],$1[1],$1[2],$1[3],$1[4],$1[5],$1[6],$1[7],$1[8],$1[9],$1[10],$1[11],$1[12],$1[13],$1[14],$1[15])}'
+ dpid=`echo $1 | awk '{printf("%s\n",$0[0])}'`
+}
+
+dpids=()
for s in $switches; do
- sudo ovs-ofctl dump-flows $s
+# echo -n "$s : "
+ i=`sudo ovs-ofctl show $s |grep dpid | awk -F ":" '{print $4}'`
+ dpids+=($i)
+done
+((j=0))
+for s in $switches; do
+ id=`cdpid ${dpids[$j]}`
+ echo id
+# sudo ovs-ofctl dump-flows $s |grep cookie| awk -vsw=$s -vdpid=${dpids[$j]} '{printf("%s %s %s\n",sw,dpid,$0)}'
+ ((j ++ ))
done
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index a9a2212..11643fa 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -82,7 +82,10 @@
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.util.EventHistory;
import net.floodlightcontroller.util.EventHistory.EvAction;
+
import net.onrc.onos.registry.controller.IControllerRegistryService;
+import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
+import net.onrc.onos.registry.controller.RegistryException;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
@@ -127,12 +130,6 @@
IStorageSourceListener, ILinkDiscoveryService,
IFloodlightModule, IInfoProvider, IHAListener {
protected static Logger log = LoggerFactory.getLogger(LinkDiscoveryManager.class);
-
- protected enum NetworkMapOperation {
- NONE,
- INSERT,
- UPDATE
- }
// Names of table/fields for links in the storage API
private static final String LINK_TABLE_NAME = "controller_link";
@@ -1028,7 +1025,6 @@
NodePortTuple srcNpt, dstNpt;
boolean linkChanged = false;
- NetworkMapOperation operation = NetworkMapOperation.NONE;
lock.writeLock().lock();
try {
@@ -1077,8 +1073,7 @@
writeLinkToStorage(lt, newInfo);
// Write link to network map
- operation = NetworkMapOperation.INSERT;
- //linkStore.update(lt, newInfo, DM_OPERATION.INSERT);
+ linkStore.update(lt, newInfo, DM_OPERATION.INSERT);
updateOperation = UpdateOperation.LINK_UPDATED;
linkChanged = true;
@@ -1137,8 +1132,7 @@
writeLinkToStorage(lt, newInfo);
// Write link to network map
- operation = NetworkMapOperation.UPDATE;
- //linkStore.update(lt, newInfo, DM_OPERATION.UPDATE);
+ linkStore.update(lt, newInfo, DM_OPERATION.UPDATE);
if (linkChanged) {
updateOperation = getUpdateOperation(newInfo.getSrcPortState(),
@@ -1168,18 +1162,6 @@
} finally {
lock.writeLock().unlock();
}
-
- switch (operation){
- case INSERT:
- linkStore.update(lt, newInfo, DM_OPERATION.INSERT);
- break;
- case UPDATE:
- linkStore.update(lt, newInfo, DM_OPERATION.UPDATE);
- break;
- case NONE:
- default:
- break;
- }
return linkChanged;
}
diff --git a/web/onos-topology.html b/web/onos-topology.html
index 9d90ea4..72e9fc4 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://gui.onlab.us:8080/controller_status");
-gui("http://gui.onlab.us:8080/topology");
+controller_status("http://gui3.onlab.us:8081/controller_status");
+gui("http://gui3.onlab.us:8081/topology");
</script>
</svg>
</body>
diff --git a/web/topology_rest.py b/web/topology_rest.py
index b10471f..74129e3 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -57,6 +57,7 @@
@app.route('/js/views/<filename>', methods=['GET'])
@app.route('/js/<filename>', methods=['GET'])
@app.route('/lib/<filename>', methods=['GET'])
+@app.route('/log/<filename>', methods=['GET'])
@app.route('/', methods=['GET'])
@app.route('/<filename>', methods=['GET'])
@app.route('/tpl/<filename>', methods=['GET'])
@@ -824,26 +825,27 @@
#* Start Iperf Througput
#http://localhost:9000/gui/iperf/start/<flow_id>/<duration>
-@app.route("/gui/iperf/start/<flow_id>/<duration>")
-def iperf_start(flow_id,duration):
+@app.route("/gui/iperf/start/<flow_id>/<duration>/<samples>")
+def iperf_start(flow_id,duration,samples):
try:
- command = "curl -s http://%s:%s/wm/flow/get/%s/json\"" % (RESTIP, 9000, flow_id)
+ command = "curl -s \'http://%s:%s/wm/flow/get/%s/json\'" % (RestIP, RestPort, flow_id)
print command
result = os.popen(command).read()
if len(result) == 0:
print "No Flow found"
return;
- parsedResult = json.load(result)
except:
print "REST IF has issue"
exit
- flowId = parsedResult['flowId']['value']
+ parsedResult = json.loads(result)
+
+ flowId = int(parsedResult['flowId']['value'], 16)
src_dpid = parsedResult['dataPath']['srcPort']['dpid']['value']
src_port = parsedResult['dataPath']['srcPort']['port']['value']
dst_dpid = parsedResult['dataPath']['dstPort']['dpid']['value']
dst_port = parsedResult['dataPath']['dstPort']['port']['value']
- print "FlowPath: (flowId = %s src = %s/%s dst = %s/%s" % (flowId, src_dpid, src_port, dst_dpid, dst_port)
+# print "FlowPath: (flowId = %s src = %s/%s dst = %s/%s" % (flowId, src_dpid, src_port, dst_dpid, dst_port)
if src_dpid in core_switches:
host = controllers[0]
@@ -851,20 +853,44 @@
hostid=int(src_dpid.split(':')[-2])
host = controllers[hostid-1]
- cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./runiperf.sh %s %s %s %s'" % (host, src_dpid, src_port, dst_dpid, dst_port)
+# ./runiperf.sh 2 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 100 15
+ cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./runiperf.sh %d %s %s %s %s %s %s'" % (host, flowId, src_dpid, src_port, dst_dpid, dst_port, duration, samples)
print cmd_string
- command = "/home/ubuntu/ONOS/scripts/iperf -t0 -i0.1 -yJ -k15 -o /tmp/iperf.out -c 127.0.0.1 &"
- print command
+ os.popen(cmd_string)
return
-
#* Get Iperf Throughput
#http://localhost:9000/gui/iperf/rate/<flow_id>
@app.route("/gui/iperf/rate/<flow_id>")
def iperf_rate(flow_id):
try:
- command = "head -1 /tmp/iperf.out"
+ command = "curl -s \'http://%s:%s/wm/flow/get/%s/json\'" % (RestIP, RestPort, flow_id)
+ print command
+ result = os.popen(command).read()
+ if len(result) == 0:
+ print "No Flow found"
+ return;
+ except:
+ print "REST IF has issue"
+ exit
+
+ parsedResult = json.loads(result)
+
+ flowId = int(parsedResult['flowId']['value'], 16)
+ src_dpid = parsedResult['dataPath']['srcPort']['dpid']['value']
+ src_port = parsedResult['dataPath']['srcPort']['port']['value']
+ dst_dpid = parsedResult['dataPath']['dstPort']['dpid']['value']
+ dst_port = parsedResult['dataPath']['dstPort']['port']['value']
+
+ if src_dpid in core_switches:
+ host = controllers[0]
+ else:
+ hostid=int(src_dpid.split(':')[-2])
+ host = controllers[hostid-1]
+
+ try:
+ command = "curl -s http://%s:%s/log/iperf_%s.out" % (host, 9000, flow_id)
print command
result = os.popen(command).read()
except:
@@ -882,17 +908,17 @@
# link_change("down", "00:00:20:4e:7f:51:8a:35", 1, "00:00:00:00:00:00:00:00", 1)
# link_change("up", "00:00:00:00:00:00:02:03", 1, "00:00:00:00:00:00:00:00", 1)
# link_change("down", "00:00:00:00:00:00:07:12", 1, "00:00:00:00:00:00:00:00", 1)
-
-
- print "-- query all switches --"
- query_switch()
- print "-- query topo --"
- topology_for_gui()
+# print "-- query all switches --"
+# query_switch()
+# print "-- query topo --"
+# topology_for_gui()
# link_change(1,2,3,4)
print "-- query all links --"
- query_links()
+# query_links()
# print "-- query all devices --"
# devices()
+ iperf_start(1,10,15)
+ iperf_rate(1)
else:
app.debug = True
app.run(threaded=True, host="0.0.0.0", port=9000)