Skip to content
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

Fix broken serial numbers for Juniper, APC PowerNet and old HP devices #2252

Merged
merged 1 commit into from Jan 14, 2021

Conversation

lunkwill42
Copy link
Member

Due to the shift to Python 3, lots of collected serial numbers would now appear as b'actual-serial-number' in NAV, particularly for Juniper device, APC PDUs and older HP switches.

Table-based MIB object retrieval will compensate for this by recognizing retrieved columns that have a syntax equivalent to DisplayString, converting these bytestrings on the fly to Python strings.

However, the methods used to retrieve serial numbers for these devices/vendors used a more low-level SNMP call, which is not imbued with MIB object syntax knowledge, and hence did not attempt to translate the result values to actual strings.

Because:
- The get_serial_number API is expected to return a string, not a bytes
  object.
- These MibRetriever implementations used the get_next() call
  directly. This call is not imbued with knowledge about which response
  OIDs can be considered text and which cannot, so all strings are
  essentially returned as bytes.
- This caused serial numbers for all old HP switches, all Juniper
  equipment and PowerNET PDU's to appear as b'real-serial-num' in NAV.
@lunkwill42 lunkwill42 added the bug label Jan 13, 2021
@lunkwill42 lunkwill42 requested a review from hmpf January 13, 2021 15:21
@lunkwill42 lunkwill42 added this to the 5.1.2 milestone Jan 13, 2021
Copy link
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

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

This again, heehe :) The gift that keeps on giving.

@lunkwill42 lunkwill42 merged commit d01de95 into Uninett:5.1.x Jan 14, 2021
@lunkwill42 lunkwill42 deleted the bugfix/serialnumbers-as-bytes branch January 12, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants