Netbox: Arista EAPI RPC Support

Created on 1 Jul 2016  路  6Comments  路  Source: netbox-community/netbox

Add Arista to the RPC support.

For testing purposes, Arista allows for virtualized instances of their EOS platform. https://eos.arista.com/tag/veos/

Most helpful comment

I can help with Arista.
What kind of integration with netbox?

All 6 comments

I can help with Arista.
What kind of integration with netbox?

Instead of writing new functionality for this, it may be more desirable to use a package like netmiko instead of paramiko, which will abstract out a lot of the logic that is built into the current RPC.

netmiko is really nice for setting up the session and getting output. Using EAPI has an advantage in that _almost_ all the responses are already parsed into JSON for easy digestion.

I am not familiar with netbox(_yet_) and what RPC calls are made where, but I can provide some assistance/testing/exmaples/gruntwork if it helps. I have vEOS and hardware switches to verify.

Tip: you can see this jsonified output from the CLI by piping to | json

co301...07:10:04#sh spanning-tree int e47
Instance         Role       State      Cost      Prio.Nbr Type
---------------- ---------- ---------- --------- -------- --------------------
MST0             root       forwarding 2000      128.47   P2p

co301...07:10:08#sh spanning-tree int e47 | json
{
    "interface": "Ethernet47",
    "spanningTreeInstances": {
        "MST0": {
            "priority": 128,
            "linkType": "p2p",
            "state": "forwarding",
            "cost": 2000,
            "role": "root",
            "inconsistentFeatures": {
                "loopGuard": false,
                "rootGuard": false,
                "mstPvstBorder": false,
                "bridgeAssurance": false
            },
            "portNumber": 47,
            "isEdgePort": false,
            "boundaryType": "none"
        }
    }
}

Agree with jgill-arista, you can easily request data via JSON RPC from Arista, for example:

  from jsonrpclib import Server

   switch = Server( "https://username:passw0rd@myswitch/command-api" )
   response = switch.runCmds( 1, ["show version"] )

and get response in JSON.
As I understand netmiko is a nice tool for legacy devices that do not support structured output.

@jgill-arista I completely agree, the eapi is much nicer for many reasons! (I'm honestly disappointed that netmiko doesn't have the option to tie into api's, but I suppose it's beyond the scope of their project). The advantage of netmiko is support for many different devices and vendors beyond what netbox wants to/can include on it's own. Vendor specific solutions like pyeapi may work much better, but depending on the functionality we're looking for, it may not make a difference...

Closing this out because we're going to be removing built-in RPC support in version 2.0, in favor of API-driven population via external tools.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VictorJ76 picture VictorJ76  路  3Comments

bellwood picture bellwood  路  4Comments

shugotek picture shugotek  路  3Comments

soer7022 picture soer7022  路  3Comments

Ali-Yazdani picture Ali-Yazdani  路  3Comments