added handling of "dormant" and "not present" interface states (issue #NX-1143)
authorVictor Kirhenshtein <victor@netxms.org>
Fri, 11 Aug 2017 17:13:44 +0000 (20:13 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Fri, 11 Aug 2017 17:14:05 +0000 (20:14 +0300)
ChangeLog
include/nxcldefs.h
src/java/client/netxms-client/src/main/java/org/netxms/client/objects/Interface.java
src/java/netxms-eclipse/ObjectView/src/org/netxms/ui/eclipse/objectview/objecttabs/helpers/InterfaceListLabelProvider.java
src/server/core/interface.cpp
src/server/libnxsrv/ndd.cpp
webui/webapp/ObjectView/src/org/netxms/ui/eclipse/objectview/objecttabs/helpers/InterfaceListLabelProvider.java

index 9e46018..5be5d76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,12 +8,13 @@
 - Fixed unrestricted node poller queue growth when discovery from SNMP traps or syslog is on
 - Server's database password can be supplied by external tool
 - Fixed OpenBSD compatibility issues
+- Correct handling of "dormant" and "not present" interface operational states
 - NXSL:
        - New class "InetAddress"
        - New attribute "ipAddressList" for class "Interface"
 - Management console:
        - Improved status map
-- Fixed issues: NX-930, NX-1263, NX-1272, NX-1273, NX-1278, NX-1281, NX-1284, NX-1285
+- Fixed issues: NX-930, NX-1143, NX-1263, NX-1272, NX-1273, NX-1278, NX-1281, NX-1284, NX-1285
 
 *
 * 2.1
index bc05e55..e2bdc91 100644 (file)
@@ -277,10 +277,12 @@ enum InterfaceAdminState
  */
 enum InterfaceOperState
 {
-   IF_OPER_STATE_UNKNOWN = 0,
-   IF_OPER_STATE_UP      = 1,
-   IF_OPER_STATE_DOWN    = 2,
-   IF_OPER_STATE_TESTING = 3
+   IF_OPER_STATE_UNKNOWN     = 0,
+   IF_OPER_STATE_UP          = 1,
+   IF_OPER_STATE_DOWN        = 2,
+   IF_OPER_STATE_TESTING     = 3,
+   IF_OPER_STATE_DORMANT     = 4,
+   IF_OPER_STATE_NOT_PRESENT = 5
 };
 
 /**
index 476c627..a59b11d 100644 (file)
@@ -54,6 +54,8 @@ public class Interface extends GenericObject
        public static final int OPER_STATE_UP            = 1;
        public static final int OPER_STATE_DOWN          = 2;
        public static final int OPER_STATE_TESTING       = 3;
+   public static final int OPER_STATE_DORMANT       = 4;
+   public static final int OPER_STATE_NOT_PRESENT   = 5;
 
    public static final int EXPECTED_STATE_UP        = 0;
    public static final int EXPECTED_STATE_DOWN      = 1;
@@ -86,7 +88,9 @@ public class Interface extends GenericObject
                        "UNKNOWN",
                        "UP",
                        "DOWN",
-                       "TESTING"
+                       "TESTING",
+                       "DORMANT",
+                       "NOT PRESENT"
                };
        private static final String[] paeStateText =
                {
index 1003277..d739d98 100644 (file)
@@ -192,6 +192,10 @@ public class InterfaceListLabelProvider extends LabelProvider implements ITableL
                                                return StatusDisplayInfo.getStatusColor((iface.getAdminState() == Interface.ADMIN_STATE_DOWN) ? ObjectStatus.DISABLED : ObjectStatus.CRITICAL);
                                        case Interface.OPER_STATE_TESTING:
                                                return StatusDisplayInfo.getStatusColor(ObjectStatus.TESTING);
+               case Interface.OPER_STATE_DORMANT:
+                  return StatusDisplayInfo.getStatusColor(ObjectStatus.MINOR);
+               case Interface.OPER_STATE_NOT_PRESENT:
+                  return StatusDisplayInfo.getStatusColor(ObjectStatus.DISABLED);
                                }
                                return StatusDisplayInfo.getStatusColor(ObjectStatus.UNKNOWN);
                        case InterfacesTab.COLUMN_ADMIN_STATE:
index fe1acea..cf446a8 100644 (file)
@@ -567,11 +567,17 @@ void Interface::statusPoll(ClientSession *session, UINT32 rqId, Queue *eventQueu
                   expectedState = IF_EXPECTED_STATE_DOWN;
                   setExpectedState(expectedState);
                }
-                                       newStatus = ((expectedState == IF_EXPECTED_STATE_UP) ? STATUS_CRITICAL : STATUS_NORMAL);
+                                       newStatus = (expectedState == IF_EXPECTED_STATE_UP) ? STATUS_CRITICAL : STATUS_NORMAL;
                                        break;
                                case IF_OPER_STATE_TESTING:
                                        newStatus = STATUS_TESTING;
                                        break;
+                               case IF_OPER_STATE_DORMANT:
+               newStatus = (expectedState == IF_EXPECTED_STATE_UP) ? STATUS_MINOR : STATUS_NORMAL;
+               break;
+            case IF_OPER_STATE_NOT_PRESENT:
+               newStatus = STATUS_DISABLED;
+               break;
                                default:
                                        newStatus = STATUS_UNKNOWN;
                                        break;
index 992a4ab..65d9318 100644 (file)
@@ -591,15 +591,21 @@ void NetworkDeviceDriver::getInterfaceState(SNMP_Transport *snmp, StringMap *att
          SnmpGet(snmp->getSnmpVersion(), snmp, oid, NULL, 0, &state, sizeof(UINT32), 0);
          switch(state)
          {
+            case 1:
+               *operState = IF_OPER_STATE_UP;
+               break;
+            case 2:  // down: interface is down
+            case 7:  // lowerLayerDown: down due to state of lower-layer interface(s)
+               *operState = IF_OPER_STATE_DOWN;
+               break;
             case 3:
                                        *operState = IF_OPER_STATE_TESTING;
                break;
-            case 2:  // down: interface is down
-                               case 7: // lowerLayerDown: down due to state of lower-layer interface(s)
-                                       *operState = IF_OPER_STATE_DOWN;
+            case 5:
+               *operState = IF_OPER_STATE_DORMANT;
                break;
-            case 1:
-                                       *operState = IF_OPER_STATE_UP;
+            case 6:
+               *operState = IF_OPER_STATE_NOT_PRESENT;
                break;
             default:
                                        *operState = IF_OPER_STATE_UNKNOWN;
index ada243a..baa14a7 100644 (file)
@@ -192,6 +192,10 @@ public class InterfaceListLabelProvider extends LabelProvider implements ITableL
                                                return StatusDisplayInfo.getStatusColor((iface.getAdminState() == Interface.ADMIN_STATE_DOWN) ? ObjectStatus.DISABLED : ObjectStatus.CRITICAL);
                                        case Interface.OPER_STATE_TESTING:
                                                return StatusDisplayInfo.getStatusColor(ObjectStatus.TESTING);
+               case Interface.OPER_STATE_DORMANT:
+                  return StatusDisplayInfo.getStatusColor(ObjectStatus.MINOR);
+               case Interface.OPER_STATE_NOT_PRESENT:
+                  return StatusDisplayInfo.getStatusColor(ObjectStatus.DISABLED);
                                }
                                return StatusDisplayInfo.getStatusColor(ObjectStatus.UNKNOWN);
                        case InterfacesTab.COLUMN_ADMIN_STATE: