On Mon, Sep 29, 2008 at 7:27 AM, Alex Bennee <[EMAIL PROTECTED]> wrote:

> 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?


I'm not sure I understand the exact problem you are trying to solve.  Is the
importer failing to set the isSnmpPrimary flag on interfaces?



> ---
>  .../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();



If the importer doesn't set the flag then the above certainly won't fix it?

Again if you could be the detailed explanation of the bug then I could
validate this patch there?

Thanks for your contribution!

Matt Brozowski
-------------------------------------------------------------------------
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