Giter Site home page Giter Site logo

Comments (6)

akarneliuk avatar akarneliuk commented on August 18, 2024

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

from pygnmi.

bpchoi avatar bpchoi commented on August 18, 2024

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

from pygnmi.

bpchoi avatar bpchoi commented on August 18, 2024

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

from pygnmi.

akarneliuk avatar akarneliuk commented on August 18, 2024

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)

from pygnmi.

bpchoi avatar bpchoi commented on August 18, 2024

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

from pygnmi.

akarneliuk avatar akarneliuk commented on August 18, 2024

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

from pygnmi.

Related Issues (20)

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.