Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bugs and enhance Transformer (sonic-net#35)
Optimize transformer for GET performance For any request URI and its children, table-name & db-key are queried for the first time and cached internally by the transformer infra. This cache block will be subsequently referred by the infra to avoid redundant callback invocations while the yang model tree is being traversed for GET operation. The cache block is local & valid for a single transaction. Data from Redis DB is queried only once for a table & cached in the infra for further reference. This cache is local & valid for a single transaction On-change, sample based subscription support for gNMI On receipt of subscription request uri, the transformer infra translates it to corresponding Redis Db-table and key, using YANG extensions and provides this info along with other subscription parameters to the translib, which takes care of sending notifications on-change of table/key. YANG extensions introduced : "subscribe-preference", "subscribe-on-change", "subscribe-min-interval". rpc callback support RPC statements defined in both OpenConfig and SONiC yang can be annotated with YANG extension “rpc-callback” to invoke the callback to take an action for the given rpc node YANG default value support Infra has been enhanced to fill the oc yang defaults by referring internal yang-metadata for terminal nodes, if it is not present in the request payload. These defaults will be pushed along with other payload data when a resource is created. RFC compliance support - resource check etc. Parent resource is checked for CRUD and GET requests for the incoming URI, before processing the request. If the parent resource is not available in DB, the transaction is rejected with 404 / "Resource not found" error. Cascade delete to de-configure all related nodes Cascade delete enables dependent config clean up for a DELETE request, based on SONiC yang table dependency. YANG extension "cascade-delete" can be annotated to a node that can be deleted along with all dependent nodes. value xfmr callback The value-xfmr callback supports data conversion before writing into the DB for CRUD request and after reading from DB for GET request. Value-xfmr annotated for a leaf will also be invoked, for all other leaves having a leaf-ref to it. The value-xfmr callback is valid only for the SONIC yang. Operation and tables ordering, dependent tables watch list For a set of DB table/instances, grouped by operation, resulting from processing a request URI, infra supports the following : CRUD Operation ordering, sequencing tables before operating based on sonic-yang/Redis dependencies providing translib, with a list of Redis-tables to watch for changes, when performing operations on dependent tables. Yang model capability Provide yang module name, organization and version information to translib in order to serve model capability request. Miscellaneous bug fixes
- Loading branch information