1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 2import grpc 3 4import gnmi_pb2 as gnmi__pb2 5 6 7class gNMIStub(object): 8 # missing associated documentation comment in .proto file 9 pass 10 11 def __init__(self, channel): 12 """Constructor. 13 14 Args: 15 channel: A grpc.Channel. 16 """ 17 self.Capabilities = channel.unary_unary( 18 '/gnmi.gNMI/Capabilities', 19 request_serializer=gnmi__pb2.CapabilityRequest.SerializeToString, 20 response_deserializer=gnmi__pb2.CapabilityResponse.FromString, 21 ) 22 self.Get = channel.unary_unary( 23 '/gnmi.gNMI/Get', 24 request_serializer=gnmi__pb2.GetRequest.SerializeToString, 25 response_deserializer=gnmi__pb2.GetResponse.FromString, 26 ) 27 self.Set = channel.unary_unary( 28 '/gnmi.gNMI/Set', 29 request_serializer=gnmi__pb2.SetRequest.SerializeToString, 30 response_deserializer=gnmi__pb2.SetResponse.FromString, 31 ) 32 self.Subscribe = channel.stream_stream( 33 '/gnmi.gNMI/Subscribe', 34 request_serializer=gnmi__pb2.SubscribeRequest.SerializeToString, 35 response_deserializer=gnmi__pb2.SubscribeResponse.FromString, 36 ) 37 38 39class gNMIServicer(object): 40 # missing associated documentation comment in .proto file 41 pass 42 43 def Capabilities(self, request, context): 44 """Capabilities allows the client to retrieve the set of capabilities that 45 is supported by the target. This allows the target to validate the 46 service version that is implemented and retrieve the set of models that 47 the target supports. The models can then be specified in subsequent RPCs 48 to restrict the set of data that is utilized. 49 Reference: gNMI Specification Section 3.2 50 """ 51 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 52 context.set_details('Method not implemented!') 53 raise NotImplementedError('Method not implemented!') 54 55 def Get(self, request, context): 56 """Retrieve a snapshot of data from the target. A Get RPC requests that the 57 target snapshots a subset of the data tree as specified by the paths 58 included in the message and serializes this to be returned to the 59 client using the specified encoding. 60 Reference: gNMI Specification Section 3.3 61 """ 62 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 63 context.set_details('Method not implemented!') 64 raise NotImplementedError('Method not implemented!') 65 66 def Set(self, request, context): 67 """Set allows the client to modify the state of data on the target. The 68 paths to modified along with the new values that the client wishes 69 to set the value to. 70 Reference: gNMI Specification Section 3.4 71 """ 72 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 73 context.set_details('Method not implemented!') 74 raise NotImplementedError('Method not implemented!') 75 76 def Subscribe(self, request_iterator, context): 77 """Subscribe allows a client to request the target to send it values 78 of particular paths within the data tree. These values may be streamed 79 at a particular cadence (STREAM), sent one off on a long-lived channel 80 (POLL), or sent as a one-off retrieval (ONCE). 81 Reference: gNMI Specification Section 3.5 82 """ 83 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 84 context.set_details('Method not implemented!') 85 raise NotImplementedError('Method not implemented!') 86 87 88def add_gNMIServicer_to_server(servicer, server): 89 rpc_method_handlers = { 90 'Capabilities': grpc.unary_unary_rpc_method_handler( 91 servicer.Capabilities, 92 request_deserializer=gnmi__pb2.CapabilityRequest.FromString, 93 response_serializer=gnmi__pb2.CapabilityResponse.SerializeToString, 94 ), 95 'Get': grpc.unary_unary_rpc_method_handler( 96 servicer.Get, 97 request_deserializer=gnmi__pb2.GetRequest.FromString, 98 response_serializer=gnmi__pb2.GetResponse.SerializeToString, 99 ), 100 'Set': grpc.unary_unary_rpc_method_handler( 101 servicer.Set, 102 request_deserializer=gnmi__pb2.SetRequest.FromString, 103 response_serializer=gnmi__pb2.SetResponse.SerializeToString, 104 ), 105 'Subscribe': grpc.stream_stream_rpc_method_handler( 106 servicer.Subscribe, 107 request_deserializer=gnmi__pb2.SubscribeRequest.FromString, 108 response_serializer=gnmi__pb2.SubscribeResponse.SerializeToString, 109 ), 110 } 111 generic_handler = grpc.method_handlers_generic_handler( 112 'gnmi.gNMI', rpc_method_handlers) 113 server.add_generic_rpc_handlers((generic_handler,)) 114