Closed bpchoi closed 2 months ago
Hey @bpchoi ,
Flag no_qos_marking
was developed specifically for this purpose. Try to amend the XPath /interfaces/interface[name=et-0/1/11]
to be /interfaces/interface[name=et-0/1/11]/state
and give it a go (--no_qos_marking
shall be maintained)
Best, Anton
Hi Anton,
This is what I got from device for capability. { 'gnmi_version': '0.7.0', 'supported_encodings': ['ascii', 'json_ietf'], 'supported_models': [ { 'name': 'junos-rpc-auto-bandwidth', 'organization': 'Juniper Networks, Inc.', 'version': '2019-01-01'}, ...
In case of json_ietf encoding, grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with: status = StatusCode.UNIMPLEMENTED details = " Encoding 4 not supported, Only PROTO/JSON encoding supported" debug_error_string = "UNKNOWN:Error received from peer ipv4:10.48.49.231:32767 {created_time:"2023-07-24T19:17:44.613652547+00:00", grpc_status:12, grpc_message:" Encoding 4 not supported, Only PROTO/JSON encoding supported"}"
With same device, other client like 'gnmic' works well. I'm not quite sure why you think Juniper telemetry implementation is 'not ideal'. Would you elaborate more?
Thank you, Phil
Hi Anton,
With your suggested way, still no date is received same as before. $ pygnmicli -t 10.48.49.231:32767 snip --insecure -e json -o subscribe-stream -x /interfaces/interface[name=et-0/1/11]/state --no-qos-marking Collecting Capabilities... Collection of Capabilities is successfull Collecting Capabilities... Collection of Capabilities is successfull { "update": {}, "sync_response": true } ^CTelemtry collection is temrinated. Exception in thread Thread-5 (enqueue_updates): Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/home/bpchoi/venv/lib/python3.10/site-packages/pygnmi/client.py", line 972, in enqueue_updates for update in subscription: File "/home/bpchoi/venv/lib/python3.10/site-packages/grpc/_channel.py", line 475, in next return self._next() File "/home/bpchoi/venv/lib/python3.10/site-packages/grpc/_channel.py", line 881, in _next raise self grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with: status = StatusCode.CANCELLED details = "Channel closed!" debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Channel closed!", grpc_status:1, created_time:"2023-07-24T13:42:47.815601706-07:00"}"
Thank you, Phil
Add /counters
. here is the working code for Juniper:
import os
import sys
from pygnmi.client import gNMIclient
# Statics
DEVICES = {
"juniper": {
"host": "hostname-juniper-router",
"port": "32767",
"message": {
"subscription": [
{
"path": "/openconfig-interfaces:interfaces/interface/state/counters",
"mode": "sample",
"sample_interval": 3000000000,
}
],
"mode": "stream",
"encoding": "proto",
},
"get": ['/openconfig-interfaces:interfaces/interface/config']
},
}
# Functions
def get_device() -> dict:
if len(sys.argv) != 2:
raise ValueError("You haven't specified device type.")
elif sys.argv[1] not in DEVICES.keys():
raise ValueError("Unsupported device type.")
else:
return DEVICES[sys.argv[1]]
# Body
if __name__ == "__main__":
creds = (os.getenv("AUTOMATION_USERNAME"), os.getenv("AUTOMATION_PASSWORD"))
dut = get_device()
with gNMIclient(
target=(dut["host"], dut["port"]),
username=creds[0],
password=creds[1],
insecure=True,
debug=False,
no_qos_marking=True,
) as gconn:
r1 = gconn.capabilities()
print(r1)
for item in gconn.subscribe2(subscribe=dut["message"]):
print(item)
Hi Anton,
I could subscribe using pygnmicli tool with 'no-qos-marking' flag on and update path with your kind info. How can I do the same with nornir_pygnmi plugin with making 'no-qos-marking' flag to nornir task, gnmi_subscribe?
Thanks, Phil
Hey @bpchoi, Check out our documentation: https://github.com/akarneliuk/nornir_pygnmi/blob/main/examples/04_example_gnmi_subscribe.md
You can pass extra variables, (e.g., no_qos_verify
) in nornir connection_options
: https://github.com/akarneliuk/nornir_pygnmi/blob/main/examples/inventory/hosts.yaml#L9
Hello,
The following error is seen and need some help.
$ pygnmicli -t 10.48.49.231:32767 --insecure -e json -o subscribe-stream -x /interfaces/interface[name=et-0/1/11]
Collecting Capabilities...
Collection of Capabilities is successfull
Collecting Capabilities...
Collection of Capabilities is successfull
Exception in thread Thread-5 (enqueue_updates):
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, self._kwargs)
File "/home/bpchoi/venv/lib/python3.10/site-packages/pygnmi/client.py", line 972, in enqueue_updates
for update in subscription:
File "/home/bpchoi/venv/lib/python3.10/site-packages/grpc/_channel.py", line 475, in next
return self._next()
File "/home/bpchoi/venv/lib/python3.10/site-packages/grpc/_channel.py", line 881, in _next
raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.UNIMPLEMENTED
details = "Qos not supported"**
debug_error_string = "UNKNOWN:Error received from peer ipv4:10.48.49.231:32767 {created_time:"2023-07-24T16:01:04.61338815+00:00", grpc_status:12, grpc_message:"Qos not supported"}"
And with '--no-qos-marking' option, no data is received and even I don't see grpc connection to the device.
$ pygnmicli -t 10.48.49.231:32767 --insecure -e json -o subscribe-stream -x /interfaces/interface[name=et-0/1/11] --no-qos-marking
Collecting Capabilities...
Collection of Capabilities is successfull
Collecting Capabilities...
Collection of Capabilities is successfull
{
"update": {},
"sync_response": true
}
^CException in thread Thread-5 (enqueue_updates):
Traceback (most recent call last):
Telemtry collection is temrinated.
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/bpchoi/venv/lib/python3.10/site-packages/pygnmi/client.py", line 972, in enqueue_updates
for update in subscription:
File "/home/bpchoi/venv/lib/python3.10/site-packages/grpc/_channel.py", line 475, in next
return self._next()
File "/home/bpchoi/venv/lib/python3.10/site-packages/grpc/_channel.py", line 881, in _next
raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.CANCELLED
details = "Channel closed!"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2023-07-24T16:02:12.620324755+00:00", grpc_status:1, grpc_message:"Channel closed!"}"
Is there anything missing?
Regards, Phil