1// 2// Copyright 2018 Google Inc. All Rights Reserved. 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16syntax = "proto3"; 17 18// Package gnmi_ext defines a set of extensions messages which can be optionally 19// included with the request and response messages of gNMI RPCs. A set of 20// well-known extensions are defined within this file, along with a registry for 21// extensions defined outside of this package. 22package gnmi_ext; 23 24// The Extension message contains a single gNMI extension. 25message Extension { 26 oneof ext { 27 RegisteredExtension registered_ext = 1; // A registered extension. 28 // Well known extensions. 29 MasterArbitration master_arbitration = 2; // Master arbitration extension. 30 } 31} 32 33// The RegisteredExtension message defines an extension which is defined outside 34// of this file. 35message RegisteredExtension { 36 ExtensionID id = 1; // The unique ID assigned to this extension. 37 bytes msg = 2; // The binary-marshalled protobuf extension payload. 38} 39 40// RegisteredExtension is an enumeration acting as a registry for extensions 41// defined by external sources. 42enum ExtensionID { 43 EID_UNSET = 0; 44 // New extensions are to be defined within this enumeration - their definition 45 // MUST link to a reference describing their implementation. 46 47 // An experimental extension that may be used during prototyping of a new 48 // extension. 49 EID_EXPERIMENTAL = 999; 50} 51 52// MasterArbitration is used to select the master among multiple gNMI clients 53// with the same Roles. The client with the largest election_id is honored as 54// the master. 55// The document about gNMI master arbitration can be found at 56// https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-master-arbitration.md 57message MasterArbitration { 58 Role role = 1; 59 Uint128 election_id = 2; 60} 61 62// Representation of unsigned 128-bit integer. 63message Uint128 { 64 uint64 high = 1; 65 uint64 low = 2; 66} 67 68// There can be one master for each role. The role is identified by its id. 69message Role { 70 string id = 1; 71 // More fields can be added if needed, for example, to specify what paths the 72 // role can read/write. 73} 74