flokinet-003 - Introduction to the Arista CLI, continued

title: flokinet-003 - Introduction to the Arista CLI, continued
author: Nicholas Morrison
draft: false
tags: [network, workshop, arista]
categories: [workshop]
noindex: true

Connecting to the lab server

Diagram

Topology 01
Topology 01

Enabling the RestConf API: SSL

Set up a self-signed certificate + ssl profile

r5#security pki certificate generate self-signed restconf.crt key restconf.key generate rsa 2048 parameters common-name restconf
r5#config
r5(config)#management security
r5(config-mgmt-security)#ssl profile restconf
r5(config-mgmt-sec-ssl-profile-restconf)#certificate restconf.crt key restconf.key
r5(config-mgmt-sec-ssl-profile-restconf)#end
r5#
!

Enabling the RestConf API: local user

Create a new user. configure, then:

!
username foo privilege 15 secret bar
aaa authorization exec default local
!

Enabling the RestConf API: enable restconf

Set up RestConf. configure, then:

!
management api restconf
   transport https test
   ssl profile restconf
!

Enabling the RestConf API: control-plane ACL

Testing the RestConf API

r5#bash

Arista Networks EOS shell

[arista@r5 ~]$ curl -s GET 'https://172.16.0.x:6020/restconf/data/openconfig-interfaces:interfaces' \
                    --header 'Accept: application/yang-data+json' \
                    --insecure \
                    -u foo:bar

Get an interface description:

curl -s GET 'https://172.16.0.x:6020/restconf/data/openconfig-interfaces:interfaces/interface=Ethernet1/config/description' \
     --header 'Accept: application/yang-data+json' \
     --insecure \
     -u foo:bar

Get info for a specific interface:

curl -s GET 'https://172.16.0.x:6020/restconf/data/openconfig-interfaces:interfaces/interface=Ethernet1' \
     --header 'Accept: application/yang-data+json' \
     --insecure \
     -u foo:bar

Browse the JSON using your favourite JSON browser.

eg http://jsonviewer.stack.hu