-
Notifications
You must be signed in to change notification settings - Fork 45
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
pygnmi doesn't send anything over the wire #57
Comments
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 also, this part is not accurate:
It shall be:
Join our Zero-to-Hero Network Automation Training to learn more about Python for network automation Best, |
Hey @svautour , Please, re-open if needed. Best, |
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 |
Hey @svautour , if pygnmi doesn't send anything to a wire, it may be something with your environment. Could you please suggest what is:
Best, |
Using a venv: (virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# python3 -V (virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# python3 pygnmitest.py (virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# uname -a (virtual3.8) root@xxxxxx-ubuntu:~/TrainingExamples# more /etc/os-release (virtual3.8) root@COVEP23tools-ubuntu:~/TrainingExamples# pip3 freeze (virtual3.8) root@COVEP23tools-ubuntu:~/TrainingExamples# pip freeze Thanks, |
Hey @svautour , Try to build a new VM and see how it would work. I've just tested this:
and got:
So it doesn't seem to be an issue with pygnmi, sir. Best, |
Hello,
I thought I would try this again. Some time has passed and a new version is
out.
I did a fresh python venv install with python 3.9.12. I also tried
pygnmicli instead of pygnmi. I discovered something:
(pygnmi-test) ***@***.***_1:~/pygnmi-test# pygnmicli -u test -p test
-t 172.16.18.8:57400 -i
tcpdump shows no packets sent. However if I remove -i:
(pygnmi-test) ***@***.***_1:~/pygnmi-test# pygnmicli -u test -p test -t
172.16.18.8:57400
The SSL certificate cannot be retrieved from ('172.16.18.8', 57400)
Traceback (most recent call last):
File "/root/pygnmi-test/lib/python3.9/site-packages/pygnmi/client.py",
line 145, in connect
ssl_cert = ssl.get_server_certificate((self.__target[0],
self.__target[1])).encode("utf-8")
File "/usr/lib/python3.9/ssl.py", line 1484, in get_server_certificate
with context.wrap_socket(sock) as sslsock:
File "/usr/lib/python3.9/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.9/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/pygnmi-test/bin/pygnmicli", line 165, in <module>
main()
File "/root/pygnmi-test/bin/pygnmicli", line 39, in main
with gNMIclient(
File "/root/pygnmi-test/lib/python3.9/site-packages/pygnmi/client.py",
line 103, in __enter__
return self.connect()
File "/root/pygnmi-test/lib/python3.9/site-packages/pygnmi/client.py",
line 149, in connect
raise gNMIException(f'The SSL certificate cannot be retrieved from
{self.__target}', e)
pygnmi.client.gNMIException: The SSL certificate cannot be retrieved from
('172.16.18.8', 57400)
and tcpdump shows:
***@***.***_1:~# tcpdump -i ens3 port 57400 -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens3, link-type EN10MB (Ethernet), capture size 262144 bytes
19:38:10.539810 IP 192.168.132.72.49678 > 172.16.18.8.57400: Flags [S], seq
4267049268, win 64240, options [mss 1460,sackOK,TS val 2625562153 ecr
0,nop,wscale 7], length 0
19:38:10.543588 IP 172.16.18.8.57400 > 192.168.132.72.49678: Flags [S.],
seq 2140161584, ack 4267049269, win 43440, options [mss 1460,sackOK,TS val
923558734 ecr 2625562153,nop,wscale 11], length 0
19:38:10.543647 IP 192.168.132.72.49678 > 172.16.18.8.57400: Flags [.], ack
1, win 502, options [nop,nop,TS val 2625562156 ecr 923558734], length 0
19:38:10.544100 IP 192.168.132.72.49678 > 172.16.18.8.57400: Flags [P.],
seq 1:518, ack 1, win 502, options [nop,nop,TS val 2625562157 ecr
923558734], length 517
19:38:10.547564 IP 172.16.18.8.57400 > 192.168.132.72.49678: Flags [.], ack
518, win 22, options [nop,nop,TS val 923558736 ecr 2625562157], length 0
19:38:10.547590 IP 172.16.18.8.57400 > 192.168.132.72.49678: Flags [P.],
seq 1:16, ack 518, win 22, options [nop,nop,TS val 923558736 ecr
2625562157], length 15
19:38:10.547600 IP 192.168.132.72.49678 > 172.16.18.8.57400: Flags [.], ack
16, win 502, options [nop,nop,TS val 2625562160 ecr 923558736], length 0
19:38:10.547617 IP 172.16.18.8.57400 > 192.168.132.72.49678: Flags [R.],
seq 16, ack 518, win 22, options [nop,nop,TS val 923558736 ecr 2625562157],
length 0
19:38:10.551564 IP 172.16.18.8.57400 > 192.168.132.72.49678: Flags [R], seq
2140161600, win 0, length 0
So whatever part of pygnmi isn't working for me has to do with no TLS "-i"
flag.
Any suggestions?
Thanks,
Serge
…On Sat, Jul 23, 2022 at 2:08 PM Anton Karneliuk ***@***.***> wrote:
Hey @svautour <https://github.com/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
—
Reply to this email directly, view it on GitHub
<#57 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLZ2VMNCCXVFWME7KFYKRTVVQRINANCNFSM5UL7ADDQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
If this is against SR Linux (or perhaps some other device with security by default), try |
Test code:
from pygnmi.client import gNMIclient
if name == 'main':
host = ("172.16.18.9", "57400")
paths = ['openconfig-interfaces:interfaces', 'openconfig-network-instance:network-instances']
with gNMIclient(target=host, username="xxxx", password="xxxxxxx", insecure=True) as gc:
response = gc.capabilities()
print (response)
When I run:
(virtual3.9) root@squad3_1:~/virtual3.9# python pygnmitest.py
Traceback (most recent call last):
File "/root/virtual3.9/pygnmitest.py", line 7, in
with gNMIclient(target=host, username="xxxx", password="xxxxxxx", insecure=True) as gc:
File "/root/virtual3.9/lib/python3.9/site-packages/pygnmi/client.py", line 94, in enter
return self.connect()
File "/root/virtual3.9/lib/python3.9/site-packages/pygnmi/client.py", line 146, in connect
self.wait_for_connect(timeout)
File "/root/virtual3.9/lib/python3.9/site-packages/pygnmi/client.py", line 156, in wait_for_connect
grpc.channel_ready_future(self.__channel).result(timeout=timeout)
File "/root/virtual3.9/lib/python3.9/site-packages/grpc/_utilities.py", line 139, in result
self._block(timeout)
File "/root/virtual3.9/lib/python3.9/site-packages/grpc/_utilities.py", line 85, in _block
raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError
I have tried this in a python 3.8 and 3.9 venv on 2 different Ubuntu VMs. Same result.
If I tcpdump the NIC, I see no traffic to the host on port 57400.
Thanks,
Serge
The text was updated successfully, but these errors were encountered: