Skip to content

Instantly share code, notes, and snippets.

@sulrich
Last active March 21, 2021 15:20
Show Gist options
  • Save sulrich/81a2e2aec1d70d7a62f21a59299e640b to your computer and use it in GitHub Desktop.
Save sulrich/81a2e2aec1d70d7a62f21a59299e640b to your computer and use it in GitHub Desktop.
random arista gnmi / gnmic notes

getting show commands via gnmi

most/lots of our show commands are json framed (you can check this from the cli by piping the command through |json from the CLI. this is also what we effectively expose via eAPI. this also also accessible via gnmi. you just feed the command in with the origin set to cli. note, the syntax w/gnmic is a little janky, but you get the idea.

krusty(~)% gnmic -a 192.168.1.21:6030 -u admin -p arista --insecure \
 get --path "cli:/show version"
Get Response:
[
  {
    "time": "1969-12-31T18:00:00-06:00",
    "updates": [
      {
        "Path": "cli:show version",
        "values": {
          "show version": {
            "architecture": "i686",
            "bootupTimestamp": 1598125714,
            "configMacAddress": "00:00:00:00:00:00",
            "hardwareRevision": "",
            "hwMacAddress": "00:00:00:00:00:00",
            "internalBuildId": "217ce1f6-919c-494b-ba67-66c9c4fc4fed",
            "internalVersion": "4.25.1F-20054771.oslorel",
            "isIntlVersion": false,
            "memFree": 2911200,
            "memTotal": 3999924,
            "mfgName": "",
            "modelName": "vEOS",
            "serialNumber": "",
            "systemMacAddress": "00:0c:29:6f:7d:c4",
            "uptime": 64411.18,
            "version": "4.25.1F-20054771.oslorel (engineering build)"
          }
        }
      }
    ]
  }
]

native configuration via gnmi

adding config

krusty(~)% gnmic -a 192.168.1.21:6030 --encoding ASCII set \
   --update-path "cli:" --update-value "logging host 192.168.1.13 514"
Set Response:
{
  "timestamp": 1598346946666698662,
  "time": "2020-08-25T04:15:46.666698662-05:00",
  "results": [
    {
      "operation": "UPDATE",
      "path": "cli:"
    }
  ]
}

validation

veos-1[09:12:56]#  sh run | i logging
logging host 192.168.1.10 514
logging host 192.168.1.11 514
veos-1[09:15:36]#  sh run | i logging
logging host 192.168.1.10 514
logging host 192.168.1.11 514
logging host 192.168.1.13 514
veos-1[09:15:50]#

removing config

krusty(~)% gnmic -a 192.168.1.21:6030 --encoding ASCII set \
   --update-path "cli:" --update-value "no logging host 192.168.1.13 514"
Set Response:
{
  "timestamp": 1598346979552010864,
  "time": "2020-08-25T04:16:19.552010864-05:00",
  "results": [
    {
      "operation": "UPDATE",
      "path": "cli:"
    }
  ]
}

validation

veos-1[09:15:36]#  sh run | i logging
logging host 192.168.1.10 514
logging host 192.168.1.11 514
logging host 192.168.1.13 514
veos-1[09:15:50]#  sh run | i logging
logging host 192.168.1.10 514
logging host 192.168.1.11 514
veos-1[09:16:28]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment