from unicon.eal.dialogs import Dialog, Statement from unicon.plugins.generic.statements import default_statement_list from unicon.plugins.generic.statemachine import GenericSingleRpStateMachine, config_transition from unicon.plugins.generic.statemachine import GenericDualRpStateMachine from unicon.plugins.nxos.patterns import NxosPatterns from unicon.statemachine import State, Path patterns = NxosPatterns() def attach_module(state_machine, spawn, context): spawn.sendline('attach module %s' % context.get('_module_num', '1')) def send_config_cmd(state_machine, spawn, context): state_machine.config_command = 'config dual-stage' if context.get('config_dual') else 'config term' config_transition(state_machine, spawn, context) class NxosSingleRpStateMachine(GenericSingleRpStateMachine): def create(self): enable = State('enable', patterns.enable_prompt) config = State('config', patterns.config_prompt) shell = State('shell', patterns.shell_prompt) loader = State('loader', patterns.loader_prompt) guestshell = State('guestshell', patterns.guestshell_prompt) module = State('module', patterns.module_prompt) module_elam = State('module_elam', patterns.module_elam_prompt) module_elam_insel = State('module_elam_insel', patterns.module_elam_insel_prompt)
# reload statement list for nxos dual-rp ha_nxos_reload_statement_list = [ save_env, reboot, secure_password, auto_provision_nxos, reload_proceed, auto_install_dialog, admin_password, setup_dialog, config_byte, enable_vdc, snmp_port, boot_vdc, login_notready, redundant, login_stmt, password_stmt, system_up, run_init, useracess1, skip_poap ] additional_connection_dialog = [ enable_vdc, boot_vdc, snmp_port, admin_password, secure_password, auto_provision_nxos ] # Statements for commit verification on NXOS pat = NxosPatterns() commit_verification_stmt = Statement(pattern=pat.commit_verification, action='sendline()', args=None, loop_continue=True, continue_timer=False) config_commit_stmt_list = [commit_verification_stmt] # Statements for execute service on NXOS pat = NxosPatterns() nxos_module_reload_stmt = Statement(pattern=pat.nxos_module_reload, action='sendline(y)', args=None,