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 90f076e..74129e3 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -857,6 +857,7 @@
   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
   os.popen(cmd_string)
+
   return 
 
 #* Get Iperf Throughput