Skip to content

Commit

Permalink
Merge pull request #178 from CiscoTestAutomation/release_24.9
Browse files Browse the repository at this point in the history
Releasing v24.9
  • Loading branch information
Taarini authored Oct 1, 2024
2 parents 1adfa6d + 2526cd2 commit f05697e
Show file tree
Hide file tree
Showing 259 changed files with 7,953 additions and 1,157 deletions.
2 changes: 0 additions & 2 deletions pkgs/clean-pkg/changelog/2024/august.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@
* Modified configure_management
* Added `alias_as_hostname` argument
* Allows user to use the alias as the device hostname


25 changes: 25 additions & 0 deletions pkgs/clean-pkg/changelog/2024/september.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------

* clean
* Modified iosxe.stage.Connect.connect
* Set learn hostname to False after hostname learned
* Modified tftp_device_recovery
* If username and password are not provided, use default username and password

* utils
* Modified validate_clean to not raise any exceptions on passing image_management to clean yaml file


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

* iosxe
* Modified
* Allowing a config_register option in RommonBoot stage, with a default of 0x0
* Added
* Added support for quad sup devices in clean to connect the active and standby
* Modified Clean Connect
* Added check for console speed being incorrect as well as a fix
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
Fix
--------------------------------------------------------------------------------
* IOSXE
* Add option to check interface and vlan for verify_ip_mac_binding_in_network
* Modified ChangeBootVariable:
* Modified verify_boot_variable to verify next reload boot variables using running image if current_running_image is True
26 changes: 13 additions & 13 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__ = '24.8'
__version__ = '24.9'
__author__ = 'Cisco Systems Inc.'
__contact__ = ['[email protected]', '[email protected]']
__copyright__ = 'Copyright (c) 2019, Cisco Systems Inc.'
Expand Down
12 changes: 11 additions & 1 deletion pkgs/clean-pkg/src/genie/libs/clean/recovery/iosxe/recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def tftp_device_recovery(spawn, timeout, device, tftp_boot, item, recovery_passw
Returns:
None
"""

dialog = TftpRommonDialog()

# Add a statement to the dialog which will match the device hostname
Expand All @@ -113,6 +112,17 @@ def tftp_device_recovery(spawn, timeout, device, tftp_boot, item, recovery_passw
action=print_message,
args={'message': 'Device has reached privileged exec prompt'}))

credentials = device.credentials

if recovery_username is None:
recovery_username = to_plaintext(credentials.get('default', {}).get('username'))

if recovery_password is None:
recovery_password = to_plaintext(credentials.get('default', {}).get('password'))

if recovery_en_password is None:
recovery_en_password = to_plaintext(credentials.get('enable', {}).get('password'))

dialog.dialog.process(
spawn,
timeout=timeout,
Expand Down
5 changes: 3 additions & 2 deletions pkgs/clean-pkg/src/genie/libs/clean/recovery/recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ def recovery_processor(
if hasattr(device, 'is_ha') and device.is_ha:
log.info('Device is HA! checking all the subconnections.')
for index, connection in enumerate(device.subconnections,1):
bring_to_any_state(connection, connection_timeout)
log.info(f'subconnection {index} is in {connection.state_machine.current_state}')
if device.get_rp_state(target=connection.alias) != 'IN_CHASSIS_STANDBY':
bring_to_any_state(connection, connection_timeout)
log.info(f'subconnection {index} is in {connection.state_machine.current_state}')
else:
bring_to_any_state(device, connection_timeout)
log.info(f'Device is in {device.state_machine.current_state}')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
connect: &connect
preface: |
Trying mock_device ...
Connected to mock_device.
Escape character is ''^]''.
prompt: "%N#"

change_boot_variable_1:
<<: *connect
commands:
? ''
: new_state: execute_1

execute_1:
commands:
show version | include operating mode: ''
config term:
new_state: configure_1
write memory: |
Building configuration...
[OK]
show bootvar: |
BOOT variable = bootflash:/image.SSA.XYZ,12;
CONFIG_FILE variable =
BOOTLDR variable does not exist
Configuration register is 0x2102
Standby BOOT variable = bootflash:/image.SSA.XYZ,12;
Standby CONFIG_FILE variable =
Standby BOOTLDR variable does not exist
Standby Configuration register is 0x2102
prompt: "%N#"

configure_1:
commands:
no boot system: ""
end:
new_state: execute_1
line console:
new_state: configure_line
boot system bootflash:/image.SSA.XYZ: ""
config-register 0x2102: ""
prompt: "%N(config)#"

change_boot_variable_2:
<<: *connect
commands:
? ''
: new_state: execute_2

execute_2:
commands:
show version | include operating mode: ''
show version: |
show version
Cisco IOS XE Software, Version BLD_POLARIS_DEV_LATEST_20240916_114854
Cisco IOS Software [IOSXE], ASR1000 Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Experimental Version 17.17.20240916:124022 [BLD_POLARIS_DEV_LATEST_20240916_114854:/nobackup/mcpre/s2c-build-ws 103]
Copyright (c) 1986-2024 by Cisco Systems, Inc.
Compiled Mon 16-Sep-24 05:40 by mcpre
Cisco IOS-XE software, Copyright (c) 2005-2024 by cisco Systems, Inc.
All rights reserved. Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0. The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY. You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0. For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.
ROM: 17.3(1r)
R2 uptime is 18 hours, 55 minutes
Uptime for this control processor is 18 hours, 57 minutes
System returned to ROM by Reload Command
System image file is "harddisk:packages.conf"
Last reload reason: Reload Command
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to
[email protected].
License Type: Smart License is permanent
License Level: advipservices
Next reload license Level: advipservices
Smart Licensing Status: Smart Licensing Using Policy
cisco ASR1006-X (RP3) processor (revision RP3) with 4087430K/24590K bytes of memory.
Processor board ID FXS2239Q329
Router operating mode: Autonomous
20 Gigabit Ethernet interfaces
2 Ten Gigabit Ethernet interfaces
32768K bytes of non-volatile configuration memory.
8388608K bytes of physical memory.
7600127K bytes of eUSB flash at bootflash:.
97620247K bytes of SATA hard disk at harddisk:.
Configuration register is 0x2102
config term:
new_state: configure_2
write memory: |
Building configuration...
[OK]
show bootvar: |
BOOT variable = harddisk:packages.conf,12;
CONFIG_FILE variable =
BOOTLDR variable does not exist
Configuration register is 0x2102
Standby BOOT variable = harddisk:packages.conf,12;
Standby CONFIG_FILE variable =
Standby BOOTLDR variable does not exist
Standby Configuration register is 0x2102
prompt: "%N#"

configure_2:
commands:
no boot system: ""
end:
new_state: execute_2
line console:
new_state: configure_line
boot system harddisk:packages.conf: ""
config-register 0x2102: ""
prompt: "%N(config)#"
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import unittest

from pyats.results import Passed
from pyats.topology import loader
from pyats.aetest.steps import Steps

from genie.libs.clean.stages.iosxe.stages import ChangeBootVariable


class TestChangeBootVariable1(unittest.TestCase):
""" Run unit testing on a mocked IOSXE asr1k device """

def test_change_boot_variable_pass(self):
testbed = """
devices:
router:
connections:
defaults:
class: unicon.Unicon
a:
command: mock_device_cli --os iosxe --mock_data_dir mock_data --state change_boot_variable_1
protocol: unknown
os: iosxe
platform: asr1k
model: ASR1001-HX
type: router
custom:
abstraction:
order: [os, platform, model]
"""
testbed = loader.load(testbed)
device = testbed.devices['router']
device.connect(
learn_hostname=True,
init_config_commands=[],
init_exec_commands=[]
)

# Make sure we have a unique Steps() object for result verification
steps = Steps()

# And we want the following methods to be mocked to simulate the stage.
change_boot_variable = ChangeBootVariable()

image = 'bootflash:/image.SSA.XYZ'

change_boot_variable(steps=steps, device=device, images=[image])

# Check the results is as expected.
self.assertEqual(Passed, steps.details[0].result)

def test_change_boot_variable_with_current_running_image(self):
testbed = """
devices:
router:
connections:
defaults:
class: unicon.Unicon
a:
command: mock_device_cli --os iosxe --mock_data_dir mock_data --state change_boot_variable_2
protocol: unknown
os: iosxe
platform: asr1k
model: ASR1001-HX
type: router
custom:
abstraction:
order: [os, platform, model]
"""
testbed = loader.load(testbed)
device = testbed.devices['router']
device.connect(
learn_hostname=True,
init_config_commands=[],
init_exec_commands=[]
)
# Make sure we have a unique Steps() object for result verification
steps = Steps()

# And we want the following methods to be mocked to simulate the stage.
change_boot_variable = ChangeBootVariable()

image = 'bootflash:/image.SSA.XYZ'

with self.assertLogs(level='INFO') as log:
change_boot_variable(steps=steps, device=device, images=[image], current_running_image=True)
self.assertIn("INFO:genie.libs.clean.stages.iosxe.stages:" +
"Verifying next reload boot variables Using the running image due to 'current_running_image: True'",
log.output)

# Check the results is as expected.
self.assertEqual(Passed, steps.details[0].result)
Loading

0 comments on commit f05697e

Please sign in to comment.