Skip to content

Commit e07178f

Browse files
authored
Merge pull request #94 from CiscoTestAutomation/release_24.1
Release 24.1
2 parents d9d4036 + 80ac39b commit e07178f

27 files changed

+449
-213
lines changed

docs/changelog/2024/january.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
January 2024
2+
==========
3+
4+
30 - Unicon v24.1
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v24.1
13+
``unicon``, v24.1
14+
15+
Install Instructions
16+
^^^^^^^^^^^^^^^^^^^^
17+
18+
.. code-block:: bash
19+
20+
bash$ pip install unicon.plugins
21+
bash$ pip install unicon
22+
23+
Upgrade Instructions
24+
^^^^^^^^^^^^^^^^^^^^
25+
26+
.. code-block:: bash
27+
28+
bash$ pip install --upgrade unicon.plugins
29+
bash$ pip install --upgrade unicon
30+
31+
Features and Bug Fixes:
32+
^^^^^^^^^^^^^^^^^^^^^^^
33+
34+
35+
36+
37+
Changelogs
38+
^^^^^^^^^^
39+
--------------------------------------------------------------------------------
40+
Fix
41+
--------------------------------------------------------------------------------
42+
43+
* pty_backend
44+
* Modified error handling logic to allow dialog to process statements on subprocess exit
45+
46+
* utils
47+
* Update ansi pattern to allow imports
48+
49+
* statemachine
50+
* Update hostname logic to handle hostnames with special characters
51+
52+
* unicon
53+
* Add CLI option to enable debug logs
54+
55+
56+
--------------------------------------------------------------------------------
57+
Fix
58+
--------------------------------------------------------------------------------
59+
60+
* service_implementation
61+
* Modified Reload service
62+
* Removed sendline after reload
63+
64+
* iosxr
65+
* Modified moonshine UTs
66+
* Updated wrong import statements in standalone_ping_test.py and config_test.py UTs.
67+
68+

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+
2024/january
78
2023/november
89
2023/october
910
2023/september
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
January 2024
2+
==========
3+
4+
30 - Unicon.Plugins v24.1
5+
------------------------
6+
7+
8+
9+
.. csv-table:: Module Versions
10+
:header: "Modules", "Versions"
11+
12+
``unicon.plugins``, v24.1
13+
``unicon``, v24.1
14+
15+
Install Instructions
16+
^^^^^^^^^^^^^^^^^^^^
17+
18+
.. code-block:: bash
19+
20+
bash$ pip install unicon.plugins
21+
bash$ pip install unicon
22+
23+
Upgrade Instructions
24+
^^^^^^^^^^^^^^^^^^^^
25+
26+
.. code-block:: bash
27+
28+
bash$ pip install --upgrade unicon.plugins
29+
bash$ pip install --upgrade unicon
30+
31+
Features and Bug Fixes:
32+
^^^^^^^^^^^^^^^^^^^^^^^
33+
34+
35+
36+
37+
Changelogs
38+
^^^^^^^^^^
39+
--------------------------------------------------------------------------------
40+
Add
41+
--------------------------------------------------------------------------------
42+
43+
* generic
44+
* Added more prompt support in connection statement list
45+
46+
47+
--------------------------------------------------------------------------------
48+
Fix
49+
--------------------------------------------------------------------------------
50+
51+
* iosxe
52+
* Added unittests to test hostnames with special characters\
53+
* Update settings for reload API, change SYSLOG_WAIT to 10 seconds
54+
* cat9k
55+
* Update image_to_boot for HA device. (active and standby rp)
56+
57+
* generic, iosxe
58+
* Update config transition logic, increase wait time for prompt
59+
60+
* generic
61+
* Update response to setup dialog to "no" instead of "n"
62+
63+
* linux
64+
* Update linux hostname learning pattern to handle ANSI characters in prompt
65+
66+

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+
2024/january
78
2023/november
89
2023/october
910
2023/september

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__ = '23.11'
1+
__version__ = '24.1'
22

33
supported_chassis = [
44
'single_rp',

src/unicon/plugins/generic/patterns.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@ def __init__(self):
2323
""" initialises all generic patterns
2424
"""
2525
super().__init__()
26-
# self.enable_prompt = r'.*%N#\s?$'
2726
self.default_hostname_pattern = r'WLC|RouterRP|Router|[Ss]witch|Controller|ios'
2827

2928
self.enable_prompt = r'^(.*?)(Router|Router-stby|Router-sdby|RouterRP|RouterRP-standby|%N-standby|%N\(standby\)|%N-sdby|%N-stby|(S|s)witch|(S|s)witch\(standby\)|Controller|ios|-Slot[0-9]+|%N)(\(boot\))*#\s?$'
3029

31-
# self.disable_prompt = r'.*%N>\s?$'
3230
self.disable_prompt = r'^(.*?)(Router|Router-stby|Router-sdby|RouterRP|RouterRP-standby|%N-standby|%N-sdby|%N-stby|(S|s)witch|s(S|s)witch\(standby\)|Controller|ios|-Slot[0-9]+|%N)(\(boot\))*>\s?$'
3331

34-
# self.config_prompt = r'.*%N\(config.*\)#\s?$'
3532
self.config_prompt = r'^(.*)\(.*(con|cfg|ipsec-profile|ca-trustpoint|gkm-local-server)\S*\)#\s?$'
3633
self.rommon_prompt = r'^(.*?)(rommon[\s\d]*>|switch:)\s?$'
3734
# self.standby_enable_prompt = r'^(.*?)(RouterRP-standby|%N-standby|%N-sdby|%N\(standby\))#\s?$'
@@ -71,7 +68,7 @@ def __init__(self):
7168

7269
self.config_locked = r'Configuration (mode )?(is )?locked|Config mode cannot be entered'
7370

74-
self.config_start = r'Enter configuration commands, one per line\.\s+End with CNTL/Z\.\s*$'
71+
self.config_start = r'\nEnter configuration commands, one per line\.\s+End with CNTL/Z\.\s*$'
7572

7673
self.enable_secret = r'^.*?(Enter|Confirm) enable secret:\s*$'
7774

src/unicon/plugins/generic/service_implementation.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,10 +1094,12 @@ def call_service(self,
10941094
post_reload_wait_time = None,
10951095
*args, **kwargs):
10961096

1097-
10981097
con = self.connection
10991098
timeout = timeout or self.timeout
11001099

1100+
syslog_wait = con.settings.SYSLOG_WAIT
1101+
con.settings.SYSLOG_WAIT = con.settings.RELOAD_SYSLOG_WAIT
1102+
11011103
if error_pattern is None:
11021104
self.error_pattern = con.settings.ERROR_PATTERN
11031105
else:
@@ -1200,7 +1202,13 @@ def call_service(self,
12001202
if (current_time - start_time) > timeout_time:
12011203
con.log.info('Time out, trying to acces device..')
12021204
break
1203-
con.sendline()
1205+
1206+
# ! This line was added to resolve an issue with HA devices, but was
1207+
# ! found to cause further issues with other devices on reload
1208+
# TODO Need to find a better way to implement a fix for HA devices
1209+
# TODO that does not cause issues with other devices. Likely need to
1210+
# TODO modify the state machine and/or dialog processing.
1211+
# con.sendline()
12041212
try:
12051213
con.context = context
12061214
con.connection_provider.connect()
@@ -1212,6 +1220,8 @@ def call_service(self,
12121220
con.log.exception('Connection to {} failed'.format(con.hostname))
12131221
self.result = False
12141222

1223+
con.settings.SYSLOG_WAIT = syslog_wait
1224+
12151225
self.log_buffer.seek(0)
12161226
reload_output = self.log_buffer.read()
12171227
# clear buffer

src/unicon/plugins/generic/service_statements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def config_session_locked_handler(context):
268268
continue_timer=False)
269269

270270
setup_dialog = Statement(pattern=reload_patterns.setup_dialog,
271-
action=send_response, args={'response': 'n'},
271+
action=send_response, args={'response': 'no'},
272272
loop_continue=True,
273273
continue_timer=False)
274274

src/unicon/plugins/generic/settings.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,8 @@ def __init__(self):
7070
self.BOOT_FILESYSTEM = 'bootflash:'
7171
self.BOOT_FILE_REGEX = r'(\S+\.bin)'
7272

73-
# Wait for the config prompt to appear
74-
# before checking for the config prompt.
75-
# This may need to be adjusted if the RTT between
76-
# the execution host and lab device is high.
77-
self.CONFIG_TRANSITION_WAIT = 0.2
73+
# Time to wait for the config prompt to appear
74+
self.CONFIG_TRANSITION_WAIT = 15
7875

7976
# If learn_hostname is requested but no hostname was actually learned,
8077
# substitute this default hostname when occurances of HOSTNAME_SUBST_PAT
@@ -100,6 +97,8 @@ def __init__(self):
10097

10198
# syslog message handling timers
10299
self.SYSLOG_WAIT = 1
100+
# syslog wait time for reload service
101+
self.RELOAD_SYSLOG_WAIT = 10
103102

104103
# pattern to replace "more" string
105104
# command to continue for more_prompt_stmt

src/unicon/plugins/generic/statemachine.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ def config_service_prompt_handler(spawn, config_pattern):
3535
""" Check if we need to send the sevice config prompt command.
3636
"""
3737
if hasattr(spawn.settings, 'SERVICE_PROMPT_CONFIG_CMD') and spawn.settings.SERVICE_PROMPT_CONFIG_CMD:
38+
spawn.log.debug('Waiting for config prompt')
3839
# if the config prompt is seen, return
3940
if re.search(config_pattern, spawn.buffer):
4041
return
4142
else:
42-
# if no buffer changes for a few seconds, check again
43-
if buffer_settled(spawn, spawn.settings.CONFIG_PROMPT_WAIT):
43+
# if no buffer changes for (config timout) seconds, check again
44+
if buffer_settled(spawn, spawn.settings.CONFIG_TRANSITION_WAIT):
4445
if re.search(config_pattern, spawn.buffer):
4546
return
4647
else:
48+
spawn.log.debug('Config prompt not seen, enabling service prompt config')
4749
spawn.sendline(spawn.settings.SERVICE_PROMPT_CONFIG_CMD)
4850

4951

@@ -66,7 +68,6 @@ def config_transition(statemachine, spawn, context):
6668

6769
for attempt in range(max_attempts + 1):
6870
spawn.sendline(statemachine.config_command)
69-
buffer_wait(spawn, spawn.settings.CONFIG_TRANSITION_WAIT)
7071
dialog.process(spawn, timeout=spawn.settings.CONFIG_TIMEOUT, context=context)
7172

7273
statemachine.detect_state(spawn)

0 commit comments

Comments
 (0)