Skip to content

Commit

Permalink
Merge pull request #103 from CiscoTestAutomation/release_24.8
Browse files Browse the repository at this point in the history
Release 24.8
  • Loading branch information
domachad authored Sep 4, 2024
2 parents 3f86be3 + 7c39c85 commit 87005c4
Show file tree
Hide file tree
Showing 30 changed files with 801 additions and 242 deletions.
92 changes: 92 additions & 0 deletions docs/changelog/2024/august.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
August 2024
==========

August 27 - Unicon v24.8
------------------------



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

``unicon.plugins``, v24.8
``unicon``, v24.8

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
--------------------------------------------------------------------------------

* 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/august
2024/july
2024/june
2024/may
Expand Down
67 changes: 67 additions & 0 deletions docs/changelog_plugins/2024/august.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
August 2024
==========

August 27 - Unicon.Plugins v24.8
------------------------



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

``unicon.plugins``, v24.8
``unicon``, v24.8

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
^^^^^^^^^^
--------------------------------------------------------------------------------
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: 2 additions & 0 deletions docs/changelog_plugins/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Plugins Changelog
.. toctree::
:maxdepth: 2

2024/september
2024/august
2024/july
2024/june
2024/may
Expand Down
91 changes: 86 additions & 5 deletions docs/user_guide/services/iosxr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,87 @@ Has same arguments as generic configure service.
output = device.configure_exclusive('logging console disable')
monitor
-------

The monitor service can be used with the `monitor interface` command. You can
also pass `action` commands to execute while the monitor is running. For
example `clear` (lowercase) will send the key associated with the action as
shown in the output, i.e. Clear="c" will send "c" for action "clear".

=============== ====================== ==================================================
Argument Type Description
=============== ====================== ==================================================
command str monitor command to execute ('monitor' is optional)
or action to send (e.g. 'clear')
reply Dialog additional dialog
timeout int (default 60 sec) timeout value for the overall interaction.
=============== ====================== ==================================================

Example:

.. code-block:: python
rtr.monitor('monitor interface GigabitEthernet0/0/0/0')
# execute `monitor interface`
rtr.monitor('interface')
# tail the output for 10 seconds
rtr.monitor.tail(timeout=10)
output = rtr.monitor.stop()
# send an action to the device
rtr.monitor('clear')
rtr.monitor('bytes')
monitor.get_buffer
~~~~~~~~~~~~~~~~~~

To get the output that has been buffered by the monitor service, you can use the `monitor.get_buffer`
method. This will return all output from the start of the monitor command until the moment of execution
of this service.

===================== ====================== ===================================================
Argument Type Description
===================== ====================== ===================================================
truncate bool (default: False) If true, will truncate the current buffer.
===================== ====================== ===================================================

.. code-block:: python
output = rtr.monitor.get_buffer()
monitor.tail
~~~~~~~~~~~~

The monitor.tail method can be used to monitor the output logging after the ``monitor`` service
has been used to start the monitor.

===================== ====================== ===================================================
Argument Type Description
===================== ====================== ===================================================
timeout int (seconds) maximum time to wait before returning output.
===================== ====================== ===================================================

.. code-block:: python
output = rtr.monitor.tail(timeout=30)
monitor.stop
~~~~~~~~~~~~

Stop the monitor and return all output.

.. code-block:: python
output = rtr.monitor.stop()
Sub-Plugins
-----------

Expand All @@ -152,7 +233,7 @@ attach_console
""""""""""""""

Service to attach to line card console/Standby RP to execute commands in. Returns a
router-like object to execute commands on using python context managers.This service is
router-like object to execute commands on using python context managers.This service is
supported in HA as well.

==================== ====================== ========================================
Expand All @@ -176,8 +257,8 @@ switchto
""""""""

Service to switch the router console to any state that user needs in order to perform
his tests. The api becomes a no-op if the console is already at the state user wants
to reach. This service is supported in HA as well.
his tests. The api becomes a no-op if the console is already at the state user wants
to reach. This service is supported in HA as well.


The states available to switch to are :
Expand All @@ -197,7 +278,7 @@ timeout int (default in None) timeout in sec for executing c
==================== ====================== ========================================

.. code-block:: python
device.switchto("xr_env")
.... some commands that need to be run in xr_env state ....
device.switchto("enable")
device.switchto("enable")
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.7'
__version__ = '24.8'

supported_chassis = [
'single_rp',
Expand Down
12 changes: 4 additions & 8 deletions src/unicon/plugins/generic/service_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,10 @@ def call_service(self, command=[], # noqa: C901

command_output = {}
for command in commands:
via = con.via
alias = con.alias if hasattr(con, 'alias') and con.alias != 'cli' else None
if alias and via:
con.log.info("+++ %s with via '%s' and alias '%s': executing command '%s' +++" % (con.hostname, via, alias, command))
elif via:
con.log.info("+++ %s with via '%s': executing command '%s' +++" % (con.hostname, via, command))
else:
con.log.info("+++ %s: executing command '%s' +++" % (con.hostname, command))

message = f"executing command '{command}'"
super().log_service_call(message)

con.sendline(command)
try:
dialog_match = dialog.process(
Expand Down
3 changes: 2 additions & 1 deletion src/unicon/plugins/generic/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ def password_handler(spawn, context, session):
raise UniconAuthenticationError('Too many password retries')

if context.get('username', '') == spawn.last_sent.rstrip() or ssh_tacacs_handler(spawn, context):
spawn.sendline(context['tacacs_password'])
if (tacacs_password := context.get('tacacs_password')):
spawn.sendline(tacacs_password)
else:
spawn.sendline(context['line_password'])

Expand Down
3 changes: 2 additions & 1 deletion src/unicon/plugins/iosxe/service_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ def pre_service(self, *args, **kwargs):
sm.go_to('enable',
con.spawn,
context=self.context)
con.configure('config-register 0x0')
confreg = kwargs.get('config_register', "0x0")
con.configure('config-register {}'.format(confreg))
super().pre_service(*args, **kwargs)


Expand Down
Loading

0 comments on commit 87005c4

Please sign in to comment.