Skip to content

Commit e4fec41

Browse files
authored
Merge pull request #111 from CiscoTestAutomation/release_25.3
Releasing v25.3
2 parents ea460a4 + 8fd0dac commit e4fec41

File tree

16 files changed

+141
-5
lines changed

16 files changed

+141
-5
lines changed

docs/changelog/2025/march.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
March 2025
2+
==========
3+
4+
March 25 - Unicon v25.3
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v25.3
13+
``unicon``, v25.3
14+
15+
16+
17+
18+
Changelogs
19+
^^^^^^^^^^
20+
--------------------------------------------------------------------------------
21+
Fix
22+
--------------------------------------------------------------------------------
23+
24+
* unicon.robot
25+
* Modified Robot Library UniconRobot.py
26+
* Address SyntaxWarning in UniconRobot.py showing up in python >= 3.12
27+
28+
* mock_device
29+
* Updated mock device to handle ctrl-c for HA tests
30+
31+
32+
--------------------------------------------------------------------------------
33+
New
34+
--------------------------------------------------------------------------------
35+
36+
* connection_provider
37+
* Modified execute_init_commands
38+
* Updated logic to config init commands only on first connnection
39+
40+
41+
--------------------------------------------------------------------------------
42+
Fix
43+
--------------------------------------------------------------------------------
44+
45+
* generic
46+
* Added fallback credentials to login_handler statement
47+
48+
* iosxe
49+
* Added grub statement in the list 'boot_from_rommon_statement_list' for
50+
51+

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+
2025/march
78
2025/february
89
2025/january
910
2024/november

docs/changelog_plugins/2025/march.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
March 2025
2+
==========
3+
4+
March 25 - Unicon.Plugins v25.3
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v25.3
13+
``unicon``, v25.3
14+
15+
16+
17+
18+
Changelogs
19+
^^^^^^^^^^

docs/changelog_plugins/index.rst

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

7+
2025/march
78
2025/february
89
2025/january
910
2024/november

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__ = '25.2'
1+
__version__ = '25.3'
22

