Closed robshakir closed 6 years ago
@tsuna @jsterne @kuvempu, @nileshsimaria @aaronbee -- would be interested in your thoughts here.
Overall, useful to include. Some thoughts ...
On error reporting: errors are reported per RPC already. Would prefer the Error message be tightened and extended (error code ranges for fatal and non-fatal errors, or add an error type as fatal or non-fatal to the message), rather than including in Extensions. This is required anyway since errors are also more specific (e.g. a specific Subscription in a SubscriptionList).
Add an extension destination: proxy or target.
Would suggest an extension type (mandatory vs. optional) in the Extension message. If a proxy or a target does not understand a mandatory extension, it must fail the request. Using well-known as mandatory is a catch-22 - an extension can become well-known only iff every implementation supports it.
Proxy-specific considerations:
Can a proxy remove received extensions? ProxyDetails would be a candidate.
Would suggest NOT allowing a proxy to add/modify extensions.
LGTM.
Just curious: what's the advantage of registered extensions as opposed to using google.protobuf.Any
? To support custom / third-party extensions that may not have protobuf payloads, or to still centrally oversee such extension through the assignment process of extension IDs?
@kuvempu why would you suggest to disallow the proxy to add/modify extensions? Or did you mean it's OK for the proxy to drop an extension it consumes for its own use (such as the ProxyDetails
extension suggested above) but not OK to add/modify extensions? I'm sure there are cases where proxies will want to add extensions — for example with a dial-out setup (see #42) a reverse proxy might need to tack on information about where the message originally came from (effectively doing the opposite of ProxyDetails
).
Hi @tsuna -- apologies, have been travelling and missed responding to you.
We wanted to keep some form of curation of what is implemented as an extension vs. something that really requires a new RPC. For example, one could implement Subscribe
with a SubscribeRequest
that really has all the parameters one expects within an extension, rather than using the existing fields - whereas such new Subscribe semantics should probably be implemented with a different RPC such that it's clear to the consumer. Effectively, we erred this way because it seemed a clearer way to keep a standardised API through gNMI.
Let me know if this doesn't make sense!
r.
@kuvempu, thanks for the feedback.
Error
message that is defined within gnmi.proto
can be used as the pyaload in the status.proto
Status
message that is returned as part of the gRPC return status. I agree that we probably want to have some extensions here, but I don't think that this can be fatal vs. non-fatal -- since the case of non-fatal errors should not use a return code other than OK
, and in the client library implementations this means that the error payload isn't populated.For the proxy specific messages, we'll define the semantics in a short doc explaining this extension, but (@gcsl, please keep me honest):
ProxyDetails
message such that chained proxies don't need to understand the index they are in the chain.Thanks! r.
Adding Optional Extensions to gNMI
Contributors: Rob Shakir (robjs@google.com), Carl Lebsack (csl@google.com), Nick Ethier (nethier@jive.com), Anees Shaikh (aashaikh@google.com)
Date: November 2017
Status: New Proposal
Summary
This contribution proposes to modify the gNMI protocol to allow extensions to be added without requiring the core specification to be modified. The intention of this is to allow implementors to add additional functionality to existing gNMI RPCs.
Problem Statement/Motivation
In particular use cases, there are requirements for data that is not currently specified within the existing RPC payloads to be carried. Some examples of this include:
Set
RPC carries additional data that allows the target to determine whether the client is the most up-to-date writer, and hence determine whether to accept aSet
request.Get
orSubscribe
RPCs. For example, conveying that a warning condition occurred when retrieving the configuration (e.g., the device was not able to map a part of a native schema back to the requested schema).The common requirement of these cases is that they require additional data to be supplied in addition to the existing payload without changing the RPC's semantics. If the semantics of an RPC are to be changed, defining an additional service (e.g.,
FooGNMIExtService
with a newMagicSubscription
RPC) provides a clean way to extend the service definition. However, for the cases above, where the semantics stay fundamentally the same, bifurcating RPC paths does not seem an optimal solution.One proposed solution to this problem is to add additional fields in the gRPC metadata. There are a number of downsides to this approach:
This proposal seeks to define a means by which existing gNMI RPC payloads can be extended using a non-metadata approach.
Proposal
We propose to introduce an additional repeated field to all top-level gNMI RPC messages (i.e.,
Capability(Request|Response)
,Get(Request|Response)
,Set(Request|Response)
and andSubscribe(Request|Response)
) namedextension
. This field is defined to a carry angnmiext.Extension
message.We propose that the
Extension
message is defined as follows:This splits gNMI extensions into two sets:
The following example for a
ProxyDetails
extension is below.contrib
definitions. We propose that an extension ID is allocated from theExtensionID
simply by requesting such an extension, and providing a link to a reference to the specification for the extension. The payload of theRegisteredExtension
msg
field is the marshalled contents of the message. TheExtensionID
acts in the same manner as thetype
field ofgoogle.protobuf.Any
, albeit with more restrictions as to the allowed set of types.If a registered extension becomes popular, it may be promoted to a well-known extension. Initially, we propose that
RegisteredExtension
IDs are assigned simply through an email request. We do not propose to assign an extension ID to a well known extension. When extensions are promoted to well known, their extension ID will be deprecated over time.Open Questions
Capability
RPC could be extended to add such discovery.