Skip to content

Lab 20.1 - Exploring the Arista eAPI

This lab introduces you to the Command Explorer environment that exists on each Arista switch. The command explorer is a great tool for beginners and experts alike, as it gives you direct insight on how the switch will respond to API calls. This allows you to verify what key-value pairs and response you should be getting back as you are writing and testing your code.

Task 1 - Use the Command Explorer

Step 1-1

Remote-desktop (RDP) into your jump-host, open a web browser (Chromium or Firefox) using the desktop shortcuts, and then connect to the switch.

  • Enter https://eos-spine1 into the browser.

Command Explorer 1

Note: This screenshot is from Chromium, but you will get a similar prompt to accept a bad certificate (in this case self-signed) in Firefox.

Step 1-2

Click on the Advanced Link.

You will see the window expand. Now click the Proceed to eos-spine1 (unsafe) link.

Command Explorer 2

Step 1-3

Login with the credentials username: ntc, password: ntc123

Command Explorer 3

Step 1-4

In the Commands (left) pane, enter the command show version for the cmds key. Click Submit POST Request.

Take note that cmds is a list. You can see this based on the brackets being used in the Request Viewer on the bottom left.

The response is displayed in the Response Viewer (bottom right) pane:

Command Explorer 4

Notice that the response is a JSON object (notice the curly braces) and this maps into a Python dictionary with three key-value pairs: jsonrpc, result, and id.

Step 1-5

Since we saw cmds is a list, now send three commands: show hostname, show version, and show vlan.

Step 1-6

Click Submit POST Request

Notice the response. result is now a list of three. The response for each command is its own dictionary.

Command Explorer 5

Step 1-7

The previous examples all received JSON data back. Now see what comes back when you switch format to "text" in the Request parameters. Enter the command show interfaces Eth1 and submit the POST request.

Command Explorer 8

Notice the blob of text? It's still wrapped in a JSON structure, but the command output itself is pure text as if you ran it on the CLI directly.

Step 1-8

Enter the same request, but now switch the format back to "JSON".

Command Explorer 9

You can clearly see the value going to JSON from pure text.

Step 1-9

In the last step, try sending a configuration change using the Command Explorer. Your goal is to perform a no shutdown on Ethernet1.

Enter the four commands: enable, configure, interface Ethernet1, and no shutdown.

Command Explorer 10

Step 1-10

Try sending the request without one of these commands, for example by removing the "configure" command.

Take a few more minutes and continue to explore the Arista Command Explorer.