• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 servod_service_pb2 as chromiumos_dot_test_dot_api_dot_servod__service__pb2
7
8
9class ServodServiceStub(object):
10    """Provides the ability to start/stop servod daemon and execute servod
11    commands on it.
12    Servod daemon can be running either inside a Docker container or directly
13    on the host.
14    The servo host could also be the same as the service host or a remote host.
15    go/cros-servod-design to learn more about the design.
16    """
17
18    def __init__(self, channel):
19        """Constructor.
20
21        Args:
22            channel: A grpc.Channel.
23        """
24        self.StartServod = channel.unary_unary(
25                '/chromiumos.test.api.ServodService/StartServod',
26                request_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.StartServodRequest.SerializeToString,
27                response_deserializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString,
28                )
29        self.StopServod = channel.unary_unary(
30                '/chromiumos.test.api.ServodService/StopServod',
31                request_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.StopServodRequest.SerializeToString,
32                response_deserializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString,
33                )
34        self.ExecCmd = channel.unary_unary(
35                '/chromiumos.test.api.ServodService/ExecCmd',
36                request_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.ExecCmdRequest.SerializeToString,
37                response_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.ExecCmdResponse.FromString,
38                )
39        self.CallServod = channel.unary_unary(
40                '/chromiumos.test.api.ServodService/CallServod',
41                request_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.CallServodRequest.SerializeToString,
42                response_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.CallServodResponse.FromString,
43                )
44        self.LogCheckPoint = channel.unary_unary(
45                '/chromiumos.test.api.ServodService/LogCheckPoint',
46                request_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.LogCheckPointRequest.SerializeToString,
47                response_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.LogCheckPointResponse.FromString,
48                )
49        self.SaveLogs = channel.unary_unary(
50                '/chromiumos.test.api.ServodService/SaveLogs',
51                request_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.SaveLogsRequest.SerializeToString,
52                response_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.SaveLogsResponse.FromString,
53                )
54
55
56class ServodServiceServicer(object):
57    """Provides the ability to start/stop servod daemon and execute servod
58    commands on it.
59    Servod daemon can be running either inside a Docker container or directly
60    on the host.
61    The servo host could also be the same as the service host or a remote host.
62    go/cros-servod-design to learn more about the design.
63    """
64
65    def StartServod(self, request, context):
66        """StartServod runs a servod Docker container and starts the servod daemon
67        inside the container if servod is containerized. Otherwise, it simply
68        starts the servod daemon.
69        """
70        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
71        context.set_details('Method not implemented!')
72        raise NotImplementedError('Method not implemented!')
73
74    def StopServod(self, request, context):
75        """StopServod stops the servod daemon inside the container and stops the
76        servod Docker container if servod is containerized. Otherwise, it simply
77        stops the servod daemon.
78        """
79        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
80        context.set_details('Method not implemented!')
81        raise NotImplementedError('Method not implemented!')
82
83    def ExecCmd(self, request, context):
84        """ExecCmd executes a system command that is provided through the command
85        parameter in the request. It allows the user to execute arbitrary commands
86        that can't be handled by calling servod (e.g. update firmware through
87        "futility", remote file copy through "scp").
88        It executes the command inside the servod Docker container if the
89        servod_docker_container_name parameter is provided in the request.
90        Otherwise, it executes the command directly inside the host that the servo
91        is physically connected to.
92        """
93        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
94        context.set_details('Method not implemented!')
95        raise NotImplementedError('Method not implemented!')
96
97    def CallServod(self, request, context):
98        """CallServod runs a servod command through an XML-RPC call.
99        It runs the command inside the servod Docker container if the
100        servod_docker_container_name parameter is provided in the request.
101        Otherwise, it runs the command directly inside the host that the servo
102        is physically connected to.
103        Allowed methods: doc, get, set, and hwinit.
104        """
105        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
106        context.set_details('Method not implemented!')
107        raise NotImplementedError('Method not implemented!')
108
109    def LogCheckPoint(self, request, context):
110        """LogCheckPoint will create checkpoint certain files so that some files
111        can be saved partially when SaveLogs is called.
112        For example, /var/log/messages in a labstation can be
113        very big and include information from a few days ago.
114        Getting the checkpoint of the current /var/log/messages will
115        allow SaveLogs to save the portion only relevant to the current
116        testing session.
117        """
118        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
119        context.set_details('Method not implemented!')
120        raise NotImplementedError('Method not implemented!')
121
122    def SaveLogs(self, request, context):
123        """SaveLogs will save servod related logs on the host that this service
124        is running.
125        Logs include:
126        /var/log/message from the servod host.
127        /var/log/servod_<port>/ latest.DEBUG from servod host.
128        /var/log/servod_<port>.STARTUP.log from servod host.
129        The output of  "dmesg -H"  from the servod host.
130        The extraction of the MCU console logs from latest.DEBUG
131        """
132        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
133        context.set_details('Method not implemented!')
134        raise NotImplementedError('Method not implemented!')
135
136
137def add_ServodServiceServicer_to_server(servicer, server):
138    rpc_method_handlers = {
139            'StartServod': grpc.unary_unary_rpc_method_handler(
140                    servicer.StartServod,
141                    request_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.StartServodRequest.FromString,
142                    response_serializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
143            ),
144            'StopServod': grpc.unary_unary_rpc_method_handler(
145                    servicer.StopServod,
146                    request_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.StopServodRequest.FromString,
147                    response_serializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
148            ),
149            'ExecCmd': grpc.unary_unary_rpc_method_handler(
150                    servicer.ExecCmd,
151                    request_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.ExecCmdRequest.FromString,
152                    response_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.ExecCmdResponse.SerializeToString,
153            ),
154            'CallServod': grpc.unary_unary_rpc_method_handler(
155                    servicer.CallServod,
156                    request_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.CallServodRequest.FromString,
157                    response_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.CallServodResponse.SerializeToString,
158            ),
159            'LogCheckPoint': grpc.unary_unary_rpc_method_handler(
160                    servicer.LogCheckPoint,
161                    request_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.LogCheckPointRequest.FromString,
162                    response_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.LogCheckPointResponse.SerializeToString,
163            ),
164            'SaveLogs': grpc.unary_unary_rpc_method_handler(
165                    servicer.SaveLogs,
166                    request_deserializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.SaveLogsRequest.FromString,
167                    response_serializer=chromiumos_dot_test_dot_api_dot_servod__service__pb2.SaveLogsResponse.SerializeToString,
168            ),
169    }
170    generic_handler = grpc.method_handlers_generic_handler(
171            'chromiumos.test.api.ServodService', rpc_method_handlers)
172    server.add_generic_rpc_handlers((generic_handler,))
173
174
175 # This class is part of an EXPERIMENTAL API.
176class ServodService(object):
177    """Provides the ability to start/stop servod daemon and execute servod
178    commands on it.
179    Servod daemon can be running either inside a Docker container or directly
180    on the host.
181    The servo host could also be the same as the service host or a remote host.
182    go/cros-servod-design to learn more about the design.
183    """
184
185    @staticmethod
186    def StartServod(request,
187            target,
188            options=(),
189            channel_credentials=None,
190            call_credentials=None,
191            insecure=False,
192            compression=None,
193            wait_for_ready=None,
194            timeout=None,
195            metadata=None):
196        return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.ServodService/StartServod',
197            chromiumos_dot_test_dot_api_dot_servod__service__pb2.StartServodRequest.SerializeToString,
198            chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString,
199            options, channel_credentials,
200            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
201
202    @staticmethod
203    def StopServod(request,
204            target,
205            options=(),
206            channel_credentials=None,
207            call_credentials=None,
208            insecure=False,
209            compression=None,
210            wait_for_ready=None,
211            timeout=None,
212            metadata=None):
213        return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.ServodService/StopServod',
214            chromiumos_dot_test_dot_api_dot_servod__service__pb2.StopServodRequest.SerializeToString,
215            chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString,
216            options, channel_credentials,
217            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
218
219    @staticmethod
220    def ExecCmd(request,
221            target,
222            options=(),
223            channel_credentials=None,
224            call_credentials=None,
225            insecure=False,
226            compression=None,
227            wait_for_ready=None,
228            timeout=None,
229            metadata=None):
230        return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.ServodService/ExecCmd',
231            chromiumos_dot_test_dot_api_dot_servod__service__pb2.ExecCmdRequest.SerializeToString,
232            chromiumos_dot_test_dot_api_dot_servod__service__pb2.ExecCmdResponse.FromString,
233            options, channel_credentials,
234            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
235
236    @staticmethod
237    def CallServod(request,
238            target,
239            options=(),
240            channel_credentials=None,
241            call_credentials=None,
242            insecure=False,
243            compression=None,
244            wait_for_ready=None,
245            timeout=None,
246            metadata=None):
247        return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.ServodService/CallServod',
248            chromiumos_dot_test_dot_api_dot_servod__service__pb2.CallServodRequest.SerializeToString,
249            chromiumos_dot_test_dot_api_dot_servod__service__pb2.CallServodResponse.FromString,
250            options, channel_credentials,
251            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
252
253    @staticmethod
254    def LogCheckPoint(request,
255            target,
256            options=(),
257            channel_credentials=None,
258            call_credentials=None,
259            insecure=False,
260            compression=None,
261            wait_for_ready=None,
262            timeout=None,
263            metadata=None):
264        return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.ServodService/LogCheckPoint',
265            chromiumos_dot_test_dot_api_dot_servod__service__pb2.LogCheckPointRequest.SerializeToString,
266            chromiumos_dot_test_dot_api_dot_servod__service__pb2.LogCheckPointResponse.FromString,
267            options, channel_credentials,
268            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
269
270    @staticmethod
271    def SaveLogs(request,
272            target,
273            options=(),
274            channel_credentials=None,
275            call_credentials=None,
276            insecure=False,
277            compression=None,
278            wait_for_ready=None,
279            timeout=None,
280            metadata=None):
281        return grpc.experimental.unary_unary(request, target, '/chromiumos.test.api.ServodService/SaveLogs',
282            chromiumos_dot_test_dot_api_dot_servod__service__pb2.SaveLogsRequest.SerializeToString,
283            chromiumos_dot_test_dot_api_dot_servod__service__pb2.SaveLogsResponse.FromString,
284            options, channel_credentials,
285            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
286