Skip to content

Commit

Permalink
Merge pull request nautobot#229 from itdependsnetworks/nav
Browse files Browse the repository at this point in the history
Move navigation, fix nautobot#165, update changelog
  • Loading branch information
itdependsnetworks authored Mar 21, 2022
2 parents 5ba4054 + 7abf843 commit dfd3304
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 65 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

- #180 Added Renovate for proactive package management
- #158 Allow for Jinja2 Filters to be used by GoldenConfig templates
- #225 Added support for nautobot secrets group on git repos
- #205 Added support for multiple golden config settings
- #167 Added support for multiple repos
- #205 Added support for multiple repos via multiple golden config settings
- #206 Add Git datasource to load GC properties
- #218 Added ability to storre SoTAgg field leveraging Nautobot saved GraphQl query
- #225 Added support for nautobot secrets group on git repos

### Changed

Expand All @@ -25,13 +26,16 @@
- #190 Update to Nautobot 1.2.0
- #190 Remove Nautobot 1.0 specific code
- #211 Update dependency mariadb to v10.8
- #229 Updated navigation to a dedicated top level menu

### Fixed

- #176 Fixed Pylint issue
- #182 Add reference to Nornir plugin for installation
- #183 Fixed documentation for sot_agg_transposer default
- #184 Fix markdown links in quick-start
- #194 Detailed Error Handling in get_job_filter helper
- #229 Fixed #165, Configuration Compliance List View "Device" filter doesn't work

## v0.9.10 - 2021-11

Expand Down
4 changes: 2 additions & 2 deletions docs/navigating-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ complicated use cases, please refer to the plugin documentation linked above.

To start a backup job manually:

1. Navigate to the Plugin Home (Plugins->Home), with Home being in the `Golden Configuration` section
1. Navigate to the Plugin Home (Golden Config->Home), with Home being in the `Golden Configuration` section
2. Select _Execute_ on the upper right buttons, then _Backup_
3. Fill in the data that you wish to have backed up
4. Select _Run Job_
Expand All @@ -65,7 +65,7 @@ To start a backup job manually:
The line removals settings is a series of regex patterns to identify lines that should be removed. This is helpful as there are usually parts of the
configurations that will change each time. A match simply means to remove.

In order to specify line removals. Navigate to **Plugins -> Config Removals**. Click the **Add** button and fill out the details.
In order to specify line removals. Navigate to **Golden Config -> Config Removals**. Click the **Add** button and fill out the details.

The remove setting is based on `Platform`. An example is shown below.
![Config Removals View](./img/00-navigating-backup.png)
Expand Down
2 changes: 1 addition & 1 deletion docs/navigating-compliance-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Once the API call is made the response data provides a quick snapshot.

You can also see the compliance data in the UI once it is created via API.

In the navigation menu: `Plugins -> Configuration Compliance`.
In the navigation menu: `Golden Config -> Configuration Compliance`.

![Example Compliance Run in UI](./img/03-navigating-compliance-json.png)

Expand Down
9 changes: 5 additions & 4 deletions docs/navigating-compliance.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ In order to generate the intended configurations, a minimum of two repositories

To start a compliance job manually:

1. Navigate to the Plugin Home (Plugins->Home), with Home being in the `Golden Configuration` section
1. Navigate to `Golden Config->Home`, with Home being in the `Golden Configuration` section
2. Select _Execute_ on the upper right buttons, then _Compliance_
3. Fill in the data that you wish to have a compliance report generated for
4. Select _Run Job_
Expand Down Expand Up @@ -112,7 +112,7 @@ router bgp 65250

Configuration compliance requires the Git Repo settings for `config backups` and `intended configs`--which are covered in their respective sections--regardless if they are actually managed via the plugin or not. The same is true for the `Backup Path` and `Intended Path`.

The Configuration compliance rule map must be created per the operator/user. You can find these configurations via `Plugins -> Compliance Rules`
The Configuration compliance rule map must be created per the operator/user. You can find these configurations via `Golden Config -> Compliance Rules`
links, which brings up the specific configurations.

![Configuration Rule](./img/compliance-rule.png)
Expand Down Expand Up @@ -170,8 +170,9 @@ There is a global overview or executive summary that provides a high level snaps

## Detail Report

This can be accessed via the Plugins drop-down via `Compliance` details button. From there you can filter the devices via the form on the right side, limit the columns with the `Configure` button, or
bulk delete with the `Delete` button. Additionally each device is click-able to view the details of that individual device.
You can view the details from the `Compliance` details button within the `Configuration Compliance` table. From there you can filter the devices via the
form on the right side, limit the columns with the `Configure` button, or bulk delete with the `Delete` button. Additionally each device is click-able to view
the details of that individual device.

You can configure the columns to limit how much is showing on one screen.

Expand Down
2 changes: 1 addition & 1 deletion docs/navigating-golden.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Each Job attempts to provide sane error handling, and respects the `debug` flag

## Application Settings

The golden configuration plugin settings can be found by navigating to `Plugins -> Settings` button. Select one of the Settings, under the `Golden Configuration` section.
The golden configuration plugin settings can be found by navigating to `Golden Config -> Settings` button. Select one of the Settings, under the `Golden Configuration` section.
Since Golden Configuration Plugin version 1.0, the plugin allows for multiple settings to be configured by the User.
Each of the settings, has the individual repositories and configuration details, as well as the scope.
You could use a combination of settings to customize Your Configuration Compliance behavior.
Expand Down
2 changes: 1 addition & 1 deletion docs/navigating-intended.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ from custom_jinja_filters import config_templates

To start a intended configuration job manually:

1. Navigate to the Plugin Home (Plugins->Home), with Home being in the `Golden Configuration` section
1. Navigate to `Golden Config -> Home`, with Home being in the `Golden Configuration` section
2. Select _Execute_ on the upper right buttons, then _Intended_
3. Fill in the data that you wish to have configurations generated for up
4. Select _Run Job_
Expand Down
16 changes: 8 additions & 8 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Follow the steps below to get up and running for the configuration backup elemen

3. Next, make sure to create new or update existing Plugins **Settings** with the backup details.

