diff --git a/docs/changelog/2025/august.rst b/docs/changelog/2025/august.rst new file mode 100644 index 00000000..57792877 --- /dev/null +++ b/docs/changelog/2025/august.rst @@ -0,0 +1,49 @@ +August 2025 +========== + +August 23 - Unicon v25.8 +------------------------ + + + +.. csv-table:: Module Versions + :header: "Modules", "Versions" + + ``unicon.plugins``, v25.8 + ``unicon``, v25.8 + + + + +Changelogs +^^^^^^^^^^ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- + +* unicon/bases + * router + * Added a statement to logout dialog to handle the standby console locked + * Added check in designate_handle to skip goto enable when standby is locked + + +-------------------------------------------------------------------------------- + New +-------------------------------------------------------------------------------- + +* cheetah + * Added cheetah ap tokens in pids csv file + +* iosxe/cat9k/9610 + * Added the support for stackwise virtual for c9610 devices + * Added SVLStackReload and SVLStackSwitchover services + + +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- + +* generic/patterns + * Modified syslog_message_pattern to handle additional syslog message formats. + + diff --git a/docs/changelog/index.rst b/docs/changelog/index.rst index 8c9c2b08..f5f53cbd 100644 --- a/docs/changelog/index.rst +++ b/docs/changelog/index.rst @@ -4,6 +4,7 @@ Changelog .. toctree:: :maxdepth: 2 + 2025/august 2025/july 2025/june 2025/may diff --git a/docs/changelog_plugins/2025/august.rst b/docs/changelog_plugins/2025/august.rst new file mode 100644 index 00000000..8abf503f --- /dev/null +++ b/docs/changelog_plugins/2025/august.rst @@ -0,0 +1,38 @@ +August 2025 +========== + +August 23 - Unicon.Plugins v25.8 +------------------------ + + + +.. csv-table:: Module Versions + :header: "Modules", "Versions" + + ``unicon.plugins``, v25.8 + ``unicon``, v25.8 + + + + +Changelogs +^^^^^^^^^^ +-------------------------------------------------------------------------------- + New +-------------------------------------------------------------------------------- + +* iosxe + * Updated prompts patterns to handle c9800 virtual devices. + + +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- + +* iosxe + * Updated syslog pattern to handle security log message + +* generic + * Handle tclsh continuation prompt "+>" on initial connection. + + diff --git a/docs/changelog_plugins/index.rst b/docs/changelog_plugins/index.rst index e68da516..dc0cfaf7 100644 --- a/docs/changelog_plugins/index.rst +++ b/docs/changelog_plugins/index.rst @@ -4,6 +4,7 @@ Plugins Changelog .. toctree:: :maxdepth: 2 + 2025/august 2025/july 2025/june 2025/may diff --git a/src/unicon/plugins/__init__.py b/src/unicon/plugins/__init__.py index f3565396..1c8ff771 100644 --- a/src/unicon/plugins/__init__.py +++ b/src/unicon/plugins/__init__.py @@ -1,4 +1,4 @@ -__version__ = "25.7" +__version__ = "25.8" supported_chassis = [ 'single_rp', diff --git a/src/unicon/plugins/generic/patterns.py b/src/unicon/plugins/generic/patterns.py index 0304b3e3..590f926b 100644 --- a/src/unicon/plugins/generic/patterns.py +++ b/src/unicon/plugins/generic/patterns.py @@ -71,12 +71,16 @@ def __init__(self): # RP/0/0/CPU0:Oct 9 01:44:47.875 # *May 28 09:01:05.136: yang-infra: Default hostkey created (NETCONF_SSH_RSA_KEY.server) # *May 28 09:01:11.975: PKI_SSL_IPC: SUDI certificate chain and key pair are invalid + # SECURITY WARNING - Module: SSH, Command: crypto key generate rsa ..., Reason: SSH RSA host key uses insufficient key length, Remediation: Configure SSH RSA host key with minimum key length of 3072 bits + # Switch#[OK] self.syslog_message_pattern = ( r"^.*?(%\w+(-\S+)?-\d+-\w+|" r"yang-infra:|PKI_SSL_IPC:|Guestshell destroyed successfully|" r"%Error opening tftp:\/\/255\.255\.255\.255|Autoinstall trying|" - r"audit: kauditd hold queue overflow|" - r"(LC|RP)/\d+/\d+/CPU\d+:\w+\s+\d+\s+\d{2}:\d{2}:\d{2}).*\s*$" + r"audit: kauditd hold queue overflow|SECURITY WARNING|" + r"(LC|RP)/\d+/\d+/CPU\d+:\w+\s+\d+\s+\d{2}:\d{2}:\d{2}|" + r"\[OK\]" + r").*\s*$" ) self.config_locked = r'Configuration (mode )?(is )?locked|Config mode cannot be entered' @@ -99,3 +103,5 @@ def __init__(self): self.enter_your_encryption_selection_2 = r'^.*?Enter your encryption selection( \[2])?:\s*$' self.no_password_set = r'^.*% (No password set|Error in authentication.).*' + + self.tclsh_continue = r'^\+\>\s?$' diff --git a/src/unicon/plugins/generic/statements.py b/src/unicon/plugins/generic/statements.py index 31fd4623..86f95b83 100644 --- a/src/unicon/plugins/generic/statements.py +++ b/src/unicon/plugins/generic/statements.py @@ -366,7 +366,7 @@ def ssh_tacacs_handler(spawn, context): def password_handler(spawn, context, session): """ handles password prompt """ - if 'enable' in spawn.last_sent: + if spawn.last_sent.startswith('enable'): return enable_password_handler(spawn, context, session) credential = get_current_credential(context=context, session=session) @@ -780,6 +780,13 @@ def __init__(self): loop_continue=True, continue_timer=True) + self.tclsh_continue_stmt = Statement(pattern=pat.tclsh_continue, + action="sendline(})", + args=None, + loop_continue=True, + continue_timer=False) + + ############################################################# # Statement lists ############################################################# @@ -827,7 +834,8 @@ def __init__(self): initial_statement_list = [generic_statements.init_conf_stmt, generic_statements.mgmt_setup_stmt, generic_statements.enter_your_selection_stmt, - generic_statements.enter_your_encryption_selection_stmt + generic_statements.enter_your_encryption_selection_stmt, + generic_statements.tclsh_continue_stmt ] @@ -842,4 +850,3 @@ def __init__(self): authentication_statement_list + \ initial_statement_list + \ pre_connection_statement_list - diff --git a/src/unicon/plugins/iosxe/cat9k/c9610/__init__.py b/src/unicon/plugins/iosxe/cat9k/c9610/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/unicon/plugins/iosxe/cat9k/c9610/stackwise_virtual/__init__.py b/src/unicon/plugins/iosxe/cat9k/c9610/stackwise_virtual/__init__.py new file mode 100644 index 00000000..e5369ff3 --- /dev/null +++ b/src/unicon/plugins/iosxe/cat9k/c9610/stackwise_virtual/__init__.py @@ -0,0 +1,26 @@ +""" A Stackwise-virtual C9610 IOS-XE connection implementation. +""" + +from unicon.plugins.iosxe.stack import StackIosXEServiceList +from unicon.plugins.iosxe.stack import IosXEStackRPConnection +from unicon.plugins.iosxe.cat9k.stackwise_virtual.connection_provider import StackwiseVirtualConnectionProvider + +from unicon.plugins.iosxe.cat9k.c9500x.stackwise_virtual.service_implementation import SVLStackReload, SVLStackSwitchover + + +class IosXEC9610StackwiseVirtualServiceList(StackIosXEServiceList): + + def __init__(self): + super().__init__() + self.reload = SVLStackReload + self.switchover = SVLStackSwitchover + + +class IosXEC9610StackwiseVirtualRPConnection(IosXEStackRPConnection): + os = 'iosxe' + platform = 'cat9k' + model = 'c9610' + submodel = 'c9610' + chassis_type = 'stackwise_virtual' + connection_provider_class = StackwiseVirtualConnectionProvider + subcommand_list = IosXEC9610StackwiseVirtualServiceList diff --git a/src/unicon/plugins/iosxe/connection_provider.py b/src/unicon/plugins/iosxe/connection_provider.py index e3382082..0a97084b 100644 --- a/src/unicon/plugins/iosxe/connection_provider.py +++ b/src/unicon/plugins/iosxe/connection_provider.py @@ -21,7 +21,6 @@ def __init__(self, *args, **kwargs): """ super().__init__(*args, **kwargs) - def learn_tokens(self): con = self.connection if (not con.learn_tokens or not con.settings.LEARN_DEVICE_TOKENS)\ @@ -32,7 +31,8 @@ def learn_tokens(self): con.spawn, context=con.context, prompt_recovery=con.prompt_recovery) - if con.state_machine.current_state in ['acm', 'config','rules']: + + if con.state_machine.current_state in ['acm', 'config', 'rules', 'tclsh']: con.state_machine.go_to('enable', con.spawn, context=con.context, diff --git a/src/unicon/plugins/iosxe/patterns.py b/src/unicon/plugins/iosxe/patterns.py index 0aa5d41c..e9f52ef6 100644 --- a/src/unicon/plugins/iosxe/patterns.py +++ b/src/unicon/plugins/iosxe/patterns.py @@ -23,11 +23,11 @@ def __init__(self): self.want_continue_confirm = r'.*Do you want to continue\?\s*\[confirm]\s*$' self.want_continue_yes = r'.*Do you want to continue\?\s*\[y/n]\?\s*\[yes]:\s*$' self.disable_prompt = \ - r'^(.*?)(\(unlicensed\))?(WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(recovery-mode\))?(\(rp-rec-mode\))?(\(standby\))?(-stby)?(-standby)?(\(boot\))?>\s?$' + r'^(.*?)(\(unlicensed\))?(wlc|WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(recovery-mode\))?(\(rp-rec-mode\))?(\(standby\))?(-stby)?(-standby)?(\(boot\))?>\s?$' self.enable_prompt = \ - r'^(.*?)(\(unlicensed\))?(WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(recovery-mode\))?(\(rp-rec-mode\))?(\(standby\))?(-stby)?(-standby)?(\(boot\))?#[\s\x07]*$' + r'^(.*?)(\(unlicensed\))?(wlc|WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(recovery-mode\))?(\(rp-rec-mode\))?(\(standby\))?(-stby)?(-standby)?(\(boot\))?#[\s\x07]*$' self.maintenance_mode_prompt = \ - r'^(.*?)(\(unlicensed\))?(WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(standby\))?(-stby)?(-standby)?(\(boot\))?\(maint-mode\)#[\s\x07]*$' + r'^(.*?)(\(unlicensed\))?(wlc|WLC|Router|RouterRP|Switch|ios|switch|%N)([0-9])?(\(standby\))?(-stby)?(-standby)?(\(boot\))?\(maint-mode\)#[\s\x07]*$' self.press_enter = ReloadPatterns().press_enter self.config_prompt = r'^(.*)\((?!.*pki-hexmode).*(con|cfg|ipsec-profile|ca-trustpoint|ca-certificate-map|cs-server|ca-profile|gkm-local-server|cloud|host-list|config-gkm-group|gkm-sa-ipsec|gdoi-coop-ks-config|wsma|enforce-rule|DDNS|ca-trustpool|cert-trustpool)\S*\)#\s?$' @@ -56,7 +56,7 @@ def __init__(self): self.useracess = r'^.*User Access Verification' self.setup_dialog = r'^.*(initial|basic) configuration dialog.*\s?' self.autoinstall_dialog = r'^(.*)Would you like to terminate autoinstall\? ?\[yes\]: $' - self.default_prompts = r'^(.*?)(WLC|Router|RouterRP|Switch|ios|switch|.*)([0-9])?(\(standby\))?(\(boot\))?(>|#)' + self.default_prompts = r'^(.*?)(wlc|WLC|Router|RouterRP|Switch|ios|switch|.*)([0-9])?(\(standby\))?(\(boot\))?(>|#)' self.telnet_prompt = r'^.*telnet>\s?' self.please_reset = r'^(.*)Please reset' self.grub_prompt = r'.*The highlighted entry will be (booted|executed) automatically in .*?(\x1b\S+)?\s+' diff --git a/src/unicon/plugins/pid_tokens.csv b/src/unicon/plugins/pid_tokens.csv index 4ef5b87b..92c3e781 100644 --- a/src/unicon/plugins/pid_tokens.csv +++ b/src/unicon/plugins/pid_tokens.csv @@ -12,6 +12,48 @@ pid,os,platform,model,submodel 8808,iosxr,spitfire,8800, 8812,iosxr,spitfire,8800, 8818,iosxr,spitfire,8800, +AIR-AP1832I-B-K9,cheetah,ap,air1800, +AIR-AP1832I-C-K9,cheetah,ap,air1800, +AIR-AP1832I-D-K9,cheetah,ap,air1800, +AIR-AP1832I-E-K9,cheetah,ap,air1800, +AIR-AP1832I-F-K9,cheetah,ap,air1800, +AIR-AP1852E-B-K9,cheetah,ap,air1800, +AIR-AP1852E-C-K9,cheetah,ap,air1800, +AIR-AP1852E-D-K9,cheetah,ap,air1800, +AIR-AP1852E-F-K9,cheetah,ap,air1800, +AIR-AP1852E-K-K9,cheetah,ap,air1800, +AIR-AP1852I-B-K9,cheetah,ap,air1800, +AIR-AP1852I-C-K9,cheetah,ap,air1800, +AIR-AP1852I-D-K9,cheetah,ap,air1800, +AIR-AP2802E-A-K9,cheetah,ap,air2800, +AIR-AP2802E-B-K9,cheetah,ap,air2800, +AIR-AP2802E-D-K9,cheetah,ap,air2800, +AIR-AP2802E-F-K9,cheetah,ap,air2800, +AIR-AP2802E-K-K9,cheetah,ap,air2800, +AIR-AP2802I-A-K9,cheetah,ap,air2800, +AIR-AP2802I-B-K9,cheetah,ap,air2800, +AIR-AP2802I-C-K9,cheetah,ap,air2800, +AIR-AP2802I-D-K9,cheetah,ap,air2800, +AIR-AP2802I-E-K9,cheetah,ap,air2800, +AIR-AP2802I-F-K9,cheetah,ap,air2800, +AIR-AP2802I-K-K9,cheetah,ap,air2800, +AIR-AP3802E-A-K9,cheetah,ap,air3800, +AIR-AP3802E-B-K9,cheetah,ap,air3800, +AIR-AP3802E-D-K9,cheetah,ap,air3800, +AIR-AP3802E-F-K9,cheetah,ap,air3800, +AIR-AP3802E-K-K9,cheetah,ap,air3800, +AIR-AP3802I-A-K9,cheetah,ap,air3800, +AIR-AP3802I-B-K9,cheetah,ap,air3800, +AIR-AP3802I-C-K9,cheetah,ap,air3800, +AIR-AP3802I-D-K9,cheetah,ap,air3800, +AIR-AP3802I-E-K9,cheetah,ap,air3800, +AIR-AP3802I-F-K9,cheetah,ap,air3800, +AIR-AP3802I-K-K9,cheetah,ap,air3800, +AIR-AP4800-B-K9,cheetah,ap,air4800, +AIR-AP4800-D-K9,cheetah,ap,air4800, +AIR-AP4800-E-K9,cheetah,ap,air4800, +AIR-AP4800-F-K9,cheetah,ap,air4800, +AIR-AP4800-K-K9,cheetah,ap,air4800, AS2511-RJ,ios,c2500,c2511, ASR-9001,iosxr,asr9k,asr9000, ASR-9001-S,iosxr,asr9k,asr9000, @@ -391,6 +433,11 @@ C9130AXI-R,cheetah,ap,c9100ap, C9130AXI-S,cheetah,ap,c9100ap, C9130AXI-T,cheetah,ap,c9100ap, C9130AXI-Z,cheetah,ap,c9100ap, +C9136I-B,cheetah,ap,c9100ap, +C9136I-D,cheetah,ap,c9100ap, +C9136I-E,cheetah,ap,c9100ap, +C9136I-F,cheetah,ap,c9100ap, +C9136I-K,cheetah,ap,c9100ap, C9200-24P,iosxe,cat9k,c9200, C9200-24PB,iosxe,cat9k,c9200, C9200-24PXG,iosxe,cat9k,c9200, @@ -637,6 +684,29 @@ CISCO7613-S,ios,c7k,c7600, CR-4430-B,iosxe,c4k,c4400, CR-4430-K9,iosxe,c4k,c4400, CR-4450-ICDN-K9,iosxe,c4k,c4400, +CW9162I-B,cheetah,ap,cw9100, +CW9162I-D,cheetah,ap,cw9100, +CW9162I-E,cheetah,ap,cw9100, +CW9162I-F,cheetah,ap,cw9100, +CW9162I-K,cheetah,ap,cw9100, +CW9164I-B,cheetah,ap,cw9100, +CW9164I-D,cheetah,ap,cw9100, +CW9164I-E,cheetah,ap,cw9100, +CW9164I-F,cheetah,ap,cw9100, +CW9164I-K,cheetah,ap,cw9100, +CW9164I-ROW,cheetah,ap,cw9100, +CW9166D1-B,cheetah,ap,cw9100, +CW9166D1-D,cheetah,ap,cw9100, +CW9166D1-E,cheetah,ap,cw9100, +CW9166D1-F,cheetah,ap,cw9100, +CW9166D1-K,cheetah,ap,cw9100, +CW9166I-B,cheetah,ap,cw9100, +CW9166I-D,cheetah,ap,cw9100, +CW9166I-E,cheetah,ap,cw9100, +CW9166I-F,cheetah,ap,cw9100, +CW9166I-K,cheetah,ap,cw9100, +CW9176I,cheetah,ap,cw9100, +CW9178I,cheetah,ap,cw9100, IE-3200-8P2S-E,iosxe,ie3k,ie3200, IE-3200-8T2S-E,iosxe,ie3k,ie3200, IE-3300-8P2S-A,iosxe,ie3k,ie3300, @@ -1441,4 +1511,4 @@ WS-C6509-NEB-A,iosxe,cat6k,c6500, WS-C6509-V-E,iosxe,cat6k,c6500, WS-C6513,iosxe,cat6k,c6500, WS-C6513-E,iosxe,cat6k,c6500, -WS-X3011-CH,iosxe,cat3k,c3000, \ No newline at end of file +WS-X3011-CH,iosxe,cat3k,c3000, diff --git a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_cat9k.yaml b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_cat9k.yaml index 4499b0af..649ab86b 100644 --- a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_cat9k.yaml +++ b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_cat9k.yaml @@ -39,6 +39,36 @@ c9k_enable: new_state: c9k_enable_quick_reload "reload": new_state: c9k_reload_proceed + "show startup-config": + response: | + Building configuration... + + Current configuration : 5073 bytes + + ! + + ! Last configuration change at 14:22:51 UTC Mon Jul 14 2025 + + ! + + version 17.18 + + service timestamps debug datetime msec + + service timestamps log datetime msec + + service internal + + ! + + hostname Switch + + ! + + ! + end + new_state: + log_message_2 "show version | include operating mode" : "" "show version" : response: | @@ -184,6 +214,13 @@ log_message: "": new_state: c9k_enable +log_message_2: + preface: "Switch#[OK]" + prompt: "" + commands: + "": + new_state: c9k_enable + c9k_login2: preface: | diff --git a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data.yaml b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data.yaml index 2076a5a2..96d56578 100644 --- a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data.yaml +++ b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data.yaml @@ -1764,4 +1764,71 @@ unlicensed_prompt: commands: "show version | include operating mode": "" "end": - new_state: general_enable \ No newline at end of file + new_state: general_enable + + + +security_log_message: + prompt: " SECURITY WARNING - Module: SSH, Command: crypto key generate rsa ..., Reason: SSH RSA host key uses insufficient key length, Remediation: Configure SSH RSA host key with minimum key length of 3072 bits" + commands: + "": + new_state: general_exec + +enable_reload_security_log1: + prompt: "%N#" + commands: + <<: *gen_enable_cmds + "reload": + new_state: enable_reload_security_log2 + +enable_reload_security_log2: + preface: "Press RETURN to get started!" + prompt: "%N>" + commands: + "": + new_state: security_log_message + +general_login1: + prompt: "Username: " + commands: + "notenable": + new_state: general_password1 + +general_password1: + prompt: "Password: " + commands: + "cisco": + new_state: general_exec1 + +general_exec1: + prompt: "%N>" + commands: + <<: *gen_exec_cmds + "enable": + new_state: enable_password1 + +enable_password1: + prompt: "Password: " + commands: + "cisco123": + new_state: general_enable + +general_exec2: + prompt: "%N>" + commands: + <<: *gen_exec_cmds + "enable 2": + new_state: enable_password2 + +enable_password2: + prompt: "Password: " + commands: + "cisco2": + new_state: general_enable + + +tclsh_continue: + prompt: "+>" + commands: + "}": + new_state: tclsh diff --git a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data_asr.yaml b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data_asr.yaml index c91a563f..54e2d64a 100644 --- a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data_asr.yaml +++ b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_data_asr.yaml @@ -131,6 +131,24 @@ enable_asr: "reload": new_state: ha_reload_proceed + "dir bootflash:/core/": | + dir bootflash:/core/ + Directory of flash-1:/core/ + + 360468 -rw- 1 Jun 27 2022 19:49:31 +00:00 .callhome + 360539 -rw- 609625345 May 19 2022 20:52:07 +00:00 UNIVERSALK9_20150104-042336-UTC.core.gz + 360538 -rw- 90855 May 19 2022 20:50:59 +00:00 kernel.NA_CAT9K_NA_20220519205207.txt + 524407 drwx 4096 Nov 10 2021 18:22:12 +00:00 modules + + "dir stby-bootflash:/core/": | + dir stby-bootflash:/core/ + Directory of stby-bootflash:/core/ + + 360468 -rw- 1 Jun 27 2022 19:49:31 +00:00 .callhome + 360539 -rw- 609625345 May 19 2022 20:52:07 +00:00 UNIVERSALK9_20150105-042336-UTC.core.gz + 360538 -rw- 90855 May 19 2022 20:50:59 +00:00 kernel.NA_CAT9K_NA_20220519205207.txt + 524407 drwx 4096 Nov 10 2021 18:22:12 +00:00 modules + config_asr: prompt: "%N(conf)#" diff --git a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_stack.yaml b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_stack.yaml index ce7db852..068e150f 100644 --- a/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_stack.yaml +++ b/src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_stack.yaml @@ -238,6 +238,30 @@ stack_enable: "exit": new_state: press_return + "dir flash-1:/core/": | + dir flash-1:/core/ + Directory of flash-1:/core/ + + 360468 -rw- 1 Jun 27 2022 19:49:31 +00:00 .callhome + 360539 -rw- 609625345 May 19 2022 20:52:07 +00:00 CAT3K_CAA-1-UNIVERSALK9_20150104-042336-UTC.core.gz + 360538 -rw- 90855 May 19 2022 20:50:59 +00:00 kernel.NA_CAT9K_NA_20220519205207.txt + 524407 drwx 4096 Nov 10 2021 18:22:12 +00:00 modules + + "dir flash-2:/core/": | + dir flash-2:/core/ + Directory of flash:-2/core/ + 170354 -rwx 216438863 Feb 27 2024 17:28:58 +00:00 lux-bootstrap-system-report_20240227-172836.tgz + 170355 drwx 4096 May 3 2015 15:15:37 +00:00 modules + 170357 -rw- 23128995 Jan 4 2015 04:23:42 +00:00 CAT3K_CAA-2-UNIVERSALK9_20150104-042336-UTC.core.gz + 170356 -rw- 183910 Jan 4 2015 04:23:42 +00:00 CAT3K_CAA-UNIVERSALK9-042336-UTC.core.gz.coregen.dbg + + "dir flash-3:/core/": | + dir flash-3:/core/ + Directory of flash-3:/core/ + 170354 -rwx 216438863 Feb 27 2024 17:28:58 +00:00 lux-bootstrap-system-report_20240227-172836.tgz + 170355 drwx 4096 May 3 2015 15:15:37 +00:00 modules + 170357 -rw- 23128995 Jan 4 2015 04:23:42 +00:00 CAT3K_CAA-3-UNIVERSALK9_20150104-042336-UTC.core.gz + 170356 -rw- 183910 Jan 4 2015 04:23:42 +00:00 CAT3K_CAA-UNIVERSALK9-042336-UTC.core.gz.coregen.dbg stack_shell_confirm: prompt: "Are you sure you want to continue? [y/n] " commands: diff --git a/src/unicon/plugins/tests/test_plugin_iosxe.py b/src/unicon/plugins/tests/test_plugin_iosxe.py index a28d249c..6c36ebba 100644 --- a/src/unicon/plugins/tests/test_plugin_iosxe.py +++ b/src/unicon/plugins/tests/test_plugin_iosxe.py @@ -411,6 +411,47 @@ def test_disable_to_enable_no_passwd(self): c.connect() c.disconnect() + def test_enable_password_handler(self): + c = Connection(hostname='Router', + start=['mock_device_cli --os iosxe --state general_exec1 --hostname Router'], + os='iosxe', + credentials=dict(default=dict(username='cisco', password='cisco'), + enable=dict(password='cisco123')), + log_buffer=True + ) + try: + c.connect() + finally: + c.disconnect() + + def test_enable_password_handler2(self): + c = Connection(hostname='Router', + start=['mock_device_cli --os iosxe --state general_login1 --hostname Router'], + os='iosxe', + credentials=dict(default=dict(username='notenable', password='cisco'), + enable=dict(password='cisco123')), + log_buffer=True + ) + try: + c.connect() + finally: + c.disconnect() + + def test_enable_password_handler3(self): + c = Connection(hostname='Router', + start=['mock_device_cli --os iosxe --state general_exec2 --hostname Router'], + os='iosxe', + credentials=dict(default=dict(username='notenable', password='cisco'), + enable=dict(password='cisco2')), + log_buffer=True, + mit=True + ) + try: + c.connect() + c.enable(command='enable 2') + finally: + c.disconnect() + class TestIosXEPluginPing(unittest.TestCase): @@ -1370,7 +1411,7 @@ def test_syslog_handler_guestshell(self): raise finally: c.disconnect() - + def test_handler_ddns_pattern(self): d = Connection( hostname='Router', @@ -1380,8 +1421,25 @@ def test_handler_ddns_pattern(self): log_buffer=True ) - d.connect() - d.disconnect() + try: + d.connect() + finally: + d.disconnect() + + def test_reload_security_log_message(self): + d = Connection( + hostname='Router', + start=['mock_device_cli --os iosxe --state enable_reload_security_log1 --hostname Router'], + os='iosxe', + credentials=dict(default=dict(username='cisco', password='cisco')), + log_buffer=True, + mit=True, + ) + try: + d.connect() + d.reload(post_reload_wait_time=3) + finally: + d.disconnect() class TestIosxeAsr1k(unittest.TestCase): @@ -1492,6 +1550,19 @@ def test_tclsh_long_hostname(self): c.enable() c.disconnect() + def test_tclsh_continue(self): + c = Connection( + hostname='R1', + start=['mock_device_cli --os iosxe --state tclsh_continue --hostname R1'], + os='iosxe', + mit=True + ) + try: + c.connect() + finally: + c.disconnect() + + class TestIosxeAcmConfigure(unittest.TestCase): def test_acm_configure(self): diff --git a/src/unicon/plugins/tests/test_plugin_iosxe_cat9k.py b/src/unicon/plugins/tests/test_plugin_iosxe_cat9k.py index baeb7740..32dbfe83 100644 --- a/src/unicon/plugins/tests/test_plugin_iosxe_cat9k.py +++ b/src/unicon/plugins/tests/test_plugin_iosxe_cat9k.py @@ -892,5 +892,22 @@ def tearDownClass(cls): def test_connect_grub(self): self.device.connect() +class TestIosXeCat9kPluginSyslog(unittest.TestCase): + + def test_syslog_messages(self): + d = Connection(hostname='Router', + start=['mock_device_cli --os iosxe --state c9k_enable'], + os='iosxe', + platform='cat9k', + credentials=dict(default=dict(username='admin', password='cisco')), + settings=dict(POST_DISCONNECT_WAIT_SEC=0, GRACEFUL_DISCONNECT_WAIT_SEC=0.2), + log_buffer=True + ) + try: + d.connect() + d.execute('show startup-config', error_pattern=[]) + finally: + d.disconnect() + if __name__ == '__main__': unittest.main()