gnmi icon indicating copy to clipboard operation
gnmi copied to clipboard

Confusion in usage between Origin and use_models

Open ashu-ciena opened this issue 3 months ago • 7 comments

I am finding it difficult to distinguish the purpose of Origin field in the prefix and use_models in the Subscribe/Get request. Both seems to serve the same purpose of specifying the data model/schema to which data should be fetched from.

Can the gnmi spec team clarify this a bit ?

My use case: The data model has got some change / some data elements were not in proper hierarchy. But fixing this bug, brings in backward compatibility issue in RPC response. I was trying to find out a way where I can let the users to decide when they want to move their infra to accept the new response structure.

ashu-ciena avatar Oct 15 '25 09:10 ashu-ciena

Maybe we should start w/ a show of hands as to any implementation that supports use_models and tag this field for deprecation across the respective RPCs.

To my knowledge there is no shipping implementation support and this adds unnecessary complexity.

As far as your use-case, what you are describing is "schema selection" along w/ a specific version however this can have the cascading dependency issue that comes along with it. Users are not going to want this complexity all the way down to per-model versions imo - schema version (or bundles) could be something driven by other means (e.g. config based pinning, packages, etc..)

earies avatar Oct 15 '25 20:10 earies

@rgwilton @jsterne @jgcumming @ncorran for comment

earies avatar Oct 15 '25 20:10 earies

FWIW, we (google) are not using the use_models field in gNMI. Also, FWIW, the reference gnmi server also does not implement use_models.

dplore avatar Oct 15 '25 23:10 dplore

Neither Nokia SROS nor SR Linux implement use_models.

jsterne avatar Oct 16 '25 13:10 jsterne

As @jsterne says, this isn't used within Nokia and I would support deprecation.

jgcumming avatar Oct 16 '25 20:10 jgcumming

To address the original question -- I'm not sure how these two concepts are related. origin (as described in the spec) is a means to have disjoint trees of data which are disambiguated based on the origin (which could be conceptually thought of as a prefix or a first element to any path). The use_models does not do this, since there is not a 1:1 origin to model correlation -- since multiple models can define one schema-tree that is rooted at /.

That being said, use_models was originally something we added to the specification to be able to handle the case that one wanted to filter augmented nodes from being returned when doing schema-compliance checks. In practice, there is complexity of implementing it in a number of different ways, and I think this has rendered it defunct.

(Some archaeology shows that this was included in the very first gNMI specification draft that I wrote in October 2016. We envisaged that it would be useful in the case described above, and also discussed whether it could be used as a means to allow schema module transitions (i.e., use_models told you to use v0.1.0 but server supports v0.2.0`, servers could translate between v0.1.0 and v0.2.0 -- this also turns out to increase complexity and hasn't been something that we've needed thus far.)

Based on this -- I'm good with deprecating this from the specification.

robshakir avatar Oct 17 '25 16:10 robshakir

Thx folks - I've gone ahead and cut PR https://github.com/openconfig/gnmi/pull/230 for the proto IDL side and can initiate a subsequent spec update if we are in agreement

earies avatar Oct 21 '25 00:10 earies