1. Navigate to `Plugins -> Settings` under the Golden Configuration Section.
1. Navigate to `Golden Config -> Settings` under the Golden Configuration Section.
2. Create new or select one of the existing `Settings` objects
3. Fill out the Backup Repository. (The dropdown will show the repository that was just created.)
4. Fill out Backup Path Template. Typically `{{obj.site.slug}}/{{obj.name}}.cfg`, see [Setting Details](./navigating-golden.md#application-settings)
Expand All @@ -35,7 +35,7 @@ Follow the steps below to get up and running for the configuration backup elemen

5. Execute the Backup.

1. Navigate to `Plugins -> Home` under the Golden Configuration Section.
1. Navigate to `Golden Config -> Home` under the Golden Configuration Section.
2. Click on the `Execute` button and select `Backup`.
3. Select what to run the backup on.
4. Run the Job by clicking "Run Job" button.
Expand Down Expand Up @@ -68,7 +68,7 @@ Follow the steps below to get up and running for the intended configuration elem

4. Next, make sure to create new or update existing Plugins **Settings** with the intended and jinja2 template details.

1. Navigate to `Plugins -> Settings` under the Golden Configuration Section.
1. Navigate to `Golden Config -> Settings` under the Golden Configuration Section.
2. Create new or select one of the existing `Settings` objects
3. Fill out the Intended Repository. (The dropdown will show the repository that was just created.)
4. Fill out Intended Path Template. Typically `{{obj.site.slug}}/{{obj.name}}.cfg`, see [Setting Details](./navigating-golden.md#application-settings)
Expand All @@ -82,12 +82,12 @@ Follow the steps below to get up and running for the intended configuration elem
3. Populate the GraphQL data.
4. Make sure to follow the format specified in the **GraphQL** section in [Source of Truth Agg Details](./navigating-sot-agg.md)
5. Click Create.
6. Navigate to `Plugins -> Settings` under the Golden Configuration Section.
6. Navigate to `Golden Config -> Settings` under the Golden Configuration Section.
7. Select a SoTAgg Saved Query. (The dropdown will show the GraphQL query that was just created.)

6. Execute the Intended.

1. Navigate to `Plugins -> Home`.
1. Navigate to `Golden Config -> Home`.
2. Click on the `Execute` button and select `Intended`.
3. Select what to run the intended generation on.
4. Run the Job.
Expand All @@ -103,17 +103,17 @@ Compliance requires Backups and Intended Configurations in order to be executed.
3. Follow the steps in [Intended Configuration](#intended-configuration).
4. Create a Compliance Feature.

1. Navigate to `Plugins -> Compliance Feature`.
1. Navigate to `Golden Config -> Compliance Feature`.
2. Click Add and give the feature a name. Typically this is based on the configuration snippet or section. E.g. "aaa".

5. Create a Compliance Rule.

1. Navigate to `Plugins -> Compliance Rules`.
1. Navigate to `Golden Config -> Compliance Rules`.
2. Click Add and populate the fields, make sure the rule is linked to the feature created previously. See [Configuration Compliance Settings](./navigating-compliance.md#configuration-compliance-settings) for details.

6. Execute Compliance Check.

1. Navigate to `Plugins -> Configuration Compliance`.
1. Navigate to `Golden Config -> Configuration Compliance`.
2. Click on the `Execute` button and select `Compliance`.
3. Select what to run the compliance on.
4. Run the Job.
Expand Down
4 changes: 2 additions & 2 deletions nautobot_golden_config/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ConfigComplianceFilterForm(utilities_forms.BootstrapMixin, extras_forms.Cu
"platform",
"device_status",
"device_type_id",
"device",
"device_id",
]

q = forms.CharField(required=False, label="Search")
Expand Down Expand Up @@ -83,7 +83,7 @@ class ConfigComplianceFilterForm(utilities_forms.BootstrapMixin, extras_forms.Cu
platform = utilities_forms.DynamicModelMultipleChoiceField(
queryset=Platform.objects.all(), to_field_name="slug", required=False, null_option="None"
)
device = utilities_forms.DynamicModelMultipleChoiceField(
device_id = utilities_forms.DynamicModelMultipleChoiceField(
queryset=Device.objects.all(), required=False, null_option="None", label="Device"
)

Expand Down
82 changes: 48 additions & 34 deletions nautobot_golden_config/navigation.py
Original file line number Diff line number Diff line change
@@ -1,108 +1,122 @@
"""Add the configuration compliance buttons to the Plugins Navigation."""

from nautobot.extras.plugins import PluginMenuItem, PluginMenuButton
from nautobot.core.apps import NavMenuGroup, NavMenuItem, NavMenuTab, NavMenuButton
from nautobot.utilities.choices import ButtonColorChoices
from nautobot_golden_config.utilities.constant import ENABLE_COMPLIANCE, ENABLE_BACKUP


plugin_items = [
PluginMenuItem(
items = [
NavMenuItem(
link="plugins:nautobot_golden_config:goldenconfig_list",
link_text="Home",
name="Home",
permissions=["nautobot_golden_config.view_goldenconfig"],
)
]

if ENABLE_COMPLIANCE:
plugin_items.append(
PluginMenuItem(
items.append(
NavMenuItem(
link="plugins:nautobot_golden_config:configcompliance_list",
link_text="Configuration Compliance",
name="Configuration Compliance",
permissions=["nautobot_golden_config.view_configcompliance"],
)
)
items.append(
NavMenuItem(
link="plugins:nautobot_golden_config:configcompliance_report",
name="Compliance Report",
permissions=["nautobot_golden_config.view_configcompliance"],
)
)
plugin_items.append(
PluginMenuItem(
items.append(
NavMenuItem(
link="plugins:nautobot_golden_config:compliancerule_list",
link_text="Compliance Rules",
name="Compliance Rules",
permissions=["nautobot_golden_config.view_compliancerule"],
buttons=(
PluginMenuButton(
NavMenuButton(
link="plugins:nautobot_golden_config:compliancerule_add",
title="Compliance Rules",
icon_class="mdi mdi-plus-thick",
color=ButtonColorChoices.GREEN,
button_class=ButtonColorChoices.GREEN,
permissions=["nautobot_golden_config.add_compliancerule"],
),
),
)
)
plugin_items.append(
PluginMenuItem(
items.append(
NavMenuItem(
link="plugins:nautobot_golden_config:compliancefeature_list",
link_text="Compliance Features",
name="Compliance Features",
permissions=["nautobot_golden_config.view_compliancefeature"],
buttons=(
PluginMenuButton(
NavMenuButton(
link="plugins:nautobot_golden_config:compliancefeature_add",
title="Compliance Features",
icon_class="mdi mdi-plus-thick",
color=ButtonColorChoices.GREEN,
button_class=ButtonColorChoices.GREEN,
permissions=["nautobot_golden_config.add_compliancefeature"],
),
),
)
)

if ENABLE_BACKUP:
plugin_items.append(
PluginMenuItem(
items.append(
NavMenuItem(
link="plugins:nautobot_golden_config:configremove_list",
link_text="Config Removals",
name="Config Removals",
permissions=["nautobot_golden_config.view_configremove"],
buttons=(
PluginMenuButton(
NavMenuButton(
link="plugins:nautobot_golden_config:configremove_add",
title="Config Remove",
icon_class="mdi mdi-plus-thick",
color=ButtonColorChoices.GREEN,
button_class=ButtonColorChoices.GREEN,
permissions=["nautobot_golden_config.add_configremove"],
),
),
)
)
plugin_items.append(
PluginMenuItem(
items.append(
NavMenuItem(
link="plugins:nautobot_golden_config:configreplace_list",
link_text="Config Replacements",
name="Config Replacements",
permissions=["nautobot_golden_config.view_configreplace"],
buttons=(
PluginMenuButton(
NavMenuButton(
link="plugins:nautobot_golden_config:configreplace_add",
title="Config Replace",
icon_class="mdi mdi-plus-thick",
color=ButtonColorChoices.GREEN,
button_class=ButtonColorChoices.GREEN,
permissions=["nautobot_golden_config.add_configreplace"],
),
),
)
)

plugin_items.append(
PluginMenuItem(

items.append(
NavMenuItem(
link="plugins:nautobot_golden_config:goldenconfigsetting_list",
link_text="Settings",
name="Settings",
permissions=["nautobot_golden_config.view_goldenconfigsetting"],
buttons=(
PluginMenuButton(
NavMenuButton(
link="plugins:nautobot_golden_config:goldenconfigsetting_add",
title="Add",
icon_class="mdi mdi-plus-thick",
color=ButtonColorChoices.GREEN,
button_class=ButtonColorChoices.GREEN,
permissions=["nautobot_golden_config.change_goldenconfigsetting"],
),
),
),
)

menu_items = tuple(plugin_items)

menu_items = (
NavMenuTab(
name="Golden Config",
weight=1000,
groups=(NavMenuGroup(name="Golden Config", weight=100, items=tuple(items)),),
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@
{% block content %}
<div class="pull-right noprint">
{% block buttons %}
<div class="btn-group">
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mdi mdi-book-open-variant" aria-hidden="true"></span> Report <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% if compliance %}
<li><a href="{% url 'plugins:nautobot_golden_config:configcompliance_report' %}">Compliance</a></li>
{% endif %}
</ul>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Execute <span class="caret"></span>
Expand Down

0 comments on commit dfd3304

Please sign in to comment.