Skip to content

Commit c41e3d5

Browse files
author
Taarini Sarath Chander
committed
Releasing v24.9
1 parent 87005c4 commit c41e3d5

File tree

15 files changed

+222
-99
lines changed

15 files changed

+222
-99
lines changed

docs/changelog/2024/September.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
September 2024
2+
==========
3+
4+
September 24 - Unicon v24.9
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v24.9
13+
``unicon``, v24.9
14+
15+
16+
17+
18+
Changelogs
19+
^^^^^^^^^^
20+
--------------------------------------------------------------------------------
21+
Fix
22+
--------------------------------------------------------------------------------
23+
24+
* backend.spawn0
25+
* Modified RawSpawn
26+
* Added check for when a decode error occurs n amount of times
27+
28+
* unicon
29+
* topology
30+
* Fixed logic for proxy connection.
31+
* sshtunnel
32+
* Added -o EnableEscapeCommandline=yes to ssh-options.
33+
34+
* unicon.bases
35+
* Added message argument to log_service_call
36+
37+
38+
--------------------------------------------------------------------------------
39+
New
40+
--------------------------------------------------------------------------------
41+
42+
* generic
43+
* Added upwards error propagation for decode errors
44+
45+

docs/changelog/2024/august.rst

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -36,57 +36,3 @@ Features and Bug Fixes:
3636

3737
Changelogs
3838
^^^^^^^^^^
39-
--------------------------------------------------------------------------------
40-
Fix
41-
--------------------------------------------------------------------------------
42-
43-
* unicon.bases
44-
* Added message argument to log_service_call
45-
46-
* unicon.statemachine
47-
* Modified Exception handling, propagate authentication failures
48-
49-
* unicon
50-
* topology
51-
* Fixed logic for proxy connection.
52-
* sshtunnel
53-
* Added -o EnableEscapeCommandline=yes to ssh-options.
54-
55-
* unicon.eal.backend
56-
* Modified telnet backend
57-
* improved option negotiation
58-
* Added informational RTT log message
59-
60-
61-
--------------------------------------------------------------------------------
62-
New
63-
--------------------------------------------------------------------------------
64-
65-
* unicon.adapter
66-
* Modified topology adapter to support enxr
67-
68-
* unicon.core.errors
69-
* Add new exception LearnTokenError
70-
71-
* unicon.bases
72-
* Update exception handling to raise LearnTokenError without closing connection
73-
74-
75-
--------------------------------------------------------------------------------
76-
New
77-
--------------------------------------------------------------------------------
78-
79-
* iosxe
80-
* Modified Rommon service
81-
* Allowing for a config-register parameter to the rommon service
82-
83-
84-
--------------------------------------------------------------------------------
85-
Fix
86-
--------------------------------------------------------------------------------
87-
88-
* unicon.plugins.generic
89-
* Modified password_handler
90-
* Have it check for tacacs_password first
91-
92-

docs/changelog/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Changelog
44
.. toctree::
55
:maxdepth: 2
66

7+
2024/September
78
2024/august
89
2024/july
910
2024/june
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
September 2024
2+
==========
3+
4+
September 24 - Unicon.Plugins v24.9
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v24.9
13+
``unicon``, v24.9
14+
15+
16+
17+
18+
Changelogs
19+
^^^^^^^^^^
20+
--------------------------------------------------------------------------------
21+
Fix
22+
--------------------------------------------------------------------------------
23+
24+
* iosxr
25+
* Added support for APIC patterns
26+
27+
* iosxe
28+
* Update config prompt pattern to support CA cert map
29+
30+
* generic
31+
* Update execute() service log message to include device alias
32+
* Add parse method to bash_console context manager with abstraction fallback to linux os
33+
34+
35+
--------------------------------------------------------------------------------
36+
Add
37+
--------------------------------------------------------------------------------
38+
39+
* apic plugin
40+
* Added Regex in post_service in Execute to remove extra junk values.
41+
42+

docs/changelog_plugins/2024/august.rst

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,3 @@ Features and Bug Fixes:
3636

