I was having a problem with nodes imported by the model importer not
listing showing the SNMP interface correctly if it failed to read the
ifTable on import.

There doesn't seem to be any particular reason to pull it out while
enumerating the interfaces if it can be set earlier. Comments?

Patch bellow:

>From 9fa52fe21365617bd985eabbb1c26462edfffd41 Mon Sep 17 00:00:00 2001
From: Alex Bennee <[EMAIL PROTECTED]>
Date: Mon, 29 Sep 2008 12:24:14 +0100
Subject: [PATCH] CBNL: Ensure isSnmpPrimary is picked up even if there hasn't 
been a succesful scan of node on import

---
 .../opennms/web/element/NetworkElementFactory.java |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git 
a/opennms-webapp/src/main/java/org/opennms/web/element/NetworkElementFactory.java
 
b/opennms-webapp/src/main/java/org/opennms/web/element/NetworkElementFactory.java
index 562727d..2a71b72 100644
--- 
a/opennms-webapp/src/main/java/org/opennms/web/element/NetworkElementFactory.java
+++ 
b/opennms-webapp/src/main/java/org/opennms/web/element/NetworkElementFactory.java
@@ -984,6 +984,15 @@ public class NetworkElementFactory extends Object {
                 intf.m_isManaged = ((String) element).charAt(0);
             }
 
+            // isSnmpPrimary may not get picked up if the initial collection 
failed
+            // (e.g. the node was down at the time of import) If we don't fill 
in the
+            // info here it will get lost
+            element = rs.getString("isSnmpPrimary");
+            if (element != null) {
+                intf.m_isSnmpPrimary = (String) element;
+            }
+            
+            
             element = rs.getTimestamp("ipLastCapsdPoll");
             if (element != null)
                 intf.m_ipLastCapsdPoll = Util.formatDateToUIString(new 
Date(((Timestamp) element).getTime()));
@@ -1028,7 +1037,7 @@ public class NetworkElementFactory extends Object {
                 pstmt = conn.prepareStatement("SELECT issnmpprimary FROM 
ipinterface WHERE nodeid=? AND ifindex=? AND ipaddr=?");
                 pstmt.setInt(1, intfs[i].getNodeId());
                 pstmt.setInt(2, intfs[i].getIfIndex());
-               pstmt.setString(3, intfs[i].getIpAddress());
+                pstmt.setString(3, intfs[i].getIpAddress());
 
                 rs = pstmt.executeQuery();
 
-- 
1.6.0.rc1.208.gc71e9



-- 
Alex Bennee, Software Engineer
No, that'd be silly. -- Larry Wall in <[EMAIL PROTECTED]>


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to