Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing v24.4 #99

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
group: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v2
Expand Down
102 changes: 102 additions & 0 deletions docs/changelog/2024/april.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
April 2024
==========

- Unicon v24.4
------------------------



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

``unicon.plugins``, v24.4
``unicon``, v24.4

Install Instructions
^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

bash$ pip install unicon.plugins
bash$ pip install unicon

Upgrade Instructions
^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

bash$ pip install --upgrade unicon.plugins
bash$ pip install --upgrade unicon

Features and Bug Fixes:
^^^^^^^^^^^^^^^^^^^^^^^




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

* sshutils
* add_tunnel
* add logic to handle allocating ports based on the tunnel type.

* unicon
* Bases/Routers
* Do learn hostname if only the learn pattern is in the statmachine patterns.
* Update the connection init logic.
* Patterns
* Add Bad secrets to bad_passwords pattern.

* unicon/bases
* Router/connection_provider
* Update logic to not learn the hostname when the device is in shell mode.


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

* unicon
* Connection provider
* Add args and kwargs for connect function


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

* iosxe
* statemachine
* add pki_hexmode state for iosxe

* iosxr
* Added get_commit_cmd
* Added support for 'commit best-effort' command.

* stackresetstandbyrp
* Added iosxe/stack StackResetStandbyRP
* iosxe/stack service reset_standby_rp
* Check whole stack readiness to decide the result of reset_standby_rp


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

* iosxr/spitfire
* Modified Prompt Recovery Commands
* Updated prompt recovery commands to user CTRL+C.

* iosxe
* connection provider
* Get the pattern for the enable statment from state machine for handeling device prompts after

* resetstandbyrp
* Modified generic ResetStandbyRP
* Fixed to handle the optinal argument "reply"


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/april
2024/march
2024/february
2024/january
Expand Down
67 changes: 67 additions & 0 deletions docs/changelog_plugins/2024/april.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
April 2024
==========

- Unicon.Plugins v24.4
------------------------



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

``unicon.plugins``, v24.4
``unicon``, v24.4

Install Instructions
^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

bash$ pip install unicon.plugins
bash$ pip install unicon

Upgrade Instructions
^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

bash$ pip install --upgrade unicon.plugins
bash$ pip install --upgrade unicon

Features and Bug Fixes:
^^^^^^^^^^^^^^^^^^^^^^^




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

* generic
* Use stricter pattern for enable password
* Update standby locked pattern
* Add connection closed statement to execute service
* Add standby locked state to single RP statemachine
* Update escape character handler timing settings
* Revert adding connection closed statement to execute service
* Update config transition logic
* Add `result_check_per_command` option to disable/enable error checking per configuration command

* iosxe
* Fix operating mode logic
* More prompt handling updated
* Added statements to token discovery dialog

* iosxr
* Add standby locked state to single RP statemachine
* Change default behavior of ``configure()`` service, error check after all commands by default
* Add handler for `show configuration failed` errors to ``configure()`` service.
* Add `SHOW_CONFIG_FAILED_CMD` setting for command to use, default `show configuration failed`

* other
* update pid token list


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

2024/april
2024/march
2024/february
2024/january
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.3'
__version__ = '24.4'