3737
Changelogs
3838
^^^^^^^^^^
39-
--------------------------------------------------------------------------------
40-
Add
41-
--------------------------------------------------------------------------------
42-
43-
* pid_tokens
44-
* add pid entry for ir1800 device
45-
46-
47-
--------------------------------------------------------------------------------
48-
Fix
49-
--------------------------------------------------------------------------------
50-
51-
* generic
52-
* Update execute() service log message to include device alias
53-
* Update unittests to handle authentication exceptions
54-
* Update unittests for token learning
55-
56-
* iosxr
57-
* Update more prompt handling to support (END) prompt
58-
59-
60-
--------------------------------------------------------------------------------
61-
New
62-
--------------------------------------------------------------------------------
63-
64-
* iosxr
65-
* New `monitor` service for IOS-XR with support for "monitor interface" command.
66-
67-

docs/changelog_plugins/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Plugins Changelog
44
.. toctree::
55
:maxdepth: 2
66

7-
2024/september
7+
2024/September
88
2024/august
99
2024/july
1010
2024/june

src/unicon/plugins/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '24.8'
1+
__version__ = '24.9'
22

33
supported_chassis = [
44
'single_rp',

src/unicon/plugins/apic/patterns.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
class ApicPatterns(GenericPatterns):
77
def __init__(self):
88
super().__init__()
9-
self.enable_prompt = r'^(.*?)(%N)#'
10-
self.config_prompt = r'^(.*?)(%N)\(config.*\)#'
11-
self.shell_prompt = r'^(.*?)(\[[-\.\w]+@(%N)\s+.*?\]#)\s*(\x1b\S+)?$'
9+
self.enable_prompt = r'^(.*?)((\x1b\S+)?\x00)*(%N)#\s*(\x1b\S+)?$'
10+
self.config_prompt = r'^(.*?)((\x1b\S+)?\x00)*(%N)\(config.*\)#\s*(\x1b\S+)?$'
11+
self.shell_prompt = r'^(.*?)((\x1b\S+)?\x00)*\[[-\.\w]+@((%N)\s+.*?\]#)\s*(\x1b\S+)?$'
1212

1313

1414
class ApicSetupPatterns(object):

src/unicon/plugins/apic/service_implementation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def post_service(self, *args, clean_output=True, **kwargs):
5151
output = self.result
5252
output = utils.remove_ansi_escape_codes(output)
5353
output = re.sub('.\x08', '', output)
54-
output = re.sub(r'%\s+\r ', '', output)
54+
output = re.sub(r'\x00+', '', output)
55+
output = re.sub(r'%(\s+\r )?', '', output)
56+
output = re.sub(r'[\r\n]+', '', output)
5557
self.result = output
5658

5759

src/unicon/plugins/generic/service_implementation.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
from unicon.bases.routers.services import BaseService
3030
from unicon.core.errors import SubCommandFailure, StateMachineError, \
31-
CopyBadNetworkError, TimeoutError
31+
CopyBadNetworkError, TimeoutError, UniconBackendDecodeError
3232
from unicon.eal.dialogs import Dialog
3333
from unicon.eal.dialogs import Statement
3434
from unicon.plugins.generic.statements import (
@@ -509,7 +509,7 @@ def call_service(self, target=None, command='', *args, **kwargs):
509509
try:
510510
sm.go_to(self.start_state,
511511
spawn,
512-
context=handle.context,
512+
context=handle.context,
513513
timeout=timeout)
514514
except Exception as err:
515515
raise SubCommandFailure("Failed to Bring device to Enable State",
@@ -736,7 +736,7 @@ def call_service(self, command=[], # noqa: C901
736736
self.result = dialog_match.match_output
737737
self.result = self.get_service_result()
738738
sm.detect_state(con.spawn, con.context)
739-
except StateMachineError:
739+
except (StateMachineError, UniconBackendDecodeError):
740740
raise
741741
except Exception as err:
742742
raise SubCommandFailure("Command execution failed", err) from err
@@ -2618,6 +2618,20 @@ def __exit__(self, exc_type, exc_value, exc_tb):
26182618
# do not suppress
26192619
return False
26202620

2621+
def parse(self, *args, **kwargs):
2622+
abstract_args = kwargs.setdefault('abstract', {})
2623+
device = getattr(self.conn, 'device', None)
2624+
if device:
2625+
abstract_args.update(dict(
2626+
os=[device.os, 'linux'],
2627+
platform=device.platform,
2628+
model=device.model,
2629+
pid=device.pid,
2630+
))
2631+
return self.conn.device.parse(*args, **kwargs)
2632+
else:
2633+
self.conn.log.warning('No device object, parse method unavailable')
2634+
26212635
def __getattr__(self, attr):
26222636
if attr in ('execute', 'sendline', 'send', 'expect'):
26232637
return getattr(self.conn, attr)

src/unicon/plugins/iosxe/patterns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self):
2929
self.maintenance_mode_prompt = \
3030
r'^(.*?)(WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(standby\))?(-stby)?(-standby)?(\(boot\))?\(maint-mode\)#[\s\x07]*$'
3131
self.press_enter = ReloadPatterns().press_enter
32-
self.config_prompt = r'^(.*)\((?!.*pki-hexmode).*(con|cfg|ipsec-profile|ca-trustpoint|cs-server|ca-profile|gkm-local-server|cloud|host-list|config-gkm-group|gkm-sa-ipsec|gdoi-coop-ks-config|wsma|enforce-rule)\S*\)#\s?$'
32+
self.config_prompt = r'^(.*)\((?!.*pki-hexmode).*(con|cfg|ipsec-profile|ca-trustpoint|ca-certificate-map|cs-server|ca-profile|gkm-local-server|cloud|host-list|config-gkm-group|gkm-sa-ipsec|gdoi-coop-ks-config|wsma|enforce-rule)\S*\)#\s?$'
3333

3434

3535
self.config_pki_prompt = r'^(.*)\(config-pki-hexmode\)#\s?$'

src/unicon/plugins/tests/mock_data/apic/apic_mock_data.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ apic_connect:
99
apic_exec:
1010
prompt: APC#
1111
commands: &exec_commands
12+
"show firmware upgrade status": |
13+
\r\r\n ID Pod ID Name Serial Number IP Address Role State LastUpdMsgId\r\n
14+
-------------------------------------------------------------------------------------
15+
\r\n 101 1 reg2_leaf1 FDO241909ZG 10.0.120.64/32 leaf active 0\r\n 102 1 reg2_leaf2
16+
FDO20510HAS 10.0.120.66/32 leaf active 0\r\n 201 1 reg2_spine1 FDO26450SH4 10.0.120.65/32 spine
17+
active 0\r\n\r\nTotal 3 nodes\r\n\r\n%
1218
"terminal length 0": ""
1319
"terminal width 0": ""
1420
"show version": |2
@@ -39,6 +45,10 @@ apic_hostname_with_escape_codes:
3945
prompt: "%1B[0m%1B[27m%1B[24m%1B[JAPC-0001-2001# "
4046
commands: *exec_commands
4147

48+
apic_hostname_with_escape_codes2:
49+
prompt: "\x1b[0m\x00\x00\x1b[m\x00\x00\x1b[m\x00\x00\x1b[J\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00apic1# \x1b[K\x00\x00\x00\x1b[?1h\x1b=\x1b[?2004h"
50+
commands: *exec_commands
51+
4252

4353
apic_restart_confirm:
4454
prompt: "This command will restart this device, Proceed? [y/N] "

src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,10 @@ config_pki_hexmode:
567567
general_bash:
568568
prompt: "[%N_RP_0:/]$"
569569
commands:
570+
"ls -l": |
571+
total 55000
572+
lrwxrwxrwx. 1 root root 7 Sep 10 2024 bin -> usr/bin
573+
drwxr-xr-x. 2 root root 60 Jan 9 20:41 boot
570574
"df /bootflash/": |
571575
Filesystem 1K-blocks Used Available Use% Mounted on
572576
/dev/sda1 5974888 3569476 2101900 63% /bootflash
@@ -581,6 +585,14 @@ general_act_reply:
581585
"y":
582586
new_state: general_bash
583587

588+
589+
general_config_certificate_map:
590+
prompt: "%N(ca-certificate-map)#"
591+
commands:
592+
"end":
593+
new_state: general_enable
594+
595+
584596
general_config_crypto_trustpoint:
585597
prompt: "%N(ca-trustpoint)#"
586598
commands:

0 commit comments

Comments
 (0)