Fix a bug that result in the openflow plugin can't discover topology. 12/31112/1
authorJieHou <houjie1@huawei.com>
Thu, 10 Dec 2015 06:37:07 +0000 (14:37 +0800)
committerJieHou <houjie1@huawei.com>
Thu, 10 Dec 2015 06:38:39 +0000 (14:38 +0800)
And fix PhysicalNetworkAdapter which sometimes can't write some physical links into data store.

Change-Id: I0768c028f8de833acff9357295aa3d952033d410
Signed-off-by: JieHou <houjie1@huawei.com>
nemo-renderers/openflow-renderer/src/main/java/org/opendaylight/nemo/renderer/openflow/physicalnetwork/PhysicalNetworkAdapter.java

index b7052dab744ad584a3a8411dc124f7115937e554..cdcbe5136f093df5c31e91077ca73808dc20b995 100644 (file)
@@ -200,9 +200,12 @@ public class PhysicalNetworkAdapter {
     protected void ofNodeAdded(Node node) {
         log.debug("OF node added: {}.", node.getKey());
         String strNodeId = node.getId().getValue();
-        //add default flow entry.
-        physicalFlowUtils.configArpPEntry(strNodeId);
-        physicalFlowUtils.configLLDPEntry(strNodeId);
+        // Add default flow entry. - Don't do this here, because it will
+        // result in that the openflow plugin can't discover the topology.
+        // Flow entries for LLDP are deployed manually through a shell script.
+        // Flow entries for ARP are added in class FlowUtils.
+//        physicalFlowUtils.configArpPEntry(strNodeId);
+//        physicalFlowUtils.configLLDPEntry(strNodeId);
 
         PhysicalNodeId nodeId = new PhysicalNodeId(strNodeId);
         PhysicalNodeBuilder nodeBuilder = new PhysicalNodeBuilder();
@@ -347,7 +350,7 @@ public class PhysicalNetworkAdapter {
         synchronized (mutex) {
             physicalLinkSet.add(linkBuilder.build());
             if (!running) {
-                phyTimer.schedule(new PhyTransmit(), 10, 100);
+                phyTimer.schedule(new PhyTransmit(), 10, 500);
                 running = true;
             }
         }
@@ -373,10 +376,12 @@ public class PhysicalNetworkAdapter {
                 for (PhysicalLink physicalLink : physicalLinkSet) {
                     handleLink(physicalLink);
                 }
-                if (physicalLinkSet.size() == 0) {
-                    phyTimer.cancel();
-                    running = false;
-                }
+                // Cancel timer. - Don't cancel timer, because this will result in
+                // that some physical links aren't wrote into data store sometimes.
+//                if (physicalLinkSet.size() == 0) {
+//                    phyTimer.cancel();
+//                    running = false;
+//                }
             }
         }