supported_chassis = [
'single_rp',
Expand Down
2 changes: 1 addition & 1 deletion src/unicon/plugins/cheetah/ap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ class ApSingleRpConnection(BaseSingleRpConnection):
state_machine_class = ApSingleRpStateMachine
connection_provider_class = ApSingleRpConnectionProvider
subcommand_list = ApServiceList
settings = ApSettings()
settings = ApSettings()
2 changes: 1 addition & 1 deletion src/unicon/plugins/cheetah/ap/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class CheetahAPPatterns(GenericPatterns):

def __init__(self):
super().__init__()
self.ap_shell_prompt = r'^(.*?)\w+:\/(.*?)#\s?$'
self.ap_shell_prompt = r'^(.*?)\w+:\/(.*?)#\s?$'
2 changes: 1 addition & 1 deletion src/unicon/plugins/cheetah/ap/service_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def call_service(self, command=None, reply=Dialog([]), timeout=None, *args,
class Reload(GenericReload):
def __init__(self, connection, context, **kwargs):
super().__init__(connection, context, **kwargs)
self.dialog = self.dialog + Dialog(ap_reload_list)
self.dialog = self.dialog + Dialog(ap_reload_list)
3 changes: 1 addition & 2 deletions src/unicon/plugins/cheetah/ap/service_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
class APReloadPatterns(ReloadPatterns):
def __init__(self):
super().__init__()
self.ap_shell_prompt = r'^Proceed with reload (command (\W+cold\W)?)?(\?) (\[)+confirm+(\])$'

self.ap_shell_prompt = r'^Proceed with reload (command (\W+cold\W)?)?(\?) (\[)+confirm+(\])$'
5 changes: 1 addition & 4 deletions src/unicon/plugins/cheetah/ap/service_statement.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""
Module:
unicon.plugins.generic

Authors:
pyATS TEAM ([email protected], [email protected])

Description:
Module for defining all Services Statement, handlers(callback) and Statement
list for service dialog would be defined here.
Expand Down Expand Up @@ -34,5 +32,4 @@ def send_response(spawn, response=""):
continue_timer=False)

ap_reload_list = list(reload_statement_list)
ap_reload_list.insert(0,ap_shell_prompt)

ap_reload_list.insert(0,ap_shell_prompt)
2 changes: 1 addition & 1 deletion src/unicon/plugins/cheetah/ap/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ def __init__(self):
'terminal width 0',
'show version',
'logging console disable',
]
]
2 changes: 1 addition & 1 deletion src/unicon/plugins/cheetah/ap/statemachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def create(self):
self.add_path(shell_to_enable)
self.add_path(enable_to_disable)

self.add_default_statements(default_statement_list)
self.add_default_statements(default_statement_list)
5 changes: 3 additions & 2 deletions src/unicon/plugins/generic/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self):
self.rommon_prompt = r'^(.*?)(rommon[\s\d]*>|switch:)\s?$'
# self.standby_enable_prompt = r'^(.*?)(RouterRP-standby|%N-standby|%N-sdby|%N\(standby\))#\s?$'
# self.standby_disable_prompt = r'^(.*?)(RouterRP-standby|%N-standby|%N-sdby|%N\(standby\))>\s?$'
self.standby_locked = r'[S|s]tandby console disabled'
self.standby_locked = r'^.*?([S|s]tandby console disabled|This \(D\)RP Node is not ready or active for login \/configuration.*)'
self.shell_prompt = r'^(.*)%N\(shell\)>\s?'

self.disconnect_message = r'Received disconnect from .*:'
Expand All @@ -56,7 +56,7 @@ def __init__(self):

self.passphrase_prompt = r'^.*Enter passphrase for key .*?:\s*?'

self.learn_os_prompt = r'^(.*?([>\$~%]|[^#\s]#|~ #|~/|^admin:|^#)\s?(\x1b\S+)?)$|(^.*This \(D\)RP Node is not ready or active for login \/configuration.*)'
self.learn_os_prompt = r'^(.*?([>\$~%]|[^#\s]#|~ #|~/|^admin:|^#)\s?(\x1b\S+)?)$'

self.sudo_password_prompt = r'^.*(\[sudo\] password for .*?:|This is your UNIX password:)\s*$'

Expand All @@ -74,6 +74,7 @@ def __init__(self):
self.config_start = r'Enter configuration commands, one per line\.\s+End with CNTL/Z\.\s*$'

self.enable_secret = r'^.*?(Enter|Confirm) enable secret:\s*$'
self.enable_password = r'^.*?enable[\r\n]*.*?[Pp]assword( for )?(\S+)?: ?$'

self.enter_your_selection_2 = r'^.*?Enter your selection( \[2])?:\s*$'

