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

Added support for Config Context with Dynamic Groups #3182

Merged
merged 86 commits into from
Mar 3, 2023

Conversation

bile0026
Copy link
Contributor

@bile0026 bile0026 commented Jan 27, 2023

Closes: #3271

What's Changed

Add functionality to apply config context items based on dynamic groups. This new feature is feature flagged with the CONFIG_CONTEXT_DYNAMIC_GROUPS_ENABLED in nautobot.core.settings.

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • Example Plugin Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@bile0026 bile0026 changed the title Config context dg Config context with Dynamic Groups Jan 27, 2023
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.

Thanks for the pull request!

nautobot/extras/filters/__init__.py Outdated Show resolved Hide resolved
nautobot/extras/migrations/0003_initial_part_3.py Outdated Show resolved Hide resolved
nautobot/extras/models/models.py Outdated Show resolved Hide resolved
nautobot/extras/querysets.py Outdated Show resolved Hide resolved
nautobot/extras/templates/extras/configcontext.html Outdated Show resolved Hide resolved
@bile0026 bile0026 marked this pull request as ready for review February 1, 2023 20:11
changes/3182.added Outdated Show resolved Hide resolved
@gsnider2195
Copy link
Contributor

Can you update these tests in nautobot/extras/tests/test_models.py?

  • ConfigContextTest.test_annotation_same_as_get_for_object_device_relations
  • ConfigContextTest.test_annotation_same_as_get_for_object_virtualmachine_relations

This would probably be a good candidate for a new test to ensure the filtering is working properly:

  • DeviceA is a member of DynamicGroupA that's tied to ConfigContextA
  • DeviceB is a member of DynamicGroupB that's tied to ConfigContextB
  • Make sure DeviceA.get_config_context() returns ConfigContextA data but not ConfigContextB and vice versa for DeviceB

Copy link
Contributor

@gsnider2195 gsnider2195 left a comment

Choose a reason for hiding this comment

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

Just need to add some tests and update the filter name and should be good to go

nautobot/docs/models/extras/configcontext.md Outdated Show resolved Hide resolved
nautobot/extras/models/models.py Outdated Show resolved Hide resolved
bile0026 and others added 5 commits March 1, 2023 13:56
Co-authored-by: Jathan McCollum <jathan@gmail.com>
Co-authored-by: Jathan McCollum <jathan@gmail.com>
Co-authored-by: Jathan McCollum <jathan@gmail.com>
Co-authored-by: Jathan McCollum <jathan@gmail.com>
nautobot/core/settings.py Show resolved Hide resolved
nautobot/docs/models/extras/configcontext.md Outdated Show resolved Hide resolved
nautobot/extras/tests/test_api.py Outdated Show resolved Hide resolved
nautobot/extras/tests/test_api.py Outdated Show resolved Hide resolved
nautobot/extras/tests/test_filters.py Outdated Show resolved Hide resolved
nautobot/extras/tests/test_filters.py Outdated Show resolved Hide resolved
nautobot/extras/tests/test_forms.py Outdated Show resolved Hide resolved
nautobot/docs/configuration/optional-settings.md Outdated Show resolved Hide resolved
nautobot/docs/configuration/optional-settings.md Outdated Show resolved Hide resolved
nautobot/docs/models/extras/configcontext.md Outdated Show resolved Hide resolved
bile0026 and others added 3 commits March 2, 2023 13:34
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
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.

Sorry to put a hold on this for the moment - see my comment about the API. Hopefully we'll have an answer to that point shortly!

nautobot/extras/api/serializers.py Show resolved Hide resolved
@bryanculver bryanculver mentioned this pull request Mar 3, 2023
5 tasks
Copy link
Contributor

@gsnider2195 gsnider2195 left a comment

Choose a reason for hiding this comment

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

Please squash the migrations into one if possible

@bryanculver bryanculver dismissed gsnider2195’s stale review March 3, 2023 20:29

Change requested (squash migrations) addressed.

@bryanculver bryanculver merged commit be33fbe into nautobot:develop Mar 3, 2023
@glennmatthews
Copy link
Contributor

see #3432.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Config Contexts: Allow Filtering by Dynamic Group Membership
6 participants