[j-nsp] gNMI on MX960

Jared Mauch jared at puck.nether.net
Thu Mar 7 10:40:42 EST 2024


I’ve been spending some time on this as well, here’s the first thing I would ask you:


If you do “show version | match tele”

Eg:

jared at Router> show version | match tele 

{master:0}
jared at Router> 

vs

jared at Router> show version | match tele 
JUNOS na telemetry [21.4R3-S5.17]

{master:0}

What do you see?  I’ve had varying results based on the platform.

The second thing is, does your sensor path actually complete?

You may want to try to use a UDP based sensor instead to start to validate the platform will output what you expect, for example:

services {
    analytics {
        streaming-server server-name {
            remote-address 10.0.0.100;
            remote-port 22022;
        }
        export-profile export-interfaces {
            local-address lo0.0-ip-address;
            local-port 9877;
            reporting-rate 60;
            format gpb;
            transport udp;
        }                               
        sensor data-interfaces {
            server-name server-name;
            export-name export-interfaces;
            resource /interfaces/interface;
        }



A simple receiver such as:

#!/usr/bin/python3
import socket, struct
from google.protobuf.descriptor import FieldDescriptor
from google.protobuf.json_format import MessageToJson
import google.protobuf.text_format
import telemetry_top_pb2 # build w/ protoc

# Bind Socket UDP port as Telemetry recevice server
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', 22022))


Telemetry_content = telemetry_top_pb2.TelemetryStream()
while True:
    buf, (src_ip, src_port) = sock.recvfrom(65535)
    print("received %d from %s:%d" % (len(buf), src_ip, src_port))

    with warnings.catch_warnings(record=True) as w:
        ret = Telemetry_content.ParseFromString(buf)
        if len(w) > 0:
            print ("Runtime Warning using ParseFromString: ", w)
            for x in w:
                print("\t", x)

    print(google.protobuf.text_format.MessageToString(Telemetry_content, print_unknown_fields=True, force_colon=True, use_index_order=True))


This will save a lot of effort/overhead of the certificates etc, and let you make sure the code supports the sensors you expect, and you can use protoc to add in the photo files that might be needed.

I’ve seen Juniper output invalid GPB in cases where the software doesn’t support the sensors.

- Jared


> On Mar 7, 2024, at 10:25 AM, Sebastian Wiesinger via juniper-nsp <juniper-nsp at puck.nether.net> wrote:
> 
> Hello everyone,
> 
> I'm trying (and failing) to get gNMI running on an MX960. All I'm
> getting are weird errors. Has anyone successfully used gNMI
> subscriptions on an MX box for streaming telemetry? If so, which
> config did you use on the box and in the client?
> 
> My config on the MX is this:
> 
> set system services extension-service request-response grpc ssl address 10.4.0.78
> set system services extension-service request-response grpc ssl port 30030
> set system services extension-service request-response grpc ssl local-certificate gnmi
> set system services extension-service request-response grpc skip-authentication
> 
> set security certificates local gnmi "-----BEGIN PRIVATE KEY-----\n[...]\n-----END CERTIFICATE-----\n"
> 
> First I had port 3060 which produced weird errors but nothing else.
> Moving the gNMI service to port 30030 at least made the gNMI
> connection succeed. Then I got weird gRPC errors, so I upgraded JunOS
> on the box to 21.2R3-S5.4.
> 
> Now, when I try to subscribe to interface counters:
> 
> subscribe = {
>        "subscription": [
>        {
>                "path": "/interfaces/interface/state/counters",
>                "mode": "sample",
>                "sample_interval": 10 * 1000000000,
>        },
>        ],
>        "mode": "stream",
>        "use_aliases": False,
>        "encoding": "proto",
> }
> 
> All the box does is spew back an gNMI error that Qos is not
> supported. WTF?
> 
> "UNKNOWN:Error received from peer ipv4:10.4.0.78:30030 {grpc_message:"Qos not supported", grpc_status:12, created_time:"2024-03-07T16:20:41.756921+01:00"}"
> 
> On Arista this worked right after gNMI was enabled on the Switch.
> 
> Am I missing something? It should not be this hard to get this
> working!
> 
> Best Regards
> 
> Sebastian
> 
> -- 
> 'Are you Death?' ... IT'S THE SCYTHE, ISN'T IT? PEOPLE ALWAYS NOTICE THE SCYTHE.
>            -- Terry Pratchett, The Fifth Elephant
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp



More information about the juniper-nsp mailing list