Skip to content

Commit

Permalink
Releasing v24.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Taarini Sarath Chander committed Sep 25, 2024
1 parent 87005c4 commit c41e3d5
Show file tree
Hide file tree
Showing 15 changed files with 222 additions and 99 deletions.
45 changes: 45 additions & 0 deletions docs/changelog/2024/September.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
September 2024
==========

September 24 - Unicon v24.9
------------------------



.. csv-table:: Module Versions
:header: "Modules", "Versions"

``unicon.plugins``, v24.9
``unicon``, v24.9




Changelogs
^^^^^^^^^^
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------

* backend.spawn0
* Modified RawSpawn
* Added check for when a decode error occurs n amount of times

* unicon
* topology
* Fixed logic for proxy connection.
* sshtunnel
* Added -o EnableEscapeCommandline=yes to ssh-options.

* unicon.bases
* Added message argument to log_service_call


--------------------------------------------------------------------------------
New
--------------------------------------------------------------------------------

* generic
* Added upwards error propagation for decode errors


54 changes: 0 additions & 54 deletions docs/changelog/2024/august.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,57 +36,3 @@ Features and Bug Fixes:

Changelogs
^^^^^^^^^^
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------

* unicon.bases
* Added message argument to log_service_call

* unicon.statemachine
* Modified Exception handling, propagate authentication failures

* unicon
* topology
* Fixed logic for proxy connection.
* sshtunnel
* Added -o EnableEscapeCommandline=yes to ssh-options.

* unicon.eal.backend
* Modified telnet backend
* improved option negotiation
* Added informational RTT log message


--------------------------------------------------------------------------------
New
--------------------------------------------------------------------------------

* unicon.adapter
* Modified topology adapter to support enxr

* unicon.core.errors
* Add new exception LearnTokenError

* unicon.bases
* Update exception handling to raise LearnTokenError without closing connection


--------------------------------------------------------------------------------
New
--------------------------------------------------------------------------------

* iosxe
* Modified Rommon service
* Allowing for a config-register parameter to the rommon service


--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------

* unicon.plugins.generic
* Modified password_handler
* Have it check for tacacs_password first


1 change: 1 addition & 0 deletions docs/changelog/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
.. toctree::
:maxdepth: 2

2024/September
2024/august
2024/july
2024/june
Expand Down
42 changes: 42 additions & 0 deletions docs/changelog_plugins/2024/September.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
September 2024
==========

September 24 - Unicon.Plugins v24.9
------------------------



.. csv-table:: Module Versions
:header: "Modules", "Versions"

``unicon.plugins``, v24.9
``unicon``, v24.9




Changelogs
^^^^^^^^^^
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------

* iosxr
* Added support for APIC patterns

* iosxe
* Update config prompt pattern to support CA cert map

* generic
* Update execute() service log message to include device alias
* Add parse method to bash_console context manager with abstraction fallback to linux os


--------------------------------------------------------------------------------
Add
--------------------------------------------------------------------------------

* apic plugin
* Added Regex in post_service in Execute to remove extra junk values.


29 changes: 0 additions & 29 deletions docs/changelog_plugins/2024/august.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,3 @@ Features and Bug Fixes:

Changelogs
^^^^^^^^^^
--------------------------------------------------------------------------------
Add
--------------------------------------------------------------------------------

* pid_tokens
* add pid entry for ir1800 device


--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------

* generic
* Update execute() service log message to include device alias
* Update unittests to handle authentication exceptions
* Update unittests for token learning

* iosxr
* Update more prompt handling to support (END) prompt


--------------------------------------------------------------------------------
New
--------------------------------------------------------------------------------

* iosxr
* New `monitor` service for IOS-XR with support for "monitor interface" command.


2 changes: 1 addition & 1 deletion docs/changelog_plugins/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Plugins Changelog
.. toctree::
:maxdepth: 2

2024/september
2024/September
2024/august
2024/july
2024/june
Expand Down
2 changes: 1 addition & 1 deletion src/unicon/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '24.8'
__version__ = '24.9'

