Giter Site home page Giter Site logo

Openconfig Path Question about gnmi-gateway HOT 2 OPEN

openconfig avatar openconfig commented on August 23, 2024
Openconfig Path Question

from gnmi-gateway.

Comments (2)

gavmckee80 avatar gavmckee80 commented on August 23, 2024 1

@colinmcintosh , thanks for coming back to me - this is a great project and saves me writing a bunch of code :D , which is even better.

I'll probably load from Netbox at some point , I'm just trying to get all the components to work , Clustering etc.

Another question on paths first.

I have two seperate requestss defined , one for Arista (eos) and one for Palo Alto (panos).

The second path in eos is to get the CPU stats

Again testing

gnmic -a arista-sw1:6030 -u eos -p password --insecure subscribe --path "components/component/cpu" --stream-mode on_change
{
  "source": "arista-sw1:6030",
  "subscription-name": "default-1629846458",
  "timestamp": 1629847029458359290,
  "time": "2021-08-24T23:17:09.45835929Z",
  "updates": [
    {
      "Path": "components/component[name=CPU0]/cpu/utilization/state/instant",
      "values": {
        "components/component/cpu/utilization/state/instant": 6
      }
    }
  ]
}
........

When I spin up the GNMI GW I don't seem to get the CPU related output.

{
    "request": {
      "eos": {
        "subscribe": {
          "prefix": {
          },
          "subscription": [
            {
              "path": {
                "elem": [
                  {
                    "name": "interfaces"
                  },
                  {
                  "name": "interface"
                  },
                  {
                  "name": "state"
                  },
                  {
                  "name": "counters"
                  }
                ]
              }
            },
            {
              "path": {
                "elem": [
                  {
                    "name": "components"
                  },
                  { 
                    "name": "component"
                  },
                  {
                    "name": "cpu"
                  }
                ]
              }
            }
          ]
        }
      },
      "panos": {
        "subscribe": {
          "prefix": {
          },
          "subscription": [
            {
              "path": {
                "elem": [
                  {
                    "name": "interfaces"
                  },
                  {
                  "name": "interface"
                  },
                  {
                  "name": "state"
                  },
                  {
                  "name": "counters"
                  }
                ]
              }
            }
          ]
        }
      }
  
    },
    "target": {
      "arista-sw1": {
        "addresses": [
          "arista-sw1:6030"
        ],
        "credentials": {
          "username": "eos",
          "password": "password"
        },
        "request": "eos",
        "meta": {
          "NoTLSVerify": "yes"
        }
      }
      },
      "panos-fw1": {
        "addresses": [
          "panos-fw1:9339"
        ],
        "credentials": {
          "username": "panos",
          "password": "password"
        },
        "request": "panos",
        "meta": {
          "NoTLSVerify": "yes"
        }
      }
}

Is there a way to set the origin for a request also ? Something like ....
gnmi -addr arista-sw1:6030 -username admin
get origin=eos_native '/Kernel/proc/cpu/utilization/total'

from gnmi-gateway.

colinmcintosh avatar colinmcintosh commented on August 23, 2024

Hi @gavmckee80! The value of elem is a list of each of the elements between the slashes in the xpath-style string that you would use with gNMIc. For /interfaces/interface/state/counters it would look something like:

{
  "request": {
    "default": {
      "subscribe": {
        "prefix": {
        },
        "subscription": [
          {
            "path": {
              "elem": [
                {
                  "name": "interfaces"
                },
                {
                  "name": "interface"
                },
                {
                  "name": "state"
                },
                {
                  "name": "counters"
                }
              ]
            }
          }
        ]
      }
    }
  },
  "target": {
    "<host>": {
      "addresses": [
        "<host>:6030"
      ],
      "credentials": {
        "username": "xxxxxx",
        "password": "xxxxxx"
      },
      "request": "default",
      "meta": {
        "NoTLSVerify": "yes"
      }
    }

  }
}

You're also able to use xpath-style paths with the "simple" Target Loader in gnmi-gateway. For example your simple config file would look something like:

connection:
  my-router:
    addresses:
      - my-router.test.example.net:9339
    credentials:
      username: myusername
      password: mypassword
    request: default
    meta:
      NoTLSVerify: yes
request:
  default:
    paths:
      - /interfaces/interface/state/counters

from gnmi-gateway.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.