Текст документа
Restrictions for gNMI Protocol
gNMI Protocol The gNMI Protocol feature describes the model-driven configuration and retrieval of operational data using the gRPC Network Management Interface (gNMI) capabilities, and the Get, Set, and Subscribe remote procedure calls (RPCs). gNMI Version 0.4.0 is supported. Restrictions for gNMI Protocol, on page 1 Information About the gNMI Protocol, on page 2 How to Enable the gNMI Protocol, on page 14 Configuration Examples for the gNMI Protocol, on page 20 Additional References for the gNMI Protocol, on page 20 Feature Information for the gNMI Protocol, on page 21 Restrictions for gNMI Protocol The following restrictions apply to the gNMI Protocol feature:
• BYTES and ASCII encoding options are not supported. • JSON IETF keys must contain a YANG prefix where the namespace of the child elements differs from that of the parent. This means that the routed VLAN derived from augmentation in openconfig-vlan.yang must be entered as oc-vlan:routed-vlan because it is different from the namespace of the parent nodes (parent nodes have the prefix oc-if) PROTO encoding is supported from Cisco IOS XE Dublin 17.11.1. • GetRequest: • Operational data filtering is not supported. • Use models are not supported.
These are a set of model data messages indicating the schema definition modules that define the data elements that must be returned in response to a Get RPC call. • GetResponse: • Alias, which is a string that provides an alternate name for a prefix specified within the GetResponse notification message is not supported. • Delete, which is a set of paths that are to be removed from a data tree is not supported. gNMI Protocol 1
Стр. 1
JSON IETF Encoding for YANG Data Trees
Information About the gNMI Protocol About GNMI gNMI is gRPC Network Management Interface developed by Google. gNMI provides the mechanism to install, manipulate, and delete the configuration of network devices, and also to view operational data. The content provided through gNMI can be modeled using YANG. gRPC is a remote procedure call developed by Google for low-latency, scalable distributions with mobile clients communicating to a cloud server. gRPC carries gNMI, and provides the means to formulate and transmit data and operation requests.
When a gNMI service failure occurs, the gNMI broker (GNMIB) will indicate an operational change of state from up to down, and all RPCs will return a service unavailable message until the database is up and running. Upon recovery, the GNMIB will indicate a change of operation state from down to up, and resume normal handling of RPCs. gNMI supports RPC services. For more information, see the Model-Driven Telemetry chapter. JSON IETF Encoding for YANG Data Trees RFC 7951 defines JavaScript Object Notation (JSON) encoding for YANG data trees and their subtrees. gNMI uses JSON for encoding data in its content layer. The JSON type indicates that the value is encoded as a JSON string.
JSON_IETF-encoded data must conform to the rules for JSON serialisation described in RFC 7951. Both the client and target must support JSON encoding. Instances of YANG data nodes (leafs, containers, leaf-lists, lists, anydata nodes, and anyxml nodes) are encoded as members of a JSON object or name/value pairs. Encoding rules are identical for all types of data trees, such as configuration data, state data, parameters of RPC operations, actions, and notifications. Every data node instance is encoded as a name/value pair where the name is formed from the data node identifier. The value depends on the category of the data node.
The leaf Data Node A leaf node has a value, but no children, in a data tree. A leaf instance is encoded as a name/value pair. This value can be a string, number, literal true or false, or the special array [null], depending on the type of the leaf. In the case that the data item at the specified path is a leaf node (which means it has no children, and an associated value) the value of that leaf is encoded directly. (A bare JSON value is included; it does not require a JSON object.) The following example shows a leaf node definition: leaf foo { type uint8; } The following is a valid JSON-encoded instance: "foo": 123 gNMI Protocol Information About the gNMI Protocol gNMI Protocol 2
Стр. 2
Proto Encoding
Proto Encoding gNMI protocol supports PROTO encoding along with the already supported JSON and JSON_IETF formats. The gnmi.proto file represents the blueprint for generating a complete set of client and server-side procedures that instantiate the framework for the gNMI protocol. The existing encoding procedure for JSON and JSON_IETF formats push the input data that causes the output values to have premature wraps and other issues, causing loss of data precision. PROTO encoding allows the querying of applications to retrieve data in scalar (TypedValue) values; each leaf is sent on its own update as per the gNMI specification.
This allows customers to have access to float and double values for more accuracy. PROTO encoding is supported for all the paths that are supported by gNMI. PROTO encoding supports subscribe RPC, but not GET and SET RPCs. PROTO encoding is part of the gNMI protocol, and is enabled when the gNMI feature is enabled. The following is a sample subscribeRequest RPC with PROTO: subscribe: prefix: origin: "legacy" elem: name: "mdt-oper-v2:mdt-oper-v2-data" > > subscription: path: elem: name: "mdt-subscriptions" > > mode: SAMPLE sample_interval: 10000000000 > mode: STREAM encoding: PROTO > The following is a sample subscribeRequest response with PROTO: update: timestamp: 1652408966709576000 prefix:
origin: "openconfig" elem: name: "oc-if:interfaces" > elem: name: "interface" key: key: "name" value: "*" > > elem: name: "state" > update: path: origin: "openconfig" gNMI Protocol Proto Encoding gNMI Protocol 3
Стр. 3
Proto Encoding
elem: name: "interfaces" > elem: name: "interface" key: key: "name" value: "GigabitEthernet3" > > elem: name: "ethernet" > elem: name: "config" > > val: string_val: "{ \"mac-address\":\"00:0c:29:29:42:e9\” }" > > update: path: origin: "openconfig" elem: name: "interfaces" > elem: name: "interface" key: key: "name" value: "GigabitEthernet3" > > elem: name: "ethernet" > elem: name: "config" > > val: bool_val: "{ \",\"auto-negotiate\":true > > update: }" path: origin: "openconfig" elem: name: "interfaces" > elem: name: "interface" key: key: "name" value: "GigabitEthernet3" > > elem: name: "ethernet" gNMI Protocol Proto Encoding gNMI Protocol 4
Стр. 4