33
supported_chassis = [
44
'single_rp',

src/unicon/plugins/generic/service_statements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def login_handler(spawn, context, session):
5353
"""
5454
credential = get_current_credential(context=context, session=session)
5555
if credential:
56+
if credential != 'default':
57+
spawn.log.info(f'Using {credential} credential set for login into device')
5658
common_cred_username_handler(
5759
spawn=spawn, context=context, credential=credential)
5860
else:

src/unicon/plugins/generic/statements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ def login_handler(spawn, context, session):
216216
"""
217217
credential = get_current_credential(context=context, session=session)
218218
if credential:
219+
if credential != 'default':
220+
spawn.log.info(f'Using {credential} credential set for login into device')
219221
common_cred_username_handler(
220222
spawn=spawn, context=context, credential=credential)
221223
else:

src/unicon/plugins/iosxe/statements.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def boot_image(spawn, context, session):
217217
boot_from_rommon_statement_list = [
218218
please_reset_stmt, admin_password_stmt,
219219
setup_dialog_stmt, auto_install_stmt,
220-
boot_timeout_stmt
220+
boot_timeout_stmt, grub_prompt_stmt
221221
]
222222

223223

@@ -245,4 +245,4 @@ def wrapper(spawn, session, context, **kwargs):
245245
boot_from_rommon_statement_list += connection_statement_list.copy()
246246
for stmt in boot_from_rommon_statement_list:
247247
if stmt.pattern in [reload_patterns.press_return] or stmt.loop_continue is False:
248-
stmt.action = boot_finished_deco(stmt.action)
248+
stmt.action = boot_finished_deco(stmt.action)

src/unicon/plugins/iosxr/spitfire/statements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def xr_login_handler(spawn, context, session):
4646
"""
4747
credential = get_current_credential(context=context, session=session)
4848
if credential:
49+
if credential != 'default':
50+
spawn.log.info(f'Using {credential} credential set to login into device')
4951
common_cred_username_handler(spawn=spawn, context=context, credential=credential)
5052
else:
5153
spawn.sendline(context['username'])

src/unicon/plugins/linux/statements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
def username_handler(spawn, context, session):
1717
credential = get_current_credential(context=context, session=session)
1818
if credential:
19+
if credential != 'default':
20+
spawn.log.info(f'Using {credential} credential set for login into device')
1921
common_cred_username_handler(spawn=spawn, context=context,
2022
credential=credential)
2123
else:

src/unicon/plugins/nxos/service_statements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def admin_password_handler(spawn, context, session):
4141
"""
4242
credential = get_current_credential(context=context, session=session)
4343
if credential:
44+
if credential != 'default':
45+
spawn.log.info(f'Using {credential} credential set for login into devices')
4446
common_cred_password_handler(
4547
spawn=spawn, context=context, credential=credential,
4648
session=session, reuse_current_credential=True)

src/unicon/plugins/sros/statements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
def username_handler(spawn, context, session):
1616
credential = get_current_credential(context=context, session=session)
1717
if credential:
18+
if credential != 'default':
19+
spawn.log.info(f'Using {credential} credential set for login into device')
1820
common_cred_username_handler(spawn=spawn, context=context,
1921
credential=credential)
2022
else:

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,18 @@ c9k_login5:
628628
"admin":
629629
new_state: c9k_password5
630630

631+
c9k_login6:
632+
prompt: "Username: "
633+
commands:
634+
"admin":
635+
new_state: c9k_password6
636+
637+
c9k_password6:
638+
prompt: "Password: "
639+
commands:
640+
"cisco":
641+
new_state: c9k_login4
642+
631643
c9k_password5:
632644
prompt: "Password: "
633645
commands:

src/unicon/plugins/tests/test_plugin_generic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def mock_sendline(*args, **kwargs):
160160
print("Sendline called with: %s %s" % (args, kwargs))
161161

162162
self.spawn = MockSpawn()
163+
self.spawn.log = Mock()
163164
self.spawn.spawn_command = 'ssh -l cisco@router'
164165
self.spawn.last_sent = 'ssh -l cisco@router'
165166
self.spawn.sendline = Mock(side_effect=mock_sendline)

src/unicon/plugins/tests/test_plugin_iosxe_cat9k.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,42 @@ def test_connect_fallback(self):
105105
connections:
106106
defaults:
107107
class: unicon.Unicon
108-
debug: True
108+
fallback_credentials:
109+
- set1
110+
a:
111+
protocol: telnet
112+
ip: 127.0.0.1
113+
port: {}
114+
""".format(md.ports[0])
115+
116+
tb = loader.load(testbed)
117+
device = tb.devices.R1
118+
try:
119+
device.connect()
120+
self.assertEqual(device.state_machine.current_state, 'enable')
121+
finally:
122+
device.disconnect()
123+
md.stop()
124+
125+
def test_connect_fallback_login_handler(self):
126+
md = MockDeviceTcpWrapperIOSXE(port=0, state='c9k_login6', hostname='switch')
127+
md.start()
128+
129+
testbed = """
130+
devices:
131+
R1:
132+
os: iosxe
133+
type: cat9k
134+
credentials:
135+
default:
136+
username: admin
137+
password: cisco
138+
set1:
139+
username: cisco
140+
password: cisco
141+
connections:
142+
defaults:
143+
class: unicon.Unicon
109144
fallback_credentials:
110145
- set1
111146
a:

src/unicon/plugins/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131

3232

3333
def _fallback_cred(context):
34-
return [context['default_cred_name']] \
34+
creds = [context['default_cred_name']] \
3535
if 'default_cred_name' in context else []
36+
if context.get('fallback_creds'):
37+
creds.extend(context['fallback_creds'])
38+
return creds
39+
3640

3741
def _get_creds_to_try(context):
3842
""" Get list of credentials to try. """

0 commit comments

Comments
 (0)