cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
157
Views
1
Helpful
0
Comments
cherifi.m85
Level 1
Level 1

Hi NetDevops folks!

In addition to my contribution to Cisco PyATS with a parser for IOS/IOSXE “show vlan internal usage”, I also recently contributed to PyATS with 06 hybrid get APIs (IPv4 and IPv6) for EIGRP (I love EIGRP like PyATS!! !).

06 Hybrid APIs is equivalent to 06 for IPv4 and 06 for IPv6: So we can say 12 APIs!

Recently I noticed that there is no get.py for EIGRP for IPv4 and IPv6. So I thought about creating one. At the beginning there were 12 APIs: 06 for EIGRPv4 and 06 for EIGRPv6. After the reviewer's suggestion, I was able to condense them into 06 hybrid APIs since there is a resemblance in the commands: the only difference is IPv6!

For this, I created APIs in a way to have the same program EXCEPT the protocol used. By default, it is IPv4 which can be changed to IPV6 as needed.

Here's the idea in brief: suppose you want to use the command "show ip eigrp neighbors" and "show ipv6 eigrp neighbors" in a single API. This little command() function is used for a demonstration:

In [1]: def command(ip="ipv4"):
   ...:     return f"show {'ipv6' if ip!='ipv4' else 'ip'} eigrp neighbors"
In [2]: command()
Out[2]: 'show ip eigrp neighbors'

In [3]: command("ipv6")
Out[3]: 'show ipv6 eigrp neighbors'

This also shows the power of f-string because we have incorporated a condition inside on the default variable “ip”.

For APIs, personally I have not found videos and blogs like the case of parsers. I just followed the instructions provided by the PyATS website. Here is the link:

https://pubhub.devnetcloud.com/media/pyats-development-guide/docs/writeapi/writeapi.html 

I would like to thank @Takashi Higashimura who guided me on the contribution process each time I contact him.

Finally, it is a pleasure to contribute to Cisco PyATS as I personally find it an exceptional framework in the world of network automation where leaders in the field have left their touch in it .

For more details:

Here is the link to the contribution: https://github.com/CiscoTestAutomation/genielibs/pull/149 

Here is the link to my Github: https://github.com/cherifimehdi 

See you soon with another blog!

 

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: