Skip to content

Releasing v25.3 #111

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

Merged
merged 1 commit into from
Apr 1, 2025
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
51 changes: 51 additions & 0 deletions docs/changelog/2025/march.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
March 2025
==========

March 25 - Unicon v25.3
------------------------



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

``unicon.plugins``, v25.3
``unicon``, v25.3




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

* unicon.robot
* Modified Robot Library UniconRobot.py
* Address SyntaxWarning in UniconRobot.py showing up in python >= 3.12

* mock_device
* Updated mock device to handle ctrl-c for HA tests


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

* connection_provider
* Modified execute_init_commands
* Updated logic to config init commands only on first connnection


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

* generic
* Added fallback credentials to login_handler statement

* iosxe
* Added grub statement in the list 'boot_from_rommon_statement_list' for


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

2025/march
2025/february
2025/january
2024/november
Expand Down
19 changes: 19 additions & 0 deletions docs/changelog_plugins/2025/march.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
March 2025
==========

March 25 - Unicon.Plugins v25.3
------------------------



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

``unicon.plugins``, v25.3
``unicon``, v25.3




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

2025/march
2025/february
2025/january
2024/november
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__ = '25.2'
__version__ = '25.3'

supported_chassis = [
'single_rp',
Expand Down
2 changes: 2 additions & 0 deletions src/unicon/plugins/generic/service_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def login_handler(spawn, context, session):
"""
credential = get_current_credential(context=context, session=session)
if credential:
if credential != 'default':
spawn.log.info(f'Using {credential} credential set for login into device')
common_cred_username_handler(
spawn=spawn, context=context, credential=credential)
else:
Expand Down
2 changes: 2 additions & 0 deletions src/unicon/plugins/generic/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def login_handler(spawn, context, session):
"""
credential = get_current_credential(context=context, session=session)
if credential:
if credential != 'default':
spawn.log.info(f'Using {credential} credential set for login into device')
common_cred_username_handler(
spawn=spawn, context=context, credential=credential)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/unicon/plugins/iosxe/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def boot_image(spawn, context, session):
boot_from_rommon_statement_list = [
please_reset_stmt, admin_password_stmt,
setup_dialog_stmt, auto_install_stmt,
boot_timeout_stmt
boot_timeout_stmt, grub_prompt_stmt
]


Expand Down Expand Up @@ -245,4 +245,4 @@ def wrapper(spawn, session, context, **kwargs):
boot_from_rommon_statement_list += connection_statement_list.copy()
for stmt in boot_from_rommon_statement_list:
if stmt.pattern in [reload_patterns.press_return] or stmt.loop_continue is False:
stmt.action = boot_finished_deco(stmt.action)
stmt.action = boot_finished_deco(stmt.action)
2 changes: 2 additions & 0 deletions src/unicon/plugins/iosxr/spitfire/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def xr_login_handler(spawn, context, session):
"""
credential = get_current_credential(context=context, session=session)
if credential:
if credential != 'default':
spawn.log.info(f'Using {credential} credential set to login into device')
common_cred_username_handler(spawn=spawn, context=context, credential=credential)
else:
spawn.sendline(context['username'])
Expand Down
2 changes: 2 additions & 0 deletions src/unicon/plugins/linux/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
def username_handler(spawn, context, session):
credential = get_current_credential(context=context, session=session)
if credential:
if credential != 'default':
spawn.log.info(f'Using {credential} credential set for login into device')
common_cred_username_handler(spawn=spawn, context=context,
credential=credential)
else:
Expand Down
2 changes: 2 additions & 0 deletions src/unicon/plugins/nxos/service_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def admin_password_handler(spawn, context, session):
"""
credential = get_current_credential(context=context, session=session)
if credential:
if credential != 'default':
spawn.log.info(f'Using {credential} credential set for login into devices')
common_cred_password_handler(
spawn=spawn, context=context, credential=credential,
session=session, reuse_current_credential=True)
Expand Down
2 changes: 2 additions & 0 deletions src/unicon/plugins/sros/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
def username_handler(spawn, context, session):
credential = get_current_credential(context=context, session=session)
if credential:
if credential != 'default':
spawn.log.info(f'Using {credential} credential set for login into device')
common_cred_username_handler(spawn=spawn, context=context,
credential=credential)
else:
Expand Down
12 changes: 12 additions & 0 deletions src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_cat9k.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,18 @@ c9k_login5:
"admin":
new_state: c9k_password5

c9k_login6:
prompt: "Username: "
commands:
"admin":
new_state: c9k_password6

c9k_password6:
prompt: "Password: "
commands:
"cisco":
new_state: c9k_login4

c9k_password5:
prompt: "Password: "
commands:
Expand Down
1 change: 1 addition & 0 deletions src/unicon/plugins/tests/test_plugin_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def mock_sendline(*args, **kwargs):
print("Sendline called with: %s %s" % (args, kwargs))

self.spawn = MockSpawn()
self.spawn.log = Mock()
self.spawn.spawn_command = 'ssh -l cisco@router'
self.spawn.last_sent = 'ssh -l cisco@router'
self.spawn.sendline = Mock(side_effect=mock_sendline)
Expand Down
37 changes: 36 additions & 1 deletion src/unicon/plugins/tests/test_plugin_iosxe_cat9k.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,42 @@ def test_connect_fallback(self):
connections:
defaults:
class: unicon.Unicon
debug: True
fallback_credentials:
- set1
a:
protocol: telnet
ip: 127.0.0.1
port: {}
""".format(md.ports[0])

tb = loader.load(testbed)
device = tb.devices.R1
try:
device.connect()
self.assertEqual(device.state_machine.current_state, 'enable')
finally:
device.disconnect()
md.stop()

def test_connect_fallback_login_handler(self):
md = MockDeviceTcpWrapperIOSXE(port=0, state='c9k_login6', hostname='switch')
md.start()

testbed = """
devices:
R1:
os: iosxe
type: cat9k
credentials:
default:
username: admin
password: cisco
set1:
username: cisco
password: cisco
connections:
defaults:
class: unicon.Unicon
fallback_credentials:
- set1
a:
Expand Down
6 changes: 5 additions & 1 deletion src/unicon/plugins/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@


def _fallback_cred(context):
return [context['default_cred_name']] \
creds = [context['default_cred_name']] \
if 'default_cred_name' in context else []
if context.get('fallback_creds'):
creds.extend(context['fallback_creds'])
return creds


def _get_creds_to_try(context):
""" Get list of credentials to try. """
Expand Down
Loading