ypgnmi-app Overview

YumaPro SDK – ypgnmi-app Integration

../_images/gNMI_diagram_WEB_01052022.png

As illustrated above, gNMI clients can be written in any language that is supported for gNMI clients. The client application is out of the scope of this document and the current gNMI protocol integration does not include a client application. A client communicates with the target server (netconfd-pro) with the help of the ypgnmi-app application

The ypgnmi-app application is written in GO language and talks to the netconfd-pro server via socket with XML encoding and acts as a YControl subsystem.

The main role of ypgnmi-app application is to translate clients requests to XML and to contact netconfd-pro server and send the replies back to the gNMI clients.

The ypgnmi-app application is a YControl subsystem that communicates to the netconfd-pro server and also it is a gNMI server that communicates to gNMI clients. Also, the ypgnmi-app application is responsible for encoding conversion between gNMI gRCP to XML that are sent to the netconfd-pro server and vice versa.

The messages processing between gNMI client to the netconfd-pro server can be split into the following components:

  • gNMI clients to the ypgnmi-app application processing - includes message parsing and conversion of the messages to the XML message

  • The ypgnmi-app application to the netconfd-pro server messages processing. YControl messages exchange encoded in XML

  • The netconfd-pro server-internal processing – includes subsystem registration, subsystem messages handling and parsing, conversion to RESTCONF Control Block for the request processing.

    • YANG-PATCH in case of gNMI SetRequest

    • RESTCONF GET in case of gNMI GetRequest and Subscribe with mode ONCE

The ypgnmi-app implements multiple goroutines to manage the replies and the clients. The following goroutines are implemented in the ypgnmi-app:

  • Client Manager goroutine. Responsible for all the gNMI clients' connections. After the client contacts the gNMI server, this goroutine registers the client, stores its information and runs all the authentication processing. It verifies the certificates and triggers the connection to be shutdown.

  • Reply Manager goroutine. This manager is responsible for any already parsed messages from the netconfd-pro server or gNMI client, it stores any not processed messages that are ready to be processed. It is responsible for finding the corresponding clients that wait for the response and trigger the response procedure.

  • Message Parser goroutine. It is responsible for all the message parsing. It parses messages from clients encoded in the protobuf and converts them into XML-encoded messages to be sent to the netconfd-pro server and vice versa.

  • Message Manager goroutine. This manager is responsible for storing any ready-to-be-processed messages that are going to the netconfd-pro server and that are coming back from the server.

All of these managers are goroutines. They run in parallel and asynchronously.

The core of the ypgnmi-app is the gNMI server that is built on top of gRPC server. It contains gNMI server code that is responsible for the:

  • gNMI client to the netconfd-pro server communication

  • Handle GET/SET/Subscribe/Capability callbacks. Send/get messages from the netconfd-pro server and respond to the clients.

  • Register gNMI server

  • Register gRPC server for the protobuf message handling

  • Run the main Serve loop that handles all the client/server communication

The ypgnmi-app application implements the HTTP/2 server over TLS in Go standard package golang.org/x/net/http2. This package provides authentication, connection, listen, etc handlers that fully fulfill all the requirements for the ypgnmi-app application.

The ypgnmi-app application has the following startup steps for the gNMI server component:

  • Initialize all the prerequisites and parse all the CLI parameters

  • Based on the netconfd-pro server modules capability create gNMI target

  • Open TCP socket to listen for clients requests

  • Serve any incoming gNMI messages from gNMI clients and re-transmit them to the netconfd-pro server if needed with the help of all the goroutine managers.

On the other side, the ypgnmi-app acts as a YControl subsystem (similar to db-api-app), however, it does not terminate after one edit or get a request. Instead, it continuously listens to the netconfd-pro server and keeps the AF_LOCAL or TCP socket open to continue communication whenever it's needed. The communication is terminated only if the ypgnmi-app application is terminated or the netconfd-pro server terminates.

All the message definitions described in the yumaworks-yp-gnmi.yang YANG module and similar to the original gNMI .proto message definitions which make the conversion easier and faster.

The ypgnmi-app application has the following startup steps to initialize connection with the netconfd-pro server:

  • Initialize all the prerequisites and parse all the CLI parameters

  • Open socket and send <ncx-connect> request to the server with

    • transport = netconf-aflocal

    • protocol = yp-gnmi

  • Register yp-gnmi service

    • Send <register-request> to the server

    • Register ypgnmi-app subsystem and initialize all corresponding code in the netconfd-pro server to be ready to handle ypgnmi-app application requests

  • Create a data model structure that will be used for gNMI client/server communication

    • Send <config-request> to the server

    • Feed the gNMI ModelData with all supported modules

  • Keep listening socket until terminated

ypgnmi-app Configuration Parameter List

The following configuration parameters are used by ypgnmi-app. Refer to the CLI Reference for more details.

Parameter

Description

--bind-address

Specifies the gNMI server binding

--ca

Specifies the gNMI server CA certificate file

--cert

Specifies the gNMI server certificate file

--fileloc-fhs

Specifies whether the ypgnmi-app should use the Filesystem Hierarchy Standard (FHS) directory locations to create, store and use data and files

--key

Specifies the gNMI server private key file

--log

Specifies the file path of the application log

--log-console

Directs that log output will be sent to STDOUT, after being sent to the log file and/or local syslog daemon

--log-level

Controls the verbosity level of messages printed to the log file or STDOUT, if no log file is specified

--server

Specifies the netconfd-pro server IP address

--server-id

Specifies the server identifier to use when registering with the netconfd-pro server.

--service-id

Specifies the service identifier to use when registering with the netconfd-pro server

--subsys-id

Specifies the subsystem identifier to use when registering with the netconfd-pro server

ypgnmi-app Source Files

This section describes the files that are contained in the yumapro-gnmi package. The full set of installation sources is installed in /usr/share/yumapro/src, if the YumaPro sources are installed.

The following table lists the files that are included within the netconf/src/ypgnmi directory.

Directory

Description

gnmi

gNMI server handling, utility functions and functions to deal with the messages

gnmi_connect

gNMI server code that is responsible for the gNMI client to the netconfd-pro server communication

message_handler

Auto-generated gostruct representation of the yumaworks-yp-gnmi.yang file. Used for message handling

netconfd_connect

Handler for the netconfd-pro connection with ypgnmi-app

utils

Generic utility functions

ycontrol

Utilities to handle the netconfd-pro YControl messages and connections

The ypgnmi-app.go subsystem application provides connectivity between the netconfd-pro server and gNMI clients.

This application implements a gNMI server that talks to gNMI clients via gRPC calls defined in gnmi.proto, and transfer any client requests to the netconfd-pro server via NCX socket and YControl protocol using XML/JSON encoded messages.