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

Introduction of Provider Networks #1144

Merged
merged 14 commits into from
Jan 21, 2022

Conversation

johannwagner
Copy link
Contributor

@johannwagner johannwagner commented Dec 9, 2021

Fixes: #724

This pull request introduces the functionality of Provider Networks. They are known from Netbox.

TODOs:

  • Migrate Tests
  • Confirm full functionality of Provider Networks

@johannwagner
Copy link
Contributor Author

Currently, I am blocked by #1137 since I am not able to test this feature properly, I guess.

@johannwagner johannwagner marked this pull request as ready for review December 9, 2021 17:14
@glennmatthews glennmatthews marked this pull request as draft December 9, 2021 18:43
@glennmatthews
Copy link
Contributor

Hi @johannwagner, it appears that #1137 was fixed by #1145. If you update your branch to pull in latest develop content, you should be able to proceed with testing. Thank you for taking on this effort!

@johannwagner
Copy link
Contributor Author

I rebased my work and it seems to work similar to the Netbox implementation.

I think, I want to keep this seperate. We want to implement @chadell idea for our own purposes but I would like to merge this PR first and add the IP Range association within another PR.

@johannwagner
Copy link
Contributor Author

What is needed to merge this?

Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

Comments from a first review (not complete)

nautobot/circuits/forms.py Outdated Show resolved Hide resolved
nautobot/circuits/migrations/0005_auto_20211209_1421.py Outdated Show resolved Hide resolved
nautobot/circuits/models.py Show resolved Hide resolved
nautobot/circuits/models.py Outdated Show resolved Hide resolved
nautobot/dcim/tests/test_models.py Outdated Show resolved Hide resolved
nautobot/circuits/tests/test_api.py Outdated Show resolved Hide resolved
nautobot/circuits/tests/test_api.py Outdated Show resolved Hide resolved
nautobot/circuits/api/nested_serializers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@glennmatthews glennmatthews left a comment

Choose a reason for hiding this comment

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

Thank you for the extensive pull request!

nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/tests/test_filters.py Outdated Show resolved Hide resolved
nautobot/circuits/tests/test_filters.py Outdated Show resolved Hide resolved
nautobot/circuits/urls.py Outdated Show resolved Hide resolved
nautobot/circuits/views.py Outdated Show resolved Hide resolved
nautobot/docs/models/circuits/circuittermination.md Outdated Show resolved Hide resolved
@johannwagner
Copy link
Contributor Author

johannwagner commented Jan 13, 2022

ToDo-List:

  • Implementing a slug as a natural key
  • Adding comments as an optional column to table
  • Revisit Circuit Termination string method

@johannwagner
Copy link
Contributor Author

johannwagner commented Jan 13, 2022

Okay, thanks for your reviews. I think, I covered every single review comment and we should be ready to merge 🎉

nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/api/serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/api/nested_serializers.py Outdated Show resolved Hide resolved
nautobot/circuits/filters.py Outdated Show resolved Hide resolved
"webhooks",
)
class ProviderNetwork(PrimaryModel):
name = models.CharField(max_length=100, unique=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think unique=True is incorrect here as below you're defining the unique_together = ("provider", "name") - it should be permissible to use the same name across different providers, I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are using this as a base for our slug, which needs to be unique, we may also want to enforce it here.
If it is no problem for the slug handling, I am happy to remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

AutoSlugField is supposed to automatically handle uniqueness at creation time - IIRC if you create Provider 1 Network "Alpha" (slug alpha) and Provider 2 Network "Alpha" (slug alpha) the latter will automatically become slug alpha1 so as to have a unique slug - but by all means please try it out to confirm.

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 does not get automagically changed, but the creation gives a reasonable error.

nautobot/circuits/models.py Show resolved Hide resolved
nautobot/circuits/models.py Show resolved Hide resolved
nautobot/circuits/tables.py Show resolved Hide resolved
@glennmatthews
Copy link
Contributor

Getting nearly there!

Shoot - I just realized that this should be a PR against next rather than develop since it's a new feature. Can you please make any necessary changes to your branch and retarget the PR accordingly?

Thank you!

@johannwagner johannwagner changed the base branch from develop to next January 14, 2022 21:50
@johannwagner
Copy link
Contributor Author

Okay, should there be any needed changes? I switched the base branch and it seems to merge fine. I did not test it, will do tomorrow.

@johannwagner
Copy link
Contributor Author

I will also fix tests tomorrow.

@johannwagner
Copy link
Contributor Author

Unit tests work on my local machine, hopefully CI is also happy about them.

@glennmatthews
Copy link
Contributor

Looks like the migrations file needs to be renumbered/regenerated so as not to conflict with the migration introduced in #1107. Sorry for the trouble!

Copy link
Contributor

@jathanism jathanism left a comment

Choose a reason for hiding this comment

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

Really great contribution but I have some specific requests. Thanks!

nautobot/circuits/models.py Show resolved Hide resolved
nautobot/circuits/models.py Show resolved Hide resolved
nautobot/circuits/migrations/0004_providernetworks.py Outdated Show resolved Hide resolved
nautobot/circuits/migrations/0004_providernetworks.py Outdated Show resolved Hide resolved
nautobot/circuits/models.py Outdated Show resolved Hide resolved
nautobot/circuits/tables.py Outdated Show resolved Hide resolved
@johannwagner
Copy link
Contributor Author

@jathanism Thanks for your comments. I mostly only ported the code from Netbox, so I am not that deep in all thought processes but I will do my best to resolve your concerns.

@johannwagner
Copy link
Contributor Author

Okay, I added the feedback from @jathanism and rebased the branch to next for a better overview. I think, I need another CI run to make sure, everything is sorted now.

Copy link
Contributor

@jathanism jathanism left a comment

Choose a reason for hiding this comment

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

Thank you for taking the time to port this over from the NetBox community. Great work!

@johannwagner
Copy link
Contributor Author

I enjoyed this one! Thanks for the great community experience and your time and effort! Looking forward to ship this!

Copy link
Contributor

@glennmatthews glennmatthews left a comment

Choose a reason for hiding this comment

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

Great work!

@glennmatthews glennmatthews merged commit 38f4b81 into nautobot:next Jan 21, 2022
timizuoebideri1 pushed a commit that referenced this pull request Feb 9, 2022
* Initial port of netbox-community/netbox#6011

* Added tests and fixed occuring bugs by adding tests

* Fixed Linting

* Applied review feedback

* Merged migrations

* Renaming providernetwork to provider_network

* Fixing weight on navigation

* Added slug field for natural keys and applied feedback from review

* Fixed Linting

* Fixed provider network template to only overwrite sub parts

* Fixing unit tests and applied feedback

* Fixed up migrations after rebasing for next

* Applied feedback

* Fixed Linting
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.

Porting of Provider Network Model
4 participants