module gnmi-topology { namespace "urn:opendaylight:gnmi:topology"; prefix "gnmi"; description "Model describing connection parameters of gNMI node and augments of network-topology. Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"; revision "2021-03-16" { description "Initial revision"; } import network-topology { prefix nt; revision-date 2013-10-21; } import yang-ext { prefix ext; revision-date "2013-07-09";} import ietf-inet-types { prefix inet; revision-date "2013-07-15"; } grouping credentials { container credentials { leaf username { description "specify the target username as part of the user credentials."; type string; } leaf password { description "specify the target password as part of the user credentials."; type string; } } } grouping security { description "Security group of statements are available for session security and authentication. The session between the client and target MUST be encrypted using TLS. For DEBUG reasons is available connection type insecure-debug-only."; reference "gNMI Specification Section 3.1"; uses credentials; choice security-choice { description "Default model behavior is a secure case and required keystore-id. If is required to use one of the insecure options, then must be defined in request."; case secure { leaf keystore-id { description "Identifier to keystore. Keystore is defined in gnmi-certificate-storage model."; mandatory true; type string; } } case insecure-debug-only { description "The insecure connection is available only for DEBUG reasons. For establish gRPC connection without TLS choose insecure connection type PLAINTEXT. INSECURE connection type indicates that the target should skip the signature verification steps, in case a secure connection is used"; leaf connection-type { type enumeration { enum PLAINTEXT; enum INSECURE; } } } } } grouping gnmi-connection-parameters { container connection-parameters { leaf host { type inet:host; description "IP address or hostname of the target"; } leaf port { type inet:port-number; description "The port number on which to contact the target"; } uses security; } container extensions-parameters { description "Defines a set of extensions parameters which can be optionally included with the request and response messages of gNMI RPCs. Allows registration of extensions defined outside of this package."; container gnmi-parameters { leaf overwrite-data-type { description "Overwrites the type field of gNMI GetRequest. If not set, the type field is automatically set to CONFIG/STATE based on the RESTCONF content query parameter. This setting is useful in cases where the device does not support GetRequest with CONFIG/STATE type field."; reference "gNMI Specification Section 3.3.1"; type enumeration { enum ALL; // All data elements. enum CONFIG; // Config (rw) only elements. enum STATE; // State (ro) only elements. // Data elements marked in the schema as operational. This refers to data // elements whose value relates to the state of processes or interactions // running on the device. enum OPERATIONAL; enum UNRECOGNIZED; // Some devices don't support any data-type in a method request. // With NONE option we can overwrite RESTCONF data-type and send // it without any. enum NONE; } } leaf use-model-name-prefix { description "Some devices require a module prefix in first element name of gNMI request path (e.g interfaces -> openconfig-interfaces:interfaces). When flag use-model-name-prefix is set to true for device, YIID will be transformed into gNMI path where elements have their module name. E.g. element interfaces from module openconfig-interfaces will be transformed as openconfig-interfaces:interfaces"; type boolean; default false; } leaf path-target { description "The path-target field is used to specify the context of a particular stream of data. The data stream can be intended for individual target datastores. Only set in prefix for a path. This field MUST only ever be present on prefix paths in the corresponding request and response messages. This field is optional for clients."; reference "gNMI Specification Section 2.2.2.1"; type string; } } } } grouping gnmi-node-state { container node-state { leaf node-status { reference "https://github.com/grpc/grpc/blob/v1.38.0/doc/connectivity-semantics-and-api.md#states-of-connectivity"; config false; type enumeration { // one-to-one from gRPC channel states enum READY; enum CONNECTING; enum TRANSIENT_FAILURE; enum IDLE; enum SHUTDOWN; // if setup failed, e.g failed building schema, security .. enum FAILURE; } } leaf failure-details { when "../node-status='FAILURE'"; config false; type string; description "Details about the reason for the connection failure. The failure-details field is associated only with FAILURE node-status."; } container available-capabilities { description "Resulting capabilities of the gNMI device based on supported_models field contained in CapabilityResponse which are used for constructing schema context for device's mount point."; config false; list available-capability { leaf capability { type string; } } } } } augment "/nt:network-topology/nt:topology/nt:topology-types" { ext:augment-identifier "gnmi-topology-types"; container gnmi-topology { presence "The presence of the container node indicates presence of gNMI devices"; } } augment "/nt:network-topology/nt:topology/nt:node" { when "../../nt:topology-types/gnmi-topology"; ext:augment-identifier "gnmi-node"; uses gnmi-connection-parameters; uses gnmi-node-state; } }