Skip to content

Instantly share code, notes, and snippets.

@fredhsu
Created October 21, 2014 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredhsu/80e19f6fadeba3a3ebf7 to your computer and use it in GitHub Desktop.
Save fredhsu/80e19f6fadeba3a3ebf7 to your computer and use it in GitHub Desktop.
eAPI script to see all the arp entries per VRF
from jsonrpclib import Server
switch = Server( "https://admin:admin@leaf1/command-api" )
response = switch.runCmds( 1, ["show vrf"], "text" )
lines = response[0]['output'].splitlines()
for line in lines:
print line
for i in range(2, len(lines) - 1):
vrfname = lines[i].split()[0]
command = "show ip arp vrf " + vrfname
response = switch.runCmds( 1, [command] )
print vrfname
print response[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment