unicon.plugins
unicon.plugins copied to clipboard
Executing commands on IOS-XE Controller-Mode fails in 24.3
Until pyats 24.2, login and command execution on IOS-XE Controller-Mode works. However starting 24.3 it doesn't. Simple test:
- Boot and configure the IOS-XE Controller-Mode
- Try to connect to console and run commands using pyats. The first time it get's stuck after "pnpa service discovery stop". Looking at the console I see pyats connected and did "show version" and "pnpa service discovery stop" however it didn't enter enable mode so command failed as expected by IOS-XE (pnpa service discovery stop needs to be run from enable mode).
User Access Verification
Username: admin
Password:
Edge1>
Edge1>show version | include operating mode
Router operating mode: Controller-Managed
Edge1>pnpa service discovery stop
^
% Invalid input detected at '^' marker.
Edge1>
If I then go into enable mode in console manually and retry, pyats will fails again. Now since console is already in enable mode, the "pnpa service discovery stop" command works, but after that nothing happens and pyats eventually gives error:
Traceback (most recent call last):
File "src/unicon/bases/connection.py", line 789, in unicon.bases.connection.Connection.connect
File "src/unicon/bases/routers/connection_provider.py", line 227, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect
File "src/unicon/bases/routers/connection_provider.py", line 268, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection
File "/Users/tzarski/Documents/sdwan-lab-deployment-tool/venv/lib/python3.12/site-packages/unicon/plugins/iosxe/connection_provider.py", line 56, in learn_tokens
dialog.process(con.spawn,
File "src/unicon/eal/dialogs.py", line 479, in unicon.eal.dialogs.Dialog.process
File "src/unicon/eal/dialog_processor.py", line 344, in unicon.eal.dialog_processor.SimpleDialogProcessor.process
File "src/unicon/eal/dialog_processor.py", line 290, in unicon.eal.dialog_processor.SimpleDialogProcessor.timeout_handler
unicon.core.errors.TimeoutError: timeout occurred:
timeout value: 300
last_command: '\r'
pattern: ['^.*System config(uration)? has been modified\\.\\s*Save\\?.*$', '^.*Are you sure you want to reset the system\\s*\\(y\\/n\\)\\?', '^.*Reload node\\s*\\?\\s*\\[no,yes\\]\\s?$', '^.*Proceed( with( quick)? reload)?\\?\\s*\\[confirm\\]', '^.*Do you wish to proceed with reload anyway\\s*\\[confirm\\]\\s*', '^.*User Access Verification', '^(.*)Uncommitted changes found.*?', '^.*(initial|basic) configuration dialog\\s?\\??\\s*((\\[yes.*\\])|(\\(yes/no\\))|(\\(yes/no\\)\\s*(\\[y\\]))):', '^(.*)Would you like to terminate autoinstall\\?\\s*\\[yes\\]:\\s*$', '^.*Do you want to reload the internal AP\\s?\\?\\s((\\[yes/no\\]\\??)|(\\[y/n\\]\\??)):?\\s?$', '^.*Do you want to save the configuration of the AP\\s?\\?\\s*((\\[yes/no\\]\\??)|(\\[y/n\\]\\??)):?\\s?$', '^(.*)This command will reboot the system.\\s*\\(y\\/n\\)\\?\\s*\\[n\\]\\s?$', '^.*Do you want to enforce secure password standard(\\?)?\\s*\\(yes\\/no\\)(\\s*\\[[yn]\\])?\\:\\s*', '^.*(Enter|Confirm) the password for .*admin', 'Abort( Power On)? Auto Provisioning .*:', 'Password OK\\s*$', '^.*([Uu]sername|[Ll]ogin): ?$', '^.*?(Enter|Confirm) enable secret:\\s*$', '^.*?Enter your selection( \\[2])?:\\s*$', '^.*?(%\\w+(-\\S+)?-\\d+-\\w+|Guestshell destroyed successfully|%Error opening tftp:\\/\\/255\\.255\\.255\\.255|Autoinstall trying|audit: kauditd hold queue overflow).*$', '^.*[Pp]assword( for )?(\\S+)?: ?$', '^.*Press RETURN to get started.*', 'Press RETURN to get started.*', '^(.*?)Connection.*? closed|disconnect: Broken pipe', '^.*?Enter your encryption selection( \\[2])?:\\s*$', '^.*--\\s?[Mm]ore\\s?--.*$', '.*The highlighted entry will be (booted|executed) automatically', '^(.*?)(rommon[\\s\\d]*>|switch:)\\s?$', '^(.*?)(Router|Router-stby|Router-sdby|RouterRP|RouterRP-standby|consoles-standby|consoles\\(standby\\)|consoles-sdby|consoles-stby|(S|s)witch|(S|s)witch\\(standby\\)|Controller|ios|-Slot[0-9]+|consoles)(\\(boot\\))*#\\s?$']
buffer:"pnpa service discovery stop\r\nEdge1#\r\n*May 1 13:28:23.241: %PNP-6-PNP_SDWAN_STARTED: PnP SDWAN started (2) via (pnp-sdwan-abort-on-cli) by (pid=567, pname=Exec)\r\n*May 1 13:28:23.241: %PNP-6-PNP_DISCOVERY_NOT_RUNNING: PNP Discovery is not running\r\n*May 1 13:28:23.241: %PNP-6-PNP_DISCOVERY_ABORT_ON_CLI: PnP Discovery abort on CLI input\r\nEdge1#\r\n*May 1 13:30:30.549: %DMI-5-AUTH_PASSED: R0/0: dmiauthd: User 'vmanage-admin' authenticated successfully from 100.0.0.1:42472 for netconf over ssh. External groups:\r\nEdge1#\r\n*May 1 13:31:00.483: %DMI-5-AUTH_PASSED: R0/0: dmiauthd: User 'vmanage-admin' authenticated successfully from 100.0.0.1:42654 for netconf over ssh. External groups:\r\nEdge1#\r\n*May 1 13:31:30.505: %DMI-5-AUTH_PASSED: R0/0: dmiauthd: User 'vmanage-admin' authenticated successfully from 100.0.0.1:42786 for netconf over ssh. External groups:\r\nEdge1#\r\n*May 1 13:32:00.523: %DMI-5-AUTH_PASSED: R0/0: dmiauthd: User 'vmanage-admin' authenticated successfully from 100.0.0.1:42940 for netconf over ssh. External groups:\r\nEdge1#\r\n*May 1 13:32:30.530: %DMI-5-AUTH_PASSED: R0/0: dmiauthd: User 'vmanage-admin' authenticated successfully from 100.0.0.1:43072 for netconf over ssh. External groups:\r\nEdge1#"
On console I see the first two commands were successful, but then nothing happened:
Edge1#show version | include operating mode
Router operating mode: Controller-Managed
Edge1#pnpa service discovery stop
Edge1#
*May 1 13:28:23.241: %PNP-6-PNP_SDWAN_STARTED: PnP SDWAN started (2) via (pnp-sdwan-abort-on-cli) by (pid=567, pname=Exec)
*May 1 13:28:23.241: %PNP-6-PNP_DISCOVERY_NOT_RUNNING: PNP Discovery is not running
*May 1 13:28:23.241: %PNP-6-PNP_DISCOVERY_ABORT_ON_CLI: PnP Discovery abort on CLI input
Edge1#
I assume both problems are due to changes introduced in: https://github.com/CiscoTestAutomation/unicon.plugins/blob/master/src/unicon/plugins/iosxe/connection_provider.py
Hello @tzarski0,
Kindly try again with pyats 24.4 version which will be released soon and then let me know the status on it.
Thank you.
Hi @SohanTirpude, I've just tested and it fails on 24.4 too. The most recent version that works is 24.2.
Hello @tzarski0,
Thank you for the update. I have raised a PR for this issue. Once it is merged, I will update you back here.
Thank you.
Hello @tzarski0,
The PR got merged, hence I am closing this ticket. The fix will be available in the upcoming pyats version. Kindly try it again once the new version gets released.
Thank you.