Expand Down
29 changes: 19 additions & 10 deletions src/unicon/plugins/generic/service_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,8 @@ class Configure(BaseService):
0 means to send all commands in a single chunk
bulk_chunk_sleep: sleep between sending command chunks,
default is 0.5 sec
result_check_per_command: boolean option, check results after
each command (default: True)

Returns:
command output on Success, raise SubCommandFailure on failure
Expand All @@ -835,6 +837,7 @@ def __init__(self, connection, context, **kwargs):
self.bulk_chunk_lines = connection.settings.BULK_CONFIG_CHUNK_LINES
self.bulk_chunk_sleep = connection.settings.BULK_CONFIG_CHUNK_SLEEP
self.valid_transition_commands = ['end', 'exit']
self.valid_transition_states = ['config_pki_hexmode']
self.state_change_matched_retries = connection.settings.EXECUTE_STATE_CHANGE_MATCH_RETRIES
self.state_change_matched_retry_sleep = connection.settings.EXECUTE_STATE_CHANGE_MATCH_RETRY_SLEEP
self.__dict__.update(kwargs)
Expand Down Expand Up @@ -877,9 +880,11 @@ def call_service(self, # noqa: C901
bulk=None,
bulk_chunk_lines=None,
bulk_chunk_sleep=None,
result_check_per_command=True,
*args,
**kwargs):

self.result_check_per_command = result_check_per_command
con = self.connection
sm = self.get_sm()
handle = self.get_handle(target)
Expand Down Expand Up @@ -910,7 +915,9 @@ def call_service(self, # noqa: C901

def config_state_change(spawn, from_state, sm):
last_cmd = spawn.last_sent.strip()
if last_cmd not in self.valid_transition_commands:
# check if the last command is not in the list of valid commands and the state is not in the list of valid states
# for transition
if last_cmd not in self.valid_transition_commands and from_state.name not in self.valid_transition_states:
invalid_state_change_action(
spawn, err_state=from_state, sm=sm)
else:
Expand Down Expand Up @@ -1018,14 +1025,15 @@ def process_dialog_on_handle(self, handle, dialog, timeout):
hostname=handle.hostname,
result_match=cmd_result)
self.result += cmd_result
try:
self.get_service_result()
except SubCommandFailure:
# Go to end state after command failure,
handle.state_machine.go_to(self.end_state,
handle.spawn,
context=self.context)
raise
if self.result_check_per_command:
try:
self.get_service_result()
except SubCommandFailure:
# Go to end state after command failure,
handle.state_machine.go_to(self.end_state,
handle.spawn,
context=self.context)
raise

def update_hostname_if_needed(self, cmd_list):
for cmd in cmd_list:
Expand Down Expand Up @@ -2471,7 +2479,8 @@ def call_service(self, command='redundancy reload peer', # noqa: C901
raise SubCommandFailure("Standby found but not in the expected state")

dialog = self.service_dialog(handle=con.active,
service_dialog=self.dialog)
service_dialog=self.dialog+reply)

# Issue standby reset command
con.active.spawn.sendline(command)
try:
Expand Down
4 changes: 2 additions & 2 deletions src/unicon/plugins/generic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ def __init__(self):

# When connecting to a device via telnet, how long (in seconds)
# to pause before checking the spawn buffer
self.ESCAPE_CHAR_CHATTY_TERM_WAIT = 0.25
self.ESCAPE_CHAR_CHATTY_TERM_WAIT = 0.5

# number of cycles to wait for if the terminal is still chatty
self.ESCAPE_CHAR_CHATTY_TERM_WAIT_RETRIES = 12

# prompt wait delay
self.ESCAPE_CHAR_PROMPT_WAIT = 0.5
self.ESCAPE_CHAR_PROMPT_WAIT = 1

# prompt wait retries
# (wait time: 0.5, 1, 1.5, 2, 2.5, 3, 3.5 == total wait: 14.0s)
Expand Down
Loading
Loading