Skip to content

Commit 87005c4

Browse files
authored
Merge pull request #103 from CiscoTestAutomation/release_24.8
Release 24.8
2 parents 3f86be3 + 7c39c85 commit 87005c4

30 files changed

+801
-242
lines changed

docs/changelog/2024/august.rst

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
August 2024
2+
==========
3+
4+
August 27 - Unicon v24.8
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v24.8
13+
``unicon``, v24.8
14+
15+
Install Instructions
16+
^^^^^^^^^^^^^^^^^^^^
17+
18+
.. code-block:: bash
19+
20+
bash$ pip install unicon.plugins
21+
bash$ pip install unicon
22+
23+
Upgrade Instructions
24+
^^^^^^^^^^^^^^^^^^^^
25+
26+
.. code-block:: bash
27+
28+
bash$ pip install --upgrade unicon.plugins
29+
bash$ pip install --upgrade unicon
30+
31+
Features and Bug Fixes:
32+
^^^^^^^^^^^^^^^^^^^^^^^
33+
34+
35+
36+
37+
Changelogs
38+
^^^^^^^^^^
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/august
78
2024/july
89
2024/june
910
2024/may
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
August 2024
2+
==========
3+
4+
August 27 - Unicon.Plugins v24.8
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v24.8
13+
``unicon``, v24.8
14+
15+
Install Instructions
16+
^^^^^^^^^^^^^^^^^^^^
17+
18+
.. code-block:: bash
19+
20+
bash$ pip install unicon.plugins
21+
bash$ pip install unicon
22+
23+
Upgrade Instructions
24+
^^^^^^^^^^^^^^^^^^^^
25+
26+
.. code-block:: bash
27+
28+
bash$ pip install --upgrade unicon.plugins
29+
bash$ pip install --upgrade unicon
30+
31+
Features and Bug Fixes:
32+
^^^^^^^^^^^^^^^^^^^^^^^
33+
34+
35+
36+
37+
Changelogs
38+
^^^^^^^^^^
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Plugins Changelog
44
.. toctree::
55
:maxdepth: 2
66

7+
2024/september
8+
2024/august
79
2024/july
810
2024/june
911
2024/may

docs/user_guide/services/iosxr.rst

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,87 @@ Has same arguments as generic configure service.
138138
output = device.configure_exclusive('logging console disable')
139139
140140
141+
monitor
142+
-------
143+
144+
The monitor service can be used with the `monitor interface` command. You can
145+
also pass `action` commands to execute while the monitor is running. For
146+
example `clear` (lowercase) will send the key associated with the action as
147+
shown in the output, i.e. Clear="c" will send "c" for action "clear".
148+
149+
=============== ====================== ==================================================
150+
Argument Type Description
151+
=============== ====================== ==================================================
152+
command str monitor command to execute ('monitor' is optional)
153+
or action to send (e.g. 'clear')
154+
reply Dialog additional dialog
155+
timeout int (default 60 sec) timeout value for the overall interaction.
156+
=============== ====================== ==================================================
157+
158+
Example:
159+
160+
.. code-block:: python
161+
162+
rtr.monitor('monitor interface GigabitEthernet0/0/0/0')
163+
164+
# execute `monitor interface`
165+
rtr.monitor('interface')
166+
167+
# tail the output for 10 seconds
168+
rtr.monitor.tail(timeout=10)
169+
170+
output = rtr.monitor.stop()
171+
172+
# send an action to the device
173+
rtr.monitor('clear')
174+
rtr.monitor('bytes')
175+
176+
177+
monitor.get_buffer
178+
~~~~~~~~~~~~~~~~~~
179+
180+
To get the output that has been buffered by the monitor service, you can use the `monitor.get_buffer`
181+
method. This will return all output from the start of the monitor command until the moment of execution
182+
of this service.
183+
184+
===================== ====================== ===================================================
185+
Argument Type Description
186+
===================== ====================== ===================================================
187+
truncate bool (default: False) If true, will truncate the current buffer.
188+
===================== ====================== ===================================================
189+
190+
.. code-block:: python
191+
192+
output = rtr.monitor.get_buffer()
193+
194+
195+
monitor.tail
196+
~~~~~~~~~~~~
197+
198+
The monitor.tail method can be used to monitor the output logging after the ``monitor`` service
199+
has been used to start the monitor.
200+
201+
===================== ====================== ===================================================
202+
Argument Type Description
203+
===================== ====================== ===================================================
204+
timeout int (seconds) maximum time to wait before returning output.
205+
===================== ====================== ===================================================
206+
207+
.. code-block:: python
208+
209+
output = rtr.monitor.tail(timeout=30)
210+
211+
212+
monitor.stop
213+
~~~~~~~~~~~~
214+
215+
Stop the monitor and return all output.
216+
217+
.. code-block:: python
218+
219+
output = rtr.monitor.stop()
220+
221+
141222
Sub-Plugins
142223
-----------
143224

@@ -152,7 +233,7 @@ attach_console
152233
""""""""""""""
153234

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

158239
==================== ====================== ========================================
@@ -176,8 +257,8 @@ switchto
176257
""""""""
177258

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

182263

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

199280
.. code-block:: python
200-
281+
201282
device.switchto("xr_env")
202283
.... some commands that need to be run in xr_env state ....
203-
device.switchto("enable")
284+
device.switchto("enable")

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.7'
1+
__version__ = '24.8'
22

33
supported_chassis = [
44
'single_rp',

src/unicon/plugins/generic/service_implementation.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -720,14 +720,10 @@ def call_service(self, command=[], # noqa: C901
720720

721721
command_output = {}
722722
for command in commands:
723-
via = con.via
724-
alias = con.alias if hasattr(con, 'alias') and con.alias != 'cli' else None
725-
if alias and via:
726-
con.log.info("+++ %s with via '%s' and alias '%s': executing command '%s' +++" % (con.hostname, via, alias, command))
727-
elif via:
728-
con.log.info("+++ %s with via '%s': executing command '%s' +++" % (con.hostname, via, command))
729-
else:
730-
con.log.info("+++ %s: executing command '%s' +++" % (con.hostname, command))
723+
724+
message = f"executing command '{command}'"
725+
super().log_service_call(message)
726+
731727
con.sendline(command)
732728
try:
733729
dialog_match = dialog.process(

src/unicon/plugins/generic/statements.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ def password_handler(spawn, context, session):
366366
raise UniconAuthenticationError('Too many password retries')
367367

368368
if context.get('username', '') == spawn.last_sent.rstrip() or ssh_tacacs_handler(spawn, context):
369-
spawn.sendline(context['tacacs_password'])
369+
if (tacacs_password := context.get('tacacs_password')):
370+
spawn.sendline(tacacs_password)
370371
else:
371372
spawn.sendline(context['line_password'])
372373

src/unicon/plugins/iosxe/service_implementation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ def pre_service(self, *args, **kwargs):
349349
sm.go_to('enable',
350350
con.spawn,
351351
context=self.context)
352-
con.configure('config-register 0x0')
352+
confreg = kwargs.get('config_register', "0x0")
353+
con.configure('config-register {}'.format(confreg))
353354
super().pre_service(*args, **kwargs)
354355

355356

0 commit comments

Comments
 (0)