Getting Structured Data Back from CLI Devices

680 views
Skip to first unread message

Jason Edelman

unread,
Aug 14, 2015, 4:01:13 PM8/14/15
to networ...@googlegroups.com
Hi Everyone,

As WE ALL KNOW, every new device has its own API.  Since that really doesn't matter since most devices, i.e. IOS, etc. don't have an API, it makes it difficult to get structured data back, i.e. JSON out of old school devices.

I just released an Ansible module that should help a ton....repo is below.

We (all of us here!) just need to come together to build out the proper templates to really see this be something meaningful.  

Repo:

To add a new command, etc., all you need to do is two things:
  1. Create a TextFSM template for a given show command and store it in ntc_templates
  2. Add that TextFSM to the indexDevice needs to be included within the index as well

Related posts:

Hope it helps someone out there!

Michael Kashin

unread,
Aug 14, 2015, 8:42:09 PM8/14/15
to network.toCode()
Amazing work! It's gonna be difficult parsing some complex tables with TextFSM but the majority of them should be fine. So do we follow the normal fork-pull cycle to add our templates?
I'm just thinking it'd also be nice to have a separate testing playbook to try templates on standard inputs and confirm they're working.

Jason Edelman

unread,
Aug 15, 2015, 8:20:39 AM8/15/15
to Michael Kashin, network.toCode()
Yes, you can use the fork and pull method, no issues there!  Will be reviewing your PR very soon :)

Regarding being difficult parsing complex tables - remember it's totally up to the user on what data is required post-parse, so *technically* you don't need to parse every attribute from a given command.  For example, you may not need/want every counter from 'show interface', etc.  



--
You received this message because you are subscribed to the Google Groups "network.toCode()" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networktocod...@googlegroups.com.
To post to this group, send email to networ...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networktocode/df4be5ff-6bb6-440a-b384-21b0fed152ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Barroso

unread,
Aug 17, 2015, 3:33:23 AM8/17/15
to network.toCode(), m.kas...@gmail.com
Great job Jason. And thank you for making me aware of TextFSM. I see TextFSM as an equivalent of the pyEZ views but for dealing with regexp instead of XML. I have to try TextFSM as that lib could simplify the development of NAPALM : )

Jason Edelman

unread,
Aug 17, 2015, 9:11:37 AM8/17/15
to David Barroso, network.toCode(), Michael Kashin
Definitely similar to what Juniper has!  And simplifying the development (and contributions) is what it is all about :)


shreya mittal

unread,
May 2, 2016, 6:20:38 AM5/2/16
to network.toCode()
Hello everyone, 
I am a beginner in this field and am trying to achieve more or less the same results. My aim is to achieve the results from command to the Flask API i am trying to build.
Can anyone help me with this. It might be really basic for u.

Thankyou in advance 

shreya mittal

unread,
May 10, 2016, 12:03:52 PM5/10/16
to network.toCode()
Hello everyone ... 

Can anyone Help me with the following : 

Calling SSH Script through Flask API ? It will be really a great help to me... I am stuck on this from past 10 days :(


On Friday, August 14, 2015 at 10:01:13 PM UTC+2, Jason Edelman wrote:

Jason Edelman

unread,
May 10, 2016, 12:05:00 PM5/10/16
to shreya mittal, network.toCode()
Can you share what you have so far?

Thanks,
Jason


--
You received this message because you are subscribed to the Google Groups "network.toCode()" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networktocod...@googlegroups.com.
To post to this group, send email to networ...@googlegroups.com.

shreya mittal

unread,
May 12, 2016, 10:34:27 AM5/12/16
to network.toCode()

I have attached the screen shots for what I have so far...
I am able to call SSH script from my Flask API... now I have to try to send an IP address to the SSH Script ... How can I do that ??
On Friday, August 14, 2015 at 10:01:13 PM UTC+2, Jason Edelman wrote:
Screenshot (30).png
Screenshot (31).png
Screenshot (32).png
Reply all
Reply to author
Forward
Message has been deleted
0 new messages