Description

Some customers have enabled gNMI (gRPC Network Management Interface) on their Junos devices but experience difficulties retrieving specific hierarchical levels of configuration features from the configuration file.

Commonly, users want to access particular segments, such as interface or system-level hierarchies, rather than the entire configuration.

Symptoms

  • Inability to retrieve specific sections of the configuration using gNMI/gRPC.
  • Errors or incomplete data when attempting to access desired hierarchical levels.
  • Customer reports requesting configuration data are returning larger or unexpected data sets.

Solution

Juniper TAC has conducted tests in the lab and provided the following commands to assist customers in gathering parts of the configuration using gNMI with the get request.


Using Native Juniper Paths

Customers can utilize the following commands to retrieve specific hierarchy stanzas:

Example of Interfaces Hierarchy

To access the interfaces hierarchy, use the command:

root@Ubuntu:~# gnmic -a host:port -u user -p password --insecure get --type CONFIG --encoding json_ietf --path "juniper:/interfaces"

Example of System Hierarchy

To access the system hierarchy, use the command:

root@Ubuntu:~# gnmic -a host:port -u user -p password --insecure get --type CONFIG --encoding json_ietf --path "juniper:/system"

Example of Routing Instances Hierarchy

To access the routing instances hierarchy, use the command:

root@Ubuntu:~# gnmic -a host:port -u user -p password --insecure get --type CONFIG --encoding json_ietf --path "juniper:/routing-instances"


Example Output for Interfaces Hierarchy

When successfully retrieving the interfaces configuration, the expected output may look like this:

[
  {
    "source": "Devie IP:Port",
    "timestamp": 1729103693125550193,
    "time": "2024-10-16T18:34:53.125550193Z",
    "updates": [
      {
        "Path": "juniper:interfaces",
        "values": {
          "interfaces": {
            "interface": [
              {
                "description": "TEST xe-0/0/0",
                "name": "xe-0/0/0",
                "unit": [
                  {
                    "family": {
                      "inet": {
                        "address": [
                          {
                            "name": "1.1.1.1/30"
                          }
                        ]
                      }
                    },
                    "name": 0
                  }
                ]
              },
              {
                "description": "TEST xe-0/0/4",
                "name": "xe-0/0/4"
              }
            ]
          }
        }
      }
    ]
  }
]


By using the commands outlined above, customers should be able to successfully retrieve the desired hierarchical data from their Junos devices using gNMI/gRPC.

If issues persist, consider verifying the connection settings and permissions or reaching out for further support.

Modification History

2024-10-16 : Article Created