Table of contents
- cURL options
- Get CVP inventory
- Get OpenConfig data streamed by EOS devices and stored in CVP
- BGP
- Get the
state
YANG container for all the bgp neighbors - Get the
session-state
YANG leaf for all the bgp neighbors - Get the
config
YANG container for all the bgp neighbors - Get the
config
YANG container for the bgp neighbor 172.16.200.1 - Get the
state
YANG container for the bgp neighbor 172.16.200.1 - Get the
session-state
YANG leaf for the bgp neighbor 172.16.200.1
- Get the
- Interfaces
- Use
jq
to parse JSON in bash- Install
jq
- Pretty prints the JSON output
- Filter the output to see only the interfaces
name
- Filter the output to see only the
counters
container of the interface ethernet 1 - Filter the output to see only the
leaf
enabled of the containerconfig
of the interface ethernet 1 - Filter the output to see only the devices id
- Install
- BGP
By default cURL uses URL globbing. The globbing uses the reserved symbols [] and {} that normally cannot be part of a legal URL. If the URLs contain these symbols, disable URL globbing from cURL using the -g
option.
Ignore the warning about the certificates with the -k
option.
curl -s -k -X GET --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5:443/restconf/data/inventory/state/device/device-id?arista-origin=arista&arista-target='
Go to Devices > Inventory and replace the target in the commands below with the device ID
found in the CVP device inventory.
The device ID
is the device SN.
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state?arista-target=spine1&arista-origin=openconfig'
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state/session-state?arista-target=spine1&arista-origin=openconfig'
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/config?arista-target=spine1&arista-origin=openconfig'
curl -s -g -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor[neighbor-address=172.16.200.1]/config?arista-target=spine1&arista-origin=openconfig'
curl -s -g -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor[neighbor-address=172.16.200.1]/state?arista-target=spine1&arista-origin=openconfig'
curl -s -g -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor[neighbor-address=172.16.200.1]/state/session-state?arista-target=spine1&arista-origin=openconfig'
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface/state?arista-target=spine1&arista-origin=openconfig'
curl -s -k -g -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface[name=Ethernet1]/state?arista-target=spine1&arista-origin=openconfig'
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface/state/counters?arista-target=spine1&arista-origin=openconfig'
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface/state/admin-status?arista-target=spine1&arista-origin=openconfig'
curl -s -g -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface[name=Ethernet6]/state/admin-status?arista-target=spine1&arista-origin=openconfig'
sudo apt-get install -y jq
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface/state?arista-target=leaf1&arista-origin=openconfig' | jq .
curl -s -k -g -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface[name=Ethernet1]?arista-target=leaf1&arista-origin=openconfig' | jq .
curl -s -k -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface?arista-target=leaf1&arista-origin=openconfig' | jq .interfaces.interface[].name
curl -s -k -g -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface[name=Ethernet1]?arista-target=leaf1&arista-origin=openconfig' | jq .interfaces.interface[0].state.counters
curl -s -k -g -X GET --header 'Accept: application/json' --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5/restconf/data/interfaces/interface[name=Ethernet1]?arista-target=leaf1&arista-origin=openconfig' | jq .interfaces.interface[0].config.enabled
curl -s -k -X GET --header "Authorization: Bearer `cat token.tok`" 'https://192.168.0.5:443/restconf/data/inventory/state/device/device-id?arista-origin=arista&arista-target=' | jq '.inventory.state.device[]."device-id"'