-
Notifications
You must be signed in to change notification settings - Fork 283
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
Nornir inventory file support #2495
base: main
Are you sure you want to change the base?
Conversation
@danlindow thanks for your contribution! I made a slight change (which touched lots of files in the same manner) where I added the scrapli platform name to the node registry that we have under the PlatformAttrs struct. The idea is that for each kind we register what scrapli platform name it uses, and then we use this platform name as the platform in the nornir' simple inv plugin. Scrapli platform names should be quite consistent with those of napalm, netmiko. If the platform doesn't have a matching name, then we use the kind of this node instead. Would appreciate you giving it a go, and thanks again! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2495 +/- ##
==========================================
+ Coverage 52.44% 52.67% +0.22%
==========================================
Files 172 173 +1
Lines 17768 18076 +308
==========================================
+ Hits 9319 9521 +202
- Misses 7462 7560 +98
- Partials 987 995 +8
|
Gave this a spin on my topology here: name: evpn
mgmt:
network: fixedips
ipv4-subnet: 172.200.20.0/24
topology:
nodes:
spine1:
kind: ceos
image: ceos:4.33-arm
mgmt-ipv4: 172.200.20.2
... The resulting nornir template looks like so: ---
leaf1:
username: admin
password: admin
platform: arista_eos
hostname: 172.200.20.4
... per the Napalm docs it looks like it specifically expects
Scrapli looks like it uses a different platform naming system in Nornir Inventory all together as opposed to the "native" platform attribute: I'm not opposed to having Scrapli in the inventory as well within it's own attributes in the inventory such as: leaf1:
username: admin
password: admin
connection_options:
scrapli:
platform: arista_eos Another fun bit is how Nornir-netmiko is actually mapping back to a similar naming to what Scrapli is doing. It does this internally though: Nornir-Napalm however looks to be a more 1:1 direct relationship. I'd have to give this some more thought but I think one solution may be:
Curious your thoughts on the manner though! |
type PlatformAttrs struct { | ||
ScrapliPlatformName string | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danlindow I think to fix the issue of napalm having a different platform naming scheme, we need to add NapalmPlatformName
here, and populate it with the relevant const in the systems that are supported by napalm.
Then to drive which platform names are used we can set the env var CLAB_PLATFORM_NAME_SCHEMA: napalm
to select what values to use in the templating.
Feel free to take a stab at it, or I can have a look at it sometime later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a shot at it! Thanks for the help!
reference issue: #1963
This MR will generate a Nornir inventory file much like the Ansible inventory file that exists today.
disclaimer: I'm not well versed in Golang yet (this is my first real experience with Go) so I am looking for feedback and guidance to deliver this!