gnetclisdk 0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gnetclisdk/auth.py +41 -0
- gnetclisdk/client.py +481 -0
- gnetclisdk/exceptions.py +116 -0
- gnetclisdk/interceptors.py +196 -0
- gnetclisdk/proto/server_pb2.py +83 -0
- gnetclisdk/proto/server_pb2.pyi +190 -0
- gnetclisdk/proto/server_pb2_grpc.py +399 -0
- gnetclisdk-0.0.dist-info/METADATA +45 -0
- gnetclisdk-0.0.dist-info/RECORD +11 -0
- gnetclisdk-0.0.dist-info/WHEEL +5 -0
- gnetclisdk-0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,196 @@
|
|
1
|
+
# type: ignore
|
2
|
+
import uuid
|
3
|
+
from typing import Callable, Iterable, List, Optional, Tuple, Union
|
4
|
+
|
5
|
+
import grpc
|
6
|
+
from grpc.aio._call import StreamStreamCall
|
7
|
+
from grpc.aio._interceptor import ClientCallDetails
|
8
|
+
from grpc.aio._typing import RequestIterableType, RequestType, ResponseType
|
9
|
+
|
10
|
+
from .auth import ClientAuthentication
|
11
|
+
|
12
|
+
_RequestMetadata = Optional[Iterable[Tuple[str, str]]]
|
13
|
+
ResponseIterableType = grpc.aio._typing.ResponseIterableType
|
14
|
+
|
15
|
+
|
16
|
+
def get_auth_client_interceptors(
|
17
|
+
authentication: ClientAuthentication,
|
18
|
+
) -> List[grpc.aio.ClientInterceptor]:
|
19
|
+
return [
|
20
|
+
_AuthInterceptorUnaryUnary(authentication),
|
21
|
+
_AuthInterceptorUnaryStream(authentication),
|
22
|
+
_AuthInterceptorStreamUnary(authentication),
|
23
|
+
_AuthInterceptorStreamStream(authentication),
|
24
|
+
]
|
25
|
+
|
26
|
+
|
27
|
+
def get_request_id_interceptors(
|
28
|
+
request_id: uuid.UUID,
|
29
|
+
) -> List[grpc.aio.ClientInterceptor]:
|
30
|
+
return [
|
31
|
+
_RequestIdInterceptorUnaryUnary(request_id),
|
32
|
+
_RequestIdInterceptorUnaryStream(request_id),
|
33
|
+
_RequestIdInterceptorStreamUnary(request_id),
|
34
|
+
_RequestIdInterceptorStreamStream(request_id),
|
35
|
+
]
|
36
|
+
|
37
|
+
|
38
|
+
class _AuthInterceptorAgent:
|
39
|
+
def __init__(self, authentication: ClientAuthentication):
|
40
|
+
self.__authentication = authentication
|
41
|
+
|
42
|
+
def _add_auth(self, details: grpc.aio.ClientCallDetails) -> grpc.aio.ClientCallDetails:
|
43
|
+
return grpc.aio.ClientCallDetails(
|
44
|
+
method=details.method,
|
45
|
+
timeout=details.timeout,
|
46
|
+
metadata=self.__add_auth_meta(details.metadata),
|
47
|
+
credentials=details.credentials,
|
48
|
+
wait_for_ready=None,
|
49
|
+
)
|
50
|
+
|
51
|
+
def __add_auth_meta(self, metadata: _RequestMetadata = None) -> _RequestMetadata:
|
52
|
+
result: Tuple[Tuple[str, str]] = []
|
53
|
+
if metadata is not None:
|
54
|
+
for m in metadata:
|
55
|
+
result.append(m)
|
56
|
+
result.append(
|
57
|
+
(
|
58
|
+
self.__authentication.get_authentication_header_key(),
|
59
|
+
self.__authentication.create_authentication_header_value(),
|
60
|
+
)
|
61
|
+
)
|
62
|
+
return tuple(result)
|
63
|
+
|
64
|
+
|
65
|
+
class _AuthInterceptorUnaryUnary(_AuthInterceptorAgent, grpc.aio.UnaryUnaryClientInterceptor):
|
66
|
+
async def intercept_unary_unary(
|
67
|
+
self,
|
68
|
+
continuation: Callable[[grpc.aio.ClientCallDetails, RequestType], grpc.aio.UnaryUnaryCall],
|
69
|
+
client_call_details: grpc.aio.ClientCallDetails,
|
70
|
+
request: RequestType,
|
71
|
+
) -> Union[grpc.aio._call.UnaryUnaryCall, ResponseType]:
|
72
|
+
res = await continuation(self._add_auth(client_call_details), request)
|
73
|
+
return res
|
74
|
+
|
75
|
+
|
76
|
+
class _AuthInterceptorUnaryStream(_AuthInterceptorAgent, grpc.aio.UnaryStreamClientInterceptor):
|
77
|
+
async def intercept_unary_stream(
|
78
|
+
self,
|
79
|
+
continuation: Callable[[grpc.aio.ClientCallDetails, RequestType], grpc.aio.UnaryStreamCall],
|
80
|
+
details: grpc.aio.ClientCallDetails,
|
81
|
+
request: RequestType,
|
82
|
+
) -> Union[ResponseIterableType, grpc.aio.UnaryStreamCall]:
|
83
|
+
return await continuation(self._add_auth(details), request)
|
84
|
+
|
85
|
+
|
86
|
+
class _AuthInterceptorStreamUnary(
|
87
|
+
_AuthInterceptorAgent,
|
88
|
+
grpc.aio.StreamUnaryClientInterceptor,
|
89
|
+
):
|
90
|
+
async def intercept_stream_unary(
|
91
|
+
self,
|
92
|
+
continuation: Callable[[grpc.aio.ClientCallDetails, RequestType], grpc.aio.StreamUnaryCall],
|
93
|
+
client_call_details: grpc.aio.ClientCallDetails,
|
94
|
+
request_iterator: RequestIterableType,
|
95
|
+
) -> grpc.aio.StreamUnaryCall:
|
96
|
+
return await continuation(self._add_auth(client_call_details), request_iterator)
|
97
|
+
|
98
|
+
|
99
|
+
class _AuthInterceptorStreamStream(
|
100
|
+
_AuthInterceptorAgent,
|
101
|
+
grpc.aio.StreamStreamClientInterceptor,
|
102
|
+
):
|
103
|
+
async def intercept_stream_stream(
|
104
|
+
self,
|
105
|
+
continuation: Callable[[ClientCallDetails, RequestType], StreamStreamCall],
|
106
|
+
client_call_details: ClientCallDetails,
|
107
|
+
request_iterator: RequestIterableType,
|
108
|
+
) -> Union[ResponseIterableType, StreamStreamCall]:
|
109
|
+
return await continuation(self._add_auth(client_call_details), request_iterator)
|
110
|
+
|
111
|
+
|
112
|
+
class _RequestIdInterceptorAgent:
|
113
|
+
_interceptor_type: str
|
114
|
+
|
115
|
+
def __init__(self, request_id: uuid.UUID):
|
116
|
+
self.__request_id = request_id
|
117
|
+
self.__counter = 0
|
118
|
+
|
119
|
+
def _add_request_id(self, details: ClientCallDetails) -> ClientCallDetails:
|
120
|
+
self.__counter += 1
|
121
|
+
|
122
|
+
metadata = ()
|
123
|
+
if details.metadata is not None:
|
124
|
+
metadata = tuple(details.metadata)
|
125
|
+
metadata += (
|
126
|
+
(
|
127
|
+
"x-request-id",
|
128
|
+
f"{self.__request_id}/{self._interceptor_type}_{self.__counter}",
|
129
|
+
),
|
130
|
+
)
|
131
|
+
|
132
|
+
res = grpc.aio.ClientCallDetails(
|
133
|
+
method=details.method,
|
134
|
+
timeout=details.timeout,
|
135
|
+
metadata=metadata,
|
136
|
+
credentials=details.credentials,
|
137
|
+
wait_for_ready=None,
|
138
|
+
)
|
139
|
+
return res
|
140
|
+
|
141
|
+
|
142
|
+
class _RequestIdInterceptorUnaryUnary(
|
143
|
+
_RequestIdInterceptorAgent,
|
144
|
+
grpc.aio.UnaryUnaryClientInterceptor,
|
145
|
+
):
|
146
|
+
_interceptor_type = "unary_unary"
|
147
|
+
|
148
|
+
async def intercept_unary_unary(
|
149
|
+
self,
|
150
|
+
continuation: Callable[[grpc.aio.ClientCallDetails, RequestType], grpc.aio.UnaryUnaryCall],
|
151
|
+
client_call_details: grpc.aio.ClientCallDetails,
|
152
|
+
request: RequestType,
|
153
|
+
) -> Union[grpc.aio.UnaryUnaryCall, ResponseType]:
|
154
|
+
return await continuation(self._add_request_id(client_call_details), request)
|
155
|
+
|
156
|
+
|
157
|
+
class _RequestIdInterceptorUnaryStream(
|
158
|
+
_RequestIdInterceptorAgent,
|
159
|
+
grpc.aio.UnaryStreamClientInterceptor,
|
160
|
+
):
|
161
|
+
_interceptor_type = "unary_stream"
|
162
|
+
|
163
|
+
async def intercept_unary_stream(
|
164
|
+
self,
|
165
|
+
continuation: Callable[[grpc.aio.ClientCallDetails, RequestType], grpc.aio.UnaryStreamCall],
|
166
|
+
client_call_details: grpc.aio.ClientCallDetails,
|
167
|
+
request: RequestType,
|
168
|
+
) -> Union[ResponseIterableType, grpc.aio.UnaryStreamCall]:
|
169
|
+
return await continuation(self._add_request_id(client_call_details), request)
|
170
|
+
|
171
|
+
|
172
|
+
class _RequestIdInterceptorStreamUnary(
|
173
|
+
_RequestIdInterceptorAgent,
|
174
|
+
grpc.aio.StreamUnaryClientInterceptor,
|
175
|
+
):
|
176
|
+
_interceptor_type = "stream_unary"
|
177
|
+
|
178
|
+
async def intercept_stream_unary(
|
179
|
+
self,
|
180
|
+
continuation: Callable[[grpc.aio.ClientCallDetails, RequestType], grpc.aio.StreamUnaryCall],
|
181
|
+
client_call_details: grpc.aio.ClientCallDetails,
|
182
|
+
request_iterator: RequestIterableType,
|
183
|
+
) -> grpc.aio.StreamUnaryCall:
|
184
|
+
return await continuation(self._add_request_id(client_call_details), request_iterator)
|
185
|
+
|
186
|
+
|
187
|
+
class _RequestIdInterceptorStreamStream(_RequestIdInterceptorAgent, grpc.aio.StreamStreamClientInterceptor):
|
188
|
+
_interceptor_type = "stream_stream"
|
189
|
+
|
190
|
+
async def intercept_stream_stream(
|
191
|
+
self,
|
192
|
+
continuation: Callable[[ClientCallDetails, RequestType], StreamStreamCall],
|
193
|
+
client_call_details: ClientCallDetails,
|
194
|
+
request_iterator: RequestIterableType,
|
195
|
+
) -> Union[ResponseIterableType, StreamStreamCall]:
|
196
|
+
return await continuation(self._add_request_id(client_call_details), request_iterator)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
4
|
+
# source: server.proto
|
5
|
+
# Protobuf Python Version: 5.27.2
|
6
|
+
"""Generated protocol buffer code."""
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
11
|
+
from google.protobuf.internal import builder as _builder
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
14
|
+
5,
|
15
|
+
27,
|
16
|
+
2,
|
17
|
+
'',
|
18
|
+
'server.proto'
|
19
|
+
)
|
20
|
+
# @@protoc_insertion_point(imports)
|
21
|
+
|
22
|
+
_sym_db = _symbol_database.Default()
|
23
|
+
|
24
|
+
|
25
|
+
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
|
26
|
+
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
|
27
|
+
|
28
|
+
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cserver.proto\x12\x07gnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\"&\n\x02QA\x12\x10\n\x08question\x18\x01 \x01(\t\x12\x0e\n\x06\x61nswer\x18\x02 \x01(\t\".\n\x0b\x43redentials\x12\r\n\x05login\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xb4\x01\n\x03\x43MD\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\r\n\x05trace\x18\x03 \x01(\x08\x12\x17\n\x02qa\x18\x04 \x03(\x0b\x32\x0b.gnetcli.QA\x12\x14\n\x0cread_timeout\x18\x05 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x06 \x01(\x01\x12\x15\n\rstring_result\x18\x08 \x01(\x08\x12(\n\x0bhost_params\x18\t \x01(\x0b\x32\x13.gnetcli.HostParams\"e\n\x06\x44\x65vice\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x11prompt_expression\x18\x02 \x01(\t\x12\x18\n\x10\x65rror_expression\x18\x03 \x01(\t\x12\x18\n\x10pager_expression\x18\x04 \x01(\t\"`\n\nCMDNetconf\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\x0c\n\x04json\x18\x03 \x01(\x08\x12\x14\n\x0cread_timeout\x18\x04 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x05 \x01(\x01\"H\n\x0c\x43MDTraceItem\x12*\n\toperation\x18\x01 \x01(\x0e\x32\x17.gnetcli.TraceOperation\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"o\n\nHostParams\x12\x0c\n\x04host\x18\x01 \x01(\t\x12)\n\x0b\x63redentials\x18\x02 \x01(\x0b\x32\x14.gnetcli.Credentials\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12\n\n\x02ip\x18\x05 \x01(\t\"\x81\x01\n\tCMDResult\x12\x0b\n\x03out\x18\x01 \x01(\x0c\x12\x0f\n\x07out_str\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\x0c\x12\x11\n\terror_str\x18\x04 \x01(\t\x12$\n\x05trace\x18\x05 \x03(\x0b\x32\x15.gnetcli.CMDTraceItem\x12\x0e\n\x06status\x18\x06 \x01(\x05\"G\n\x0c\x44\x65viceResult\x12(\n\x03res\x18\x01 \x01(\x0e\x32\x1b.gnetcli.DeviceResultStatus\x12\r\n\x05\x65rror\x18\x02 \x01(\t\"l\n\x13\x46ileDownloadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\x0e\n\x06\x64\x65vice\x18\x03 \x01(\t\x12(\n\x0bhost_params\x18\x05 \x01(\x0b\x32\x13.gnetcli.HostParams\"K\n\x08\x46ileData\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12#\n\x06status\x18\x03 \x01(\x0e\x32\x13.gnetcli.FileStatus\"}\n\x11\x46ileUploadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12 \n\x05\x66iles\x18\x03 \x03(\x0b\x32\x11.gnetcli.FileData\x12(\n\x0bhost_params\x18\x06 \x01(\x0b\x32\x13.gnetcli.HostParams\"/\n\x0b\x46ilesResult\x12 \n\x05\x66iles\x18\x01 \x03(\x0b\x32\x11.gnetcli.FileData*f\n\x0eTraceOperation\x12\x14\n\x10Operation_notset\x10\x00\x12\x15\n\x11Operation_unknown\x10\x01\x12\x13\n\x0fOperation_write\x10\x02\x12\x12\n\x0eOperation_read\x10\x03*H\n\x12\x44\x65viceResultStatus\x12\x11\n\rDevice_notset\x10\x00\x12\r\n\tDevice_ok\x10\x01\x12\x10\n\x0c\x44\x65vice_error\x10\x02*}\n\nFileStatus\x12\x15\n\x11\x46ileStatus_notset\x10\x00\x12\x11\n\rFileStatus_ok\x10\x01\x12\x14\n\x10\x46ileStatus_error\x10\x02\x12\x18\n\x14\x46ileStatus_not_found\x10\x03\x12\x15\n\x11\x46ileStatus_is_dir\x10\x04\x32\x8c\x05\n\x07Gnetcli\x12\x64\n\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/api/v1/setup_host_params:\x01*\x12\x41\n\x04\x45xec\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/api/v1/exec:\x01*\x12\x32\n\x08\x45xecChat\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12R\n\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/api/v1/add_device:\x01*\x12W\n\x0b\x45xecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/api/v1/exec_netconf:\x01*\x12@\n\x0f\x45xecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12\\\n\x08\x44ownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/api/v1/downloads:\x01*\x12W\n\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13\"\x0e/api/v1/upload:\x01*B7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3')
|
30
|
+
|
31
|
+
_globals = globals()
|
32
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
33
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'server_pb2', _globals)
|
34
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
35
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
36
|
+
_globals['DESCRIPTOR']._serialized_options = b'Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetcli'
|
37
|
+
_globals['_GNETCLI'].methods_by_name['SetupHostParams']._loaded_options = None
|
38
|
+
_globals['_GNETCLI'].methods_by_name['SetupHostParams']._serialized_options = b'\202\323\344\223\002\036\"\031/api/v1/setup_host_params:\001*'
|
39
|
+
_globals['_GNETCLI'].methods_by_name['Exec']._loaded_options = None
|
40
|
+
_globals['_GNETCLI'].methods_by_name['Exec']._serialized_options = b'\202\323\344\223\002\021\"\014/api/v1/exec:\001*'
|
41
|
+
_globals['_GNETCLI'].methods_by_name['AddDevice']._loaded_options = None
|
42
|
+
_globals['_GNETCLI'].methods_by_name['AddDevice']._serialized_options = b'\202\323\344\223\002\027\"\022/api/v1/add_device:\001*'
|
43
|
+
_globals['_GNETCLI'].methods_by_name['ExecNetconf']._loaded_options = None
|
44
|
+
_globals['_GNETCLI'].methods_by_name['ExecNetconf']._serialized_options = b'\202\323\344\223\002\031\"\024/api/v1/exec_netconf:\001*'
|
45
|
+
_globals['_GNETCLI'].methods_by_name['Download']._loaded_options = None
|
46
|
+
_globals['_GNETCLI'].methods_by_name['Download']._serialized_options = b'\202\323\344\223\002\026\"\021/api/v1/downloads:\001*'
|
47
|
+
_globals['_GNETCLI'].methods_by_name['Upload']._loaded_options = None
|
48
|
+
_globals['_GNETCLI'].methods_by_name['Upload']._serialized_options = b'\202\323\344\223\002\023\"\016/api/v1/upload:\001*'
|
49
|
+
_globals['_TRACEOPERATION']._serialized_start=1311
|
50
|
+
_globals['_TRACEOPERATION']._serialized_end=1413
|
51
|
+
_globals['_DEVICERESULTSTATUS']._serialized_start=1415
|
52
|
+
_globals['_DEVICERESULTSTATUS']._serialized_end=1487
|
53
|
+
_globals['_FILESTATUS']._serialized_start=1489
|
54
|
+
_globals['_FILESTATUS']._serialized_end=1614
|
55
|
+
_globals['_QA']._serialized_start=84
|
56
|
+
_globals['_QA']._serialized_end=122
|
57
|
+
_globals['_CREDENTIALS']._serialized_start=124
|
58
|
+
_globals['_CREDENTIALS']._serialized_end=170
|
59
|
+
_globals['_CMD']._serialized_start=173
|
60
|
+
_globals['_CMD']._serialized_end=353
|
61
|
+
_globals['_DEVICE']._serialized_start=355
|
62
|
+
_globals['_DEVICE']._serialized_end=456
|
63
|
+
_globals['_CMDNETCONF']._serialized_start=458
|
64
|
+
_globals['_CMDNETCONF']._serialized_end=554
|
65
|
+
_globals['_CMDTRACEITEM']._serialized_start=556
|
66
|
+
_globals['_CMDTRACEITEM']._serialized_end=628
|
67
|
+
_globals['_HOSTPARAMS']._serialized_start=630
|
68
|
+
_globals['_HOSTPARAMS']._serialized_end=741
|
69
|
+
_globals['_CMDRESULT']._serialized_start=744
|
70
|
+
_globals['_CMDRESULT']._serialized_end=873
|
71
|
+
_globals['_DEVICERESULT']._serialized_start=875
|
72
|
+
_globals['_DEVICERESULT']._serialized_end=946
|
73
|
+
_globals['_FILEDOWNLOADREQUEST']._serialized_start=948
|
74
|
+
_globals['_FILEDOWNLOADREQUEST']._serialized_end=1056
|
75
|
+
_globals['_FILEDATA']._serialized_start=1058
|
76
|
+
_globals['_FILEDATA']._serialized_end=1133
|
77
|
+
_globals['_FILEUPLOADREQUEST']._serialized_start=1135
|
78
|
+
_globals['_FILEUPLOADREQUEST']._serialized_end=1260
|
79
|
+
_globals['_FILESRESULT']._serialized_start=1262
|
80
|
+
_globals['_FILESRESULT']._serialized_end=1309
|
81
|
+
_globals['_GNETCLI']._serialized_start=1617
|
82
|
+
_globals['_GNETCLI']._serialized_end=2269
|
83
|
+
# @@protoc_insertion_point(module_scope)
|
@@ -0,0 +1,190 @@
|
|
1
|
+
from google.api import annotations_pb2 as _annotations_pb2
|
2
|
+
from google.protobuf import empty_pb2 as _empty_pb2
|
3
|
+
from google.protobuf.internal import containers as _containers
|
4
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
6
|
+
from google.protobuf import message as _message
|
7
|
+
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
|
8
|
+
|
9
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
10
|
+
|
11
|
+
class TraceOperation(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
12
|
+
__slots__ = ()
|
13
|
+
Operation_notset: _ClassVar[TraceOperation]
|
14
|
+
Operation_unknown: _ClassVar[TraceOperation]
|
15
|
+
Operation_write: _ClassVar[TraceOperation]
|
16
|
+
Operation_read: _ClassVar[TraceOperation]
|
17
|
+
|
18
|
+
class DeviceResultStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
19
|
+
__slots__ = ()
|
20
|
+
Device_notset: _ClassVar[DeviceResultStatus]
|
21
|
+
Device_ok: _ClassVar[DeviceResultStatus]
|
22
|
+
Device_error: _ClassVar[DeviceResultStatus]
|
23
|
+
|
24
|
+
class FileStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
25
|
+
__slots__ = ()
|
26
|
+
FileStatus_notset: _ClassVar[FileStatus]
|
27
|
+
FileStatus_ok: _ClassVar[FileStatus]
|
28
|
+
FileStatus_error: _ClassVar[FileStatus]
|
29
|
+
FileStatus_not_found: _ClassVar[FileStatus]
|
30
|
+
FileStatus_is_dir: _ClassVar[FileStatus]
|
31
|
+
Operation_notset: TraceOperation
|
32
|
+
Operation_unknown: TraceOperation
|
33
|
+
Operation_write: TraceOperation
|
34
|
+
Operation_read: TraceOperation
|
35
|
+
Device_notset: DeviceResultStatus
|
36
|
+
Device_ok: DeviceResultStatus
|
37
|
+
Device_error: DeviceResultStatus
|
38
|
+
FileStatus_notset: FileStatus
|
39
|
+
FileStatus_ok: FileStatus
|
40
|
+
FileStatus_error: FileStatus
|
41
|
+
FileStatus_not_found: FileStatus
|
42
|
+
FileStatus_is_dir: FileStatus
|
43
|
+
|
44
|
+
class QA(_message.Message):
|
45
|
+
__slots__ = ("question", "answer")
|
46
|
+
QUESTION_FIELD_NUMBER: _ClassVar[int]
|
47
|
+
ANSWER_FIELD_NUMBER: _ClassVar[int]
|
48
|
+
question: str
|
49
|
+
answer: str
|
50
|
+
def __init__(self, question: _Optional[str] = ..., answer: _Optional[str] = ...) -> None: ...
|
51
|
+
|
52
|
+
class Credentials(_message.Message):
|
53
|
+
__slots__ = ("login", "password")
|
54
|
+
LOGIN_FIELD_NUMBER: _ClassVar[int]
|
55
|
+
PASSWORD_FIELD_NUMBER: _ClassVar[int]
|
56
|
+
login: str
|
57
|
+
password: str
|
58
|
+
def __init__(self, login: _Optional[str] = ..., password: _Optional[str] = ...) -> None: ...
|
59
|
+
|
60
|
+
class CMD(_message.Message):
|
61
|
+
__slots__ = ("host", "cmd", "trace", "qa", "read_timeout", "cmd_timeout", "string_result", "host_params")
|
62
|
+
HOST_FIELD_NUMBER: _ClassVar[int]
|
63
|
+
CMD_FIELD_NUMBER: _ClassVar[int]
|
64
|
+
TRACE_FIELD_NUMBER: _ClassVar[int]
|
65
|
+
QA_FIELD_NUMBER: _ClassVar[int]
|
66
|
+
READ_TIMEOUT_FIELD_NUMBER: _ClassVar[int]
|
67
|
+
CMD_TIMEOUT_FIELD_NUMBER: _ClassVar[int]
|
68
|
+
STRING_RESULT_FIELD_NUMBER: _ClassVar[int]
|
69
|
+
HOST_PARAMS_FIELD_NUMBER: _ClassVar[int]
|
70
|
+
host: str
|
71
|
+
cmd: str
|
72
|
+
trace: bool
|
73
|
+
qa: _containers.RepeatedCompositeFieldContainer[QA]
|
74
|
+
read_timeout: float
|
75
|
+
cmd_timeout: float
|
76
|
+
string_result: bool
|
77
|
+
host_params: HostParams
|
78
|
+
def __init__(self, host: _Optional[str] = ..., cmd: _Optional[str] = ..., trace: bool = ..., qa: _Optional[_Iterable[_Union[QA, _Mapping]]] = ..., read_timeout: _Optional[float] = ..., cmd_timeout: _Optional[float] = ..., string_result: bool = ..., host_params: _Optional[_Union[HostParams, _Mapping]] = ...) -> None: ...
|
79
|
+
|
80
|
+
class Device(_message.Message):
|
81
|
+
__slots__ = ("name", "prompt_expression", "error_expression", "pager_expression")
|
82
|
+
NAME_FIELD_NUMBER: _ClassVar[int]
|
83
|
+
PROMPT_EXPRESSION_FIELD_NUMBER: _ClassVar[int]
|
84
|
+
ERROR_EXPRESSION_FIELD_NUMBER: _ClassVar[int]
|
85
|
+
PAGER_EXPRESSION_FIELD_NUMBER: _ClassVar[int]
|
86
|
+
name: str
|
87
|
+
prompt_expression: str
|
88
|
+
error_expression: str
|
89
|
+
pager_expression: str
|
90
|
+
def __init__(self, name: _Optional[str] = ..., prompt_expression: _Optional[str] = ..., error_expression: _Optional[str] = ..., pager_expression: _Optional[str] = ...) -> None: ...
|
91
|
+
|
92
|
+
class CMDNetconf(_message.Message):
|
93
|
+
__slots__ = ("host", "cmd", "json", "read_timeout", "cmd_timeout")
|
94
|
+
HOST_FIELD_NUMBER: _ClassVar[int]
|
95
|
+
CMD_FIELD_NUMBER: _ClassVar[int]
|
96
|
+
JSON_FIELD_NUMBER: _ClassVar[int]
|
97
|
+
READ_TIMEOUT_FIELD_NUMBER: _ClassVar[int]
|
98
|
+
CMD_TIMEOUT_FIELD_NUMBER: _ClassVar[int]
|
99
|
+
host: str
|
100
|
+
cmd: str
|
101
|
+
json: bool
|
102
|
+
read_timeout: float
|
103
|
+
cmd_timeout: float
|
104
|
+
def __init__(self, host: _Optional[str] = ..., cmd: _Optional[str] = ..., json: bool = ..., read_timeout: _Optional[float] = ..., cmd_timeout: _Optional[float] = ...) -> None: ...
|
105
|
+
|
106
|
+
class CMDTraceItem(_message.Message):
|
107
|
+
__slots__ = ("operation", "data")
|
108
|
+
OPERATION_FIELD_NUMBER: _ClassVar[int]
|
109
|
+
DATA_FIELD_NUMBER: _ClassVar[int]
|
110
|
+
operation: TraceOperation
|
111
|
+
data: bytes
|
112
|
+
def __init__(self, operation: _Optional[_Union[TraceOperation, str]] = ..., data: _Optional[bytes] = ...) -> None: ...
|
113
|
+
|
114
|
+
class HostParams(_message.Message):
|
115
|
+
__slots__ = ("host", "credentials", "port", "device", "ip")
|
116
|
+
HOST_FIELD_NUMBER: _ClassVar[int]
|
117
|
+
CREDENTIALS_FIELD_NUMBER: _ClassVar[int]
|
118
|
+
PORT_FIELD_NUMBER: _ClassVar[int]
|
119
|
+
DEVICE_FIELD_NUMBER: _ClassVar[int]
|
120
|
+
IP_FIELD_NUMBER: _ClassVar[int]
|
121
|
+
host: str
|
122
|
+
credentials: Credentials
|
123
|
+
port: int
|
124
|
+
device: str
|
125
|
+
ip: str
|
126
|
+
def __init__(self, host: _Optional[str] = ..., credentials: _Optional[_Union[Credentials, _Mapping]] = ..., port: _Optional[int] = ..., device: _Optional[str] = ..., ip: _Optional[str] = ...) -> None: ...
|
127
|
+
|
128
|
+
class CMDResult(_message.Message):
|
129
|
+
__slots__ = ("out", "out_str", "error", "error_str", "trace", "status")
|
130
|
+
OUT_FIELD_NUMBER: _ClassVar[int]
|
131
|
+
OUT_STR_FIELD_NUMBER: _ClassVar[int]
|
132
|
+
ERROR_FIELD_NUMBER: _ClassVar[int]
|
133
|
+
ERROR_STR_FIELD_NUMBER: _ClassVar[int]
|
134
|
+
TRACE_FIELD_NUMBER: _ClassVar[int]
|
135
|
+
STATUS_FIELD_NUMBER: _ClassVar[int]
|
136
|
+
out: bytes
|
137
|
+
out_str: str
|
138
|
+
error: bytes
|
139
|
+
error_str: str
|
140
|
+
trace: _containers.RepeatedCompositeFieldContainer[CMDTraceItem]
|
141
|
+
status: int
|
142
|
+
def __init__(self, out: _Optional[bytes] = ..., out_str: _Optional[str] = ..., error: _Optional[bytes] = ..., error_str: _Optional[str] = ..., trace: _Optional[_Iterable[_Union[CMDTraceItem, _Mapping]]] = ..., status: _Optional[int] = ...) -> None: ...
|
143
|
+
|
144
|
+
class DeviceResult(_message.Message):
|
145
|
+
__slots__ = ("res", "error")
|
146
|
+
RES_FIELD_NUMBER: _ClassVar[int]
|
147
|
+
ERROR_FIELD_NUMBER: _ClassVar[int]
|
148
|
+
res: DeviceResultStatus
|
149
|
+
error: str
|
150
|
+
def __init__(self, res: _Optional[_Union[DeviceResultStatus, str]] = ..., error: _Optional[str] = ...) -> None: ...
|
151
|
+
|
152
|
+
class FileDownloadRequest(_message.Message):
|
153
|
+
__slots__ = ("host", "paths", "device", "host_params")
|
154
|
+
HOST_FIELD_NUMBER: _ClassVar[int]
|
155
|
+
PATHS_FIELD_NUMBER: _ClassVar[int]
|
156
|
+
DEVICE_FIELD_NUMBER: _ClassVar[int]
|
157
|
+
HOST_PARAMS_FIELD_NUMBER: _ClassVar[int]
|
158
|
+
host: str
|
159
|
+
paths: _containers.RepeatedScalarFieldContainer[str]
|
160
|
+
device: str
|
161
|
+
host_params: HostParams
|
162
|
+
def __init__(self, host: _Optional[str] = ..., paths: _Optional[_Iterable[str]] = ..., device: _Optional[str] = ..., host_params: _Optional[_Union[HostParams, _Mapping]] = ...) -> None: ...
|
163
|
+
|
164
|
+
class FileData(_message.Message):
|
165
|
+
__slots__ = ("path", "data", "status")
|
166
|
+
PATH_FIELD_NUMBER: _ClassVar[int]
|
167
|
+
DATA_FIELD_NUMBER: _ClassVar[int]
|
168
|
+
STATUS_FIELD_NUMBER: _ClassVar[int]
|
169
|
+
path: str
|
170
|
+
data: bytes
|
171
|
+
status: FileStatus
|
172
|
+
def __init__(self, path: _Optional[str] = ..., data: _Optional[bytes] = ..., status: _Optional[_Union[FileStatus, str]] = ...) -> None: ...
|
173
|
+
|
174
|
+
class FileUploadRequest(_message.Message):
|
175
|
+
__slots__ = ("host", "device", "files", "host_params")
|
176
|
+
HOST_FIELD_NUMBER: _ClassVar[int]
|
177
|
+
DEVICE_FIELD_NUMBER: _ClassVar[int]
|
178
|
+
FILES_FIELD_NUMBER: _ClassVar[int]
|
179
|
+
HOST_PARAMS_FIELD_NUMBER: _ClassVar[int]
|
180
|
+
host: str
|
181
|
+
device: str
|
182
|
+
files: _containers.RepeatedCompositeFieldContainer[FileData]
|
183
|
+
host_params: HostParams
|
184
|
+
def __init__(self, host: _Optional[str] = ..., device: _Optional[str] = ..., files: _Optional[_Iterable[_Union[FileData, _Mapping]]] = ..., host_params: _Optional[_Union[HostParams, _Mapping]] = ...) -> None: ...
|
185
|
+
|
186
|
+
class FilesResult(_message.Message):
|
187
|
+
__slots__ = ("files",)
|
188
|
+
FILES_FIELD_NUMBER: _ClassVar[int]
|
189
|
+
files: _containers.RepeatedCompositeFieldContainer[FileData]
|
190
|
+
def __init__(self, files: _Optional[_Iterable[_Union[FileData, _Mapping]]] = ...) -> None: ...
|