Skip to content

Commit

Permalink
Merge pull request #139 from CiscoTestAutomation/release_23.10
Browse files Browse the repository at this point in the history
Releasing v23.10
  • Loading branch information
bastell authored Nov 3, 2023
2 parents 33570f9 + a59a506 commit 177526b
Show file tree
Hide file tree
Showing 286 changed files with 8,387 additions and 1,134 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ CYTHON_CMD = compileAll
RELATED_PKGS = genie.libs.health genie.libs.clean genie.libs.conf genie.libs.ops genie.libs.robot genie.libs.sdk
RELATED_PKGS += genie.libs.filetransferutils
# pinning the version of pysnmp and pyasn1 to fix the type error when using execute_power_cycle_device api
DEPENDENCIES = restview psutil==5.9.2 Sphinx wheel asynctest pysnmp-lextudio==5.0.29 pyasn1==0.4.8
DEPENDENCIES = restview psutil Sphinx wheel asynctest pysnmp-lextudio==5.0.29 pyasn1==0.4.8
DEPENDENCIES += sphinx-rtd-theme==1.1.0 pyftpdlib tftpy\<0.8.1 robotframework
# aiohttp-swagger 1.0.15 requires jinja2==2.11.2 and markupsafe==1.1.1
DEPENDENCIES += Cython==3.0.0 requests ruamel.yaml grpcio protobuf jinja2==2.11.2 markupsafe==1.1.1
# aiohttp requires charset-normalizer<3.0.0
DEPENDENCIES += charset-normalizer==2.1.1
DEPENDENCIES += Cython==3.0.0 requests ruamel.yaml grpcio protobuf jinja2==2.11.2 markupsafe==2.0.1
# Internal variables.
# (note - build examples & templates last because it will fail uploading to pypi
# due to duplicates, and we'll for now accept that error)
Expand Down
11 changes: 11 additions & 0 deletions pkgs/clean-pkg/changelog/2023/october.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------

* recovery
* Update device recovery logic for checking the state machine. Instead of clearing the line

* generic
* Update defaults for clean stages


40 changes: 20 additions & 20 deletions pkgs/clean-pkg/sdk_generator/output/github_clean.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkgs/clean-pkg/src/genie/libs/clean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'''

# metadata
__version__ = '23.9'
__version__ = '23.10'
__author__ = 'Cisco Systems Inc.'
__contact__ = ['asg-genie-support@cisco.com', 'pyats-support-ext@cisco.com']
__copyright__ = 'Copyright (c) 2019, Cisco Systems Inc.'
Expand Down
17 changes: 11 additions & 6 deletions pkgs/clean-pkg/src/genie/libs/clean/recovery/iosxe/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ class RommonDialog(TelnetDialog):

def __init__(self):

# Login prompt
self.add_statement(Statement(pattern=r'^.*(Username|login): ?$',
action=print_message,
args={'message': 'Device reached login prompt before rommon prompt',
'raise_exception': False}))

# Would you like to enter the initial configuration dialog? [yes/no]:
self.add_statement(Statement(pattern=r'^.*(initial|basic) configuration dialog *\?.*',
Expand Down Expand Up @@ -112,7 +107,17 @@ def boot_device(spawn, session, context):
@statement_decorator(r'^.*[Pp]assword( for )?(\\S+)?: ?$', loop_continue=True)
def send_password(spawn, session, context):
# Send password to teh device when prompted
spawn.sendline('{}'.format(context['password']))
if context['pass_login']:
spawn.sendline('{}'.format(context['password']))
time.sleep(0.5)
context['pass_login'] = 0
else:
spawn.sendline('{}'.format(context['en_password']))

@statement_decorator(r'^.*([Uu]sername|[Ll]ogin): ?$', loop_continue=True)
def send_username(spawn, session, context):
# Send password to teh device when prompted
spawn.sendline('{}'.format(context['username']))
time.sleep(0.5)

# grub>
Expand Down
14 changes: 11 additions & 3 deletions pkgs/clean-pkg/src/genie/libs/clean/recovery/iosxe/recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
RommonDialog,
TftpRommonDialog)

#pyats
from pyats.utils.secret_strings import to_plaintext

# Logger
log = logging.getLogger(__name__)

Expand Down Expand Up @@ -113,7 +116,8 @@ def grub_breakboot(spawn, break_char):
spawn = Spawn(spawn_command=start,
settings=device.cli.settings,
target=target,
logger=device.log)
logger=device.log,
device=device)

# Stop the device from booting
break_dialog = BreakBootDialog()
Expand Down Expand Up @@ -168,13 +172,17 @@ def device_recovery(spawn, timeout, golden_image, recovery_password=None, **kwar
Returns:
None
"""

device = spawn.device
credentials = device.credentials
dialog = RommonDialog()
dialog.dialog.process(
spawn,
timeout=timeout,
context={'boot_image': golden_image[0],
'password': recovery_password})
'password': to_plaintext(credentials.get('default',{}).get('password')),
'username': to_plaintext(credentials.get('default',{}).get('username')),
'en_password': to_plaintext(credentials.get('enable',{}).get('password')),
'pass_login':1})


def tftp_device_recovery(spawn, timeout, device, tftp_boot, item, recovery_password=None
Expand Down
Loading

0 comments on commit 177526b

Please sign in to comment.