-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarifying gNMI server behavior for GET and default values #155
Comments
For state paths, could it also return nil (i.e. no updates) if the path is not populated? In other words, should there be a difference between config and state paths as far as telemetry is concerned? |
The state paths represent the operational state of the device, and the YANG spec requires:
So if a path has a default value and has not been explicitly set, the server MUST return the default value when you query the state. There are two ways to unset a path - you can REPLACE an ancestor without providing a value for this path, or you can DELETE the path directly. In the first case, the gNMI spec says that the value shouldn't become unset if it has a default, but should instead be set to its default value Section 3.4.6 says the opposite for deletion - if a path is deleted, it should be removed from the data tree entirely. I think this is an error, and section 3.4.6 should instead say that DELETE behaves just like an empty REPLACE, and sets a path to its default value if there is one. This means that we won't need to handle config and state paths differently, and it means that the implementation of GET doesn't even need to know about defaults - it's impossible for a node that has a default value to ever be unset. This also makes the GET logic simple: GET for any path should return the value at that path if one is set, null if the path is not set, and an error if the path is not instantiated, not supported, or not recognized at all. To support this, we should also clarify that paths with defaults MUST have those default values when the data tree is first created - a newly-started device should have default values throughout the tree, not an empty tree. Note: Of course, this is only defining how the API behaves - under the hood, an implementation doesn't have to store default values, if it's trying e.g. to minimize memory, but it MUST respond to API calls as though all unset paths with defaults were set to their default values. |
I mentioned here #142 (comment) that
However, I also see in https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#332-the-getresponse-message
Therefore, there indeed could be differences between Subscribe and Get. We should clarify what a "nil" return value means in the OP. |
This comment may be relevant: #144 (comment) -- it appears that their behaviours could be different, that for @robshakir We need some clarification on whether for an unpopulated path, that there is a difference between a |
Had a quick discussion with @robshakir on both this issue and #142, could you confirm and if necessary expand on the following points? Thanks.
|
This seems fine to me, but I don't have a strong opinion on it either way.
This seems like it could make tooling a little more awkward to build - e.g. if you have a function that takes some data and calls several replaces at different points in the tree, and under certain circumstances it might delete the node it's replacing, you can't just do Replace(whatever), you'd have to explicitly |
CorrectionSorry I wrote RFC7951 but meant RFC7950. Specifically, if you're interested, here mentions when a leaf has a default value in use. Aside
Reply to 1A leaf node exists in zero or one instance in the data tree., so I interpret that to mean the server should return nothing at all. In the case of GET it should return I read distinguishing between "a child of this container has no set value" and "the device doesn't support or even know about that child" as the same thing as distinguishing "a path that is in the schema" and "a path not in the schema". In both cases according to Darren's two posts in this and the other issue Reply to 2Interesting, I'm thinking what makes the most sense in this case is to have Reply to the last replyI'm open to keeping this as-is for now since this is not currently an important thing to fix in the tooling, but my current thinking is that the clarity of the API is more important than this programming convenience. |
Apologies for the delay here. After a number of offline discussions, I suggest these conclusions:
|
Do you think it's worth getting this into the spec while memory is fresh so that this doesn't end up as another FAQ item? If you want I could try adding a subsection on default values for Subscribe and Get and adding a couple sentences for |
Yes, I think it's worth making a change in the spec here. |
What do we return in cases where
no update value? |
there's significant overlap here with #142, the current conclusions there are:
please see the discussion over in the other issue :-) |
You can have a NotFound status with a payload - do we require that a GetResponse have a Notification for every requested path that DOES exist on a NotFound, or do we allow the device to just return a NotFound with no data? |
The gNMI spec doesn't elaborate on how GetRequest errors are handled. It only says that the GetResponse must contain a set of notifications for all the paths. I interpret this as the server must return all the paths in the response with a single error. So all paths are returned; those that are found and those which are not found. Those which are not found would have a 'nil' value. Ref: GetResponse |
Under "GetResponse Behavior Table" in #169 you can see that we could have
How do we represent a |
That is a good question. Here is an answer that I think follows specification 2.5, but with a clarification below for your consideration The response status MUST set status to |
Does your suggestion mean that whenever there is a single failure or more of one of these three types that the error code is Another alternative is just to return the first error code type encountered. This is also simple but less precise. |
The error code that we specify should just be included in the status.proto that is returned (see the Go package for an example) - so if we're returning The string |
If multiple of the errors are triggered, I think this is really up to the implementation - I expect in practice, it'll be that the first error encountered is used, and we could encode that. This avoids the issue of having to walk all paths even if the response is going to be discarded. |
Sounds good to me, thanks |
gNMI error handling requires both an Can you clarify for me, is |
I noticed that this part of the spec is outdated and is pending to be removed by #157, it looks like |
I think I may have resolved my own question after some investigation and gRPC learning. So I think the only status to be used for a SetResponse and UpdateResponse is the standard gRPC return codes and there is no other or additional code? I agree that #157 clarifies this. I will add further comments there. |
This is a fork of issues from #142
GET for a state path leaf MUST return one of:
GET for a config path leaf MUST return one of:
GET a subtree
This may need to be clarified as there is an implementation which is returning 'nil' when a leaf that does exist and contains a default value.
The text was updated successfully, but these errors were encountered: