Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygnmicli sub #89

Open
ksator opened this issue Jul 30, 2022 · 8 comments
Open

pygnmicli sub #89

ksator opened this issue Jul 30, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@ksator
Copy link

ksator commented Jul 30, 2022

Hello @akarneliuk
I am not able to use pygnmicli with subscribe-once subscribe-stream subscribe2
I already provided output examples in issue #85
using subscribe2 on the same setup with Python pygNMI works

@akarneliuk akarneliuk self-assigned this Jul 30, 2022
@akarneliuk akarneliuk added the bug Something isn't working label Jul 30, 2022
@akarneliuk
Copy link
Owner

Hello @ksator ,

Thanks, I already picked that up in that thread, but it is good to track that separately, so thanks for creating a new issue. The fix is coming...

Best,
Anton

@akarneliuk
Copy link
Owner

akarneliuk commented Jul 31, 2022

Hello @ksator ,

it shall be fixed in #90 and release pygnmi==0.8.5. You still will be getting exception when you close stream subscription, cause that is related to the underlying gRPC code. I'm still looking into that one.

Best,
Anton

@ksator
Copy link
Author

ksator commented Jul 31, 2022

Thank you @akarneliuk

capabilities works

pygnmicli -t "192.168.0.5:443" --token `cat token.tok` -o capabilities

subscribe-once works

pygnmicli -t "192.168.0.5:443" --token `cat token.tok` -o subscribe-once -x /inventory/state/device/device-id
pygnmicli -t "192.168.0.5:443" --token `cat token.tok` -o subscribe-once -x arista:/inventory/state/device/device-id
pygnmicli -t "192.168.0.5:443" --token `cat token.tok` -o subscribe-once -x openconfig:/interfaces/interface[name=Ethernet2]/state/admin-status --gnmi-path-target leaf1

@ksator
Copy link
Author

ksator commented Jul 31, 2022

subscribe-stream works, but there is a traceback when you close the connection using ^C

arista@devbox:~$ pygnmicli -t "192.168.0.5:443" --token `cat token.tok` -o subscribe-stream -x openconfig:/interfaces/interface[name=Ethernet2]/state/admin-status --gnmi-path-target leaf1
Collecting Capabilities...
Collection of Capabilities is successfull
{
    "update": {
        "update": [
            {
                "path": "interfaces/interface[name=Ethernet2]/state/admin-status",
                "val": "UP"
            }
        ],
        "timestamp": 1659298841014572795,
        "prefix": ""
    },
    "sync_response": true
}

^CTelemtry collection is temrinated.
Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/home/arista/.local/lib/python3.9/site-packages/pygnmi/client.py", line 950, in enqueue_updates
    for update in subscription:
  File "/home/arista/.local/lib/python3.9/site-packages/grpc/_channel.py", line 426, in __next__
    return self._next()
  File "/home/arista/.local/lib/python3.9/site-packages/grpc/_channel.py", line 826, in _next
    raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.CANCELLED
        details = "Channel closed!"
        debug_error_string = "{"created":"@1659299168.214843927","description":"Error received from peer ipv4:192.168.0.5:443","file":"src/core/lib/surface/call.cc","file_line":966,"grpc_message":"Channel closed!","grpc_status":1}"
>
arista@devbox:~$ 

@ksator
Copy link
Author

ksator commented Jul 31, 2022

subscribe2 doesnt work but I think I dont need if I use subscribe-stream and subscribe-once

arista@devbox:~$ pygnmicli -t "192.168.0.5:443" --token `cat token.tok` -o subscribe2 -x openconfig:/interfaces/interface[name=Ethernet2]/state/admin-status --gnmi-path-target leaf1
Collecting Capabilities...
Collection of Capabilities is successfull
Traceback (most recent call last):
  File "/home/arista/.local/bin/pygnmicli", line 163, in <module>
    main()
  File "/home/arista/.local/bin/pygnmicli", line 76, in main
    mode = args.operation.split("-")[1]
IndexError: list index out of range
arista@devbox:~$ ```

@akarneliuk
Copy link
Owner

Hey @ksator ,

That is correct, you don't need subsribe2, so just use subsribe-once and subsrcibe-stream. We will work out how to remove the tracebacks, but for the time being, it is important it is working. Thanks for validating.

Best,
Anton

@vinodkumar-singh
Copy link

Hi, I still see this issue. Is this resolved? After closing the connection, if I re run the code to stream using subscribe2 or subscribe-once or subscribe-stream, it always throws error "grpc status:1, grpcs_message:"channel closed!"

@akarneliuk
Copy link
Owner

Hey @vinodkumar-singh ,
Is there any help needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants