Fix bug 5433: calling rpc get-node-connector-list and get-edge-list failed 91/35091/4
authorNanfei Chen <chen.nanfei@h3c.com>
Fri, 19 Feb 2016 13:50:08 +0000 (21:50 +0800)
committerYi-Ling Hsieh <ylhsieh@itri.org.tw>
Fri, 1 Apr 2016 10:18:38 +0000 (10:18 +0000)
because the valid port number did not begin from 1 always, and not be
continuous always too.

Change-Id: I1dd6464c4c1fc793ac52adb673a49121eeef7ad3
Signed-off-by: Nanfei Chen <chen.nanfei@h3c.com>
snmp4sdn/src/main/java/org/opendaylight/snmp4sdn/internal/SNMPHandler.java

index 264d046a66593a317440463dfb9279a4f29f5f0b..331ad1ae79fa7a9bd35b797c9788111e6b06c30b 100644 (file)
@@ -2077,7 +2077,15 @@ public class SNMPHandler{
         }\r
 \r
         //logger.debug("Number of table entries: " + tableVars.size());\r
-        int tmpCount = 0;//TODO: tmpCount's init value is 0, based on that port number begins from 1. Always ok?\r
+        \r
+        /*\r
+         * Bug fix: the valid port number in tableVars does not begin from 1 always. And the valid port number in\r
+         * tableVars does not be continuous always.\r
+         * For example, as to a device whose model is H3C S6800-4C, when the second slot is used only, the valid port\r
+         * number in tableVars will be 33~57, 61, 26446. There are also other similar situations.\r
+         * In those cases, there will be some problems when using tmpCount for decision.\r
+         * */\r
+        //int tmpCount = 0;//TODO: tmpCount's init value is 0, based on that port number begins from 1. Always ok?\r
         for(int i = 0; i < tableVars.size(); i++){\r
             SNMPSequence pair = (SNMPSequence)(tableVars.getSNMPObjectAt(i));\r
             SNMPObjectIdentifier snmpOID = (SNMPObjectIdentifier)pair.getSNMPObjectAt(0);\r
@@ -2091,12 +2099,12 @@ public class SNMPHandler{
                 logger.debug("ERROR: readPortStateEntries(): for node {}, call retrievePortNumFromChassisOIDAtEnd(), given snmpOIDstr {}, fail", comInterface.getHostAddress(), snmpOIDstr);\r
                 return null;\r
             }\r
-            if(portNum != tmpCount + 1){\r
-                logger.trace("readPortStateEntries(): for node {}, the {} port state entries, port {} is followed by port {}, so skip the ports afterward", comInterface.getHostAddress(), tmpCount, portNum);\r
-                return table;\r
-            }\r
-            else\r
-                tmpCount = portNum;\r
+            //if(portNum != tmpCount + 1){\r
+            //    logger.trace("readPortStateEntries(): for node {}, the {} port state entries, port {} is followed by port {}, so skip the ports afterward", comInterface.getHostAddress(), tmpCount, portNum);\r
+            //    return table;\r
+            //}\r
+            //else\r
+            //    tmpCount = portNum;\r
 \r
             int valueInt = ((BigInteger)value.getValue()).intValue();\r
 \r