1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 2"""Client and server classes corresponding to protobuf-defined services.""" 3import grpc 4 5from chromiumos.longrunning import operations_pb2 as chromiumos_dot_longrunning_dot_operations__pb2 6from chromiumos.test.api import dut_service_pb2 as chromiumos_dot_test_dot_api_dot_dut__service__pb2 7 8 9class DutServiceStub(object): 10 """Provides network based access to a device under test for remote 11 command execution and device state/identity retrieval. 12 """ 13 14 def __init__(self, channel): 15 """Constructor. 16 17 Args: 18 channel: A grpc.Channel. 19 """ 20 self.ExecCommand = channel.unary_stream( 21 '/chromiumos.test.api.DutService/ExecCommand', 22 request_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.ExecCommandRequest.SerializeToString, 23 response_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.ExecCommandResponse.FromString, 24 ) 25 self.FetchCrashes = channel.unary_stream( 26 '/chromiumos.test.api.DutService/FetchCrashes', 27 request_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchCrashesRequest.SerializeToString, 28 response_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchCrashesResponse.FromString, 29 ) 30 self.Restart = channel.unary_unary( 31 '/chromiumos.test.api.DutService/Restart', 32 request_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.RestartRequest.SerializeToString, 33 response_deserializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString, 34 ) 35 self.DetectDeviceConfigId = channel.unary_stream( 36 '/chromiumos.test.api.DutService/DetectDeviceConfigId', 37 request_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.DetectDeviceConfigIdRequest.SerializeToString, 38 response_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.DetectDeviceConfigIdResponse.FromString, 39 ) 40 self.FetchFile = channel.unary_stream( 41 '/chromiumos.test.api.DutService/FetchFile', 42 request_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchFileRequest.SerializeToString, 43 response_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.File.FromString, 44 ) 45 self.Cache = channel.unary_unary( 46 '/chromiumos.test.api.DutService/Cache', 47 request_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.CacheRequest.SerializeToString, 48 response_deserializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString, 49 ) 50 self.ForceReconnect = channel.unary_unary( 51 '/chromiumos.test.api.DutService/ForceReconnect', 52 request_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.ForceReconnectRequest.SerializeToString, 53 response_deserializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString, 54 ) 55 56 57class DutServiceServicer(object): 58 """Provides network based access to a device under test for remote 59 command execution and device state/identity retrieval. 60 """ 61 62 def ExecCommand(self, request, context): 63 """ExecCommand runs a command on a DUT. 64 65 The working directory is /. 66 A tty is not spawned for the command. 67 The user and group is root. 68 All signals have their default dispositions and are not masked. 69 The umask is set to 0. 70 71 The environment contains: 72 73 TERM=dumb 74 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin 75 LANG=en_US.UTF-8 76 USER=root 77 HOME=/root 78 79 The environment MAY also contain SSH client variables. 80 The environment SHALL NOT contain variables not mentioned above. 81 82 If the stream is interrupted, the implementation MAY attempt to 83 stop the command by sending SIGINT, SIGHUP, SIGTERM, or SIGKILL. 84 """ 85 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 86 context.set_details('Method not implemented!') 87 raise NotImplementedError('Method not implemented!') 88 89 def FetchCrashes(self, request, context): 90 """FetchCrashes gets a stream of all crash reports currently on the DUT. 91 92 The stream returned may split up a crash over multiple 93 `FetchCrashesResponse` protos. See the definition of that proto for 94 details. 95 96 This call is read-only: it doesn't delete the crashes that it reads. 97 """ 98 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 99 context.set_details('Method not implemented!') 100 raise NotImplementedError('Method not implemented!') 101 102 def Restart(self, request, context): 103 """Restart simply reboots a DUT and returns when done. 104 105 This is necessary as we need to refresh our connection to the DUT at 106 restart, and this allows a signaling to the server that the connection 107 will be severed. 108 """ 109 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 110 context.set_details('Method not implemented!') 111 raise NotImplementedError('Method not implemented!') 112 113 def DetectDeviceConfigId(self, request, context): 114 """Scans the live device to determine device config identifiers. 115 116 The returned scan config can then be used to reverse lookup 117 the actual DeviceConfigId values and corresponding configs. 118 """ 119 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 120 context.set_details('Method not implemented!') 121 raise NotImplementedError('Method not implemented!') 122 123 def FetchFile(self, request, context): 124 """Fetch a file or dir from the device. 125 126 The files will be returned via a tar'd bytestream. 127 """ 128 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 129 context.set_details('Method not implemented!') 130 raise NotImplementedError('Method not implemented!') 131 132 def Cache(self, request, context): 133 """Downloads files from GS to the DUT 134 135 The files downloaded may be decompressed in this layer to save cycles (and 136 space) in the DUT. This utilizes the cacheForDUT endpoint to download the 137 files. 138 """ 139 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 140 context.set_details('Method not implemented!') 141 raise NotImplementedError('Method not implemented!') 142 143 def ForceReconnect(self, request, context): 144 """Used to reestablish connection to DUT in case of drops. 145 146 This is needed in case the connection to the DUT is lost and we need to 147 keep the connection. Previously this was done by the service, but as we try 148 to accomplish true microservice functionality (i.e.: no side-effects) we 149 removed it and gave the option for the user to reconnect if needed with 150 whichever algorithm they prefer. 151 """ 152 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 153 context.set_details('Method not implemented!') 154 raise NotImplementedError('Method not implemented!') 155 156 157def add_DutServiceServicer_to_server(servicer, server): 158 rpc_method_handlers = { 159 'ExecCommand': grpc.unary_stream_rpc_method_handler( 160 servicer.ExecCommand, 161 request_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.ExecCommandRequest.FromString, 162 response_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.ExecCommandResponse.SerializeToString, 163 ), 164 'FetchCrashes': grpc.unary_stream_rpc_method_handler( 165 servicer.FetchCrashes, 166 request_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchCrashesRequest.FromString, 167 response_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchCrashesResponse.SerializeToString, 168 ), 169 'Restart': grpc.unary_unary_rpc_method_handler( 170 servicer.Restart, 171 request_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.RestartRequest.FromString, 172 response_serializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, 173 ), 174 'DetectDeviceConfigId': grpc.unary_stream_rpc_method_handler( 175 servicer.DetectDeviceConfigId, 176 request_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.DetectDeviceConfigIdRequest.FromString, 177 response_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.DetectDeviceConfigIdResponse.SerializeToString, 178 ), 179 'FetchFile': grpc.unary_stream_rpc_method_handler( 180 servicer.FetchFile, 181 request_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchFileRequest.FromString, 182 response_serializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.File.SerializeToString, 183 ), 184 'Cache': grpc.unary_unary_rpc_method_handler( 185 servicer.Cache, 186 request_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.CacheRequest.FromString, 187 response_serializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, 188 ), 189 'ForceReconnect': grpc.unary_unary_rpc_method_handler( 190 servicer.ForceReconnect, 191 request_deserializer=chromiumos_dot_test_dot_api_dot_dut__service__pb2.ForceReconnectRequest.FromString, 192 response_serializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, 193 ), 194 } 195 generic_handler = grpc.method_handlers_generic_handler( 196 'chromiumos.test.api.DutService', rpc_method_handlers) 197 server.add_generic_rpc_handlers((generic_handler,)) 198 199 200 # This class is part of an EXPERIMENTAL API. 201class DutService(object): 202 """Provides network based access to a device under test for remote 203 command execution and device state/identity retrieval. 204 """ 205 206 @staticmethod 207 def ExecCommand(request, 208 target, 209 options=(), 210 channel_credentials=None, 211 call_credentials=None, 212 insecure=False, 213 compression=None, 214 wait_for_ready=None, 215 timeout=None, 216 metadata=None): 217 return grpc.experimental.unary_stream(request, target, '/chromiumos.test.api.DutService/ExecCommand', 218 chromiumos_dot_test_dot_api_dot_dut__service__pb2.ExecCommandRequest.SerializeToString, 219 chromiumos_dot_test_dot_api_dot_dut__service__pb2.ExecCommandResponse.FromString, 220 options, channel_credentials, 221 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 222 223 @staticmethod 224 def FetchCrashes(request, 225 target, 226 options=(), 227 channel_credentials=None, 228 call_credentials=None, 229 insecure=False, 230 compression=None, 231 wait_for_ready=None, 232 timeout=None, 233 metadata=None): 234 return grpc.experimental.unary_stream(request, target, '/chromiumos.test.api.DutService/FetchCrashes', 235 chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchCrashesRequest.SerializeToString, 236 chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchCrashesResponse.FromString, 237 options, channel_credentials, 238 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 239 240 @staticmethod 241 def Restart(request, 242 target, 243 options=(), 244 channel_credentials=None, 245 call_credentials=None, 246 insecure=False, 247 compression=None, 248 wait_for_ready=None, 249 timeout=None, 250 metadata=None): 251 return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.DutService/Restart', 252 chromiumos_dot_test_dot_api_dot_dut__service__pb2.RestartRequest.SerializeToString, 253 chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString, 254 options, channel_credentials, 255 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 256 257 @staticmethod 258 def DetectDeviceConfigId(request, 259 target, 260 options=(), 261 channel_credentials=None, 262 call_credentials=None, 263 insecure=False, 264 compression=None, 265 wait_for_ready=None, 266 timeout=None, 267 metadata=None): 268 return grpc.experimental.unary_stream(request, target, '/chromiumos.test.api.DutService/DetectDeviceConfigId', 269 chromiumos_dot_test_dot_api_dot_dut__service__pb2.DetectDeviceConfigIdRequest.SerializeToString, 270 chromiumos_dot_test_dot_api_dot_dut__service__pb2.DetectDeviceConfigIdResponse.FromString, 271 options, channel_credentials, 272 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 273 274 @staticmethod 275 def FetchFile(request, 276 target, 277 options=(), 278 channel_credentials=None, 279 call_credentials=None, 280 insecure=False, 281 compression=None, 282 wait_for_ready=None, 283 timeout=None, 284 metadata=None): 285 return grpc.experimental.unary_stream(request, target, '/chromiumos.test.api.DutService/FetchFile', 286 chromiumos_dot_test_dot_api_dot_dut__service__pb2.FetchFileRequest.SerializeToString, 287 chromiumos_dot_test_dot_api_dot_dut__service__pb2.File.FromString, 288 options, channel_credentials, 289 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 290 291 @staticmethod 292 def Cache(request, 293 target, 294 options=(), 295 channel_credentials=None, 296 call_credentials=None, 297 insecure=False, 298 compression=None, 299 wait_for_ready=None, 300 timeout=None, 301 metadata=None): 302 return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.DutService/Cache', 303 chromiumos_dot_test_dot_api_dot_dut__service__pb2.CacheRequest.SerializeToString, 304 chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString, 305 options, channel_credentials, 306 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 307 308 @staticmethod 309 def ForceReconnect(request, 310 target, 311 options=(), 312 channel_credentials=None, 313 call_credentials=None, 314 insecure=False, 315 compression=None, 316 wait_for_ready=None, 317 timeout=None, 318 metadata=None): 319 return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.DutService/ForceReconnect', 320 chromiumos_dot_test_dot_api_dot_dut__service__pb2.ForceReconnectRequest.SerializeToString, 321 chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString, 322 options, channel_credentials, 323 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 324