gNMI subscription for translib managed YANG data#1287
gNMI subscription for translib managed YANG data#1287adyeung merged 13 commits intosonic-net:masterfrom
Conversation
|
|
||
| SONiC Telemetry service suports gNMI Get, Set and Subscribe RPCs for DB paths and sonic-yang based paths. | ||
| It also suppots Get and Set for OpenConfig and IETF yang based paths that are part of **sonic-mgmt-common** repository. | ||
| This design document describes proposed enhancements to support gNMI Subscribe RPC for such YANG paths. |
There was a problem hiding this comment.
Can you please be explicit here that this HLD adds the subscription feature for openconfig models based on translib infra part of sonic-mgmt-common?
|
|
||
| ## 8 Unit Tests | ||
|
|
||
| Following unit test cases require app code changes to handle subscription. |
There was a problem hiding this comment.
What UT/FT cases will be added for this infra code if no app code changes?
There was a problem hiding this comment.
We will either enhance some of the existing app module code or introduce temporary test yangs.
| The request `target` will be made optional. | ||
| Request will be processed as described in [GRPC Telemetry HLD](../../system-telemetry/grpc_telemetry.md) | ||
| if the `target` is specified and matches one of the reserved keywords listed in that HLD. | ||
| If `target` is not specified or not one of the reserved ones, the subscribe path will be treated as tarnslib YANG path. |
There was a problem hiding this comment.
@qiluo-msft , @zbud-msft , do we plan to use any other target, if yes, then this would break our future use cases.
There was a problem hiding this comment.
@lguohan & team -- did not hear any responses for this. Anyway, I now have proposed a origin based identification of OpenConfig YANG paths. Existing target based identification of DB/event/virtual paths will be retained when client did not specify an origin. Please check.
However this target based identification is a violation of the gNMI specification. Please consider using origin instead of target.
Added new translateSubscribe() and processSubscribe() functions to appInterface as per HLD sonic-net/SONiC#1287 Also added stub implementation of these functions to all existing app modules. It blindly treats all paths as non-db. Basic subscription features, without on_change, are enabled with this mapping. Signed-off-by: Sachin Holla <sachin.holla@broadcom.com>
Added new translateSubscribe() and processSubscribe() functions to appInterface as per HLD sonic-net/SONiC#1287 Also added stub implementation of these functions to all existing app modules. It blindly treats all paths as non-db. Basic subscription features, without on_change, can be verified with this mapping. Signed-off-by: Sachin Holla <sachin.holla@broadcom.com>
|
|
||
| SONiC Telemetry service suports gNMI Get, Set and Subscribe RPCs for DB paths and sonic-yang based paths. | ||
| It also suppots Get and Set for OpenConfig and IETF yang based paths that are part of **sonic-mgmt-common** repository. | ||
| This design document describes proposed enhancements to support gNMI Subscribe RPC for such YANG paths. |
There was a problem hiding this comment.
Sonic yang paths are not considering it in this HLD. But it can be easily supported in future if needed.
There was a problem hiding this comment.
I see some of the requirements are useful for sonic-yang paths, and for sonic-db paths. For example TARGET_DEFINED/POLL and ONCE/Wildcard Keys.
It would be nice if the requirement could be implemented onto all the possible path types.
There was a problem hiding this comment.
Translib can handle sonic-yang paths. We are planning to implement in a future release.
sonic-db paths cannot be be handled in translib. You need to enhance the DbClient implementation to handle all other subscription modes. This HLD is applicable for TranslClient only.
|
|
||
| ### 1.2 Requirements | ||
|
|
||
| #### 1.2.1 ON_CHANGE subscription for eligible paths |
There was a problem hiding this comment.
This HLD only covers the yang paths handled by translib.
|
@hui-ma Please help review. |
| #### 1.2.3 TARGET_DEFINED subscription for all paths | ||
|
|
||
| Infrastructure should support TARGET_DEFINED subscription for all YANG paths. | ||
| Subscribe request should be treated as ON_CHANGE or SAMPLE based on the app's preferences for the target path. |
There was a problem hiding this comment.
Subscription preferences for a yang path as set by the app module. Section 2.5 has more details.
|
|
||
| Infrastructure should support TARGET_DEFINED subscription for all YANG paths. | ||
| Subscribe request should be treated as ON_CHANGE or SAMPLE based on the app's preferences for the target path. | ||
| It should split into multiple requests if the target path supports ON_CHANGE |
There was a problem hiding this comment.
Could you explain "It should split into multiple requests if the target path supports ON_CHANGE"? Better with an example?
|
|
||
| Infrastructure should support POLL and ONCE subscriptions for all YANG paths. | ||
|
|
||
| #### 1.2.5 Support Wildcard Keys |
There was a problem hiding this comment.
This HLD only covers the yang paths handled by translib.
| Apps should be allowed to indicate wildcard unsupported paths. | ||
| An `INVALID_ARGUMENT` status should be returned if wildcard key cannot be supported for the target path. | ||
|
|
||
| Wildcard in path element (like `/interfaces/*/config` or `/interfaces/.../config`) is a stretch goal. |
There was a problem hiding this comment.
Supporting wildcard keys is the basic goal (section heading). I will remove this line to avoid confusion.
| ### 1.3 Translib Overview | ||
|
|
||
| Translib is a golang library for reading and writing YANG model based data to redis DB or non-DB data source. | ||
| Applications would plugin the YANG models and their translation code into the translib. |
There was a problem hiding this comment.
Will try to rephrase
| Apps should implement a *path transformer* to handle special cases -- | ||
| subtree transformer or when there is no one-to-one mapping of YANG key to DB key. | ||
|
|
||
| ### 2.2 Identifying YANG Based Subscriptions |
There was a problem hiding this comment.
@ganglyu Please help check this section. #Closed
| ### 2.4 Streaming Data from Translib | ||
|
|
||
| Unlike Get, translib will be returning multiple responses while processing the subscribe request. | ||
| To handle this, the gNMI server would pass a queue to translib and wait for the response on it. |
There was a problem hiding this comment.
There should not be any silent drops. We are re-using the existing PriorityQueue of client_subscribe.go. I do not see any queue size related handling there. Behavior will be same as that of the existing DbClient or NonDbClient (with respect to the response queue management).
|
Please add sonic-mgmt-common#81 (Transformer UT) to the PR list. I can't edit the main text of this PR. |
| | *{empty}* | *{empty}* | Error (existing logic) | | ||
| | *{empty}* | *{unknown}* | Error | | ||
| | *{unknown}* | *{opaque}* | Error | | ||
|
|
There was a problem hiding this comment.
Please check https://github.com/sonic-net/SONiC/blob/master/doc/mgmt/gnmi/SONiC_GNMI_Server_Interface_Design.md 1.2.1.3 Data Schema.
This table does not align with our decision tree, would you please update decision tree?
There was a problem hiding this comment.
I had referred that section earlier. That HLD only addresses schema identification for Get and Set rpcs. It does not talk about the Subscribe rpc. However, I saw few discrepancies in the implementation -- the Get & Set code is looking for origin=sonic-db only. I could not find any handling for origin=sonic-yang or origin=sonic_yang as described in the HLD.
The proposal in the current HLD is applicable for Subscribe rpc alone. It does not affect the Get and Set handling. Also, it is in alignment with decision matrix from the other HLD. It only looks different because it does not talk about origin values "sonic-db" and "sonic-yang". We do not support sonic yang based subscription as of now. Hence origin=sonic-yang is not applicable for the current HLD. Similarly, origin=sonic-db is not included because the existing code uses a target based path identification for DB, non-DB and events paths; and we cannot change it without breaking the backward compatibility.
There was a problem hiding this comment.
sonic-yang is not implemented for now.
For the Subscribe rpc, we might need to support sonic-db and sonic-yang. This requires a decision tree to handle different scenarios for this rpc. The existing code uses target and origin="", so supporting origin=sonic-db should not affect backward compatibility.
There was a problem hiding this comment.
And the logic of decision tree could be:
if origin == 'openconfig':
# translib subscribe
elif origin == 'sonic-db':
# sonic db subscribe
elif origin == 'sonic-yang':
# sonic yang subscribe
else:
# existing subscribe implementation
There was a problem hiding this comment.
As discussed in yesterday's meeting, the scope of this HLD is to support subscription for openconfig yang paths only. Hence I have not included anything about origin=sonic-yang in this HLD to avoid confusion. We do have plans to extend it to sonic ynag paths in a future release. Decision table will be updated at that time.
For sonic-db paths, the current implementation uses a different logic and we do not want to touch it -- for backward compatibility with existing clients. The path structure used also slightly differs from your HLD; please refer to SONiC gRPC Telemetry HLD. There are other path types, like non-DB path, event path etc. Hence we are asking the owners of those components (I guess Microsoft) to enhance them.
|
only two open code PRs left, nice! |
|
@adyeung Can you please update the Quality Metric (Alpha/Beta/GA) for the feature either in this PR comments or in HLD itself based on https://github.com/sonic-net/SONiC/blob/master/doc/SONiC%20feature%20quality%20definition.md |
|
Please mark Quality Metric as Alpha for this feature |
Describes the high level design for SONiC Telemetry service and Translib infrastructure changes
to support gNMI subscriptions and wildcard paths for YANG defined paths
Code PRs: