gnmi icon indicating copy to clipboard operation
gnmi copied to clipboard

Question:how to fill the mode field of Subscription if the mode is ONCE or POLL?

Open dingrui37 opened this issue 6 years ago • 2 comments

Hi, all, I have a question. According to the specification, there are three type subscriptions, ONCE, STREAM and POLL. When using STREAM mode, the mode field of Subscription must be specified with one of the following modes: ON_CHANGE, SAMPLE and TARGET_DEFINED, I want to know if I use ONCE or POLL mode, how to fill the mode field of Subscription? I didn't find any explain in the specification. Thanks. https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md

message SubscriptionList {
    Path prefix = 1;                          // Prefix used for paths.
    repeated Subscription subscription = 2;   // Set of subscriptions to create.
  ...
  enum Mode {
      STREAM = 0; // Values streamed by the target (Sec. 3.5.1.5.2).
      ONCE = 1;   // Values sent once-off by the target (Sec. 3.5.1.5.1).
      POLL = 2;   // Values sent in response to a poll request (Sec. 3.5.1.5.3).
  }
  Mode mode = 5;
  ...
}

message Subscription {
  Path path = 1;                    // The data tree path.
  SubscriptionMode mode = 2;        // Subscription mode to be used.
  uint64 sample_interval = 3;       // ns between samples in SAMPLE mode.
  ...
}

enum SubscriptionMode {
  TARGET_DEFINED = 0;  // The target selects the relevant mode for each element.
  ON_CHANGE      = 1;  // The target sends an update on element value change.
  SAMPLE         = 2;  // The target samples values according to the interval.
}

dingrui37 avatar Aug 10 '18 02:08 dingrui37

The SubscriptionMode only has meaning if the Mode is set to STREAM. For ONCE and POLL the values returned are those that are currently available at the time of the request.

On Thu, Aug 9, 2018 at 7:54 PM dingrui37 [email protected] wrote:

Hi, all, I have a question. According to the specification, there are three type subscriptions, ONCE, STREAM and POLL. When using STREAM mode, the mode field of Subscription must be specified with one of the following modes: ON_CHANGE, SAMPLE and TARGET_DEFINED, I want to know if I use ONCE or POLL mode, how to fill the mode field of Subscription? I didn't find any explain in the specification. Thanks.

https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md

message SubscriptionList { Path prefix = 1; // Prefix used for paths. repeated Subscription subscription = 2; // Set of subscriptions to create. ... enum Mode { STREAM = 0; // Values streamed by the target (Sec. 3.5.1.5.2). ONCE = 1; // Values sent once-off by the target (Sec. 3.5.1.5.1). POLL = 2; // Values sent in response to a poll request (Sec. 3.5.1.5.3). } Mode mode = 5; ... }

message Subscription { Path path = 1; // The data tree path. SubscriptionMode mode = 2; // Subscription mode to be used. uint64 sample_interval = 3; // ns between samples in SAMPLE mode. ... }

enum SubscriptionMode { TARGET_DEFINED = 0; // The target selects the relevant mode for each element. ON_CHANGE = 1; // The target sends an update on element value change. SAMPLE = 2; // The target samples values according to the interval. }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openconfig/gnmi/issues/36, or mute the thread https://github.com/notifications/unsubscribe-auth/ARfIL_7l0EX0FvRHIrtdqJs-ZDxaLSw0ks5uPPX8gaJpZM4V3gix .

gcsl avatar Aug 10 '18 22:08 gcsl

Thanks for your reply@gcsl. I think if this explains can be added to the specification, it will be better.

dingrui37 avatar Aug 13 '18 01:08 dingrui37