Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Add PNG path functionality for IP Fabric v4 #61

Merged
merged 7 commits into from
Jan 18, 2022
Merged

Add PNG path functionality for IP Fabric v4 #61

merged 7 commits into from
Jan 18, 2022

Conversation

pke11y
Copy link
Contributor

@pke11y pke11y commented Jan 12, 2022

This PR will add a new command that is supported in IP Fabric v4 to render a path simulation as a PNG.

I decided to separate this pathlookup command from the existing end-to-end-path command due to the different naming, URL and potential outputs for diagrams in v4. Also it will allow us to retire the end-to-end-path command easier.

nautobot_chatops_ipfabric/ipfabric.py Show resolved Hide resolved
nautobot_chatops_ipfabric/ipfabric.py Outdated Show resolved Hide resolved
nautobot_chatops_ipfabric/ipfabric.py Outdated Show resolved Hide resolved
]
)

# only supported in IP Fabric OS version 4.0+
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks to me that we could implement a generic version validation function, as the product evolves, more cases like this will arise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I'd like to get some feedback on how we could approach version management.

Copy link
Contributor

Choose a reason for hiding this comment

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

feedback from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anyone who is currently maintaining a library that is dependent on a specific API/software library and it's versioning. I was hoping there is a preferred approach for this kind of thing. We're not the first to do it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mentioned during the EU call and the suggestion was to drop the old command in the next release and only support v4 in our next release. Makes it easier to maintain and allows users to use two versions. What do you think?

Copy link
Contributor

@chadell chadell Jan 14, 2022

Choose a reason for hiding this comment

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

if the approach is to only support latest IPfabric version we could go this way... but this is a question that we will need to answer more times, and not sure if losing support to "old" ipfabric versions is a good strategy (when there are just some differences).
If we opt for the support for only one version support we have to document it well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I guess it's a trade off between maintenance vs functionality. It's harder and more time-consuming to maintain and test multiple versions, especially in our environment. But it's better for users to have greater support.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, it's not the right strategy for function. But it probably is the right strategy for maintenance.

Copy link
Contributor

Choose a reason for hiding this comment

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

go ahead for now, we can implement it later if needed, before deprectaing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a generic validation function for now. I agree, it'll come in handy.

nautobot_chatops_ipfabric/worker.py Outdated Show resolved Hide resolved
nautobot_chatops_ipfabric/worker.py Outdated Show resolved Hide resolved
nautobot_chatops_ipfabric/worker.py Show resolved Hide resolved
# only supported in IP Fabric OS version 4.0+
response = ipfabric_api.get_os_version()
os_version = float(response.get("version", "0.0").rpartition(".")[0])
if os_version >= 4:
Copy link
Contributor

@chadell chadell Jan 13, 2022

Choose a reason for hiding this comment

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

regarding version handling, I was thinking about another potential approach and I would like to get your feedback.
Your proposal is:

  • if os_version <x -> command_1
  • if os_version >= x -> command_2

what about:

  • command and behind the scenes we check the os_version and decide which logic to use? (this works well if the input data is the same)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm totally open to a better solution. Originally I had the logic in the end-to-end-path command. However the new v4 OS names the path simulation a different name with a different URL. Also, we could extend the new path lookup for JSON and SVG output if desired. I felt it would be adding complexity, for the short term. But perhaps I'm not understanding your proposal?

Copy link
Contributor

Choose a reason for hiding this comment

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

my idea would be to expose the user with only one command: the_very_best_e2e_path
Inside this we would have a version if statement that would call the specific logic that you need for end-to-end-path and pathlookup (data input if there are changes, and the actual output)
The goal is to make the user experience "unique", so the user don' have to understand there are two implementations, there is one with different behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally we'll extend the pathlookup command with JSON capability using an additional argument for output format. Unfortunately the JSON result for the new version and old version are completely different :-(
So the only thing that's similar is the input variables which, will change very soon anyway.

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.

LGTM

@pke11y pke11y requested a review from chadell January 17, 2022 13:17
@pke11y
Copy link
Contributor Author

pke11y commented Jan 17, 2022

@chadell if you get the chance, can you check the CHANGELOG, open to a better approach.

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.

LGTM

CHANGELOG.md Outdated
@@ -1,4 +1,16 @@

## v1.1.0 - 2022-MM-DD

### Announcement
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
### Announcement
### Deprecated

@pke11y pke11y requested a review from chadell January 17, 2022 21:46
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.

LGTM

(I usually leave the date out of the dev branch, and update it for the release date)

@pke11y
Copy link
Contributor Author

pke11y commented Jan 18, 2022

Oh good tip, thanks!

@pke11y pke11y merged commit 52612d5 into develop Jan 18, 2022
@pke11y pke11y deleted the pk-e2e-png branch February 10, 2022 16:36
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.

2 participants