|
| 1 | +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! |
| 2 | +import grpc |
| 3 | + |
| 4 | +from p4.v1 import p4runtime_pb2 as p4_dot_v1_dot_p4runtime__pb2 |
| 5 | + |
| 6 | + |
| 7 | +class P4RuntimeStub(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.Write = channel.unary_unary( |
| 18 | + '/p4.v1.P4Runtime/Write', |
| 19 | + request_serializer=p4_dot_v1_dot_p4runtime__pb2.WriteRequest.SerializeToString, |
| 20 | + response_deserializer=p4_dot_v1_dot_p4runtime__pb2.WriteResponse.FromString, |
| 21 | + ) |
| 22 | + self.Read = channel.unary_stream( |
| 23 | + '/p4.v1.P4Runtime/Read', |
| 24 | + request_serializer=p4_dot_v1_dot_p4runtime__pb2.ReadRequest.SerializeToString, |
| 25 | + response_deserializer=p4_dot_v1_dot_p4runtime__pb2.ReadResponse.FromString, |
| 26 | + ) |
| 27 | + self.SetForwardingPipelineConfig = channel.unary_unary( |
| 28 | + '/p4.v1.P4Runtime/SetForwardingPipelineConfig', |
| 29 | + request_serializer=p4_dot_v1_dot_p4runtime__pb2.SetForwardingPipelineConfigRequest.SerializeToString, |
| 30 | + response_deserializer=p4_dot_v1_dot_p4runtime__pb2.SetForwardingPipelineConfigResponse.FromString, |
| 31 | + ) |
| 32 | + self.GetForwardingPipelineConfig = channel.unary_unary( |
| 33 | + '/p4.v1.P4Runtime/GetForwardingPipelineConfig', |
| 34 | + request_serializer=p4_dot_v1_dot_p4runtime__pb2.GetForwardingPipelineConfigRequest.SerializeToString, |
| 35 | + response_deserializer=p4_dot_v1_dot_p4runtime__pb2.GetForwardingPipelineConfigResponse.FromString, |
| 36 | + ) |
| 37 | + self.StreamChannel = channel.stream_stream( |
| 38 | + '/p4.v1.P4Runtime/StreamChannel', |
| 39 | + request_serializer=p4_dot_v1_dot_p4runtime__pb2.StreamMessageRequest.SerializeToString, |
| 40 | + response_deserializer=p4_dot_v1_dot_p4runtime__pb2.StreamMessageResponse.FromString, |
| 41 | + ) |
| 42 | + self.Capabilities = channel.unary_unary( |
| 43 | + '/p4.v1.P4Runtime/Capabilities', |
| 44 | + request_serializer=p4_dot_v1_dot_p4runtime__pb2.CapabilitiesRequest.SerializeToString, |
| 45 | + response_deserializer=p4_dot_v1_dot_p4runtime__pb2.CapabilitiesResponse.FromString, |
| 46 | + ) |
| 47 | + |
| 48 | + |
| 49 | +class P4RuntimeServicer(object): |
| 50 | + # missing associated documentation comment in .proto file |
| 51 | + pass |
| 52 | + |
| 53 | + def Write(self, request, context): |
| 54 | + """Update one or more P4 entities on the target. |
| 55 | + """ |
| 56 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 57 | + context.set_details('Method not implemented!') |
| 58 | + raise NotImplementedError('Method not implemented!') |
| 59 | + |
| 60 | + def Read(self, request, context): |
| 61 | + """Read one or more P4 entities from the target. |
| 62 | + """ |
| 63 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 64 | + context.set_details('Method not implemented!') |
| 65 | + raise NotImplementedError('Method not implemented!') |
| 66 | + |
| 67 | + def SetForwardingPipelineConfig(self, request, context): |
| 68 | + """Sets the P4 forwarding-pipeline config. |
| 69 | + """ |
| 70 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 71 | + context.set_details('Method not implemented!') |
| 72 | + raise NotImplementedError('Method not implemented!') |
| 73 | + |
| 74 | + def GetForwardingPipelineConfig(self, request, context): |
| 75 | + """Gets the current P4 forwarding-pipeline config. |
| 76 | + """ |
| 77 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 78 | + context.set_details('Method not implemented!') |
| 79 | + raise NotImplementedError('Method not implemented!') |
| 80 | + |
| 81 | + def StreamChannel(self, request_iterator, context): |
| 82 | + """Represents the bidirectional stream between the controller and the |
| 83 | + switch (initiated by the controller), and is managed for the following |
| 84 | + purposes: |
| 85 | + - connection initiation through client arbitration |
| 86 | + - indicating switch session liveness: the session is live when switch |
| 87 | + sends a positive client arbitration update to the controller, and is |
| 88 | + considered dead when either the stream breaks or the switch sends a |
| 89 | + negative update for client arbitration |
| 90 | + - the controller sending/receiving packets to/from the switch |
| 91 | + - streaming of notifications from the switch |
| 92 | + """ |
| 93 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 94 | + context.set_details('Method not implemented!') |
| 95 | + raise NotImplementedError('Method not implemented!') |
| 96 | + |
| 97 | + def Capabilities(self, request, context): |
| 98 | + # missing associated documentation comment in .proto file |
| 99 | + pass |
| 100 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 101 | + context.set_details('Method not implemented!') |
| 102 | + raise NotImplementedError('Method not implemented!') |
| 103 | + |
| 104 | + |
| 105 | +def add_P4RuntimeServicer_to_server(servicer, server): |
| 106 | + rpc_method_handlers = { |
| 107 | + 'Write': grpc.unary_unary_rpc_method_handler( |
| 108 | + servicer.Write, |
| 109 | + request_deserializer=p4_dot_v1_dot_p4runtime__pb2.WriteRequest.FromString, |
| 110 | + response_serializer=p4_dot_v1_dot_p4runtime__pb2.WriteResponse.SerializeToString, |
| 111 | + ), |
| 112 | + 'Read': grpc.unary_stream_rpc_method_handler( |
| 113 | + servicer.Read, |
| 114 | + request_deserializer=p4_dot_v1_dot_p4runtime__pb2.ReadRequest.FromString, |
| 115 | + response_serializer=p4_dot_v1_dot_p4runtime__pb2.ReadResponse.SerializeToString, |
| 116 | + ), |
| 117 | + 'SetForwardingPipelineConfig': grpc.unary_unary_rpc_method_handler( |
| 118 | + servicer.SetForwardingPipelineConfig, |
| 119 | + request_deserializer=p4_dot_v1_dot_p4runtime__pb2.SetForwardingPipelineConfigRequest.FromString, |
| 120 | + response_serializer=p4_dot_v1_dot_p4runtime__pb2.SetForwardingPipelineConfigResponse.SerializeToString, |
| 121 | + ), |
| 122 | + 'GetForwardingPipelineConfig': grpc.unary_unary_rpc_method_handler( |
| 123 | + servicer.GetForwardingPipelineConfig, |
| 124 | + request_deserializer=p4_dot_v1_dot_p4runtime__pb2.GetForwardingPipelineConfigRequest.FromString, |
| 125 | + response_serializer=p4_dot_v1_dot_p4runtime__pb2.GetForwardingPipelineConfigResponse.SerializeToString, |
| 126 | + ), |
| 127 | + 'StreamChannel': grpc.stream_stream_rpc_method_handler( |
| 128 | + servicer.StreamChannel, |
| 129 | + request_deserializer=p4_dot_v1_dot_p4runtime__pb2.StreamMessageRequest.FromString, |
| 130 | + response_serializer=p4_dot_v1_dot_p4runtime__pb2.StreamMessageResponse.SerializeToString, |
| 131 | + ), |
| 132 | + 'Capabilities': grpc.unary_unary_rpc_method_handler( |
| 133 | + servicer.Capabilities, |
| 134 | + request_deserializer=p4_dot_v1_dot_p4runtime__pb2.CapabilitiesRequest.FromString, |
| 135 | + response_serializer=p4_dot_v1_dot_p4runtime__pb2.CapabilitiesResponse.SerializeToString, |
| 136 | + ), |
| 137 | + } |
| 138 | + generic_handler = grpc.method_handlers_generic_handler( |
| 139 | + 'p4.v1.P4Runtime', rpc_method_handlers) |
| 140 | + server.add_generic_rpc_handlers((generic_handler,)) |
0 commit comments