The Cisco NX-OS 9.3(1) release and later support the following gNMI Subscription features:
Table 2. Subscribe Options
Type
|
Sub Type
|
Supported?
|
Description
|
Once
|
|
Yes
|
Switch sends current values only once for all specified paths
|
Poll
|
|
Yes
|
Whenever the switch receives a Poll message, the switch sends the current values for all specified paths.
|
Stream
|
Sample
|
Yes
|
Once per stream sample interval, the switch sends the current values for all specified paths. The supported sample interval
range is from 1 through 604800 seconds.
The default sample interval is 10 seconds.
|
|
On_Change |
Yes |
The switch sends current values as its initial state, but then updates the values only when changes, such as create, modify,
or delete occur to any of the specified paths.
|
Target_Defined |
Yes |
When you create a subscription specifying the target define mode, the target must define the best type of subscription to
be created.
|
Note
|
Beginning with 10.2(1)F release, Target_Defined sub type subscribe option is supported.
|
Beginning with Cisco NX-OS Release 10.2(3)F, a new CLI command is introduced that changes the keepalive interval of the gNMI
subscription. The settable limits are 600 seconds to 86400 seconds.
The command is "[no] grpc gnmi keepalive-timeout <timeout>" . For example, switch(config)# grpc gnmi keepalive-timeout 600.
The following is the an example to verify the CLI command:
Verify in show statistics cmd
switch(config)# sh grpc gnmi service statistics
=============
gRPC Endpoint
=============
Vrf : management
Server address : [::]:50051
Cert notBefore : Feb 6 01:15:06 2022 GMT
Cert notAfter : Feb 7 01:15:06 2022 GMT
Client Root Cert notBefore : n/a
Client Root Cert notAfter : n/a
Max concurrent calls : 8
Listen calls : 1
Active calls : 0
KeepAlive Timeout : 1000
The following are the guidelines for the CLI command:
-
The gnmi server would send an empty response to the subscription clients every given interval.
-
The purpose is to detect and cleanup rogue/dangling client connections.
-
By default the keepalive interval is 600 seconds.
-
This command changes the interval to the user-specified value.
Optional SUBSCRIBE Flags
For the SUBSCRIBE option, some optional flags are available that modify the response to the options listed in the table. In
Cisco NX-OS release 9.3(1) and later, the
updates_only
optional flag is supported, which is applicable to ON_CHANGE subscriptions. If this flag is set, the switch suppresses the
initial snapshot data (current state) that is normally sent with the first response.
The following flags are not supported:
-
aliases
-
allow_aggregation
-
extensions
-
prefix
-
qos
Beginning with Cisco NX-OS Release 10.2(3)F, the following flags are supported:
-
heartbeat_interval
-
suppress_redundant
A heartbeat_interval may be specified to modify the behavior of suppress_redundant in a sampled subscription. In this case, the target must generate one telemetry update per heartbeat interval regardless
of whether the suppress_redundant flag is set to true. This value is specified as an unsigned 64-bit integer in nanoseconds.
The suppress_redundant field of the subscription message may be set for a sampled subscription. In the case that it is set to true, the target must
not generate a telemetry update message unless the value of the path being reported on has changed since the last update was
generated. Updates must only be generated for those individual leaf nodes in the subscription that have changed.
For example, a subscription to /A/B - where there are leaves C and D branching from the B node - if the value of C has changed,
but D remains unchanged, an update for D must not be generated, whereas an update for C must be generated.
The following is the example for the supported Optional SUBSCRIBE Flags:
{
"SubscribeRequest":
[
{
"subscribe":
{
"subscription":
[
{
"_comment" : "1st subscription path",
"path":
{
"origin": "openconfig",
"elem":
[
{
"name": "interfaces/interface[name=eht1/1]"
}
]
},
"mode": "SAMPLE",
“heartbeat_interval”: 30000000000
“suppress-redundant”: true
},
"mode": "STREAM",
"allow_aggregation" : false,
"use_models":
[
{
"name": "DME",
"organization": "Cisco Systems, Inc.",
"version": "1.0.0"
}
],
"encoding": "JSON"
}
}
The following is the support metrics for the subscribe flags:
Table 3. Support Metrics for SUBSCRIBE flags
Subscription Type
|
heartbeat_interval
|
suppress_redundant
|
On_Change
|
Origin: Device YANG, OpenConfig YANG, DME
|
N/A
|
Sample
|
Origin: Device YANG, OpenConfig YANG, DME
|
Origin: Device YANG, OpenConfig YANG
|