Closed laimaretto closed 3 years ago
Hello @laimaretto ,
Thanks for your kind response. Your path is not accurate, i am afraid.
By it looks, you are trying to poll info about routing interfaces, but that doesn't match any YANG modules.
Do you have interfaces configured using openconfig models? In Nokia SR OS it must be explicitly configured.
Best, Anton
Hi @akarneliuk, thanks for the reply.
Ok, I see ... as per your comment I should check the openconfig and/or YANG configuration inside the router ... didn't do it nor don't know how to do it ...
But let me check that out first ... I'm might come back here with some other doubts ... ;-)
Regards!
Lucas
Yep, basically, it could be that Nokia native models are used, we would need to tweak the path either. Best, Anton
Hello @laimaretto ,
did you have a chance to check the Nokia config?
Best, Anton
Hi @akarneliuk , so I basically was following this link from NoKia on how to enable YANG models and also the model-driven. There are three kind of YANG models that I can enable with my release 16.0.
*[gl:configure]
A:admin@rtr2# tree flat | match yang
system management-interface yang-modules
system management-interface yang-modules base-r13-modules
system management-interface yang-modules nokia-combined-modules
system management-interface yang-modules nokia-modules
system management-interface yang-modules openconfig-modules
So this is the configuration that I have enabled:
system {
name "rtr2"
grpc {
admin-state enable
allow-unsecure-connection
rib-api {
admin-state enable
}
}
management-interface {
configuration-mode model-driven
yang-modules {
base-r13-modules true
nokia-modules true
openconfig-modules true
nokia-combined-modules true
}
}
However, after setting paths = ["gl:configure router Base interface system"]
and ...
with gNMIclient(
target = (host['ip_address'],host['port']),
username = host['username'],
password = host['password'],
insecure = True
) as gc:
result = gc.get(path=paths)
... all I get is...
Host: 192.168.122.12:57400
Error: MINOR: MGMT_CORE #2201: /configure router Base interface system - Unknown element
CRITICAL:root:Host: 192.168.122.12:57400, Error: MINOR: MGMT_CORE #2201: /configure router Base interface system - Unknown element
ERROR:root:Internal Python error in the inspect module.
Which is weird since I can get that information from within the console, as follows:
*[gl:configure router "Base" interface "system"]
A:admin@rtr2# info
ipv4 {
primary {
address 172.16.0.12
prefix-length 32
}
}
For sure is something I'm missing, either on enabling some configuration within the router, or something with the declaration of the path
variable ...
Any hint from your side will be of help ...
Thanks!
Lucas
Hey @laimaretto ,
Yeah, your path should follow YANG module, not the CLI. In the Nokia native modules you should have /nokia-conf:configure/router[router-name=Base]/interface[interface-name=system]
.
Here is the example:
$ cat gnmi_get.py
#!/usr/bin/env python
# Modules
from pygnmi.client import gNMIclient
# Variables
host = {"ip_address": "10.0.0.1", "port": 57400}
# Body
if __name__ == "__main__":
paths = ['/nokia-conf:configure/router[router-name=Base]/interface[interface-name=system]']
with gNMIclient(target=(host["ip_address"], host["port"]), username="***",
password="***", insecure=True) as gc:
result = gc.get(path=paths, encoding='json')
print(f"{host['ip_address']}: {result}\n\n")
And result:
10.0.0.1: {'notification': [{'timestamp': 1619463746816959227, 'update': [{'path': 'configure/router[router-name=Base]/interface[interface-name=system]', 'val': {'interface-name': 'system', 'admin-state': 'enable', 'ipv4': {'bfd': {'admin-state': 'enable', 'transmit-interval': 100, 'receive': 100, 'multiplier': 3, 'type': 'cpm-np'}, 'primary': {'address': '10.10.10.10', 'prefix-length': 32}}, 'ipv6': {'bfd': {'admin-state': 'enable', 'transmit-interval': 100, 'receive': 100, 'multiplier': 3, 'type': 'cpm-np'}, 'address': [{'ipv6-address': 'fc00:10:10:10::10', 'prefix-length': 128}]}}}]}]}
Make sure you download the latest version of pygnmi we published yesterday.
Best, Anton
Hey @laimaretto ,
We haven't heard from you for a bit and provide the example. Please, re-open the issue or open the new one if further assistance is needed.
Best, Anton
Hi there! First of all, thanks for this library: it looks awesome!
You know I've been trying what I think is the simplest example, as you show in the main page of the project:
After that, I get an error:
In the router I do have grpc enabled, and so gnmi.
Nevertheless my guess is there is something wrong either with the
path
variable of some configuration missing in the router. All I want to do is to get the list of interfaces as you can see in the path variable.Could you help me with this? Thanks!!
Lucas