scrapli 2.0.0a2__py3-none-musllinux_1_1_x86_64.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.
- scrapli/__init__.py +30 -0
- scrapli/auth.py +216 -0
- scrapli/cli.py +1414 -0
- scrapli/cli_decorators.py +148 -0
- scrapli/cli_parse.py +161 -0
- scrapli/cli_result.py +197 -0
- scrapli/definitions/__init__.py +1 -0
- scrapli/definitions/arista_eos.yaml +64 -0
- scrapli/definitions/cisco_iosxe.yaml +63 -0
- scrapli/definitions/cisco_iosxr.yaml +47 -0
- scrapli/definitions/cisco_nxos.yaml +64 -0
- scrapli/definitions/juniper_junos.yaml +85 -0
- scrapli/definitions/nokia_srlinux.yaml +35 -0
- scrapli/exceptions.py +49 -0
- scrapli/ffi.py +76 -0
- scrapli/ffi_mapping.py +202 -0
- scrapli/ffi_mapping_cli.py +646 -0
- scrapli/ffi_mapping_netconf.py +1612 -0
- scrapli/ffi_mapping_options.py +1031 -0
- scrapli/ffi_types.py +154 -0
- scrapli/helper.py +95 -0
- scrapli/lib/__init__.py +1 -0
- scrapli/lib/libscrapli.0.0.1-alpha.10.dylib +0 -0
- scrapli/lib/libscrapli.so.0.0.1-alpha.10 +0 -0
- scrapli/netconf.py +2804 -0
- scrapli/netconf_decorators.py +148 -0
- scrapli/netconf_result.py +72 -0
- scrapli/py.typed +0 -0
- scrapli/session.py +122 -0
- scrapli/transport.py +401 -0
- scrapli-2.0.0a2.dist-info/METADATA +49 -0
- scrapli-2.0.0a2.dist-info/RECORD +35 -0
- scrapli-2.0.0a2.dist-info/WHEEL +5 -0
- scrapli-2.0.0a2.dist-info/licenses/LICENSE +21 -0
- scrapli-2.0.0a2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1031 @@
|
|
1
|
+
"""scrapli.ffi_mapping_options"""
|
2
|
+
|
3
|
+
from collections.abc import Callable
|
4
|
+
from ctypes import (
|
5
|
+
CDLL,
|
6
|
+
c_char_p,
|
7
|
+
c_int,
|
8
|
+
c_uint8,
|
9
|
+
c_uint64,
|
10
|
+
)
|
11
|
+
|
12
|
+
from scrapli.ffi_types import (
|
13
|
+
DriverPointer,
|
14
|
+
)
|
15
|
+
|
16
|
+
|
17
|
+
class LibScrapliNetconfOptionsMapping:
|
18
|
+
"""
|
19
|
+
Mapping to libscrapli netconf option setter exported functions.
|
20
|
+
|
21
|
+
Should not be used/called directly.
|
22
|
+
|
23
|
+
Args:
|
24
|
+
N/A
|
25
|
+
|
26
|
+
Returns:
|
27
|
+
None
|
28
|
+
|
29
|
+
Raises:
|
30
|
+
N/A
|
31
|
+
|
32
|
+
"""
|
33
|
+
|
34
|
+
def __init__(self, lib: CDLL) -> None:
|
35
|
+
self._set_error_tag: Callable[[DriverPointer, c_char_p], int] = (
|
36
|
+
lib.ls_option_netconf_error_tag
|
37
|
+
)
|
38
|
+
lib.ls_option_netconf_error_tag.argtypes = [
|
39
|
+
DriverPointer,
|
40
|
+
c_char_p,
|
41
|
+
]
|
42
|
+
lib.ls_option_netconf_error_tag.restype = c_uint8
|
43
|
+
|
44
|
+
self._set_preferred_version: Callable[[DriverPointer, c_char_p], int] = (
|
45
|
+
lib.ls_option_netconf_preferred_version
|
46
|
+
)
|
47
|
+
lib.ls_option_netconf_preferred_version.argtypes = [
|
48
|
+
DriverPointer,
|
49
|
+
c_char_p,
|
50
|
+
]
|
51
|
+
lib.ls_option_netconf_preferred_version.restype = c_uint8
|
52
|
+
|
53
|
+
self._set_message_poll_interva_ns: Callable[[DriverPointer, c_int], int] = (
|
54
|
+
lib.ls_option_netconf_message_poll_interval
|
55
|
+
)
|
56
|
+
lib.ls_option_netconf_message_poll_interval.argtypes = [
|
57
|
+
DriverPointer,
|
58
|
+
c_int,
|
59
|
+
]
|
60
|
+
lib.ls_option_netconf_message_poll_interval.restype = c_uint8
|
61
|
+
|
62
|
+
def set_error_tag(self, ptr: DriverPointer, error_tag: c_char_p) -> int:
|
63
|
+
"""
|
64
|
+
Set the error tag substring.
|
65
|
+
|
66
|
+
Should not be used/called directly.
|
67
|
+
|
68
|
+
Args:
|
69
|
+
ptr: ptr to the netconf object
|
70
|
+
error_tag: error tag substring
|
71
|
+
|
72
|
+
Returns:
|
73
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
74
|
+
ctypes.
|
75
|
+
|
76
|
+
Raises:
|
77
|
+
N/A
|
78
|
+
|
79
|
+
"""
|
80
|
+
return self._set_error_tag(ptr, error_tag)
|
81
|
+
|
82
|
+
def set_preferred_version(self, ptr: DriverPointer, version: c_char_p) -> int:
|
83
|
+
"""
|
84
|
+
Set the preferred netconf version.
|
85
|
+
|
86
|
+
Should not be used/called directly.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
ptr: ptr to the netconf object
|
90
|
+
version: version string
|
91
|
+
|
92
|
+
Returns:
|
93
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
94
|
+
ctypes.
|
95
|
+
|
96
|
+
Raises:
|
97
|
+
N/A
|
98
|
+
|
99
|
+
"""
|
100
|
+
return self._set_preferred_version(ptr, version)
|
101
|
+
|
102
|
+
def set_message_poll_interva_ns(self, ptr: DriverPointer, interval: c_int) -> int:
|
103
|
+
"""
|
104
|
+
Set the netconf message poll interval.
|
105
|
+
|
106
|
+
Should not be used/called directly.
|
107
|
+
|
108
|
+
Args:
|
109
|
+
ptr: ptr to the netconf object
|
110
|
+
interval: interval in ns
|
111
|
+
|
112
|
+
Returns:
|
113
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
114
|
+
ctypes.
|
115
|
+
|
116
|
+
Raises:
|
117
|
+
N/A
|
118
|
+
|
119
|
+
"""
|
120
|
+
return self._set_message_poll_interva_ns(ptr, interval)
|
121
|
+
|
122
|
+
|
123
|
+
class LibScrapliSessionOptionsMapping:
|
124
|
+
"""
|
125
|
+
Mapping to libscrapli session option setter exported functions.
|
126
|
+
|
127
|
+
Should not be used/called directly.
|
128
|
+
|
129
|
+
Args:
|
130
|
+
N/A
|
131
|
+
|
132
|
+
Returns:
|
133
|
+
None
|
134
|
+
|
135
|
+
Raises:
|
136
|
+
N/A
|
137
|
+
|
138
|
+
"""
|
139
|
+
|
140
|
+
def __init__(self, lib: CDLL) -> None:
|
141
|
+
self._set_read_size: Callable[
|
142
|
+
[
|
143
|
+
DriverPointer,
|
144
|
+
c_uint64,
|
145
|
+
],
|
146
|
+
int,
|
147
|
+
] = lib.ls_option_session_read_size
|
148
|
+
lib.ls_option_session_read_size.argtypes = [
|
149
|
+
DriverPointer,
|
150
|
+
c_uint64,
|
151
|
+
]
|
152
|
+
lib.ls_option_session_read_size.restype = c_uint8
|
153
|
+
|
154
|
+
self._set_return_char: Callable[
|
155
|
+
[
|
156
|
+
DriverPointer,
|
157
|
+
c_char_p,
|
158
|
+
],
|
159
|
+
int,
|
160
|
+
] = lib.ls_option_session_return_char
|
161
|
+
lib.ls_option_session_return_char.argtypes = [
|
162
|
+
DriverPointer,
|
163
|
+
c_char_p,
|
164
|
+
]
|
165
|
+
lib.ls_option_session_return_char.restype = c_uint8
|
166
|
+
|
167
|
+
self._set_operation_timeout_ns: Callable[
|
168
|
+
[
|
169
|
+
DriverPointer,
|
170
|
+
c_uint64,
|
171
|
+
],
|
172
|
+
int,
|
173
|
+
] = lib.ls_option_session_operation_timeout_ns
|
174
|
+
lib.ls_option_session_operation_timeout_ns.argtypes = [
|
175
|
+
DriverPointer,
|
176
|
+
c_uint64,
|
177
|
+
]
|
178
|
+
lib.ls_option_session_operation_timeout_ns.restype = c_uint8
|
179
|
+
|
180
|
+
self._set_operation_max_search_depth: Callable[
|
181
|
+
[
|
182
|
+
DriverPointer,
|
183
|
+
c_uint64,
|
184
|
+
],
|
185
|
+
int,
|
186
|
+
] = lib.ls_option_session_operation_max_search_depth
|
187
|
+
lib.ls_option_session_operation_max_search_depth.argtypes = [
|
188
|
+
DriverPointer,
|
189
|
+
c_uint64,
|
190
|
+
]
|
191
|
+
lib.ls_option_session_operation_max_search_depth.restype = c_uint8
|
192
|
+
|
193
|
+
self._set_recorder_path: Callable[
|
194
|
+
[
|
195
|
+
DriverPointer,
|
196
|
+
c_char_p,
|
197
|
+
],
|
198
|
+
int,
|
199
|
+
] = lib.ls_option_session_record_destination
|
200
|
+
lib.ls_option_session_record_destination.argtypes = [
|
201
|
+
DriverPointer,
|
202
|
+
c_char_p,
|
203
|
+
]
|
204
|
+
lib.ls_option_session_record_destination.restype = c_uint8
|
205
|
+
|
206
|
+
def set_read_size(self, ptr: DriverPointer, read_size: c_uint64) -> int:
|
207
|
+
"""
|
208
|
+
Set the session read size.
|
209
|
+
|
210
|
+
Should not be used/called directly.
|
211
|
+
|
212
|
+
Args:
|
213
|
+
ptr: ptr to the cli/netconf object
|
214
|
+
read_size: read size
|
215
|
+
|
216
|
+
Returns:
|
217
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
218
|
+
ctypes.
|
219
|
+
|
220
|
+
Raises:
|
221
|
+
N/A
|
222
|
+
|
223
|
+
"""
|
224
|
+
return self._set_read_size(ptr, read_size)
|
225
|
+
|
226
|
+
def set_return_char(self, ptr: DriverPointer, return_char: c_char_p) -> int:
|
227
|
+
r"""
|
228
|
+
Set the session return char
|
229
|
+
|
230
|
+
Should not be used/called directly.
|
231
|
+
|
232
|
+
Args:
|
233
|
+
ptr: ptr to the cli/netconf object
|
234
|
+
return_char: return char to use in the session (usually \n, could be \r\n)
|
235
|
+
|
236
|
+
Returns:
|
237
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
238
|
+
ctypes.
|
239
|
+
|
240
|
+
Raises:
|
241
|
+
N/A
|
242
|
+
|
243
|
+
"""
|
244
|
+
return self._set_return_char(ptr, return_char)
|
245
|
+
|
246
|
+
def set_operation_timeout_ns(
|
247
|
+
self, ptr: DriverPointer, set_operation_timeout_ns: c_uint64
|
248
|
+
) -> int:
|
249
|
+
"""
|
250
|
+
Set the session operation timeout in ns.
|
251
|
+
|
252
|
+
Should not be used/called directly.
|
253
|
+
|
254
|
+
Args:
|
255
|
+
ptr: ptr to the cli/netconf object
|
256
|
+
set_operation_timeout_ns: operation timeout in ns
|
257
|
+
|
258
|
+
Returns:
|
259
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
260
|
+
ctypes.
|
261
|
+
|
262
|
+
Raises:
|
263
|
+
N/A
|
264
|
+
|
265
|
+
"""
|
266
|
+
return self._set_operation_timeout_ns(ptr, set_operation_timeout_ns)
|
267
|
+
|
268
|
+
def set_operation_max_search_depth(
|
269
|
+
self, ptr: DriverPointer, set_operation_max_search_depth: c_uint64
|
270
|
+
) -> int:
|
271
|
+
"""
|
272
|
+
Set the session maximum prompt search depth
|
273
|
+
|
274
|
+
Should not be used/called directly.
|
275
|
+
|
276
|
+
Args:
|
277
|
+
ptr: ptr to the cli/netconf object
|
278
|
+
set_operation_max_search_depth: maximum prompt search depth (in count of chars)
|
279
|
+
|
280
|
+
Returns:
|
281
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
282
|
+
ctypes.
|
283
|
+
|
284
|
+
Raises:
|
285
|
+
N/A
|
286
|
+
|
287
|
+
"""
|
288
|
+
return self._set_operation_max_search_depth(ptr, set_operation_max_search_depth)
|
289
|
+
|
290
|
+
def set_recorder_path(self, ptr: DriverPointer, set_recorder_path: c_char_p) -> int:
|
291
|
+
"""
|
292
|
+
Set the session recorder output path
|
293
|
+
|
294
|
+
Should not be used/called directly.
|
295
|
+
|
296
|
+
Args:
|
297
|
+
ptr: ptr to the cli/netconf object
|
298
|
+
set_recorder_path: file path to write session recorder output to
|
299
|
+
|
300
|
+
Returns:
|
301
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
302
|
+
ctypes.
|
303
|
+
|
304
|
+
Raises:
|
305
|
+
N/A
|
306
|
+
|
307
|
+
"""
|
308
|
+
return self._set_recorder_path(ptr, set_recorder_path)
|
309
|
+
|
310
|
+
|
311
|
+
class LibScrapliAuthOptionsMapping:
|
312
|
+
"""
|
313
|
+
Mapping to libscrapli auth option setter exported functions.
|
314
|
+
|
315
|
+
Should not be used/called directly.
|
316
|
+
|
317
|
+
Args:
|
318
|
+
N/A
|
319
|
+
|
320
|
+
Returns:
|
321
|
+
None
|
322
|
+
|
323
|
+
Raises:
|
324
|
+
N/A
|
325
|
+
|
326
|
+
"""
|
327
|
+
|
328
|
+
def __init__(self, lib: CDLL) -> None:
|
329
|
+
self._set_username: Callable[[DriverPointer, c_char_p], int] = lib.ls_option_auth_username
|
330
|
+
lib.ls_option_auth_username.argtypes = [
|
331
|
+
DriverPointer,
|
332
|
+
c_char_p,
|
333
|
+
]
|
334
|
+
lib.ls_option_auth_username.restype = c_uint8
|
335
|
+
|
336
|
+
self._set_password: Callable[[DriverPointer, c_char_p], int] = lib.ls_option_auth_password
|
337
|
+
lib.ls_option_auth_password.argtypes = [
|
338
|
+
DriverPointer,
|
339
|
+
c_char_p,
|
340
|
+
]
|
341
|
+
lib.ls_option_auth_password.restype = c_uint8
|
342
|
+
|
343
|
+
self._set_private_key_path: Callable[[DriverPointer, c_char_p], int] = (
|
344
|
+
lib.ls_option_auth_private_key_path
|
345
|
+
)
|
346
|
+
lib.ls_option_auth_private_key_path.argtypes = [
|
347
|
+
DriverPointer,
|
348
|
+
c_char_p,
|
349
|
+
]
|
350
|
+
lib.ls_option_auth_private_key_path.restype = c_uint8
|
351
|
+
|
352
|
+
self._set_private_key_passphrase: Callable[[DriverPointer, c_char_p], int] = (
|
353
|
+
lib.ls_option_auth_private_key_passphrase
|
354
|
+
)
|
355
|
+
lib.ls_option_auth_private_key_passphrase.argtypes = [
|
356
|
+
DriverPointer,
|
357
|
+
c_char_p,
|
358
|
+
]
|
359
|
+
lib.ls_option_auth_private_key_passphrase.restype = c_uint8
|
360
|
+
|
361
|
+
self._set_lookup_key_value: Callable[[DriverPointer, c_char_p, c_char_p], int] = (
|
362
|
+
lib.ls_option_auth_set_lookup_key_value
|
363
|
+
)
|
364
|
+
lib.ls_option_auth_set_lookup_key_value.argtypes = [
|
365
|
+
DriverPointer,
|
366
|
+
c_char_p,
|
367
|
+
c_char_p,
|
368
|
+
]
|
369
|
+
lib.ls_option_auth_set_lookup_key_value.restype = c_uint8
|
370
|
+
|
371
|
+
self._set_in_session_auth_bypass: Callable[[DriverPointer], int] = (
|
372
|
+
lib.ls_option_auth_in_session_auth_bypass
|
373
|
+
)
|
374
|
+
lib.ls_option_auth_in_session_auth_bypass.argtypes = [
|
375
|
+
DriverPointer,
|
376
|
+
]
|
377
|
+
lib.ls_option_auth_in_session_auth_bypass.restype = c_uint8
|
378
|
+
|
379
|
+
self._set_username_pattern: Callable[[DriverPointer, c_char_p], int] = (
|
380
|
+
lib.ls_option_auth_username_pattern
|
381
|
+
)
|
382
|
+
lib.ls_option_auth_username_pattern.argtypes = [
|
383
|
+
DriverPointer,
|
384
|
+
c_char_p,
|
385
|
+
]
|
386
|
+
lib.ls_option_auth_username_pattern.restype = c_uint8
|
387
|
+
|
388
|
+
self._set_password_pattern: Callable[[DriverPointer, c_char_p], int] = (
|
389
|
+
lib.ls_option_auth_password_pattern
|
390
|
+
)
|
391
|
+
lib.ls_option_auth_password_pattern.argtypes = [
|
392
|
+
DriverPointer,
|
393
|
+
c_char_p,
|
394
|
+
]
|
395
|
+
lib.ls_option_auth_password_pattern.restype = c_uint8
|
396
|
+
|
397
|
+
self._set_private_key_passphrase_pattern: Callable[[DriverPointer, c_char_p], int] = (
|
398
|
+
lib.ls_option_auth_private_key_passphrase_pattern
|
399
|
+
)
|
400
|
+
lib.ls_option_auth_private_key_passphrase_pattern.argtypes = [
|
401
|
+
DriverPointer,
|
402
|
+
c_char_p,
|
403
|
+
]
|
404
|
+
lib.ls_option_auth_private_key_passphrase_pattern.restype = c_uint8
|
405
|
+
|
406
|
+
def set_username(self, ptr: DriverPointer, username: c_char_p) -> int:
|
407
|
+
"""
|
408
|
+
Set the username.
|
409
|
+
|
410
|
+
Should not be used/called directly.
|
411
|
+
|
412
|
+
Args:
|
413
|
+
ptr: ptr to the cli/netconf object
|
414
|
+
username: username string
|
415
|
+
|
416
|
+
Returns:
|
417
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
418
|
+
ctypes.
|
419
|
+
|
420
|
+
Raises:
|
421
|
+
N/A
|
422
|
+
|
423
|
+
"""
|
424
|
+
return self._set_username(ptr, username)
|
425
|
+
|
426
|
+
def set_password(self, ptr: DriverPointer, password: c_char_p) -> int:
|
427
|
+
"""
|
428
|
+
Set the password.
|
429
|
+
|
430
|
+
Should not be used/called directly.
|
431
|
+
|
432
|
+
Args:
|
433
|
+
ptr: ptr to the cli/netconf object
|
434
|
+
password: password string
|
435
|
+
|
436
|
+
Returns:
|
437
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
438
|
+
ctypes.
|
439
|
+
|
440
|
+
Raises:
|
441
|
+
N/A
|
442
|
+
|
443
|
+
"""
|
444
|
+
return self._set_password(ptr, password)
|
445
|
+
|
446
|
+
def set_private_key_path(self, ptr: DriverPointer, private_key_path: c_char_p) -> int:
|
447
|
+
"""
|
448
|
+
Set the private key path.
|
449
|
+
|
450
|
+
Should not be used/called directly.
|
451
|
+
|
452
|
+
Args:
|
453
|
+
ptr: ptr to the cli/netconf object
|
454
|
+
private_key_path: private key path string
|
455
|
+
|
456
|
+
Returns:
|
457
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
458
|
+
ctypes.
|
459
|
+
|
460
|
+
Raises:
|
461
|
+
N/A
|
462
|
+
|
463
|
+
"""
|
464
|
+
return self._set_private_key_path(ptr, private_key_path)
|
465
|
+
|
466
|
+
def set_private_key_passphrase(
|
467
|
+
self, ptr: DriverPointer, private_key_passphrase: c_char_p
|
468
|
+
) -> int:
|
469
|
+
"""
|
470
|
+
Set the private key passphrase.
|
471
|
+
|
472
|
+
Should not be used/called directly.
|
473
|
+
|
474
|
+
Args:
|
475
|
+
ptr: ptr to the cli/netconf object
|
476
|
+
private_key_passphrase: private key passphrase string
|
477
|
+
|
478
|
+
Returns:
|
479
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
480
|
+
ctypes.
|
481
|
+
|
482
|
+
Raises:
|
483
|
+
N/A
|
484
|
+
|
485
|
+
"""
|
486
|
+
return self._set_private_key_passphrase(ptr, private_key_passphrase)
|
487
|
+
|
488
|
+
def set_lookup_key_value(
|
489
|
+
self,
|
490
|
+
ptr: DriverPointer,
|
491
|
+
key: c_char_p,
|
492
|
+
value: c_char_p,
|
493
|
+
) -> int:
|
494
|
+
"""
|
495
|
+
Set a lookup key/value pair.
|
496
|
+
|
497
|
+
Should not be used/called directly.
|
498
|
+
|
499
|
+
Args:
|
500
|
+
ptr: ptr to the cli/netconf object
|
501
|
+
key: the name of the key
|
502
|
+
value: the value of the key
|
503
|
+
|
504
|
+
Returns:
|
505
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
506
|
+
ctypes.
|
507
|
+
|
508
|
+
Raises:
|
509
|
+
N/A
|
510
|
+
|
511
|
+
"""
|
512
|
+
return self._set_lookup_key_value(ptr, key, value)
|
513
|
+
|
514
|
+
def set_in_session_auth_bypass(
|
515
|
+
self,
|
516
|
+
ptr: DriverPointer,
|
517
|
+
) -> int:
|
518
|
+
"""
|
519
|
+
Enable the in session auth bypass.
|
520
|
+
|
521
|
+
Should not be used/called directly.
|
522
|
+
|
523
|
+
Args:
|
524
|
+
ptr: ptr to the cli/netconf object
|
525
|
+
|
526
|
+
Returns:
|
527
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
528
|
+
ctypes.
|
529
|
+
|
530
|
+
Raises:
|
531
|
+
N/A
|
532
|
+
|
533
|
+
"""
|
534
|
+
return self._set_in_session_auth_bypass(
|
535
|
+
ptr,
|
536
|
+
)
|
537
|
+
|
538
|
+
def set_username_pattern(self, ptr: DriverPointer, pattern: c_char_p) -> int:
|
539
|
+
"""
|
540
|
+
Set the username pattern.
|
541
|
+
|
542
|
+
Should not be used/called directly.
|
543
|
+
|
544
|
+
Args:
|
545
|
+
ptr: ptr to the cli/netconf object
|
546
|
+
pattern: username pattern string
|
547
|
+
|
548
|
+
Returns:
|
549
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
550
|
+
ctypes.
|
551
|
+
|
552
|
+
Raises:
|
553
|
+
N/A
|
554
|
+
|
555
|
+
"""
|
556
|
+
return self._set_username_pattern(ptr, pattern)
|
557
|
+
|
558
|
+
def set_password_pattern(self, ptr: DriverPointer, pattern: c_char_p) -> int:
|
559
|
+
"""
|
560
|
+
Set the password pattern.
|
561
|
+
|
562
|
+
Should not be used/called directly.
|
563
|
+
|
564
|
+
Args:
|
565
|
+
ptr: ptr to the cli/netconf object
|
566
|
+
pattern: password pattern string
|
567
|
+
|
568
|
+
Returns:
|
569
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
570
|
+
ctypes.
|
571
|
+
|
572
|
+
Raises:
|
573
|
+
N/A
|
574
|
+
|
575
|
+
"""
|
576
|
+
return self._set_password_pattern(ptr, pattern)
|
577
|
+
|
578
|
+
def set_private_key_passphrase_pattern(self, ptr: DriverPointer, pattern: c_char_p) -> int:
|
579
|
+
"""
|
580
|
+
Set the private key passphrase pattern.
|
581
|
+
|
582
|
+
Should not be used/called directly.
|
583
|
+
|
584
|
+
Args:
|
585
|
+
ptr: ptr to the cli/netconf object
|
586
|
+
pattern: private key passphrase pattern string
|
587
|
+
|
588
|
+
Returns:
|
589
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
590
|
+
ctypes.
|
591
|
+
|
592
|
+
Raises:
|
593
|
+
N/A
|
594
|
+
|
595
|
+
"""
|
596
|
+
return self._set_private_key_passphrase_pattern(ptr, pattern)
|
597
|
+
|
598
|
+
|
599
|
+
class LibScrapliTransportBinOptionsMapping:
|
600
|
+
"""
|
601
|
+
Mapping to libscrapli bin (default) transport option setter exported functions.
|
602
|
+
|
603
|
+
Should not be used/called directly.
|
604
|
+
|
605
|
+
Args:
|
606
|
+
N/A
|
607
|
+
|
608
|
+
Returns:
|
609
|
+
None
|
610
|
+
|
611
|
+
Raises:
|
612
|
+
N/A
|
613
|
+
|
614
|
+
"""
|
615
|
+
|
616
|
+
def __init__(self, lib: CDLL) -> None:
|
617
|
+
self._set_bin: Callable[[DriverPointer, c_char_p], int] = lib.ls_option_transport_bin_bin
|
618
|
+
lib.ls_option_transport_bin_bin.argtypes = [
|
619
|
+
DriverPointer,
|
620
|
+
c_char_p,
|
621
|
+
]
|
622
|
+
lib.ls_option_transport_bin_bin.restype = c_uint8
|
623
|
+
|
624
|
+
self._set_extra_open_args: Callable[[DriverPointer, c_char_p], int] = (
|
625
|
+
lib.ls_option_transport_bin_extra_open_args
|
626
|
+
)
|
627
|
+
lib.ls_option_transport_bin_extra_open_args.argtypes = [
|
628
|
+
DriverPointer,
|
629
|
+
c_char_p,
|
630
|
+
]
|
631
|
+
lib.ls_option_transport_bin_extra_open_args.restype = c_uint8
|
632
|
+
|
633
|
+
self._set_override_open_args: Callable[[DriverPointer, c_char_p], int] = (
|
634
|
+
lib.ls_option_transport_bin_override_open_args
|
635
|
+
)
|
636
|
+
lib.ls_option_transport_bin_override_open_args.argtypes = [
|
637
|
+
DriverPointer,
|
638
|
+
c_char_p,
|
639
|
+
]
|
640
|
+
lib.ls_option_transport_bin_override_open_args.restype = c_uint8
|
641
|
+
|
642
|
+
self._set_ssh_config_path: Callable[[DriverPointer, c_char_p], int] = (
|
643
|
+
lib.ls_option_transport_bin_ssh_config_path
|
644
|
+
)
|
645
|
+
lib.ls_option_transport_bin_ssh_config_path.argtypes = [
|
646
|
+
DriverPointer,
|
647
|
+
c_char_p,
|
648
|
+
]
|
649
|
+
lib.ls_option_transport_bin_ssh_config_path.restype = c_uint8
|
650
|
+
|
651
|
+
self._set_known_hosts_path: Callable[[DriverPointer, c_char_p], int] = (
|
652
|
+
lib.ls_option_transport_bin_known_hosts_path
|
653
|
+
)
|
654
|
+
lib.ls_option_transport_bin_known_hosts_path.argtypes = [
|
655
|
+
DriverPointer,
|
656
|
+
c_char_p,
|
657
|
+
]
|
658
|
+
lib.ls_option_transport_bin_known_hosts_path.restype = c_uint8
|
659
|
+
|
660
|
+
self._set_enable_strict_key: Callable[[DriverPointer], int] = (
|
661
|
+
lib.ls_option_transport_bin_enable_strict_key
|
662
|
+
)
|
663
|
+
lib.ls_option_transport_bin_enable_strict_key.argtypes = [
|
664
|
+
DriverPointer,
|
665
|
+
]
|
666
|
+
lib.ls_option_transport_bin_enable_strict_key.restype = c_uint8
|
667
|
+
|
668
|
+
self._set_term_height: Callable[[DriverPointer, c_int], int] = (
|
669
|
+
lib.ls_option_transport_bin_term_height
|
670
|
+
)
|
671
|
+
lib.ls_option_transport_bin_term_height.argtypes = [
|
672
|
+
DriverPointer,
|
673
|
+
c_int,
|
674
|
+
]
|
675
|
+
lib.ls_option_transport_bin_term_height.restype = c_uint8
|
676
|
+
|
677
|
+
self._set_term_width: Callable[[DriverPointer, c_int], int] = (
|
678
|
+
lib.ls_option_transport_bin_term_width
|
679
|
+
)
|
680
|
+
lib.ls_option_transport_bin_term_width.argtypes = [
|
681
|
+
DriverPointer,
|
682
|
+
c_int,
|
683
|
+
]
|
684
|
+
lib.ls_option_transport_bin_term_width.restype = c_uint8
|
685
|
+
|
686
|
+
def set_bin(self, ptr: DriverPointer, bin_: c_char_p) -> int:
|
687
|
+
"""
|
688
|
+
Set bin transport binary file to exec.
|
689
|
+
|
690
|
+
Should not be used/called directly.
|
691
|
+
|
692
|
+
Args:
|
693
|
+
ptr: ptr to the cli/netconf object
|
694
|
+
bin_: path to the bin to use
|
695
|
+
|
696
|
+
Returns:
|
697
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
698
|
+
ctypes.
|
699
|
+
|
700
|
+
Raises:
|
701
|
+
N/A
|
702
|
+
|
703
|
+
"""
|
704
|
+
return self._set_bin(ptr, bin_)
|
705
|
+
|
706
|
+
def set_extra_open_args(
|
707
|
+
self,
|
708
|
+
ptr: DriverPointer,
|
709
|
+
extra_open_args: c_char_p,
|
710
|
+
) -> int:
|
711
|
+
"""
|
712
|
+
Set bin transport extra open args.
|
713
|
+
|
714
|
+
Should not be used/called directly.
|
715
|
+
|
716
|
+
Args:
|
717
|
+
ptr: ptr to the cli/netconf object
|
718
|
+
extra_open_args: extra open args
|
719
|
+
|
720
|
+
Returns:
|
721
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
722
|
+
ctypes.
|
723
|
+
|
724
|
+
Raises:
|
725
|
+
N/A
|
726
|
+
|
727
|
+
"""
|
728
|
+
return self._set_extra_open_args(
|
729
|
+
ptr,
|
730
|
+
extra_open_args,
|
731
|
+
)
|
732
|
+
|
733
|
+
def set_override_open_args(
|
734
|
+
self,
|
735
|
+
ptr: DriverPointer,
|
736
|
+
override_open_args: c_char_p,
|
737
|
+
) -> int:
|
738
|
+
"""
|
739
|
+
Set bin transport extra open args.
|
740
|
+
|
741
|
+
Should not be used/called directly.
|
742
|
+
|
743
|
+
Args:
|
744
|
+
ptr: ptr to the cli/netconf object
|
745
|
+
override_open_args: override open args
|
746
|
+
|
747
|
+
Returns:
|
748
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
749
|
+
ctypes.
|
750
|
+
|
751
|
+
Raises:
|
752
|
+
N/A
|
753
|
+
|
754
|
+
"""
|
755
|
+
return self._set_override_open_args(
|
756
|
+
ptr,
|
757
|
+
override_open_args,
|
758
|
+
)
|
759
|
+
|
760
|
+
def set_ssh_config_path(self, ptr: DriverPointer, path: c_char_p) -> int:
|
761
|
+
"""
|
762
|
+
Set bin transport ssh config file path.
|
763
|
+
|
764
|
+
Should not be used/called directly.
|
765
|
+
|
766
|
+
Args:
|
767
|
+
ptr: ptr to the cli/netconf object
|
768
|
+
path: the path to the ssh config file
|
769
|
+
|
770
|
+
Returns:
|
771
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
772
|
+
ctypes.
|
773
|
+
|
774
|
+
Raises:
|
775
|
+
N/A
|
776
|
+
|
777
|
+
"""
|
778
|
+
return self._set_ssh_config_path(ptr, path)
|
779
|
+
|
780
|
+
def set_known_hosts_path(self, ptr: DriverPointer, path: c_char_p) -> int:
|
781
|
+
"""
|
782
|
+
Set bin transport known hosts file path.
|
783
|
+
|
784
|
+
Should not be used/called directly.
|
785
|
+
|
786
|
+
Args:
|
787
|
+
ptr: ptr to the cli/netconf object
|
788
|
+
path: the path to the known hosts file
|
789
|
+
|
790
|
+
Returns:
|
791
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
792
|
+
ctypes.
|
793
|
+
|
794
|
+
Raises:
|
795
|
+
N/A
|
796
|
+
|
797
|
+
"""
|
798
|
+
return self._set_known_hosts_path(ptr, path)
|
799
|
+
|
800
|
+
def set_enable_strict_key(
|
801
|
+
self,
|
802
|
+
ptr: DriverPointer,
|
803
|
+
) -> int:
|
804
|
+
"""
|
805
|
+
Set bin transport strict key checking
|
806
|
+
|
807
|
+
Should not be used/called directly.
|
808
|
+
|
809
|
+
Args:
|
810
|
+
ptr: ptr to the cli/netconf object
|
811
|
+
|
812
|
+
Returns:
|
813
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
814
|
+
ctypes.
|
815
|
+
|
816
|
+
Raises:
|
817
|
+
N/A
|
818
|
+
|
819
|
+
"""
|
820
|
+
return self._set_enable_strict_key(
|
821
|
+
ptr,
|
822
|
+
)
|
823
|
+
|
824
|
+
def set_term_height(self, ptr: DriverPointer, height: c_int) -> int:
|
825
|
+
"""
|
826
|
+
Set bin transport terminal height
|
827
|
+
|
828
|
+
Should not be used/called directly.
|
829
|
+
|
830
|
+
Args:
|
831
|
+
ptr: ptr to the cli/netconf object
|
832
|
+
height: size of terminal height
|
833
|
+
|
834
|
+
Returns:
|
835
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
836
|
+
ctypes.
|
837
|
+
|
838
|
+
Raises:
|
839
|
+
N/A
|
840
|
+
|
841
|
+
"""
|
842
|
+
return self._set_term_height(ptr, height)
|
843
|
+
|
844
|
+
def set_term_width(self, ptr: DriverPointer, width: c_int) -> int:
|
845
|
+
"""
|
846
|
+
Set bin transport terminal width
|
847
|
+
|
848
|
+
Should not be used/called directly.
|
849
|
+
|
850
|
+
Args:
|
851
|
+
ptr: ptr to the cli/netconf object
|
852
|
+
width: size of terminal width
|
853
|
+
|
854
|
+
Returns:
|
855
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
856
|
+
ctypes.
|
857
|
+
|
858
|
+
Raises:
|
859
|
+
N/A
|
860
|
+
|
861
|
+
"""
|
862
|
+
return self._set_term_width(ptr, width)
|
863
|
+
|
864
|
+
|
865
|
+
class LibScrapliTransportSsh2OptionsMapping:
|
866
|
+
"""
|
867
|
+
Mapping to libscrapli ssh2 transport option setter exported functions.
|
868
|
+
|
869
|
+
Should not be used/called directly.
|
870
|
+
|
871
|
+
Args:
|
872
|
+
N/A
|
873
|
+
|
874
|
+
Returns:
|
875
|
+
None
|
876
|
+
|
877
|
+
Raises:
|
878
|
+
N/A
|
879
|
+
|
880
|
+
"""
|
881
|
+
|
882
|
+
def __init__(self, lib: CDLL) -> None:
|
883
|
+
self._set_known_hosts_path: Callable[[DriverPointer, c_char_p], int] = (
|
884
|
+
lib.ls_option_transport_ssh2_known_hosts_path
|
885
|
+
)
|
886
|
+
lib.ls_option_transport_ssh2_known_hosts_path.argtypes = [
|
887
|
+
DriverPointer,
|
888
|
+
c_char_p,
|
889
|
+
]
|
890
|
+
lib.ls_option_transport_ssh2_known_hosts_path.restype = c_uint8
|
891
|
+
|
892
|
+
self._set_libssh2_trace: Callable[[DriverPointer], int] = (
|
893
|
+
lib.ls_option_transport_ssh2_libssh2trace
|
894
|
+
)
|
895
|
+
lib.ls_option_transport_ssh2_libssh2trace.argtypes = [
|
896
|
+
DriverPointer,
|
897
|
+
]
|
898
|
+
lib.ls_option_transport_ssh2_libssh2trace.restype = c_uint8
|
899
|
+
|
900
|
+
def set_known_hosts_path(self, ptr: DriverPointer, path: c_char_p) -> int:
|
901
|
+
"""
|
902
|
+
Set ssh2 transport known hosts file path.
|
903
|
+
|
904
|
+
Should not be used/called directly.
|
905
|
+
|
906
|
+
Args:
|
907
|
+
ptr: ptr to the cli/netconf object
|
908
|
+
path: the path to the known hosts file
|
909
|
+
|
910
|
+
Returns:
|
911
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
912
|
+
ctypes.
|
913
|
+
|
914
|
+
Raises:
|
915
|
+
N/A
|
916
|
+
|
917
|
+
"""
|
918
|
+
return self._set_known_hosts_path(ptr, path)
|
919
|
+
|
920
|
+
def set_libssh2_trace(self, ptr: DriverPointer) -> int:
|
921
|
+
"""
|
922
|
+
Set ssh2 transport libssh2 trace
|
923
|
+
|
924
|
+
Should not be used/called directly.
|
925
|
+
|
926
|
+
Args:
|
927
|
+
ptr: ptr to the cli/netconf object
|
928
|
+
|
929
|
+
Returns:
|
930
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
931
|
+
ctypes.
|
932
|
+
|
933
|
+
Raises:
|
934
|
+
N/A
|
935
|
+
|
936
|
+
"""
|
937
|
+
return self._set_libssh2_trace(ptr)
|
938
|
+
|
939
|
+
|
940
|
+
class LibScrapliTransportTelnetOptionsMapping:
|
941
|
+
"""
|
942
|
+
Mapping to libscrapli telnet transport option setter exported functions.
|
943
|
+
|
944
|
+
Should not be used/called directly.
|
945
|
+
|
946
|
+
Args:
|
947
|
+
N/A
|
948
|
+
|
949
|
+
Returns:
|
950
|
+
None
|
951
|
+
|
952
|
+
Raises:
|
953
|
+
N/A
|
954
|
+
|
955
|
+
"""
|
956
|
+
|
957
|
+
def __init__(self, lib: CDLL) -> None:
|
958
|
+
_ = lib
|
959
|
+
|
960
|
+
|
961
|
+
class LibScrapliTransportTestOptionsMapping:
|
962
|
+
"""
|
963
|
+
Mapping to libscrapli test transport option setter exported functions.
|
964
|
+
|
965
|
+
Should not be used/called directly.
|
966
|
+
|
967
|
+
Args:
|
968
|
+
N/A
|
969
|
+
|
970
|
+
Returns:
|
971
|
+
None
|
972
|
+
|
973
|
+
Raises:
|
974
|
+
N/A
|
975
|
+
|
976
|
+
"""
|
977
|
+
|
978
|
+
def __init__(self, lib: CDLL) -> None:
|
979
|
+
self._set_f: Callable[[DriverPointer, c_char_p], int] = lib.ls_option_transport_test_f
|
980
|
+
lib.ls_option_transport_test_f.argtypes = [
|
981
|
+
DriverPointer,
|
982
|
+
c_char_p,
|
983
|
+
]
|
984
|
+
lib.ls_option_transport_test_f.restype = c_int
|
985
|
+
|
986
|
+
def set_f(self, ptr: DriverPointer, f: c_char_p) -> int:
|
987
|
+
"""
|
988
|
+
Set test transport f
|
989
|
+
|
990
|
+
Should not be used/called directly.
|
991
|
+
|
992
|
+
Args:
|
993
|
+
ptr: ptr to the cli/netconf object
|
994
|
+
f: file to read/load
|
995
|
+
|
996
|
+
Returns:
|
997
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
998
|
+
ctypes.
|
999
|
+
|
1000
|
+
Raises:
|
1001
|
+
N/A
|
1002
|
+
|
1003
|
+
"""
|
1004
|
+
return self._set_f(ptr, f)
|
1005
|
+
|
1006
|
+
|
1007
|
+
class LibScrapliOptionsMapping:
|
1008
|
+
"""
|
1009
|
+
Mapping to libscrapli option setter exported functions.
|
1010
|
+
|
1011
|
+
Should not be used/called directly.
|
1012
|
+
|
1013
|
+
Args:
|
1014
|
+
N/A
|
1015
|
+
|
1016
|
+
Returns:
|
1017
|
+
None
|
1018
|
+
|
1019
|
+
Raises:
|
1020
|
+
N/A
|
1021
|
+
|
1022
|
+
"""
|
1023
|
+
|
1024
|
+
def __init__(self, lib: CDLL) -> None:
|
1025
|
+
self.netconf = LibScrapliNetconfOptionsMapping(lib)
|
1026
|
+
self.session = LibScrapliSessionOptionsMapping(lib)
|
1027
|
+
self.auth = LibScrapliAuthOptionsMapping(lib)
|
1028
|
+
self.transport_bin = LibScrapliTransportBinOptionsMapping(lib)
|
1029
|
+
self.transport_ssh2 = LibScrapliTransportSsh2OptionsMapping(lib)
|
1030
|
+
self.transport_telnet = LibScrapliTransportTelnetOptionsMapping(lib)
|
1031
|
+
self.transport_test = LibScrapliTransportTestOptionsMapping(lib)
|