Posted on March 29, 2020 3:32 pm
 |  Asked by Alex Bogushevich
 |  68 views
RESOLVED
0
0
Print Friendly, PDF & Email

Hi, I work with your equipment and I need to know the system parameters.
In my work I use pyeapi.
I retrieve data using commands
:

Hi, I work with your equipment and I need to know the system parameters.

In my work I use pyeapi.

conn.execute(['show mac address-table'])
conn.execute(['show interfaces status'])
and so on
I inherited the code and now I am having difficulty parsing data from JSON
Could you give a link to the data structure so that I can better analyze JSON ?

 

0
Posted by Tamas Plugor
Answered on March 29, 2020 3:40 pm

Hi Alex,

Not sure exactly about the ask here, you have the structure if you run those commands, alternatively you can access eAPI documentation and built-in command explorer on each switch in a browser. All EOS instances have eAPI documentation.

Just type: https://mgmt_IP

run any commands and it'll return you the structure, obviously different commands will have different key-value pairs but the result structure should be the same for all

 

e.g. for 'show mac address-table' you will see this:

 

{
"jsonrpc": "2.0",
"id": "EapiExplorer-1",
"result": [
{
"multicastTable": {
"tableEntries": []
},
"unicastTable": {
"tableEntries": [
{
"macAddress": "11:22:33:44:55:66",
"lastMove": 1585495711.886518,
"interface": "Ethernet50/1",
"moves": 1,
"entryType": "dynamic",
"vlanId": 1
},
{
"macAddress": "aa:bb:cc:dd:ee:ff",
"lastMove": 1585495710.047472,
"interface": "Ethernet50/1",
"moves": 1,
"entryType": "dynamic",
"vlanId": 1
},
{
"macAddress": "de:ad:be:ef:ca:fe",
"lastMove": 1585495839.14851,
"interface": "Ethernet50/1",
"moves": 1,
"entryType": "dynamic",
"vlanId": 1
}
]
}
}
]

HTH,

Tamas

 

Post your Answer

You must be logged in to post an answer.