supported_chassis = [
'single_rp',
Expand Down
6 changes: 3 additions & 3 deletions src/unicon/plugins/apic/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
class ApicPatterns(GenericPatterns):
def __init__(self):
super().__init__()
self.enable_prompt = r'^(.*?)(%N)#'
self.config_prompt = r'^(.*?)(%N)\(config.*\)#'
self.shell_prompt = r'^(.*?)(\[[-\.\w]+@(%N)\s+.*?\]#)\s*(\x1b\S+)?$'
self.enable_prompt = r'^(.*?)((\x1b\S+)?\x00)*(%N)#\s*(\x1b\S+)?$'
self.config_prompt = r'^(.*?)((\x1b\S+)?\x00)*(%N)\(config.*\)#\s*(\x1b\S+)?$'
self.shell_prompt = r'^(.*?)((\x1b\S+)?\x00)*\[[-\.\w]+@((%N)\s+.*?\]#)\s*(\x1b\S+)?$'


class ApicSetupPatterns(object):
Expand Down
4 changes: 3 additions & 1 deletion src/unicon/plugins/apic/service_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def post_service(self, *args, clean_output=True, **kwargs):
output = self.result
output = utils.remove_ansi_escape_codes(output)
output = re.sub('.\x08', '', output)
output = re.sub(r'%\s+\r ', '', output)
output = re.sub(r'\x00+', '', output)
output = re.sub(r'%(\s+\r )?', '', output)
output = re.sub(r'[\r\n]+', '', output)
self.result = output


Expand Down
20 changes: 17 additions & 3 deletions src/unicon/plugins/generic/service_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from unicon.bases.routers.services import BaseService
from unicon.core.errors import SubCommandFailure, StateMachineError, \
CopyBadNetworkError, TimeoutError
CopyBadNetworkError, TimeoutError, UniconBackendDecodeError
from unicon.eal.dialogs import Dialog
from unicon.eal.dialogs import Statement
from unicon.plugins.generic.statements import (
Expand Down Expand Up @@ -509,7 +509,7 @@ def call_service(self, target=None, command='', *args, **kwargs):
try:
sm.go_to(self.start_state,
spawn,
context=handle.context,
context=handle.context,
timeout=timeout)
except Exception as err:
raise SubCommandFailure("Failed to Bring device to Enable State",
Expand Down Expand Up @@ -736,7 +736,7 @@ def call_service(self, command=[], # noqa: C901
self.result = dialog_match.match_output
self.result = self.get_service_result()
sm.detect_state(con.spawn, con.context)
except StateMachineError:
except (StateMachineError, UniconBackendDecodeError):
raise
except Exception as err:
raise SubCommandFailure("Command execution failed", err) from err
Expand Down Expand Up @@ -2618,6 +2618,20 @@ def __exit__(self, exc_type, exc_value, exc_tb):
# do not suppress
return False

def parse(self, *args, **kwargs):
abstract_args = kwargs.setdefault('abstract', {})
device = getattr(self.conn, 'device', None)
if device:
abstract_args.update(dict(
os=[device.os, 'linux'],
platform=device.platform,
model=device.model,
pid=device.pid,
))
return self.conn.device.parse(*args, **kwargs)
else:
self.conn.log.warning('No device object, parse method unavailable')

def __getattr__(self, attr):
if attr in ('execute', 'sendline', 'send', 'expect'):
return getattr(self.conn, attr)
Expand Down
2 changes: 1 addition & 1 deletion src/unicon/plugins/iosxe/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self):
self.maintenance_mode_prompt = \
r'^(.*?)(WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(standby\))?(-stby)?(-standby)?(\(boot\))?\(maint-mode\)#[\s\x07]*$'
self.press_enter = ReloadPatterns().press_enter
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?$'
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?$'


self.config_pki_prompt = r'^(.*)\(config-pki-hexmode\)#\s?$'
Expand Down
10 changes: 10 additions & 0 deletions src/unicon/plugins/tests/mock_data/apic/apic_mock_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ apic_connect:
apic_exec:
prompt: APC#
commands: &exec_commands
"show firmware upgrade status": |
\r\r\n ID Pod ID Name Serial Number IP Address Role State LastUpdMsgId\r\n
-------------------------------------------------------------------------------------
\r\n 101 1 reg2_leaf1 FDO241909ZG 10.0.120.64/32 leaf active 0\r\n 102 1 reg2_leaf2
FDO20510HAS 10.0.120.66/32 leaf active 0\r\n 201 1 reg2_spine1 FDO26450SH4 10.0.120.65/32 spine
active 0\r\n\r\nTotal 3 nodes\r\n\r\n%
"terminal length 0": ""
"terminal width 0": ""
"show version": |2
Expand Down Expand Up @@ -39,6 +45,10 @@ apic_hostname_with_escape_codes:
prompt: "%1B[0m%1B[27m%1B[24m%1B[JAPC-0001-2001# "
commands: *exec_commands

apic_hostname_with_escape_codes2:
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"
commands: *exec_commands


apic_restart_confirm:
prompt: "This command will restart this device, Proceed? [y/N] "
Expand Down
12 changes: 12 additions & 0 deletions src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,10 @@ config_pki_hexmode:
general_bash:
prompt: "[%N_RP_0:/]$"
commands:
"ls -l": |
total 55000
lrwxrwxrwx. 1 root root 7 Sep 10 2024 bin -> usr/bin
drwxr-xr-x. 2 root root 60 Jan 9 20:41 boot
"df /bootflash/": |
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 5974888 3569476 2101900 63% /bootflash
Expand All @@ -581,6 +585,14 @@ general_act_reply:
"y":
new_state: general_bash


general_config_certificate_map:
prompt: "%N(ca-certificate-map)#"
commands:
"end":
new_state: general_enable


general_config_crypto_trustpoint:
prompt: "%N(ca-trustpoint)#"
commands:
Expand Down
Loading

0 comments on commit c41e3d5

Please sign in to comment.