nautobot / nautobot-app-golden-config

Golden Configuration App for Nautobot.
https://docs.nautobot.com/projects/golden-config/en/latest/
Other
101 stars 57 forks source link

Multi-Device Collapsing Config Diff #825

Open rifen opened 4 weeks ago

rifen commented 4 weeks ago

Environment

I'd like to be able to select a certain amount of devices and see all of their config diffs and if they all have the same diff then they would combine or not. It could be shown in Config Plans as a button with a popup of all the devices in the plan and/or Configuration Overview I could select the devices (probably a bulk action) and get a collapsing diff view of them all.

I want to deploy a bunch of configs to a lot of devices and I want to check what is going on with all the devices. Selecting each device 1 by 1 is not scalable and adds a lot of engineer time.

Figmaed (Figma'd?) a quick example: image

itdependsnetworks commented 4 weeks ago

Yea, certainly agreed, this was on our original design spec, but did not make MVP (along with many other features). Another relevant one was the ability to understand when the changes are the same, e.g. if there was a hash value associated with the change and ideally a filter, to filter out one hash value at a time.

rifen commented 4 weeks ago

A good example of that: https://aeolun.github.io/react-diff-viewer-continued/ though not working in React in this case :)

itdependsnetworks commented 4 weeks ago

hmm, that just looks like a diff viewer, which we already have in bootstrap: https://demo.nautobot.com/plugins/golden-config/golden-config/d200ff18-ef93-449b-b75e-301e948aaf50/compliance/

not sure what you are suggesting we are comparing?

rifen commented 4 weeks ago

not sure what you are suggesting we are comparing?

I thought by "filter" you meant only show the changes needed. In that diff viewer it had "Expand" showing only the diffed parts to the user. It seems that isn't what you were getting at.

rifen commented 3 weeks ago

Hey @itdependsnetworks and @jeffkala,

I'd like to contribute this feature, my company has allocated me time to do so :slightly_smiling_face: . I have plenty of Python Experience and I am willing to learn more Django (Outside interacting with the ORM via writing Jobs). I have some JavaScript experience but very little, which I believe is a small requirement in this.

My plans for this feature would go something like this:

  1. Add a new button "Compare" to the Configuration Overview view at the top + a "Compare" button via the Config Plans screen.
  2. The button would direct you to a view utilizing the selected devices in Configuration Overview (if possible) or Config Plan
  3. The new view would use Collapsible Panels and diff2html side-by-side comparison for each device to start. (Combining devices could come in a later but separate feature depending on the complexity.)
  4. Here is a touchy part - from my perspective I believe engineers would want each comparison to be of the Running Config and the Intended Config. Today the comparison is between the backup and the intended. When users press the Compare button, I don't see a complete issue with going out and getting the running config for each device, utilizing the URL the same as they were navigating to Devices > Configuration. There would be noticeable overhead of course because of the amount of devices potentially. Maybe it could be a setting - where users could set "Backup" or "Running" in Golden Config settings to point to which they want to look at for comparisons. I could enqueue the Backup job for the devices specifically, would be the same I think 🤔 probably same amount of waiting.

I can dedicate most of my time to this contribution and hopefully future contributions. If there is anything I didn't touch on in this feature, any changes or any extra tips let me know. If your comfortable assigning me this Issue now or waiting until I have an MVP/PR, that's fine too.


Additional ideas while going through GC code:

itdependsnetworks commented 3 weeks ago

I think it makes sense to create a PR for each of the following steps

  1. Redirect you to a view when you select devices, then click the "Deploy" Button and this would have the collapsible panels
  2. The panel headers should include a hash value of what will change, so one can understand if this is the same change
  3. Add in a comparison view for Missing and Remediation, that would simply show what the current intended is in place
  4. Add in the ability to have diff view (It's not clear to us yet if we want to proceed with this, as it may cause confusion, but certainly not off of the table)

For your initial 4, this is not something we would do in the near or even medium term future. The idea is to have a control of what you have approved, and this breaks the principle of least astonishment in that it was approved as one configuration and pushed yet another configuration.

rifen commented 3 weeks ago

To align with your step 1 and limit scope:

On the 'Config Plans' view specifically, we redirect 'Deploy Selected' button to a new page. This page would have collapsible panels view of running vs. intended configurations (or missing vs. extra?) for each selected device.

Workflow would be:

  1. Generate intended config
  2. Create config plans
  3. Press "Deploy Selected" after selecting plans
  4. Redirect to page with Comparison Panels for Devices plans selected
  5. Press "Deploy"

The "Deploy" job button on the Config Plan page would be removed to lower confusion and granting 1 streamlined workflow to deploy plans.


Edits:

itdependsnetworks commented 3 weeks ago

Instead of modal, I was just thinking it's own page, I could be convinced otherwise, but given the amount of data on it, I think we will need all of the real estate.

I am not understanding what workflow 2 would provide?

rifen commented 3 weeks ago

Agreed on the full page.

Well the deploy button was already in the Config Plan page :shrug: so I figured there was a reason. Could just remove it and have the "Merge Selected" button that then takes you to the next page. That consolidates ways you can merge. Makes it 1 streamlined flow.

rifen commented 2 weeks ago

Updated previous comment: https://github.com/nautobot/nautobot-app-golden-config/issues/825#issuecomment-2450266612 for clarity with discussions.

itdependsnetworks commented 2 weeks ago

I think that works, I think you can leave it as Deployed Selected, I don't think anyone will be confused that there is a confirmation.