scrapli 2.0.0a2__py3-none-macosx_11_0_arm64.whl → 2.0.0a4__py3-none-macosx_11_0_arm64.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 +2 -1
- scrapli/cli.py +34 -66
- scrapli/ffi.py +1 -1
- scrapli/ffi_mapping.py +3 -4
- scrapli/ffi_mapping_cli.py +42 -22
- scrapli/ffi_mapping_netconf.py +28 -60
- scrapli/ffi_types.py +42 -2
- scrapli/lib/libscrapli.0.0.1-alpha.13.dylib +0 -0
- scrapli/netconf.py +36 -147
- scrapli/transport.py +71 -130
- {scrapli-2.0.0a2.dist-info → scrapli-2.0.0a4.dist-info}/METADATA +1 -1
- {scrapli-2.0.0a2.dist-info → scrapli-2.0.0a4.dist-info}/RECORD +15 -15
- scrapli/lib/libscrapli.0.0.1-alpha.10.dylib +0 -0
- {scrapli-2.0.0a2.dist-info → scrapli-2.0.0a4.dist-info}/WHEEL +0 -0
- {scrapli-2.0.0a2.dist-info → scrapli-2.0.0a4.dist-info}/licenses/LICENSE +0 -0
- {scrapli-2.0.0a2.dist-info → scrapli-2.0.0a4.dist-info}/top_level.txt +0 -0
scrapli/__init__.py
CHANGED
@@ -12,7 +12,8 @@ from scrapli.transport import Ssh2Options as TransportSsh2Options
|
|
12
12
|
from scrapli.transport import TelnetOptions as TransportTelnetOptions
|
13
13
|
from scrapli.transport import TestOptions as TransportTestOptions
|
14
14
|
|
15
|
-
__version__ = "2.0.0-alpha.
|
15
|
+
__version__ = "2.0.0-alpha.4"
|
16
|
+
__calendar_version__ = "2025.6.7"
|
16
17
|
__definitions_version__ = "471f12e"
|
17
18
|
|
18
19
|
__all__ = (
|
scrapli/cli.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"""scrapli.cli"""
|
2
2
|
|
3
3
|
import importlib.resources
|
4
|
-
from collections.abc import Callable
|
5
4
|
from ctypes import (
|
6
5
|
c_bool,
|
7
6
|
c_char_p,
|
@@ -31,14 +30,13 @@ from scrapli.exceptions import (
|
|
31
30
|
)
|
32
31
|
from scrapli.ffi_mapping import LibScrapliMapping
|
33
32
|
from scrapli.ffi_types import (
|
34
|
-
CancelPointer,
|
35
33
|
DriverPointer,
|
36
34
|
IntPointer,
|
37
|
-
LogFuncCallback,
|
38
35
|
OperationIdPointer,
|
39
36
|
U64Pointer,
|
40
37
|
ZigSlice,
|
41
38
|
ZigU64Slice,
|
39
|
+
ffi_logger_wrapper,
|
42
40
|
to_c_string,
|
43
41
|
)
|
44
42
|
from scrapli.helper import (
|
@@ -47,6 +45,7 @@ from scrapli.helper import (
|
|
47
45
|
wait_for_available_operation_result_async,
|
48
46
|
)
|
49
47
|
from scrapli.session import Options as SessionOptions
|
48
|
+
from scrapli.transport import BinOptions as TransportBinOptions
|
50
49
|
from scrapli.transport import Options as TransportOptions
|
51
50
|
|
52
51
|
CLI_DEFINITIONS_PATH_OVERRIDE_ENV = "SCRAPLI_DEFINITIONS_PATH"
|
@@ -93,7 +92,6 @@ class Cli:
|
|
93
92
|
definition_file_or_name: str,
|
94
93
|
host: str,
|
95
94
|
*,
|
96
|
-
logger_callback: Callable[[int, str], None] | None = None,
|
97
95
|
port: int = 22,
|
98
96
|
auth_options: AuthOptions | None = None,
|
99
97
|
session_options: SessionOptions | None = None,
|
@@ -105,6 +103,7 @@ class Cli:
|
|
105
103
|
logger_name += f":{logging_uid}"
|
106
104
|
|
107
105
|
self.logger = getLogger(logger_name)
|
106
|
+
self.logger_callback = ffi_logger_wrapper(logger=self.logger)
|
108
107
|
self._logging_uid = logging_uid
|
109
108
|
|
110
109
|
self.ffi_mapping = LibScrapliMapping()
|
@@ -117,18 +116,13 @@ class Cli:
|
|
117
116
|
# why. in this case we also just store the host since thats cheap and we need it as a string
|
118
117
|
# in places too
|
119
118
|
self.host = host
|
120
|
-
self._host = to_c_string(host)
|
121
|
-
|
122
|
-
self.logger_callback = (
|
123
|
-
LogFuncCallback(logger_callback) if logger_callback else LogFuncCallback(0)
|
124
|
-
)
|
125
|
-
self._logger_callback = logger_callback
|
119
|
+
self._host = to_c_string(s=host)
|
126
120
|
|
127
121
|
self.port = port
|
128
122
|
|
129
123
|
self.auth_options = auth_options or AuthOptions()
|
130
124
|
self.session_options = session_options or SessionOptions()
|
131
|
-
self.transport_options = transport_options or
|
125
|
+
self.transport_options = transport_options or TransportBinOptions()
|
132
126
|
|
133
127
|
self.ptr: DriverPointer | None = None
|
134
128
|
self.poll_fd: int = 0
|
@@ -264,7 +258,6 @@ class Cli:
|
|
264
258
|
return Cli(
|
265
259
|
host=self.host,
|
266
260
|
definition_file_or_name=self.definition_file_or_name,
|
267
|
-
logger_callback=self._logger_callback,
|
268
261
|
port=self.port,
|
269
262
|
auth_options=self.auth_options,
|
270
263
|
session_options=self.session_options,
|
@@ -307,7 +300,7 @@ class Cli:
|
|
307
300
|
logger_callback=self.logger_callback,
|
308
301
|
host=self._host,
|
309
302
|
port=c_int(self.port),
|
310
|
-
transport_kind=c_char_p(self.transport_options.
|
303
|
+
transport_kind=c_char_p(self.transport_options.transport_kind.encode(encoding="utf-8")),
|
311
304
|
)
|
312
305
|
if ptr == 0: # type: ignore[comparison-overlap]
|
313
306
|
raise AllocationException("failed to allocate cli")
|
@@ -319,7 +312,7 @@ class Cli:
|
|
319
312
|
ptr=self._ptr_or_exception(),
|
320
313
|
)
|
321
314
|
)
|
322
|
-
if poll_fd
|
315
|
+
if poll_fd <= 0:
|
323
316
|
raise AllocationException("failed to allocate cli")
|
324
317
|
|
325
318
|
self.poll_fd = poll_fd
|
@@ -393,9 +386,9 @@ class Cli:
|
|
393
386
|
|
394
387
|
def _open(
|
395
388
|
self,
|
389
|
+
*,
|
396
390
|
operation_id: OperationIdPointer,
|
397
|
-
|
398
|
-
) -> c_uint:
|
391
|
+
) -> None:
|
399
392
|
self._alloc()
|
400
393
|
|
401
394
|
self.auth_options.apply(self.ffi_mapping, self._ptr_or_exception())
|
@@ -405,15 +398,12 @@ class Cli:
|
|
405
398
|
status = self.ffi_mapping.cli_mapping.open(
|
406
399
|
ptr=self._ptr_or_exception(),
|
407
400
|
operation_id=operation_id,
|
408
|
-
cancel=cancel,
|
409
401
|
)
|
410
402
|
if status != 0:
|
411
403
|
self._free()
|
412
404
|
|
413
405
|
raise OpenException("failed to submit open operation")
|
414
406
|
|
415
|
-
return c_uint(operation_id.contents.value)
|
416
|
-
|
417
407
|
def open(
|
418
408
|
self,
|
419
409
|
) -> Result:
|
@@ -431,11 +421,10 @@ class Cli:
|
|
431
421
|
|
432
422
|
"""
|
433
423
|
operation_id = OperationIdPointer(c_uint(0))
|
434
|
-
cancel = CancelPointer(c_bool(False))
|
435
424
|
|
436
|
-
|
425
|
+
self._open(operation_id=operation_id)
|
437
426
|
|
438
|
-
return self._get_result(operation_id=operation_id)
|
427
|
+
return self._get_result(operation_id=operation_id.contents.value)
|
439
428
|
|
440
429
|
async def open_async(self) -> Result:
|
441
430
|
"""
|
@@ -452,24 +441,23 @@ class Cli:
|
|
452
441
|
|
453
442
|
"""
|
454
443
|
operation_id = OperationIdPointer(c_uint(0))
|
455
|
-
cancel = CancelPointer(c_bool(False))
|
456
444
|
|
457
|
-
|
445
|
+
self._open(operation_id=operation_id)
|
458
446
|
|
459
|
-
return await self._get_result_async(operation_id=operation_id)
|
460
|
-
|
461
|
-
def _close(self) -> c_uint:
|
462
|
-
operation_id = OperationIdPointer(c_uint(0))
|
463
|
-
cancel = CancelPointer(c_bool(False))
|
447
|
+
return await self._get_result_async(operation_id=operation_id.contents.value)
|
464
448
|
|
449
|
+
def _close(
|
450
|
+
self,
|
451
|
+
*,
|
452
|
+
operation_id: OperationIdPointer,
|
453
|
+
) -> None:
|
465
454
|
status = self.ffi_mapping.cli_mapping.close(
|
466
|
-
ptr=self._ptr_or_exception(),
|
455
|
+
ptr=self._ptr_or_exception(),
|
456
|
+
operation_id=operation_id,
|
467
457
|
)
|
468
458
|
if status != 0:
|
469
459
|
raise CloseException("submitting close operation")
|
470
460
|
|
471
|
-
return c_uint(operation_id.contents.value)
|
472
|
-
|
473
461
|
def close(
|
474
462
|
self,
|
475
463
|
) -> Result:
|
@@ -487,9 +475,11 @@ class Cli:
|
|
487
475
|
CloseException: if the operation fails
|
488
476
|
|
489
477
|
"""
|
490
|
-
operation_id =
|
478
|
+
operation_id = OperationIdPointer(c_uint(0))
|
479
|
+
|
480
|
+
self._close(operation_id=operation_id)
|
491
481
|
|
492
|
-
result = self._get_result(operation_id=operation_id)
|
482
|
+
result = self._get_result(operation_id=operation_id.contents.value)
|
493
483
|
|
494
484
|
self._free()
|
495
485
|
|
@@ -512,9 +502,11 @@ class Cli:
|
|
512
502
|
CloseException: if the operation fails
|
513
503
|
|
514
504
|
"""
|
515
|
-
operation_id =
|
505
|
+
operation_id = OperationIdPointer(c_uint(0))
|
516
506
|
|
517
|
-
|
507
|
+
self._close(operation_id=operation_id)
|
508
|
+
|
509
|
+
result = await self._get_result_async(operation_id=operation_id.contents.value)
|
518
510
|
|
519
511
|
self._free()
|
520
512
|
|
@@ -658,13 +650,11 @@ class Cli:
|
|
658
650
|
self,
|
659
651
|
*,
|
660
652
|
operation_id: OperationIdPointer,
|
661
|
-
cancel: CancelPointer,
|
662
653
|
requested_mode: c_char_p,
|
663
654
|
) -> c_uint:
|
664
655
|
status = self.ffi_mapping.cli_mapping.enter_mode(
|
665
656
|
ptr=self._ptr_or_exception(),
|
666
657
|
operation_id=operation_id,
|
667
|
-
cancel=cancel,
|
668
658
|
requested_mode=requested_mode,
|
669
659
|
)
|
670
660
|
if status != 0:
|
@@ -698,12 +688,12 @@ class Cli:
|
|
698
688
|
_ = operation_timeout_ns
|
699
689
|
|
700
690
|
operation_id = OperationIdPointer(c_uint(0))
|
701
|
-
cancel = CancelPointer(c_bool(False))
|
702
691
|
|
703
692
|
_requested_mode = to_c_string(requested_mode)
|
704
693
|
|
705
694
|
operation_id = self._enter_mode(
|
706
|
-
operation_id=operation_id,
|
695
|
+
operation_id=operation_id,
|
696
|
+
requested_mode=_requested_mode,
|
707
697
|
)
|
708
698
|
|
709
699
|
return self._get_result(operation_id=operation_id)
|
@@ -734,12 +724,12 @@ class Cli:
|
|
734
724
|
_ = operation_timeout_ns
|
735
725
|
|
736
726
|
operation_id = OperationIdPointer(c_uint(0))
|
737
|
-
cancel = CancelPointer(c_bool(False))
|
738
727
|
|
739
728
|
_requested_mode = to_c_string(requested_mode)
|
740
729
|
|
741
730
|
operation_id = self._enter_mode(
|
742
|
-
operation_id=operation_id,
|
731
|
+
operation_id=operation_id,
|
732
|
+
requested_mode=_requested_mode,
|
743
733
|
)
|
744
734
|
|
745
735
|
return await self._get_result_async(operation_id=operation_id)
|
@@ -748,12 +738,10 @@ class Cli:
|
|
748
738
|
self,
|
749
739
|
*,
|
750
740
|
operation_id: OperationIdPointer,
|
751
|
-
cancel: CancelPointer,
|
752
741
|
) -> c_uint:
|
753
742
|
status = self.ffi_mapping.cli_mapping.get_prompt(
|
754
743
|
ptr=self._ptr_or_exception(),
|
755
744
|
operation_id=operation_id,
|
756
|
-
cancel=cancel,
|
757
745
|
)
|
758
746
|
if status != 0:
|
759
747
|
raise SubmitOperationException("submitting get prompt operation failed")
|
@@ -784,9 +772,8 @@ class Cli:
|
|
784
772
|
_ = operation_timeout_ns
|
785
773
|
|
786
774
|
operation_id = OperationIdPointer(c_uint(0))
|
787
|
-
cancel = CancelPointer(c_bool(False))
|
788
775
|
|
789
|
-
operation_id = self._get_prompt(operation_id=operation_id
|
776
|
+
operation_id = self._get_prompt(operation_id=operation_id)
|
790
777
|
|
791
778
|
return self._get_result(operation_id=operation_id)
|
792
779
|
|
@@ -814,9 +801,8 @@ class Cli:
|
|
814
801
|
_ = operation_timeout_ns
|
815
802
|
|
816
803
|
operation_id = OperationIdPointer(c_uint(0))
|
817
|
-
cancel = CancelPointer(c_bool(False))
|
818
804
|
|
819
|
-
operation_id = self._get_prompt(operation_id=operation_id
|
805
|
+
operation_id = self._get_prompt(operation_id=operation_id)
|
820
806
|
|
821
807
|
return await self._get_result_async(operation_id=operation_id)
|
822
808
|
|
@@ -824,7 +810,6 @@ class Cli:
|
|
824
810
|
self,
|
825
811
|
*,
|
826
812
|
operation_id: OperationIdPointer,
|
827
|
-
cancel: CancelPointer,
|
828
813
|
input_: c_char_p,
|
829
814
|
requested_mode: c_char_p,
|
830
815
|
input_handling: c_char_p,
|
@@ -834,7 +819,6 @@ class Cli:
|
|
834
819
|
status = self.ffi_mapping.cli_mapping.send_input(
|
835
820
|
ptr=self._ptr_or_exception(),
|
836
821
|
operation_id=operation_id,
|
837
|
-
cancel=cancel,
|
838
822
|
input_=input_,
|
839
823
|
requested_mode=requested_mode,
|
840
824
|
input_handling=input_handling,
|
@@ -880,7 +864,6 @@ class Cli:
|
|
880
864
|
_ = operation_timeout_ns
|
881
865
|
|
882
866
|
operation_id = OperationIdPointer(c_uint(0))
|
883
|
-
cancel = CancelPointer(c_bool(False))
|
884
867
|
|
885
868
|
_input = to_c_string(input_)
|
886
869
|
_requested_mode = to_c_string(requested_mode)
|
@@ -888,7 +871,6 @@ class Cli:
|
|
888
871
|
|
889
872
|
operation_id = self._send_input(
|
890
873
|
operation_id=operation_id,
|
891
|
-
cancel=cancel,
|
892
874
|
input_=_input,
|
893
875
|
requested_mode=_requested_mode,
|
894
876
|
input_handling=_input_handling,
|
@@ -932,7 +914,6 @@ class Cli:
|
|
932
914
|
_ = operation_timeout_ns
|
933
915
|
|
934
916
|
operation_id = OperationIdPointer(c_uint(0))
|
935
|
-
cancel = CancelPointer(c_bool(False))
|
936
917
|
|
937
918
|
_input = to_c_string(input_)
|
938
919
|
_requested_mode = to_c_string(requested_mode)
|
@@ -940,7 +921,6 @@ class Cli:
|
|
940
921
|
|
941
922
|
operation_id = self._send_input(
|
942
923
|
operation_id=operation_id,
|
943
|
-
cancel=cancel,
|
944
924
|
input_=_input,
|
945
925
|
requested_mode=_requested_mode,
|
946
926
|
input_handling=_input_handling,
|
@@ -986,8 +966,6 @@ class Cli:
|
|
986
966
|
# meaning all the "inputs" combined, not individually
|
987
967
|
_ = operation_timeout_ns
|
988
968
|
|
989
|
-
cancel = CancelPointer(c_bool(False))
|
990
|
-
|
991
969
|
result: Result | None = None
|
992
970
|
|
993
971
|
for input_ in inputs:
|
@@ -999,7 +977,6 @@ class Cli:
|
|
999
977
|
|
1000
978
|
operation_id = self._send_input(
|
1001
979
|
operation_id=operation_id,
|
1002
|
-
cancel=cancel,
|
1003
980
|
input_=_input,
|
1004
981
|
requested_mode=_requested_mode,
|
1005
982
|
input_handling=_input_handling,
|
@@ -1055,8 +1032,6 @@ class Cli:
|
|
1055
1032
|
# meaning all the "inputs" combined, not individually
|
1056
1033
|
_ = operation_timeout_ns
|
1057
1034
|
|
1058
|
-
cancel = CancelPointer(c_bool(False))
|
1059
|
-
|
1060
1035
|
result: Result | None = None
|
1061
1036
|
|
1062
1037
|
for input_ in inputs:
|
@@ -1068,7 +1043,6 @@ class Cli:
|
|
1068
1043
|
|
1069
1044
|
operation_id = self._send_input(
|
1070
1045
|
operation_id=operation_id,
|
1071
|
-
cancel=cancel,
|
1072
1046
|
input_=_input,
|
1073
1047
|
requested_mode=_requested_mode,
|
1074
1048
|
input_handling=_input_handling,
|
@@ -1179,7 +1153,6 @@ class Cli:
|
|
1179
1153
|
self,
|
1180
1154
|
*,
|
1181
1155
|
operation_id: OperationIdPointer,
|
1182
|
-
cancel: CancelPointer,
|
1183
1156
|
input_: c_char_p,
|
1184
1157
|
prompt: c_char_p,
|
1185
1158
|
prompt_pattern: c_char_p,
|
@@ -1193,7 +1166,6 @@ class Cli:
|
|
1193
1166
|
status = self.ffi_mapping.cli_mapping.send_prompted_input(
|
1194
1167
|
ptr=self._ptr_or_exception(),
|
1195
1168
|
operation_id=operation_id,
|
1196
|
-
cancel=cancel,
|
1197
1169
|
input_=input_,
|
1198
1170
|
prompt=prompt,
|
1199
1171
|
prompt_pattern=prompt_pattern,
|
@@ -1252,7 +1224,6 @@ class Cli:
|
|
1252
1224
|
_ = operation_timeout_ns
|
1253
1225
|
|
1254
1226
|
operation_id = OperationIdPointer(c_uint(0))
|
1255
|
-
cancel = CancelPointer(c_bool(False))
|
1256
1227
|
|
1257
1228
|
_input = to_c_string(input_)
|
1258
1229
|
_prompt = to_c_string(prompt)
|
@@ -1264,7 +1235,6 @@ class Cli:
|
|
1264
1235
|
|
1265
1236
|
operation_id = self._send_prompted_input(
|
1266
1237
|
operation_id=operation_id,
|
1267
|
-
cancel=cancel,
|
1268
1238
|
input_=_input,
|
1269
1239
|
prompt=_prompt,
|
1270
1240
|
prompt_pattern=_prompt_pattern,
|
@@ -1321,7 +1291,6 @@ class Cli:
|
|
1321
1291
|
_ = operation_timeout_ns
|
1322
1292
|
|
1323
1293
|
operation_id = OperationIdPointer(c_uint(0))
|
1324
|
-
cancel = CancelPointer(c_bool(False))
|
1325
1294
|
|
1326
1295
|
_input = to_c_string(input_)
|
1327
1296
|
_prompt = to_c_string(prompt)
|
@@ -1333,7 +1302,6 @@ class Cli:
|
|
1333
1302
|
|
1334
1303
|
operation_id = self._send_prompted_input(
|
1335
1304
|
operation_id=operation_id,
|
1336
|
-
cancel=cancel,
|
1337
1305
|
input_=_input,
|
1338
1306
|
prompt=_prompt,
|
1339
1307
|
prompt_pattern=_prompt_pattern,
|
scrapli/ffi.py
CHANGED
@@ -10,7 +10,7 @@ from scrapli.exceptions import LibScrapliException
|
|
10
10
|
|
11
11
|
logger = getLogger(__name__)
|
12
12
|
|
13
|
-
LIBSCRAPLI_VERSION = "0.0.1-alpha.
|
13
|
+
LIBSCRAPLI_VERSION = "0.0.1-alpha.13"
|
14
14
|
LIBSCRAPLI_PATH_OVERRIDE_ENV = "LIBSCRAPLI_PATH"
|
15
15
|
LIBSCRAPLI_CACHE_PATH_OVERRIDE_ENV = "LIBSCRAPLI_CACHE_PATH"
|
16
16
|
XDG_CACHE_HOME_ENV = "XDG_CACHE_HOME"
|
scrapli/ffi_mapping.py
CHANGED
@@ -7,7 +7,6 @@ from ctypes import (
|
|
7
7
|
c_char_p,
|
8
8
|
c_int,
|
9
9
|
c_uint8,
|
10
|
-
c_uint32,
|
11
10
|
)
|
12
11
|
|
13
12
|
from scrapli.ffi import get_libscrapli_path
|
@@ -43,12 +42,12 @@ class LibScrapliSharedMapping:
|
|
43
42
|
[
|
44
43
|
DriverPointer,
|
45
44
|
],
|
46
|
-
|
45
|
+
c_int,
|
47
46
|
] = lib.ls_shared_get_poll_fd
|
48
47
|
lib.ls_shared_get_poll_fd.argtypes = [
|
49
48
|
DriverPointer,
|
50
49
|
]
|
51
|
-
lib.ls_cli_alloc.restype =
|
50
|
+
lib.ls_cli_alloc.restype = c_int
|
52
51
|
|
53
52
|
self._free: Callable[
|
54
53
|
[
|
@@ -91,7 +90,7 @@ class LibScrapliSharedMapping:
|
|
91
90
|
]
|
92
91
|
lib.ls_shared_write_session.restype = c_uint8
|
93
92
|
|
94
|
-
def get_poll_fd(self, ptr: DriverPointer) ->
|
93
|
+
def get_poll_fd(self, ptr: DriverPointer) -> c_int:
|
95
94
|
"""
|
96
95
|
Get the operation poll fd from the driver at ptr.
|
97
96
|
|
scrapli/ffi_mapping_cli.py
CHANGED
@@ -12,6 +12,7 @@ from ctypes import (
|
|
12
12
|
from _ctypes import POINTER
|
13
13
|
|
14
14
|
from scrapli.ffi_types import (
|
15
|
+
CANCEL,
|
15
16
|
CancelPointer,
|
16
17
|
DriverPointer,
|
17
18
|
IntPointer,
|
@@ -171,7 +172,13 @@ class LibScrapliCliMapping:
|
|
171
172
|
lib.ls_cli_fetch_operation.restype = c_uint8
|
172
173
|
|
173
174
|
self._enter_mode: Callable[
|
174
|
-
[
|
175
|
+
[
|
176
|
+
DriverPointer,
|
177
|
+
OperationIdPointer,
|
178
|
+
CancelPointer,
|
179
|
+
c_char_p,
|
180
|
+
],
|
181
|
+
int,
|
175
182
|
] = lib.ls_cli_enter_mode
|
176
183
|
lib.ls_cli_enter_mode.argtypes = [
|
177
184
|
DriverPointer,
|
@@ -181,9 +188,14 @@ class LibScrapliCliMapping:
|
|
181
188
|
]
|
182
189
|
lib.ls_cli_enter_mode.restype = c_uint8
|
183
190
|
|
184
|
-
self._get_prompt: Callable[
|
185
|
-
|
186
|
-
|
191
|
+
self._get_prompt: Callable[
|
192
|
+
[
|
193
|
+
DriverPointer,
|
194
|
+
OperationIdPointer,
|
195
|
+
CancelPointer,
|
196
|
+
],
|
197
|
+
int,
|
198
|
+
] = lib.ls_cli_get_prompt
|
187
199
|
lib.ls_cli_get_prompt.argtypes = [
|
188
200
|
DriverPointer,
|
189
201
|
OperationIdPointer,
|
@@ -337,7 +349,9 @@ class LibScrapliCliMapping:
|
|
337
349
|
)
|
338
350
|
|
339
351
|
def open(
|
340
|
-
self,
|
352
|
+
self,
|
353
|
+
ptr: DriverPointer,
|
354
|
+
operation_id: OperationIdPointer,
|
341
355
|
) -> int:
|
342
356
|
"""
|
343
357
|
Open the driver at ptr.
|
@@ -347,7 +361,6 @@ class LibScrapliCliMapping:
|
|
347
361
|
Args:
|
348
362
|
ptr: the ptr to the libscrapli cli object.
|
349
363
|
operation_id: c_int pointer that is filled with the operation id to poll for completion.
|
350
|
-
cancel: bool pointer that can be set to true to cancel the operation.
|
351
364
|
|
352
365
|
Returns:
|
353
366
|
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
@@ -357,13 +370,16 @@ class LibScrapliCliMapping:
|
|
357
370
|
N/A
|
358
371
|
|
359
372
|
"""
|
360
|
-
return self._open(
|
373
|
+
return self._open(
|
374
|
+
ptr,
|
375
|
+
operation_id,
|
376
|
+
CANCEL,
|
377
|
+
)
|
361
378
|
|
362
379
|
def close(
|
363
380
|
self,
|
364
381
|
ptr: DriverPointer,
|
365
382
|
operation_id: OperationIdPointer,
|
366
|
-
cancel: CancelPointer,
|
367
383
|
) -> int:
|
368
384
|
"""
|
369
385
|
Close the driver at ptr.
|
@@ -373,7 +389,6 @@ class LibScrapliCliMapping:
|
|
373
389
|
Args:
|
374
390
|
ptr: the ptr to the libscrapli cli object.
|
375
391
|
operation_id: c_int pointer that is filled with the operation id to poll for completion.
|
376
|
-
cancel: bool pointer that can be set to true to cancel the operation.
|
377
392
|
|
378
393
|
Returns:
|
379
394
|
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
@@ -386,7 +401,7 @@ class LibScrapliCliMapping:
|
|
386
401
|
return self._close(
|
387
402
|
ptr,
|
388
403
|
operation_id,
|
389
|
-
|
404
|
+
CANCEL,
|
390
405
|
)
|
391
406
|
|
392
407
|
def fetch_sizes(
|
@@ -491,7 +506,6 @@ class LibScrapliCliMapping:
|
|
491
506
|
*,
|
492
507
|
ptr: DriverPointer,
|
493
508
|
operation_id: OperationIdPointer,
|
494
|
-
cancel: CancelPointer,
|
495
509
|
requested_mode: c_char_p,
|
496
510
|
) -> int:
|
497
511
|
"""
|
@@ -502,7 +516,6 @@ class LibScrapliCliMapping:
|
|
502
516
|
Args:
|
503
517
|
ptr: ptr to the cli object
|
504
518
|
operation_id: int pointer to fill with the id of the submitted operation
|
505
|
-
cancel: bool pointer that can be set to true to cancel the operation
|
506
519
|
requested_mode: string name of the mode to enter
|
507
520
|
|
508
521
|
Returns:
|
@@ -513,10 +526,18 @@ class LibScrapliCliMapping:
|
|
513
526
|
N/A
|
514
527
|
|
515
528
|
"""
|
516
|
-
return self._enter_mode(
|
529
|
+
return self._enter_mode(
|
530
|
+
ptr,
|
531
|
+
operation_id,
|
532
|
+
CANCEL,
|
533
|
+
requested_mode,
|
534
|
+
)
|
517
535
|
|
518
536
|
def get_prompt(
|
519
|
-
self,
|
537
|
+
self,
|
538
|
+
*,
|
539
|
+
ptr: DriverPointer,
|
540
|
+
operation_id: OperationIdPointer,
|
520
541
|
) -> int:
|
521
542
|
"""
|
522
543
|
Get the current prompt for the cli object.
|
@@ -526,7 +547,6 @@ class LibScrapliCliMapping:
|
|
526
547
|
Args:
|
527
548
|
ptr: ptr to the cli object
|
528
549
|
operation_id: int pointer to fill with the id of the submitted operation
|
529
|
-
cancel: bool pointer that can be set to true to cancel the operation
|
530
550
|
|
531
551
|
Returns:
|
532
552
|
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
@@ -536,14 +556,17 @@ class LibScrapliCliMapping:
|
|
536
556
|
N/A
|
537
557
|
|
538
558
|
"""
|
539
|
-
return self._get_prompt(
|
559
|
+
return self._get_prompt(
|
560
|
+
ptr,
|
561
|
+
operation_id,
|
562
|
+
CANCEL,
|
563
|
+
)
|
540
564
|
|
541
565
|
def send_input(
|
542
566
|
self,
|
543
567
|
*,
|
544
568
|
ptr: DriverPointer,
|
545
569
|
operation_id: OperationIdPointer,
|
546
|
-
cancel: CancelPointer,
|
547
570
|
input_: c_char_p,
|
548
571
|
requested_mode: c_char_p,
|
549
572
|
input_handling: c_char_p,
|
@@ -558,7 +581,6 @@ class LibScrapliCliMapping:
|
|
558
581
|
Args:
|
559
582
|
ptr: ptr to the cli object
|
560
583
|
operation_id: int pointer to fill with the id of the submitted operation
|
561
|
-
cancel: bool pointer that can be set to true to cancel the operation
|
562
584
|
input_: the input to send
|
563
585
|
requested_mode: string name of the mode to send the input in
|
564
586
|
input_handling: string mapping to input handling enum that governs how the input is
|
@@ -577,7 +599,7 @@ class LibScrapliCliMapping:
|
|
577
599
|
return self._send_input(
|
578
600
|
ptr,
|
579
601
|
operation_id,
|
580
|
-
|
602
|
+
CANCEL,
|
581
603
|
input_,
|
582
604
|
requested_mode,
|
583
605
|
input_handling,
|
@@ -590,7 +612,6 @@ class LibScrapliCliMapping:
|
|
590
612
|
*,
|
591
613
|
ptr: DriverPointer,
|
592
614
|
operation_id: OperationIdPointer,
|
593
|
-
cancel: CancelPointer,
|
594
615
|
input_: c_char_p,
|
595
616
|
prompt: c_char_p,
|
596
617
|
prompt_pattern: c_char_p,
|
@@ -609,7 +630,6 @@ class LibScrapliCliMapping:
|
|
609
630
|
Args:
|
610
631
|
ptr: ptr to the cli object
|
611
632
|
operation_id: int pointer to fill with the id of the submitted operation
|
612
|
-
cancel: bool pointer that can be set to true to cancel the operation
|
613
633
|
input_: the input to send
|
614
634
|
prompt: the prompt to expect
|
615
635
|
prompt_pattern: the prompt pattern to expect
|
@@ -633,7 +653,7 @@ class LibScrapliCliMapping:
|
|
633
653
|
return self._send_prompted_input(
|
634
654
|
ptr,
|
635
655
|
operation_id,
|
636
|
-
|
656
|
+
CANCEL,
|
637
657
|
input_,
|
638
658
|
prompt,
|
639
659
|
prompt_pattern,
|