33 pyATS TEAM (pyats-support@cisco.com, pyats-support-ext@cisco.com)
44"""
55import re
6- from unicon .eal .dialogs import Dialog
6+
7+ from unicon .eal .dialogs import Dialog , Statement
78from unicon .bases .routers .connection_provider import BaseStackRpConnectionProvider
89
10+ from genie .metaparser .util .exceptions import SchemaEmptyParserError
11+
912from unicon .plugins .generic .statements import connection_statement_list , custom_auth_statements
1013
14+
1115class StackwiseVirtualConnectionProvider (BaseStackRpConnectionProvider ):
1216 """ Implements Stack Connection Provider,
1317 This class overrides the base class with the
@@ -36,12 +40,23 @@ def designate_handles(self):
3640 other_alias = None
3741
3842 # Try to go to enable mode on both connections
43+ standby_locked_dialog = Dialog ([
44+ Statement (
45+ pattern = r'.*Standby console disabled.*' ,
46+ action = None ,
47+ loop_continue = False ,
48+ continue_timer = False ,
49+ )
50+ ])
51+
3952 for subcon in [subcon1 , subcon2 ]:
4053 try :
4154 subcon .state_machine .go_to (
4255 'enable' ,
4356 subcon .spawn ,
4457 context = subcon .context ,
58+ timeout = con .settings .BOOT_TIMEOUT ,
59+ dialog = standby_locked_dialog ,
4560 )
4661 except Exception :
4762 pass
@@ -63,7 +78,11 @@ def designate_handles(self):
6378 device = con .device
6479 try :
6580 # To check if the device is in SVL state
66- output = device .parse ("show switch" )
81+ try :
82+ output = device .parse ("show switch" )
83+ except SchemaEmptyParserError :
84+ con .log .debug ("show switch returned empty output" )
85+ output = {}
6786 stack_info = output .get ("switch" , {}).get ("stack" , {})
6887 roles = [switch_info .get ("role" ) for switch_info in stack_info .values ()]
6988
0 commit comments