Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

POC: Experimental support for upcoming NetBox v3.2 release #128

Merged

Conversation

jeremystretch
Copy link
Contributor

@jeremystretch jeremystretch commented Feb 9, 2022

Hi folks! As we approach the first beta release for NetBox v3.2, which introduces a greatly extended plugins API, I took a stab at updating this plugin to use the newly available resources. This PR is submitted as a proof of concept only and should not be treated as an actual proposed change at this time. (I based this PR off of the main branch as it appears that develop is no longer in use. Is that correct?)

While this work has uncovered a few minor tweaks/extensions needed in the new plugins framework, I'm pretty happy with how smooth the implementation went overall. I've included a summary of the changes made thus far below. I would very much appreciate feedback: Did I miss anything? Is there something we could handle better? Do you foresee any issues with this approach? Let me know and we'll get it sorted. Thanks!

Summary

  • Add a migration for NetBox v3.2 model changes
    • created is now a DateTimeField on all change-logged models
    • Remove the blank=True attribute from tag managers (cosmetic change)
    • Remove tags and objects attributes (now inherited from NetBoxModel), except where custom
  • Models
    • Replace PrimaryModel with NetBoxModel
    • Remove calls to extras_features() (features are not provided by NetBoxModel)
  • Views
    • Update path to ObjectChangeLogView
  • Form classes
    • Replace the local BulkEditForm with NetBoxModelBulkEditForm
    • Remove the pk fields (inherited from NetBoxModelBulkEditForm)
    • Remove Meta classes and set model on bulk edit forms
  • FilterSet classes
    • Replace PrimaryModelFilterSet with NetBoxModelFilterSet
    • Remove the tags filter declarations (inherited from NetBoxModelFilterSet)
  • Tables
    • Replace BaseTable with NetBoxTable
    • Remove pk column (inherited from NetBoxTable)
    • Replace calls to old configure_table() utility with table.configure()
  • Templates
    • Replace local object.html with generic/object.html
    • Replace local object_list.html with generic/object_list.html
    • Replace record_list.html and managed_record_list.html with generic/object_list.html
      • Removed the add & import buttons by setting action_buttons on the views
      • We don't yet have a way to toggle the display of the bulk edit/delete buttons beneath the table
    • Replace paginate_table() with configure_table() (not yet officially supported)
  • Miscellaneous
    • Removed obsolete template tags (replicated from NetBox)

@jeremystretch jeremystretch marked this pull request as draft February 9, 2022 17:06
@peteeckel
Copy link
Contributor

thanks a lot for this! I hope I'll find the time to experiment with your code over the weekend and will provide some more detailed feedback as soon as I can manage. From looking at the code alone, the new interfaces look really promising and much cleaner than the former unsupported tweaks we used.

You're correct in your observation that develop hasn't been updating lately, I think the maintainers should update the developer documentation accordingly (or change the process) - @hbasria, @hatsat32, any thoughts on this?

@hatsat32
Copy link
Collaborator

Hi all! Sorry for the late response.

Yes, we haven't been using the dev brand for a while. I tried to use gitflow but it does not work for me. I think I can update CONTRIBUTING.md if it is OK for you.

Thanks, @jeremystretch. Your changes look good. The new plugin framework looks really promising. I tested changes with the netbox feature branch and it worked really well with a few small changes. Here are the changes I did.

  • replace configure_table(tablename, request) with tablename.configure(request)
  • replece Zone.CHOICES with netbox's ChoiceSet
  • delete templatetags/view_helpers.py we don't need that file anymore

@hatsat32
Copy link
Collaborator

I think we can start implementing the new netbox plugin framework based on this PR. I created a new branch named netbox32-changes. @jeremystretch can you please change the target branch to netbox32-changes so we can merge.

Again thanks a lot.

@jeremystretch jeremystretch changed the base branch from main to netbox32-changes February 15, 2022 18:16
@jeremystretch jeremystretch marked this pull request as ready for review February 15, 2022 18:46
@jeremystretch
Copy link
Contributor Author

@peteeckel @hatsat32 thanks! I've pushed the changes mentioned above to bring this up to date with NetBox's current feature branch. I plan to release the first beta for v3.2 today or tomorrow, so this should be reasonably complete if you'd like to merge it into the local netbox32-changes branch.

@hatsat32
Copy link
Collaborator

Thanks, @jeremystretch great job. Please give me a few days so that I can review the changes.

@jeremystretch
Copy link
Contributor Author

@hatsat32 let me know if I can be of any help!

@hatsat32
Copy link
Collaborator

CI/CD fails because the current test implementation uses netbox master branch but it is OK.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants