Giter Site home page Giter Site logo

Comments (8)

akarneliuk avatar akarneliuk commented on July 19, 2024

Hello @svautour ,

sorry for the delay, I somehow overlooked your request. I'm afraid you don't provide any details of your setup. Please, provide the configuration of your network device you try to manage with pygnmi.

also, this part is not accurate:

if name == 'main':

It shall be:

if __name__ == "__main__":

Join our Zero-to-Hero Network Automation Training to learn more about Python for network automation

Best,
Anton

from pygnmi.

akarneliuk avatar akarneliuk commented on July 19, 2024

Hey @svautour ,

Please, re-open if needed.

Best,
Anton

from pygnmi.

svautour avatar svautour commented on July 19, 2024

Re-opening. Sorry for the delay, I was on vacation.

My code does have the underscore. It didn't come across correctly as I didn't paste it as a code block.

What information do you require that I did not include? What command outputs would you like?

The config on the router that I am trying to manage is irrelevant here as when I tcpdump the NIC on the server where I run the code, I see no outbound packets to my device on port 57400.

Thanks for creating and sharing. I am looking forward to a gnmi client for python. I will help if I can.

Serge

from pygnmi.

akarneliuk avatar akarneliuk commented on July 19, 2024

Hey @svautour ,

if pygnmi doesn't send anything to a wire, it may be something with your environment. Could you please suggest what is:

  • Your OS and its version
  • Your Python version
  • Output of pip freeze

Best,
Anton

from pygnmi.

svautour avatar svautour commented on July 19, 2024

Using a venv:

(virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# python3 -V
Python 3.8.0

(virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# python3 pygnmitest.py
Traceback (most recent call last):
File "pygnmitest.py", line 7, in
with gNMIclient(target=host, username="svautour", password="xxxxxxx", insecure=True) as gc:
File "/root/TrainingExamples/virtual3.8/lib/python3.8/site-packages/pygnmi/client.py", line 94, in enter
return self.connect()
File "/root/TrainingExamples/virtual3.8/lib/python3.8/site-packages/pygnmi/client.py", line 146, in connect
self.wait_for_connect(timeout)
File "/root/TrainingExamples/virtual3.8/lib/python3.8/site-packages/pygnmi/client.py", line 156, in wait_for_connect
grpc.channel_ready_future(self.__channel).result(timeout=timeout)
File "/root/TrainingExamples/virtual3.8/lib/python3.8/site-packages/grpc/_utilities.py", line 139, in result
self._block(timeout)
File "/root/TrainingExamples/virtual3.8/lib/python3.8/site-packages/grpc/_utilities.py", line 85, in _block
raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError

(virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# uname -a
Linux xxxxxx-ubuntu 4.15.0-167-generic #175-Ubuntu SMP Wed Jan 5 01:56:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

(virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# more /etc/os-release
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

(virtual3.8) root@COVEP23tools-ubuntu:~/TrainingExamples# pip3 freeze
cffi==1.15.0
cryptography==36.0.2
dictdiffer==0.9.0
grpcio==1.44.0
grpcio-tools==1.44.0
kthread==0.2.3
protobuf==3.20.0
pycparser==2.21
pygnmi==0.6.9
six==1.16.0

(virtual3.8) root@COVEP23tools-ubuntu:~/TrainingExamples# pip freeze
cffi==1.15.0
cryptography==36.0.2
dictdiffer==0.9.0
grpcio==1.44.0
grpcio-tools==1.44.0
kthread==0.2.3
protobuf==3.20.0
pycparser==2.21
pygnmi==0.6.9
six==1.16.0

Thanks,
Serge

from pygnmi.

akarneliuk avatar akarneliuk commented on July 19, 2024

Hey @svautour ,

Try to build a new VM and see how it would work. I've just tested this:

if __name__ == "__main__":
    with gNMIclient(target=(ENV_HOSTNAME, ENV_PORT),
                    username=ENV_USERNAME,
                    password=ENV_PASSWORD,
                    insecure=True) as gconn:
        gconn.capabilities()

        result = gconn.get(path=["/"])
        print(result)

and got:

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes
16:52:46.668450 IP 192.168.1.115.60630 > ***.***.***.***.57400: Flags [S], seq 2497241027, win 64240, options [mss 1460,sackOK,TS val 867433530 ecr 0,nop,wscale 7], length 0
16:52:46.672539 IP ***.***.***.***.57400 > 192.168.1.115.60630: Flags [S.], seq 1098571442, ack 2497241028, win 65160, options [mss 1460,sackOK,TS val 2456298786 ecr 867433530,nop,wscale 7], length 0
16:52:46.672583 IP 192.168.1.115.60630 > ***.***.***.***.57400: Flags [.], ack 1, win 502, options [nop,nop,TS val 867433534 ecr 2456298786], length 0

So it doesn't seem to be an issue with pygnmi, sir.

Best,
Anton

from pygnmi.

svautour avatar svautour commented on July 19, 2024

from pygnmi.

jbemmel avatar jbemmel commented on July 19, 2024

If this is against SR Linux (or perhaps some other device with security by default), try insecure=False

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.