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

Adding an initial '.' to a sysObjectID value in NAV's type registry prevents ipdevpoll and SeedDB from detecting the vendor ID properly #2566

Closed
lunkwill42 opened this issue Feb 3, 2023 · 1 comment · Fixed by #2584
Assignees
Labels

Comments

@lunkwill42
Copy link
Member

Describe the bug

A customer accidentally changed the sysObjectID value of one of the Netbox Type entries in SeedDB. Changing it back, a leading . was added to the sysObjectID value. While this seems perfectly reasonable (seeing as how this is normally how OIDs are presented), NAV's type registry has the quirk that sysObjectID values must be entered without the leading dot.

However, there is nothing that verifies the value or gives any user feedback about invalid values.

It turns out NetboxType.get_enterprise_id() doesn't handle a sysObjectID value with a leading dot, and returns None rather than a proper enterprise id number (like 9 for Cisco).

This in turn causes ipdevpoll to be unable to detect the proper vendor for devices of this type. Many ipdevpoll plugins will therefore opt to not select vendor-specific MIBs, causing various functionality to fail (such as vendor specific sensor collection, CPU and memory collection, or even power supply and fan monitoring).

Another quirk that appears when this happens, is that SeedDB is now unable to detect an existing type entry for devices of this type when using the "check connectivity" button (even though the IP Device is already associated with the correct type entry).

To Reproduce

  1. Find any IP device with vendor specific support in NAV (e.g. Cisco)
  2. Find the IP device's associated type entry in SeedDB
  3. Edit the type's sysObjectID value, prefixing the existing value with a leading .
  4. Run ipdevpoll collection
  5. Observe that vendor-specific functionality stops working

Expected behavior

  1. NetboxType.get_enterprise_id() should be able to detect an enterprise id from a sysObjectID with a leading .

  2. SeedDB should be able to associate a collected sysObjectID value with one from the type registry, even if it is stored with a leading ..

  3. Optionally, SeedDB and the Type model should refuse to accept values with a leading . if this isn't supposed to work.

Environment (please complete the following information):

  • NAV version installed: 5.6.0
@lunkwill42 lunkwill42 added the bug label Feb 3, 2023
@lunkwill42
Copy link
Member Author

This method explicitly only checks for a non-dotted enterprise prefix:

def get_enterprise_id(self):
"""Returns the type's enterprise ID as an integer.
The type's sysobjectid should always start with
SNMPv2-SMI::enterprises (1.3.6.1.4.1). The next OID element will be
an enterprise ID, while the remaining elements will describe the type
specific to the vendor.
"""
prefix = u"1.3.6.1.4.1."
if self.sysobjectid.startswith(prefix):
specific = self.sysobjectid[len(prefix) :]
enterprise = specific.split('.')[0]
return int(enterprise)

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 a pull request may close this issue.

2 participants