Skip to content

NMS-18059: Fix LLDP handling for SNMP agents from Planet and Microsense #7776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 8, 2025

Conversation

rssntn67
Copy link
Contributor

@rssntn67 rssntn67 commented Jun 24, 2025

This PR regards an issue related to couple of devices supporting lldp MIB.

The devices are Microsense and Planet.

In particular Planet reports mac addresses using the - So mac address 00:00:00:00:00:00 is reported ad 00-00-00-00-00-00.
So first of all I moved all the methods to decode from snmp agent into SnmpLldpUtils class. I guess that is a better place, before where in the tracker classes. Because of weird snmp agent implementation I have moved all the stuff converting snmp data into proper string in one place.

The Microsense also has wrong decoding of the LLDP mib and data needs to be properly decoded. Inparticular Hex Strings are coded as Strings.

finally I have reworked the LldpServiceImpl this class is fundamental to produce topology used in topology maps. I have reworked the class to let find links in more ways. Also to support Microsense to Microsense Lldp links beceuase I found that there is a bug in the lldp oimplementation reporting the wrong port on sides.

I ave run all the IT test of enlinkd and everything is fine.

Also I changed some Thread.sleep statements from 1000ms to 200ms to speed up test running

https://opennms.atlassian.net/browse/NMS-18059

rssntn67 added 4 commits June 24, 2025 14:44
Therad.sleep from 1000 to 20 ms
The data collection fails for errors
Also fixed mac addresses with dash instead of other separator
Added more matchable criteria for topology link
Micro sense Lldp snmp data present wrong informatiopn on lldptable
Copy link
Contributor

@cgorantla cgorantla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rssntn67 Can you update description on what you are trying to fix in this PR.

I see some common utils getting refactoring to LldpSnmpUtils. Other than that what else is important to review here ?

Also we require a JIRA issue for this contribution. Let me know if you need any help here.

@marshallmassengill
Copy link
Contributor

I appreciate this contribution @rssntn67! I really appreciate the work on the "formatMacAddress" function. Will be good to see that working. Let us know if you need any help with the items @cgorantla mentioned.

@rssntn67
Copy link
Contributor Author

I appreciate this contribution @rssntn67! I really appreciate the work on the "formatMacAddress" function. Will be good to see that working. Let us know if you need any help with the items @cgorantla mentioned.

I have updated the informations. It is a work I've done a coule of months ago. I guess it is all.
The main problem with planet and micro sense is decondig properly the mac addresses they provide.

@rssntn67
Copy link
Contributor Author

@rssntn67 Can you update description on what you are trying to fix in this PR.

I see some common utils getting refactoring to LldpSnmpUtils. Other than that what else is important to review here ?

Also we require a JIRA issue for this contribution. Let me know if you need any help here.

Done

@rssntn67 rssntn67 changed the title Fix lldp enlinkd NMS-18059: Fix Lldp Snmp Planet and Microsense Jun 28, 2025
@marshallmassengill
Copy link
Contributor

@rssntn67, how are the MAC addresses stored in the database? Is it as collected from the devices or are they decoded and sanitized before storing?

@rssntn67
Copy link
Contributor Author

rssntn67 commented Jul 3, 2025

@rssntn67, how are the MAC addresses stored in the database? Is it as collected from the devices or are they decoded and sanitized before storing?

Well, they are decoded ad sanitized and the final format is "001122334455", but on the other end if the sanitation does not work I store the string. In the case of planet the data was formatted as a string:
00-11-22-33-44-55, and I add to the method now also the replace for - with blanck, as is was for ":" and so on.

@rssntn67 rssntn67 requested a review from cgorantla July 7, 2025 13:01
Copy link
Contributor

@christianpape christianpape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a few minor things to change...

rssntn67 and others added 11 commits July 7, 2025 15:46
…ennms/netmgt/enlinkd/snmp/LldpSnmpUtils.java

Co-authored-by: Christian Pape <[email protected]>
…ennms/netmgt/enlinkd/snmp/LldpSnmpUtils.java

Co-authored-by: Christian Pape <[email protected]>
…ennms/netmgt/enlinkd/snmp/LldpSnmpUtils.java

Co-authored-by: Christian Pape <[email protected]>
…ennms/netmgt/enlinkd/snmp/LldpSnmpUtils.java

Co-authored-by: Christian Pape <[email protected]>
…ennms/netmgt/enlinkd/snmp/LldpSnmpUtils.java

Co-authored-by: Christian Pape <[email protected]>
…/enlinkd/service/impl/LldpTopologyServiceImpl.java

Co-authored-by: Christian Pape <[email protected]>
…/enlinkd/service/impl/LldpTopologyServiceImpl.java

Co-authored-by: Christian Pape <[email protected]>
…/enlinkd/service/impl/LldpTopologyServiceImpl.java

Co-authored-by: Christian Pape <[email protected]>
…/enlinkd/service/impl/LldpTopologyServiceImpl.java

Co-authored-by: Christian Pape <[email protected]>
…/enlinkd/service/impl/LldpTopologyServiceImpl.java

Co-authored-by: Christian Pape <[email protected]>
…/enlinkd/service/impl/LldpTopologyServiceImpl.java

Co-authored-by: Christian Pape <[email protected]>
christianpape
christianpape previously approved these changes Jul 7, 2025
Copy link
Contributor

@christianpape christianpape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.


public static String getInterface(SnmpValue snmpValue) {
if (snmpValue == null )
return "Null";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this custom null ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is simply a way of returning the value in the database.
It looks better in UI.

} catch (Exception e) {
LOG.debug("getNetworkAddress: not valid {}", snmpValue.toDisplayString());
}
return "Not Valid";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to throw exception instead of custom return values or use Optional ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is simply a way of returning the value in the database.
It looks better in UI.
If I throw the exception then I have to forgot the data.
Too many weird Snmp implementation of Lldp.
The most important is having data saved.

Use brackets for if
Let reg expression be constant
Copy link
Contributor

@cgorantla cgorantla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thanks for your contribution.

@indigo423 indigo423 changed the title NMS-18059: Fix Lldp Snmp Planet and Microsense NMS-18059: Fix LLDP handling for SNMP agents from Planet and Microsense Jul 7, 2025
@christianpape christianpape merged commit 8974477 into OpenNMS:develop Jul 8, 2025
17 checks passed
@rssntn67 rssntn67 deleted the fix-lldp-enlinkd branch July 8, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants