scrapli 2.0.0a4__py3-none-manylinux2010_x86_64.whl → 2.0.0a5__py3-none-manylinux2010_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 +5 -6
- scrapli/auth.py +14 -7
- scrapli/cli.py +300 -0
- scrapli/cli_parse.py +1 -1
- scrapli/cli_result.py +42 -0
- scrapli/definitions/aethra_atosnt.yaml +9 -0
- scrapli/definitions/alcatel_aos.yaml +9 -0
- scrapli/definitions/arista_eos.yaml +1 -0
- scrapli/definitions/aruba_aoscx.yaml +33 -0
- scrapli/definitions/cisco_aireos.yaml +31 -0
- scrapli/definitions/cisco_asa.yaml +48 -0
- scrapli/definitions/cisco_cbs.yaml +50 -0
- scrapli/definitions/cisco_ftd.yaml +42 -0
- scrapli/definitions/cisco_nxos.yaml +2 -0
- scrapli/definitions/cumulus_linux.yaml +28 -0
- scrapli/definitions/cumulus_vtysh.yaml +42 -0
- scrapli/definitions/datacom_dmos.yaml +30 -0
- scrapli/definitions/datacom_dmswitch.yaml +32 -0
- scrapli/definitions/default.yaml +9 -0
- scrapli/definitions/dell_emc.yaml +46 -0
- scrapli/definitions/dell_enterprisesonic.yaml +40 -0
- scrapli/definitions/dlink_os.yaml +46 -0
- scrapli/definitions/edgecore_ecs.yaml +35 -0
- scrapli/definitions/eltex_esr.yaml +43 -0
- scrapli/definitions/fortinet_fortios.yaml +20 -0
- scrapli/definitions/fortinet_wlc.yaml +33 -0
- scrapli/definitions/hp_comware.yaml +31 -0
- scrapli/definitions/huawei_smartax.yaml +61 -0
- scrapli/definitions/huawei_vrp.yaml +56 -0
- scrapli/definitions/juniper_junos.yaml +3 -0
- scrapli/definitions/nokia_srlinux.yaml +13 -2
- scrapli/definitions/nokia_sros.yaml +31 -0
- scrapli/definitions/nokia_sros_classic.yaml +33 -0
- scrapli/definitions/nokia_sros_classic_aram.yaml +25 -0
- scrapli/definitions/paloalto_panos.yaml +36 -0
- scrapli/definitions/raisecom_ros.yaml +45 -0
- scrapli/definitions/ruckus_fastiron.yaml +45 -0
- scrapli/definitions/ruckus_unleashed.yaml +64 -0
- scrapli/definitions/siemens_roxii.yaml +28 -0
- scrapli/definitions/versa_flexvnf.yaml +45 -0
- scrapli/definitions/vyos_vyos.yaml +35 -0
- scrapli/definitions/zyxel_dslam.yaml +18 -0
- scrapli/ffi.py +1 -1
- scrapli/ffi_mapping.py +89 -33
- scrapli/ffi_mapping_cli.py +104 -0
- scrapli/ffi_mapping_options.py +38 -6
- scrapli/ffi_types.py +1 -1
- scrapli/helper.py +56 -0
- scrapli/lib/{libscrapli.0.0.1-alpha.13.dylib → libscrapli.0.0.1-alpha.17.dylib} +0 -0
- scrapli/lib/{libscrapli.so.0.0.1-alpha.13 → libscrapli.so.0.0.1-alpha.17} +0 -0
- {scrapli-2.0.0a4.dist-info → scrapli-2.0.0a5.dist-info}/METADATA +1 -1
- scrapli-2.0.0a5.dist-info/RECORD +68 -0
- scrapli-2.0.0a4.dist-info/RECORD +0 -35
- {scrapli-2.0.0a4.dist-info → scrapli-2.0.0a5.dist-info}/WHEEL +0 -0
- {scrapli-2.0.0a4.dist-info → scrapli-2.0.0a5.dist-info}/licenses/LICENSE +0 -0
- {scrapli-2.0.0a4.dist-info → scrapli-2.0.0a5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '.*\[.*?\]\n.*#'
|
3
|
+
default_mode: 'exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^\[.*?\]\n.*#'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'configuration'
|
9
|
+
instructions:
|
10
|
+
- send_input:
|
11
|
+
input: 'edit-config exclusive'
|
12
|
+
- name: 'configuration'
|
13
|
+
prompt_pattern: '.?\(.*?\)\[.*?\]\n.*#'
|
14
|
+
accessible_modes:
|
15
|
+
- name: 'exec'
|
16
|
+
instructions:
|
17
|
+
- send_input:
|
18
|
+
input: 'quit-config'
|
19
|
+
failure_indicators:
|
20
|
+
- 'MINOR:'
|
21
|
+
- 'MAJOR:'
|
22
|
+
on_open_instructions:
|
23
|
+
- enter_mode:
|
24
|
+
requested_mode: 'exec'
|
25
|
+
- send_input:
|
26
|
+
input: 'environment no more'
|
27
|
+
on_close_instructions:
|
28
|
+
- enter_mode:
|
29
|
+
requested_mode: 'exec'
|
30
|
+
- write:
|
31
|
+
input: 'logout'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^\*?[abcd]:[\w\s_.-]+#\s?$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'configuration'
|
9
|
+
instructions:
|
10
|
+
- send_input:
|
11
|
+
input: 'configure'
|
12
|
+
- name: 'configuration'
|
13
|
+
prompt_pattern: '^\*?[abcd]:[\w\s_.-]+>config[\w>]*(#|\$)\s?$'
|
14
|
+
accessible_modes:
|
15
|
+
- name: 'exec'
|
16
|
+
instructions:
|
17
|
+
- send_input:
|
18
|
+
input: 'exit all'
|
19
|
+
failure_indicators:
|
20
|
+
- 'MINOR:'
|
21
|
+
- 'MAJOR:'
|
22
|
+
- 'Error:'
|
23
|
+
- 'Bad Command:'
|
24
|
+
on_open_instructions:
|
25
|
+
- enter_mode:
|
26
|
+
requested_mode: 'exec'
|
27
|
+
- send_input:
|
28
|
+
input: 'environment no more'
|
29
|
+
on_close_instructions:
|
30
|
+
- enter_mode:
|
31
|
+
requested_mode: 'exec'
|
32
|
+
- write:
|
33
|
+
input: 'logout'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^(.*)[a-zA-Z0-9_\:\-\>]*[\#\$] ?$'
|
7
|
+
failure_indicators:
|
8
|
+
- 'command is not complete'
|
9
|
+
- 'invalid token'
|
10
|
+
on_open_instructions:
|
11
|
+
- enter_mode:
|
12
|
+
requested_mode: 'exec'
|
13
|
+
- send_input:
|
14
|
+
input: 'environment mode batch'
|
15
|
+
- send_input:
|
16
|
+
input: 'environment inhibit-alarms'
|
17
|
+
- send_input:
|
18
|
+
input: 'environment print no-more'
|
19
|
+
- send_input:
|
20
|
+
input: 'exit all'
|
21
|
+
on_close_instructions:
|
22
|
+
- enter_mode:
|
23
|
+
requested_mode: 'exec'
|
24
|
+
- write:
|
25
|
+
input: 'logout'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^[\w\._-]+@[\w\.\(\)_-]+>\s?$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'configuration'
|
9
|
+
instructions:
|
10
|
+
- send_input:
|
11
|
+
input: 'configure'
|
12
|
+
- name: 'configuration'
|
13
|
+
prompt_pattern: '^[\w\._-]+@[\w\.\(\)_-]+#\s?$'
|
14
|
+
accessible_modes:
|
15
|
+
- name: 'exec'
|
16
|
+
instructions:
|
17
|
+
- send_input:
|
18
|
+
input: 'exit'
|
19
|
+
failure_indicators:
|
20
|
+
- 'Unknown command:'
|
21
|
+
- 'Invalid syntax.'
|
22
|
+
- 'Server error'
|
23
|
+
- 'Validation Error:'
|
24
|
+
on_open_instructions:
|
25
|
+
- enter_mode:
|
26
|
+
requested_mode: 'exec'
|
27
|
+
- send_input:
|
28
|
+
input: 'set cli scripting-mode on'
|
29
|
+
- send_input:
|
30
|
+
input: 'set cli pager off'
|
31
|
+
on_close_instructions:
|
32
|
+
- enter_mode:
|
33
|
+
requested_mode: 'exec'
|
34
|
+
- write:
|
35
|
+
input: 'exit'
|
36
|
+
ntc_templates_platform: 'paloalto_panos'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'privileged_exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^[a-z0-9.\-_@()/:]{1,63}>$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'privileged_exec'
|
9
|
+
instructions:
|
10
|
+
- send_prompted_input:
|
11
|
+
input: 'enable'
|
12
|
+
prompt_exact: '[pP]assword:\s?$'
|
13
|
+
response: '__lookup::enable'
|
14
|
+
- name: 'privileged_exec'
|
15
|
+
prompt_pattern: '^[a-z0-9.\-_@/:]{1,63}#$'
|
16
|
+
accessible_modes:
|
17
|
+
- name: 'exec'
|
18
|
+
instructions:
|
19
|
+
- send_input:
|
20
|
+
input: 'disable'
|
21
|
+
- name: 'configuration'
|
22
|
+
instructions:
|
23
|
+
- send_input:
|
24
|
+
input: 'config'
|
25
|
+
- name: 'configuration'
|
26
|
+
prompt_pattern: '^[\w.\-@/:]{1,63}\([\w.\-@/:+]{0,32}\)#$'
|
27
|
+
accessible_modes:
|
28
|
+
- name: 'privileged_exec'
|
29
|
+
instructions:
|
30
|
+
- send_input:
|
31
|
+
input: 'end'
|
32
|
+
failure_indicators:
|
33
|
+
- 'Error input in the position marked by ''^''.'
|
34
|
+
- 'Ambiguous input in the position marked by ''^'''
|
35
|
+
- '% Incomplete command.'
|
36
|
+
on_open_instructions:
|
37
|
+
- enter_mode:
|
38
|
+
requested_mode: 'privileged_exec'
|
39
|
+
- send_input:
|
40
|
+
input: 'terminal page-break disable'
|
41
|
+
on_close_instructions:
|
42
|
+
- enter_mode:
|
43
|
+
requested_mode: 'privileged_exec'
|
44
|
+
- write:
|
45
|
+
input: 'exit'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'privileged_exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^[a-z0-9 .\-_@()/:]{1,63}>$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'privileged_exec'
|
9
|
+
instructions:
|
10
|
+
- send_prompted_input:
|
11
|
+
input: 'enable'
|
12
|
+
prompt_exact: '^[pP]assword:\s?$'
|
13
|
+
response: '__lookup::enable'
|
14
|
+
- name: 'privileged_exec'
|
15
|
+
prompt_pattern: '^[a-z0-9 .\-_@/:]{1,63}#$'
|
16
|
+
accessible_modes:
|
17
|
+
- name: 'exec'
|
18
|
+
instructions:
|
19
|
+
- send_input:
|
20
|
+
input: 'quit'
|
21
|
+
- name: 'configuration'
|
22
|
+
instructions:
|
23
|
+
- send_input:
|
24
|
+
input: 'configure terminal'
|
25
|
+
- name: 'configuration'
|
26
|
+
prompt_pattern: '^[a-z0-9 .\-_@/:]{1,63}\(conf[a-z0-9.\-@/:\+]{0,32}\)#$'
|
27
|
+
accessible_modes:
|
28
|
+
- name: 'privileged_exec'
|
29
|
+
instructions:
|
30
|
+
- send_input:
|
31
|
+
input: 'end'
|
32
|
+
failure_indicators:
|
33
|
+
- 'Error -'
|
34
|
+
- 'Invalid input -'
|
35
|
+
on_open_instructions:
|
36
|
+
- enter_mode:
|
37
|
+
requested_mode: 'privileged_exec'
|
38
|
+
- send_input:
|
39
|
+
input: 'skip-page-display'
|
40
|
+
on_close_instructions:
|
41
|
+
- enter_mode:
|
42
|
+
requested_mode: 'privileged_exec'
|
43
|
+
- write:
|
44
|
+
input: 'exit'
|
45
|
+
ntc_templates_platform: 'ruckus_fastiron'
|
@@ -0,0 +1,64 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'privileged_exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^[a-z0-9]{1,24}>\s*$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'privileged_exec'
|
9
|
+
instructions:
|
10
|
+
- send_input:
|
11
|
+
input: 'enable force'
|
12
|
+
- name: 'privileged_exec'
|
13
|
+
prompt_pattern: '^[a-z0-9]{1,24}#\s*$'
|
14
|
+
accessible_modes:
|
15
|
+
- name: 'exec'
|
16
|
+
instructions:
|
17
|
+
- send_input:
|
18
|
+
input: 'disable'
|
19
|
+
- name: 'configuration'
|
20
|
+
instructions:
|
21
|
+
- send_input:
|
22
|
+
input: 'config'
|
23
|
+
- name: 'debug'
|
24
|
+
instructions:
|
25
|
+
- send_input:
|
26
|
+
input: 'debug'
|
27
|
+
- name: 'ap_mode'
|
28
|
+
instructions:
|
29
|
+
- send_input:
|
30
|
+
input: 'ap-mode'
|
31
|
+
- name: 'configuration'
|
32
|
+
prompt_pattern: '^[a-z0-9]{1,24}\(conf[a-z0-9\-]{0,24}\)#\s*$'
|
33
|
+
accessible_modes:
|
34
|
+
- name: 'privileged_exec'
|
35
|
+
instructions:
|
36
|
+
- send_input:
|
37
|
+
input: 'end'
|
38
|
+
- name: 'debug'
|
39
|
+
prompt_pattern: '^[a-z0-9]{1,24}\(debug\)#\s*$'
|
40
|
+
accessible_modes:
|
41
|
+
- name: 'privileged_exec'
|
42
|
+
instructions:
|
43
|
+
- send_input:
|
44
|
+
input: 'quit'
|
45
|
+
- name: 'ap_mode'
|
46
|
+
prompt_pattern: '^[a-z0-9]{1,24}\(ap-mode\)#\s*$'
|
47
|
+
accessible_modes:
|
48
|
+
- name: 'privileged_exec'
|
49
|
+
instructions:
|
50
|
+
- send_input:
|
51
|
+
input: 'quit'
|
52
|
+
failure_indicators:
|
53
|
+
- 'The command is'
|
54
|
+
- 'is invalid'
|
55
|
+
- 'must consist'
|
56
|
+
on_open_instructions:
|
57
|
+
- enter_mode:
|
58
|
+
requested_mode: 'privileged_exec'
|
59
|
+
on_close_instructions:
|
60
|
+
- enter_mode:
|
61
|
+
requested_mode: 'privileged_exec'
|
62
|
+
- write:
|
63
|
+
input: 'exit'
|
64
|
+
force_in_session_auth: true
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'privileged_exec'
|
4
|
+
modes:
|
5
|
+
- name: 'privileged_exec'
|
6
|
+
prompt_pattern: '^[a-z0-9\-_]{1,48}#\s*$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'configuration'
|
9
|
+
instructions:
|
10
|
+
- send_input:
|
11
|
+
input: 'config'
|
12
|
+
- name: 'configuration'
|
13
|
+
prompt_pattern: '^[a-z0-9\-_]{1,63}\(conf[a-z0-9.\-@/:\+]{0,32}\)#\s*$'
|
14
|
+
accessible_modes:
|
15
|
+
- name: 'privileged_exec'
|
16
|
+
instructions:
|
17
|
+
- send_input:
|
18
|
+
input: 'top; exit'
|
19
|
+
failure_indicators:
|
20
|
+
- 'syntax error:'
|
21
|
+
on_open_instructions:
|
22
|
+
- enter_mode:
|
23
|
+
requested_mode: 'privileged_exec'
|
24
|
+
on_close_instructions:
|
25
|
+
- enter_mode:
|
26
|
+
requested_mode: 'privileged_exec'
|
27
|
+
- write:
|
28
|
+
input: 'q'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$%]\s?+$'
|
3
|
+
default_mode: 'privileged_exec'
|
4
|
+
modes:
|
5
|
+
- name: 'shell'
|
6
|
+
prompt_pattern: '^\[\w+\@\S+ \S+\] \$ ?$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'cli'
|
9
|
+
instructions:
|
10
|
+
- send_input:
|
11
|
+
input: 'cli'
|
12
|
+
- name: 'cli'
|
13
|
+
prompt_pattern: '^\w+@\S+-cli> ?$'
|
14
|
+
accessible_modes:
|
15
|
+
- name: 'shell'
|
16
|
+
instructions:
|
17
|
+
- send_input:
|
18
|
+
input: 'exit'
|
19
|
+
- name: 'configuration'
|
20
|
+
instructions:
|
21
|
+
- send_input:
|
22
|
+
input: 'configure'
|
23
|
+
- name: 'configuration'
|
24
|
+
prompt_pattern: '^\w+@\S+-cli\(\S+\)% ?$'
|
25
|
+
accessible_modes:
|
26
|
+
- name: 'cli'
|
27
|
+
instructions:
|
28
|
+
- send_input:
|
29
|
+
input: 'exit'
|
30
|
+
failure_indicators:
|
31
|
+
- '[error]'
|
32
|
+
on_open_instructions:
|
33
|
+
- enter_mode:
|
34
|
+
requested_mode: 'cli'
|
35
|
+
- send_input:
|
36
|
+
input: 'set complete-on-space false'
|
37
|
+
- send_input:
|
38
|
+
input: 'set paginate false'
|
39
|
+
- send_input:
|
40
|
+
input: 'set screen width 512'
|
41
|
+
on_close_instructions:
|
42
|
+
- enter_mode:
|
43
|
+
requested_mode: 'cli'
|
44
|
+
- write:
|
45
|
+
input: 'logout'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'privileged_exec'
|
4
|
+
modes:
|
5
|
+
- name: 'privileged_exec'
|
6
|
+
prompt_pattern: '^[a-z0-9\.\--_()/:~]{1,1000}@[a-z0-9\.\--_()/:~]{1,1000}\$'
|
7
|
+
accessible_modes:
|
8
|
+
- name: 'configuration'
|
9
|
+
instructions:
|
10
|
+
- send_input:
|
11
|
+
input: 'configure'
|
12
|
+
- name: 'configuration'
|
13
|
+
prompt_pattern: '^[a-z0-9\.\--_()/:~]{1,1000}@[a-z0-9\.\--_()/:~]{1,1000}#'
|
14
|
+
accessible_modes:
|
15
|
+
- name: 'privileged_exec'
|
16
|
+
instructions:
|
17
|
+
- send_input:
|
18
|
+
input: 'exit'
|
19
|
+
failure_indicators:
|
20
|
+
- 'Ambiguous command'
|
21
|
+
- 'Incomplete command'
|
22
|
+
- 'Invalid command'
|
23
|
+
- 'Invalid value'
|
24
|
+
- 'Need to specify the config node to set'
|
25
|
+
- 'Set failed'
|
26
|
+
on_open_instructions:
|
27
|
+
- enter_mode:
|
28
|
+
requested_mode: 'privileged_exec'
|
29
|
+
- send_input:
|
30
|
+
input: 'stty cols 100000'
|
31
|
+
on_close_instructions:
|
32
|
+
- enter_mode:
|
33
|
+
requested_mode: 'privileged_exec'
|
34
|
+
- write:
|
35
|
+
input: 'exit'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
prompt_pattern: '^.*[>#$]\s?+$'
|
3
|
+
default_mode: 'exec'
|
4
|
+
modes:
|
5
|
+
- name: 'exec'
|
6
|
+
prompt_pattern: '^(.*)[a-zA-Z0-9_\-]*[\>#]\s*$'
|
7
|
+
failure_indicators:
|
8
|
+
- 'invalid command'
|
9
|
+
- 'command authorization fail'
|
10
|
+
on_open_instructions:
|
11
|
+
- enter_mode:
|
12
|
+
requested_mode: 'exec'
|
13
|
+
on_close_instructions:
|
14
|
+
- enter_mode:
|
15
|
+
requested_mode: 'exec'
|
16
|
+
- write:
|
17
|
+
input: 'exit'
|
18
|
+
ntc_templates_platform: 'zyxel_dslam'
|
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.17"
|
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
@@ -60,36 +60,6 @@ class LibScrapliSharedMapping:
|
|
60
60
|
]
|
61
61
|
lib.ls_shared_free.restype = None
|
62
62
|
|
63
|
-
self._read: Callable[
|
64
|
-
[
|
65
|
-
DriverPointer,
|
66
|
-
StringPointer,
|
67
|
-
IntPointer,
|
68
|
-
],
|
69
|
-
int,
|
70
|
-
] = lib.ls_shared_read_session
|
71
|
-
lib.ls_shared_read_session.argtypes = [
|
72
|
-
DriverPointer,
|
73
|
-
StringPointer,
|
74
|
-
IntPointer,
|
75
|
-
]
|
76
|
-
lib.ls_shared_read_session.restype = c_int
|
77
|
-
|
78
|
-
self._write: Callable[
|
79
|
-
[
|
80
|
-
DriverPointer,
|
81
|
-
c_char_p,
|
82
|
-
c_bool,
|
83
|
-
],
|
84
|
-
int,
|
85
|
-
] = lib.ls_shared_write_session
|
86
|
-
lib.ls_shared_write_session.argtypes = [
|
87
|
-
DriverPointer,
|
88
|
-
c_char_p,
|
89
|
-
c_bool,
|
90
|
-
]
|
91
|
-
lib.ls_shared_write_session.restype = c_uint8
|
92
|
-
|
93
63
|
def get_poll_fd(self, ptr: DriverPointer) -> c_int:
|
94
64
|
"""
|
95
65
|
Get the operation poll fd from the driver at ptr.
|
@@ -126,6 +96,70 @@ class LibScrapliSharedMapping:
|
|
126
96
|
"""
|
127
97
|
return self._free(ptr)
|
128
98
|
|
99
|
+
|
100
|
+
class LibScrapliSessionMapping:
|
101
|
+
"""
|
102
|
+
Mapping to libscrapli shared (between cli/netconf) object functions mapping.
|
103
|
+
|
104
|
+
Should not be used/called directly.
|
105
|
+
|
106
|
+
Args:
|
107
|
+
N/A
|
108
|
+
|
109
|
+
Returns:
|
110
|
+
None
|
111
|
+
|
112
|
+
Raises:
|
113
|
+
N/A
|
114
|
+
|
115
|
+
"""
|
116
|
+
|
117
|
+
def __init__(self, lib: CDLL) -> None:
|
118
|
+
self._read: Callable[
|
119
|
+
[
|
120
|
+
DriverPointer,
|
121
|
+
StringPointer,
|
122
|
+
IntPointer,
|
123
|
+
],
|
124
|
+
int,
|
125
|
+
] = lib.ls_session_read
|
126
|
+
lib.ls_session_read.argtypes = [
|
127
|
+
DriverPointer,
|
128
|
+
StringPointer,
|
129
|
+
IntPointer,
|
130
|
+
]
|
131
|
+
lib.ls_session_read.restype = c_int
|
132
|
+
|
133
|
+
self._write: Callable[
|
134
|
+
[
|
135
|
+
DriverPointer,
|
136
|
+
c_char_p,
|
137
|
+
c_bool,
|
138
|
+
],
|
139
|
+
int,
|
140
|
+
] = lib.ls_session_write
|
141
|
+
lib.ls_session_write.argtypes = [
|
142
|
+
DriverPointer,
|
143
|
+
c_char_p,
|
144
|
+
c_bool,
|
145
|
+
]
|
146
|
+
lib.ls_session_write.restype = c_uint8
|
147
|
+
|
148
|
+
self._write_and_return: Callable[
|
149
|
+
[
|
150
|
+
DriverPointer,
|
151
|
+
c_char_p,
|
152
|
+
c_bool,
|
153
|
+
],
|
154
|
+
int,
|
155
|
+
] = lib.ls_session_write_and_return
|
156
|
+
lib.ls_session_write_and_return.argtypes = [
|
157
|
+
DriverPointer,
|
158
|
+
c_char_p,
|
159
|
+
c_bool,
|
160
|
+
]
|
161
|
+
lib.ls_session_write_and_return.restype = c_uint8
|
162
|
+
|
129
163
|
def read(self, ptr: DriverPointer, buf: StringPointer, read_size: IntPointer) -> int:
|
130
164
|
"""
|
131
165
|
Read from the session of driver at ptr.
|
@@ -147,7 +181,7 @@ class LibScrapliSharedMapping:
|
|
147
181
|
"""
|
148
182
|
return self._read(ptr, buf, read_size)
|
149
183
|
|
150
|
-
def write(self, ptr: DriverPointer,
|
184
|
+
def write(self, ptr: DriverPointer, input_: c_char_p, redacted: c_bool) -> int:
|
151
185
|
"""
|
152
186
|
Write to the session of driver at ptr.
|
153
187
|
|
@@ -155,7 +189,28 @@ class LibScrapliSharedMapping:
|
|
155
189
|
|
156
190
|
Args:
|
157
191
|
ptr: the ptr to the libscrapli cli/netconf object.
|
158
|
-
|
192
|
+
input_: buffer contents to write during the write operation..
|
193
|
+
redacted: bool indicated if the write contents should be redacted from logs.
|
194
|
+
|
195
|
+
Returns:
|
196
|
+
int: return code, non-zero value indicates an error. technically a c_uint8 converted by
|
197
|
+
ctypes.
|
198
|
+
|
199
|
+
Raises:
|
200
|
+
N/A
|
201
|
+
|
202
|
+
"""
|
203
|
+
return self._write(ptr, input_, redacted)
|
204
|
+
|
205
|
+
def write_and_return(self, ptr: DriverPointer, input_: c_char_p, redacted: c_bool) -> int:
|
206
|
+
"""
|
207
|
+
Write and then send a return to the session of driver at ptr.
|
208
|
+
|
209
|
+
Should (generally) not be called directly/by users.
|
210
|
+
|
211
|
+
Args:
|
212
|
+
ptr: the ptr to the libscrapli cli/netconf object.
|
213
|
+
input_: buffer contents to write during the write operation..
|
159
214
|
redacted: bool indicated if the write contents should be redacted from logs.
|
160
215
|
|
161
216
|
Returns:
|
@@ -166,7 +221,7 @@ class LibScrapliSharedMapping:
|
|
166
221
|
N/A
|
167
222
|
|
168
223
|
"""
|
169
|
-
return self.
|
224
|
+
return self._write_and_return(ptr, input_, redacted)
|
170
225
|
|
171
226
|
|
172
227
|
class LibScrapliMapping:
|
@@ -196,6 +251,7 @@ class LibScrapliMapping:
|
|
196
251
|
def __init__(self) -> None:
|
197
252
|
self.lib = CDLL(get_libscrapli_path())
|
198
253
|
self.shared_mapping = LibScrapliSharedMapping(self.lib)
|
254
|
+
self.session_mapping = LibScrapliSessionMapping(self.lib)
|
199
255
|
self.cli_mapping = LibScrapliCliMapping(self.lib)
|
200
256
|
self.netconf_mapping = LibScrapliNetconfMapping(self.lib)
|
201
257
|
self.options_mapping = LibScrapliOptionsMapping(self.lib)
|