You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
admin@sonic:~$ sudo openssl req -new -newkey rsa:4096 -nodes
-keyout /etc/sonic/telemetry/streamingtelemetryserver.key -out /etc/sonic/telemetry/streamingtelemetryserver.csr
-subj "/CN=dev-pygnmi-sonic-003" --> Here is used hostname and CN as "sonic".
if name == "main":
with gNMIclient(
target=(host["ip_address"], host["port"]),
username=host["username"],
password=host["password"],
path_root="/etc/sonic/telemetry/certs/ca.pem",
path_cert="/etc/sonic/telemetry/certs/server.pem",
path_key="/etc/sonic/telemetry/certs/server.key",
override="sonic",
#override="dev-pygnmi-sonic-003",
) as gc:
result = gc.capabilities()
print(json.dumps(result, indent=4))
Iam getting a proper output of the capabilities: $ python3 test.py
{
"supported_models": [
{
"name": "openconfig-acl",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-acl",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-interfaces",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-lldp",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-platform",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-system",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "ietf-yang-library",
"organization": "IETF NETCONF (Network Configuration) Working Group",
"version": "2016-06-21"
},
{
"name": "sonic-db",
"organization": "SONiC",
"version": "0.1.0"
}
],
"supported_encodings": [
"json",
"json_ietf"
],
"gnmi_version": "0.7.0"
}
Like this if i try to perform the get/set operation iam facing issue.
$ python3 get.py
Traceback (most recent call last):
File "get.py", line 15, in
password=host["password"], insecure=True) as gc:
File "/usr/local/lib/python3.6/dist-packages/pygnmi/client.py", line 136, in enter
return self.connect()
File "/usr/local/lib/python3.6/dist-packages/pygnmi/client.py", line 259, in connect
self.wait_for_connect(timeout)
File "/usr/local/lib/python3.6/dist-packages/pygnmi/client.py", line 281, in wait_for_connect
grpc.channel_ready_future(self.__channel).result(timeout=timeout)
File "/usr/local/lib/python3.6/dist-packages/grpc/_utilities.py", line 139, in result
self._block(timeout)
File "/usr/local/lib/python3.6/dist-packages/grpc/_utilities.py", line 85, in _block
raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError
First like mentioned in the link https://karneliuk.com/2023/01/automation-19-enabling-ocp-sonic-to-be-managed-via-gnmi-with-pygnmi/ we have made a connection between Linux machine and SONiC switch.
Configured all the things like hostname, ip-address, up and running the telemetry container.
Performed the set of commands to create a certification:
admin@sonic:~$ sudo openssl req -x509 -newkey rsa:4096 -keyout /etc/sonic/telemetry/dsmsroot.key
-out /etc/sonic/telemetry/dsmsroot.cer -sha256 -days 365 -nodes -subj '/CN=lab-ca'
admin@sonic:~$ sudo openssl req -new -newkey rsa:4096 -nodes
-keyout /etc/sonic/telemetry/streamingtelemetryserver.key -out /etc/sonic/telemetry/streamingtelemetryserver.csr
-subj "/CN=dev-pygnmi-sonic-003" --> Here is used hostname and CN as "sonic".
admin@sonic:~$ sudo openssl x509 -req -in /etc/sonic/telemetry/streamingtelemetryserver.csr
-CA /etc/sonic/telemetry/dsmsroot.cer -CAkey /etc/sonic/telemetry/dsmsroot.key
-CAcreateserial -out /etc/sonic/telemetry/streamingtelemetryserver.cer
-days 365 -sha512
$ cat test.py
from pygnmi.client import gNMIclient
import json
host = {
"ip_address": "50.0.0.20",
"port": 50051,
"username": "admin",
"password": "YourPaSsWoRd",
}
if name == "main":
with gNMIclient(
target=(host["ip_address"], host["port"]),
username=host["username"],
password=host["password"],
path_root="/etc/sonic/telemetry/certs/ca.pem",
path_cert="/etc/sonic/telemetry/certs/server.pem",
path_key="/etc/sonic/telemetry/certs/server.key",
override="sonic",
#override="dev-pygnmi-sonic-003",
) as gc:
result = gc.capabilities()
print(json.dumps(result, indent=4))
Iam getting a proper output of the capabilities: $ python3 test.py
{
"supported_models": [
{
"name": "openconfig-acl",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-acl",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-interfaces",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-lldp",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-platform",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "openconfig-system",
"organization": "OpenConfig working group",
"version": "1.0.2"
},
{
"name": "ietf-yang-library",
"organization": "IETF NETCONF (Network Configuration) Working Group",
"version": "2016-06-21"
},
{
"name": "sonic-db",
"organization": "SONiC",
"version": "0.1.0"
}
],
"supported_encodings": [
"json",
"json_ietf"
],
"gnmi_version": "0.7.0"
}
Like this if i try to perform the get/set operation iam facing issue.
$ python3 get.py
Traceback (most recent call last):
File "get.py", line 15, in
password=host["password"], insecure=True) as gc:
File "/usr/local/lib/python3.6/dist-packages/pygnmi/client.py", line 136, in enter
return self.connect()
File "/usr/local/lib/python3.6/dist-packages/pygnmi/client.py", line 259, in connect
self.wait_for_connect(timeout)
File "/usr/local/lib/python3.6/dist-packages/pygnmi/client.py", line 281, in wait_for_connect
grpc.channel_ready_future(self.__channel).result(timeout=timeout)
File "/usr/local/lib/python3.6/dist-packages/grpc/_utilities.py", line 139, in result
self._block(timeout)
File "/usr/local/lib/python3.6/dist-packages/grpc/_utilities.py", line 85, in _block
raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError
--> script to run the get operation:
gnmi_get -xpath_target COUNTERS_DB -xpath COUNTERS_PORT_NAME_MAP -target_addr 50.0.0.20:50051 -alsologtostderr -insecure true
gnmi_get -xpath_target COUNTERS_DB -xpath COUNTERS/eth0 -target_addr 50.0.0.20:50051 -alsologtostderr -insecure true
Both command troughed the same issue:
The text was updated successfully, but these errors were encountered: