Closed jeremystretch closed 5 years ago
This sounds great to me. Give me a few days to investigate which OC models we need and then I can guide you on how to get it done with the OC framework.
@dbarrosop Just checking in. Happy to give this a shot on my own if you can't spare the time.
I haven't forgotten about this :) I am almost done but there is a severe lack of documentation on how to use the framework. If you have the energy you can look at this:
https://github.com/napalm-automation/napalm-yang/blob/augment/napalm_yang/mappings/eos/extractors/oc-if/interfaces.yaml https://github.com/napalm-automation/napalm-yang/blob/augment/napalm_yang/mappings/eos/extractors/oc-ip/ipv4.yaml
Basically, to extract data from the device into the OC framework you just have to define the rules to do so. So far I have implemented an "extractor" for plain text and for xml (I think you only care about the text one right now). Rules are not documented, sorry about that but I guess it shouldn't be difficult to start playing with it and figure out how it works.
@jeremystretch You can start looking at this:
https://github.com/napalm-automation/napalm-yang/blob/augment/interactive_demo/tutorial.ipynb
There are some things to be refactored that will happen soon but you can start playing with the model if you want to take a look. You could do the folllowing:
import napalm_yang
import pprint
config = napalm_yang.BaseBinding()
config.add_model(napalm_yang.oc_platform.platform())
pretty_print(config.model_to_dict())
And start seeing how to map what you want with that structure. I think the platform model is quite "open to interpretation".
Just a quick keepalive
. I am almost done, paperwork (aka docs, testing and cleaning) always takes more than anticipated. You can start looking at the docs if you want (WIP but the parts that are relevant for you are probably all there already):
https://napalm.readthedocs.io/en/yang_doc/YANG/index.html
This weekend I will finish the docs and next week I will start merging and releasing stuff so you can start working on this in 1-2 weeks tops.
Excellent! Thanks for the update. Really hoping to dig into the code and familiarize myself more this week.
Ok, this is all out, documentation, libraries, etc... You can find a quick summary here:
https://www.dravetech.com/blog/2017/04/09/napalm-yang.html
Note that @bewing is also working on this. Turns out that the components model is a nightmare but we are discussing how to address it here:
What's the state of this? Is this something you still need or that you are working on?
@dbarrosop Sorry, NetBox has been sucking up all my dev time lately. I've been following what @bewing has been working on though. How crucial is it that we utilize the OpenConfig platform model for inventory data in the first place, given that it's essentially arbitrary?
I think it makes sense to use the OC models even if use a regular getter. It doesn't make sense to bother reinventing the wheel and it will help migrating code to napalm-yang
later on. If the model doesn't make sense at all we should bring it to the OC group.
FYI, there's code now (napalm-automation/napalm-eos#165), I just need to write tests.
Did this ever make it live?
This repo is deprecated. Head to main napalm repo.
I'm interested in extending NAPALM to include a method for retrieving hardware information from devices. Currently, only the chassis serial number can be read (via
get_facts()
). I'd like to add the ability to return the equivalent ofshow chassis hardware
(Junos) orshow inventory
(IOS). Here's an example CLI output for Junos:And for IOS:
The proposed method would be read-only, similar to
get_environment()
. It would return a list of objects, each representing a hardware component. The format of each object will be largely arbitrary, as it would probably not be practical to attempt to standardize among the platforms, but each component would include at least a name, model/part number, and serial number. I'm not too familiar with OpenConfig yet, but I believe this object would correspond to the platform model.My primary interest in adding this capability is to extend an IPAM/DCIM application I maintain called NetBox. It would be great to replace the custom RPC functionality I've written with NAPALM; I just need to implement the hardware inventory piece. Beyond that, of course, there's inherent value in being able to retrieve a list of all the components installed within a device.
If people think this would be a valuable addition to NAPALM, I'd love to volunteer my time.