-
Notifications
You must be signed in to change notification settings - Fork 42
Add endpoint for the NetboxEntity model #3404
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
Conversation
b87ccd6 to
9c45bd1
Compare
Test results 12 files 12 suites 11m 59s ⏱️ Results for commit b746445. ♻️ This comment has been updated with latest results. |
Getting the serialnumber is prob useful here
9c730db to
d7eab32
Compare
d7eab32 to
d223a05
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just nitpicks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Just minimal doc nitpicks, methinks...
|
Though, I must confess I'm not a fan of throwing around the magic numbers of entPhysicalClass outside of the NAV DB storage or MIB system. I might be interested in having the It's hard for us to control whether the MIB is updated and adds new enumerations values, though, and I'm not sure if Django models can specify that a field is allowed to take integers we have no mapping for... any idea, @hmpf ? |
Not enough context. What's mapping to what? In Django there's hardcoded choices with I don't have the context to know how many tables or if proxying would work or if any other data is needed per table. |
|
A lookup table can be (natural key=primary key, mappings*) or (primary key, natural key, mappings*), the latter would hide the actual magical number but the field would need its own index. |
|
On reload/restart of nav you could have something that looks up the magic number and its mappings in the relevant MIB(s) and alters the lookup table accordingly. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy, but leaving this in "Ready for Review" for @lunkwill42 or @hmpf for the entPhysicalClass details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3404 +/- ##
==============================
==============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Upon closer examination, I don't think we need the lookup table after all. We already have a value mapping in the Django Model field, We should probably modify the endpoint slightly to include also the human-readable name of the classifier, @stveit |

Fixes #3378
Quick implementation of an endpoint for getting NetboxEntity data.
Filters can easily be expanded by adding more fields to
filterset_fields.The data you get out can be modified via the serializer. I've added an Inline serializer for device so you get the serialnumber directly for each entity since that will probably be useful for syncing to netbox. If you need more netbox data then that can be added as inline in a similar way
Added two simple tests. Not huge test coverage but will at least act as a blueprint to make more tests if needed