class ydk.gnmi.path.gNMISession(repo, address, port=57400, username, password, server_certificate="", private_key="")
  • repo – Instance of Repository with path to local directory containing the the ydk yang model along with all the yang models supported on the gNMI server.
  • address – (str) Host address of the device supporting a gNMI interface
  • port – (int)Port on which the gNMI interface can be accessed on the device. If not specified, the default value of 57400 is assigned.
  • username – (str) Username.
  • password – (str) Password.
  • server_certificate – (str) Full path to a file, which contains server certificate of authorization (public key). If not specified, it is assumed non-secure connection to gNMI server.
  • private_key – (str) Full path to a file, which contains private key of the application host. If not specified and server_certificate is defined (secure connection), the GRPC internally defined private key is used.
Returns:RootSchemaNode for this gNMI session.

Executes gNMI RPCs gnmi-set, gnmi-get, and gnmi-caps.

Parameters:rpc – (Rpc) RPC to be executed.
Returns:DataNode for gnmi-get RPC, or None otherwise.
subscribe(rpc, output_callback_function=None)

Executes gnmi-subscribe RPC. Returns subscription data over specified callback.

param rpc:(Rpc) RPC to be executed.
param output_callback_function:
 (func(str)) Callback function, which is used to process the subscription data. The subscription data returned to the user as a string representation of protobuf SubscribeResponse message. If not specified, the response is printed to system stdout.