- Discard discovery packet if the ingress port is down 35/335/1
authorJason Ye <yisye@cisco.com>
Sun, 12 May 2013 19:09:52 +0000 (12:09 -0700)
committerJason Ye <yisye@cisco.com>
Sun, 12 May 2013 19:09:52 +0000 (12:09 -0700)
- SwitchManager osgi cmds are useful tools for debugging. But the input node id currently has to be in long format. Change it to take node id string. Example: pncs "OF|00:01:44:03:a7:7a:54:e0"
Signed-off-by: Jason Ye <yisye@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerImpl.java

index afc5b8c..0cbaf67 100644 (file)
@@ -294,11 +294,13 @@ public class DiscoveryService implements IInventoryShimExternalListener,
         }
         if (ethPkt.getPayload() instanceof LLDP) {
             NodeConnector dst = inPkt.getIncomingNodeConnector();
-            if (!processDiscoveryPacket(dst, ethPkt)) {
-                /* Snoop the discovery pkt if not generated from us */
-                snoopDiscoveryPacket(dst, ethPkt);
+            if (isEnabled(dst)) {
+                if (!processDiscoveryPacket(dst, ethPkt)) {
+                    /* Snoop the discovery pkt if not generated from us */
+                    snoopDiscoveryPacket(dst, ethPkt);
+                }
+                return PacketResult.CONSUME;
             }
-            return PacketResult.CONSUME;
         }
         return PacketResult.IGNORED;
     }
index 79159e5..4ef8416 100644 (file)
@@ -1479,9 +1479,13 @@ public class SwitchManagerImpl implements ISwitchManager,
             ci.println("Please enter node id");
             return;
         }
-        Long id = Long.decode(st);
 
-        Node node = NodeCreator.createOFNode(id);
+        Node node = Node.fromString(st);
+        if (node == null) {
+            ci.println("Please enter node id");
+            return;
+        }
+
         Set<NodeConnector> nodeConnectorSet = getUpNodeConnectors(node);
         if (nodeConnectorSet == null) {
             return;
@@ -1501,10 +1505,14 @@ public class SwitchManagerImpl implements ISwitchManager,
             ci.println("Please enter node id");
             return;
         }
-        Long id = Long.decode(st);
+
+        Node node = Node.fromString(st);
+        if (node == null) {
+            ci.println("Please enter node id");
+            return;
+        }
 
         ci.println("          NodeConnector               BandWidth(Gbps)     Admin     State");
-        Node node = NodeCreator.createOFNode(id);
         Set<NodeConnector> nodeConnectorSet = getNodeConnectors(node);
         if (nodeConnectorSet == null) {
             return;
@@ -1534,8 +1542,14 @@ public class SwitchManagerImpl implements ISwitchManager,
             ci.println("Please enter node id");
             return;
         }
-        Object id = Long.decode(st);
-        Switch sw = getSwitchByNode(NodeCreator.createOFNode((Long) id));
+
+        Node node = Node.fromString(st);
+        if (node == null) {
+            ci.println("Please enter node id");
+            return;
+        }
+
+        Switch sw = getSwitchByNode(node);
 
         ci.println("          NodeConnector                        Name");
         if (sw == null) {
@@ -1549,10 +1563,9 @@ public class SwitchManagerImpl implements ISwitchManager,
                 nodeConnectorName = (propMap == null) ? null : ((Name) propMap
                         .get(Name.NamePropName)).getValue();
                 if (nodeConnectorName != null) {
-                    Node node = nodeConnector.getNode();
-                    if (!node.equals(getNode((Long) id))) {
-                        log.debug("node not match {} {}", node,
-                                getNode((Long) id));
+                    Node nd = nodeConnector.getNode();
+                    if (!nd.equals(node)) {
+                        log.debug("node not match {} {}", nd, node);
                     }
                     Map<String, NodeConnector> map = nodeConnectorNames
                             .get(node);
@@ -1584,9 +1597,12 @@ public class SwitchManagerImpl implements ISwitchManager,
             ci.println("Please enter node id");
             return;
         }
-        Long id = Long.decode(st);
 
-        Node node = NodeCreator.createOFNode(id);
+        Node node = Node.fromString(st);
+        if (node == null) {
+            ci.println("Please enter node id");
+            return;
+        }
 
         st = ci.nextArgument();
         if (st == null) {