├── .github ├── CODEOWNERS └── workflows │ └── run_tests.yml ├── .gitignore ├── DESCRIPTION.rst ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.md ├── docs ├── README.md ├── _static │ └── css │ │ └── custom.css ├── api │ ├── modules.rst │ ├── unicon.bases.linux.rst │ ├── unicon.bases.routers.rst │ ├── unicon.bases.rst │ ├── unicon.core.rst │ ├── unicon.database.rst │ ├── unicon.eal.backend.rst │ ├── unicon.eal.rst │ ├── unicon.rst │ └── unicon.statemachine.rst ├── changelog │ ├── 2016 │ │ ├── december.rst │ │ ├── february.rst │ │ ├── may.rst │ │ ├── november.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2017 │ │ ├── august.rst │ │ ├── december.rst │ │ ├── feb.rst │ │ ├── jan.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── may.rst │ │ ├── november.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2018 │ │ ├── apr.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── jul.rst │ │ ├── jun.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── nov.rst │ │ ├── oct.rst │ │ └── sept.rst │ ├── 2019 │ │ ├── april.rst │ │ ├── aug.rst │ │ ├── dec.rst │ │ ├── jan.rst │ │ ├── jul.rst │ │ ├── jun.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── nov.rst │ │ ├── oct.rst │ │ └── sept.rst │ ├── 2020 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── december.rst │ │ ├── feb.rst │ │ ├── jan.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── may.rst │ │ ├── october.rst │ │ └── sept.rst │ ├── 2021 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── december.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2022 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── november.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2023 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── november.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2024 │ │ ├── September.rst │ │ ├── april.rst │ │ ├── august.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── november.rst │ │ └── october.rst │ ├── 2025 │ │ ├── april.rst │ │ ├── february.rst │ │ ├── january.rst │ │ └── march.rst │ ├── index.rst │ └── undistributed │ │ └── template.rst ├── changelog_plugins │ ├── 2019 │ │ ├── dec.rst │ │ └── nov.rst │ ├── 2020 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── december.rst │ │ ├── feb.rst │ │ ├── jan.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── may.rst │ │ ├── october.rst │ │ └── sept.rst │ ├── 2021 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── december.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2022 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── november.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2023 │ │ ├── april.rst │ │ ├── august.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── november.rst │ │ ├── october.rst │ │ └── september.rst │ ├── 2024 │ │ ├── September.rst │ │ ├── april.rst │ │ ├── august.rst │ │ ├── february.rst │ │ ├── january.rst │ │ ├── july.rst │ │ ├── june.rst │ │ ├── march.rst │ │ ├── may.rst │ │ ├── november.rst │ │ └── october.rst │ ├── 2025 │ │ ├── april.rst │ │ ├── february.rst │ │ ├── january.rst │ │ └── march.rst │ ├── changelog_modify_generice_rommon_prompt_pattern_20241028185708.rst │ ├── index.rst │ └── undistributed │ │ └── template.rst ├── conf.py ├── developer_guide │ ├── eal.rst │ ├── images │ │ ├── bench.jpg │ │ ├── connection.jpeg │ │ ├── plugins.jpg │ │ └── statemachine.jpeg │ ├── ios_mock_data.yaml │ ├── plugins.rst │ ├── service_framework.rst │ ├── statemachine.rst │ └── unittests.rst ├── gen_dialogs_rst.py ├── index.rst ├── playback │ └── index.rst ├── robot │ └── index.rst └── user_guide │ ├── connection.rst │ ├── examples │ ├── 1_eal_simple_sendex.py │ ├── 2_dialog_with_three_callbacks.py │ ├── 3_dialog_with_one_callback.py │ ├── 4_using_lambda.py │ ├── 5_using_shorthand.py │ ├── 6_using_session.py │ ├── 7_using_shorthand_with_session.py │ └── router.sh │ ├── introduction.rst │ ├── passwords.rst │ ├── proxy.rst │ ├── services │ ├── aci.rst │ ├── asa_fp2k.rst │ ├── cimc.rst │ ├── confd.rst │ ├── ftd.png │ ├── ftd.rst │ ├── fxos.rst │ ├── fxos_fp4k.rst │ ├── fxos_fp9k.rst │ ├── gaia.rst │ ├── generic_services.rst │ ├── index.rst │ ├── iosxe.rst │ ├── iosxe_c9800_ewc_ap.rst │ ├── iosxr.rst │ ├── junos.rst │ ├── linux.rst │ ├── nso.rst │ ├── nxos.rst │ ├── nxos_mds.rst │ ├── sdwan.rst │ ├── sros.rst │ ├── staros.rst │ ├── vos.rst │ ├── what_are_services.rst │ └── windows.rst │ └── supported_platforms.rst ├── setup.py ├── src └── unicon │ └── plugins │ ├── __init__.py │ ├── aireos │ ├── __init__.py │ ├── ap │ │ ├── __init__.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── service_statements.py │ ├── settings.py │ └── statemachine.py │ ├── apic │ ├── __init__.py │ ├── connection.py │ ├── patterns.py │ ├── service_implementation.py │ ├── service_patterns.py │ ├── service_statements.py │ ├── settings.py │ └── statemachine.py │ ├── asa │ ├── ASAv │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── __init__.py │ ├── fp2k │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ └── statements.py │ ├── patterns.py │ ├── provider.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── cheetah │ ├── __init__.py │ └── ap │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statement.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── cimc │ ├── __init__.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── comware │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── service_statements.py │ ├── settings.py │ └── statemachine.py │ ├── confd │ ├── __init__.py │ ├── csp │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── esc │ │ └── __init__.py │ ├── nfvis │ │ ├── __init__.py │ │ ├── patterns.py │ │ └── statemachine.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── dnos10 │ ├── __init__.py │ ├── patterns.py │ ├── services.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── dnos6 │ ├── __init__.py │ ├── patterns.py │ ├── services.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── eos │ ├── __init__.py │ ├── patterns.py │ ├── services.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── fxos │ ├── __init__.py │ ├── fp4k │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── fp9k │ │ └── __init__.py │ ├── ftd │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ └── statements.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── gaia │ ├── __init__.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── generic │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── service_patterns.py │ ├── service_statements.py │ ├── settings.py │ ├── statemachine.py │ ├── statements.py │ └── utils.py │ ├── hvrp │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── services.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── ios │ ├── __init__.py │ ├── ap │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ └── settings.py │ ├── iol │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ └── service_statements.py │ ├── iosv │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_statements.py │ │ ├── setting.py │ │ ├── statemachine.py │ │ └── statements.py │ ├── pagent │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── statemachine.py │ │ └── statements.py │ ├── service_implementation.py │ └── settings.py │ ├── iosxe │ ├── __init__.py │ ├── cat3k │ │ ├── __init__.py │ │ ├── ewlc │ │ │ ├── __init__.py │ │ │ └── service_implementation.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_statements.py │ │ ├── setting.py │ │ ├── statemachine.py │ │ └── tests │ │ │ └── test.py │ ├── cat4k │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── cat8k │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── cat9k │ │ ├── __init__.py │ │ ├── c9100ap │ │ │ ├── __init__.py │ │ │ ├── patterns.py │ │ │ ├── service_implementation.py │ │ │ ├── service_statements.py │ │ │ ├── settings.py │ │ │ └── statemachine.py │ │ ├── c9800 │ │ │ ├── __init__.py │ │ │ ├── settings.py │ │ │ └── statemachine.py │ │ ├── c9800cl │ │ │ └── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ └── statements.py │ ├── connection_provider.py │ ├── csr1000v │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ └── vewlc │ │ │ ├── __init__.py │ │ │ └── service_implementation.py │ ├── iec3400 │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── patterns.py │ ├── quad │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ └── utils.py │ ├── sdwan │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── service_implementation.py │ ├── service_statements.py │ ├── settings.py │ ├── stack │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ ├── exception.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ └── utils.py │ ├── statemachine.py │ └── statements.py │ ├── iosxr │ ├── __init__.py │ ├── asr9k │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── connection_provider.py │ ├── errors.py │ ├── iosxrv │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ ├── patterns.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── iosxrv9k │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ ├── patterns.py │ │ └── settings.py │ ├── moonshine │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ ├── patterns.py │ │ ├── pty_backend.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ ├── statements.py │ │ └── tests │ │ │ ├── config_test.py │ │ │ ├── ios_moonshine_clean.yaml │ │ │ ├── ios_moonshine_unicon_config.yaml │ │ │ ├── moonshine_e2e_test.py │ │ │ ├── moonshine_moonshine_clean.yaml │ │ │ ├── moonshine_moonshine_unicon_config.yaml │ │ │ ├── moonshine_test_job.py │ │ │ └── standalone_ping_test.py │ ├── ncs5k │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ └── settings.py │ ├── patterns.py │ ├── service_implementation.py │ ├── service_patterns.py │ ├── service_statements.py │ ├── settings.py │ ├── spitfire │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ ├── errors.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ ├── statemachine.py │ │ └── statements.py │ ├── statemachine.py │ ├── statements.py │ └── utils.py │ ├── ironware │ ├── __init__.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ └── statemachine.py │ ├── ise │ ├── __init__.py │ ├── patterns.py │ ├── service_implementation.py │ ├── statemachine.py │ └── tests │ │ └── test_ise.py │ ├── junos │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── setting.py │ ├── statemachine.py │ ├── statements.py │ └── vsrx │ │ ├── __init__.py │ │ └── statemachine.py │ ├── linux │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ ├── statements.py │ └── utils.py │ ├── nd │ └── __init__.py │ ├── nso │ └── __init__.py │ ├── nxos │ ├── __init__.py │ ├── aci │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── connection_provider.py │ ├── mds │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ └── statemachine.py │ ├── n5k │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ └── service_statements.py │ ├── n7k │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ └── setting.py │ ├── n9k │ │ ├── __init__.py │ │ ├── service_implementation.py │ │ ├── service_statements.py │ │ └── setting.py │ ├── nxosv │ │ ├── __init__.py │ │ ├── connection_provider.py │ │ ├── patterns.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── setting.py │ │ └── statemachine.py │ ├── patterns.py │ ├── service_implementation.py │ ├── service_patterns.py │ ├── service_statements.py │ ├── setting.py │ ├── statemachine.py │ ├── statements.py │ ├── tests │ │ └── test_vdc.py │ └── utils.py │ ├── ons │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── settings.py │ └── statemachine.py │ ├── pid_tokens.csv │ ├── sdwan │ ├── __init__.py │ ├── iosxe │ │ └── __init__.py │ └── viptela │ │ ├── __init__.py │ │ ├── patterns.py │ │ ├── service_implementation.py │ │ ├── service_patterns.py │ │ ├── service_statements.py │ │ ├── settings.py │ │ └── statemachine.py │ ├── slxos │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ ├── sonic │ ├── __init__.py │ └── settings.py │ ├── sros │ ├── __init__.py │ ├── connection_provider.py │ ├── patterns.py │ ├── service_implementation.py │ ├── setting.py │ ├── statemachine.py │ └── statements.py │ ├── staros │ ├── __init__.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ └── statemachine.py │ ├── tests │ ├── __init__.py │ ├── mock │ │ ├── __init__.py │ │ ├── mock_device_aireos.py │ │ ├── mock_device_asa.py │ │ ├── mock_device_confd.py │ │ ├── mock_device_dnos10.py │ │ ├── mock_device_dnos6.py │ │ ├── mock_device_eos.py │ │ ├── mock_device_fxos.py │ │ ├── mock_device_gaia.py │ │ ├── mock_device_generic.py │ │ ├── mock_device_hpcomware.py │ │ ├── mock_device_hvrp.py │ │ ├── mock_device_ios.py │ │ ├── mock_device_iosxe.py │ │ ├── mock_device_iosxe_cat4k.py │ │ ├── mock_device_iosxe_cat8k.py │ │ ├── mock_device_iosxe_cat9k.py │ │ ├── mock_device_iosxr.py │ │ ├── mock_device_iosxr_spitfire.py │ │ ├── mock_device_ironware.py │ │ ├── mock_device_junos.py │ │ ├── mock_device_linux.py │ │ ├── mock_device_nxos.py │ │ ├── mock_device_slxos.py │ │ ├── mock_device_sros.py │ │ └── mock_device_vos.py │ ├── mock_data │ │ ├── aci │ │ │ └── apic_mock_data.yaml │ │ ├── aireos │ │ │ ├── aireos_force_switchover.txt │ │ │ ├── aireos_mock_data.yaml │ │ │ ├── aireos_reload_85.txt │ │ │ ├── aireos_reload_with_error_patterns.txt │ │ │ └── aireos_restart.txt │ │ ├── apic │ │ │ ├── apic_mock_data.yaml │ │ │ └── apic_reboot.txt │ │ ├── asa │ │ │ ├── asa_fp2k_mock_data.yaml │ │ │ ├── asa_mock_data.yaml │ │ │ ├── fp2k_reload.txt │ │ │ ├── fp2k_reload_rommon.txt │ │ │ └── fp2k_rommon_boot.txt │ │ ├── cheetah │ │ │ ├── cheetah_mock_data.yaml │ │ │ └── cheetah_reload.txt │ │ ├── cimc │ │ │ └── cimc_mock_data.yaml │ │ ├── comware │ │ │ └── comware_data.yaml │ │ ├── confd │ │ │ ├── confd_mock_data.yaml │ │ │ ├── confd_mock_data_csp.yaml │ │ │ ├── confd_mock_data_nfvis.yaml │ │ │ ├── confd_mock_error_data.yaml │ │ │ └── csp_reload.txt │ │ ├── dnos10 │ │ │ └── dnos10_mock_data.yaml │ │ ├── dnos6 │ │ │ └── dnos6_mock_data.yaml │ │ ├── eos │ │ │ └── eos_mock_data.yaml │ │ ├── fxos │ │ │ ├── fp2k_ftd_boot.txt │ │ │ ├── fp2k_mgmt_boot.txt │ │ │ ├── fp2k_mgmt_rommon.txt │ │ │ ├── fp2k_mgmt_rommon_boot.txt │ │ │ ├── fp2k_mock_data.yaml │ │ │ ├── fp4k_mgmt_boot.txt │ │ │ ├── fp4k_mgmt_rommon.txt │ │ │ ├── fp4k_mgmt_rommon_boot.txt │ │ │ ├── fp4k_mock_data.yaml │ │ │ └── fxos_mock_data.yaml │ │ ├── gaia │ │ │ ├── gaia_mock_data.yaml │ │ │ └── gaia_mock_data_expert.yaml │ │ ├── generic │ │ │ ├── generic_mock_data_asa.yaml │ │ │ ├── generic_mock_data_ios.yaml │ │ │ ├── generic_mock_data_iosxe.yaml │ │ │ ├── generic_mock_data_iosxe_ha_asr.yaml │ │ │ ├── generic_mock_data_iosxr.yaml │ │ │ ├── generic_mock_data_linux.yaml │ │ │ └── generic_mock_data_nxos.yaml │ │ ├── hvrp │ │ │ └── hvrp_mock_data.yaml │ │ ├── ios │ │ │ ├── ios_iol_mock_data.yaml │ │ │ ├── ios_mock_clear.yaml │ │ │ ├── ios_mock_copy.yaml │ │ │ ├── ios_mock_data.yaml │ │ │ ├── ios_mock_data_standby.yaml │ │ │ ├── ios_mock_pagent.yaml │ │ │ ├── ios_mock_ping.yaml │ │ │ └── ios_mock_reload.yaml │ │ ├── iosxe │ │ │ ├── asr1k_reload.txt │ │ │ ├── c9k_boot_rommon.txt │ │ │ ├── c9k_redundancy_switchover.txt │ │ │ ├── cat3k_rommon_boot.txt │ │ │ ├── cat8kv_grub_menu.txt │ │ │ ├── cat9k_ctc_version.txt │ │ │ ├── cat9k_ha_reload.txt │ │ │ ├── cat9k_reload_logs.txt │ │ │ ├── cat9k_vwlc_reload_logs.txt │ │ │ ├── ha_asr1k_boot_from_rommon.txt │ │ │ ├── iosxe_mock_cat9k.yaml │ │ │ ├── iosxe_mock_cat9k_config_session.yaml │ │ │ ├── iosxe_mock_copy.yaml │ │ │ ├── iosxe_mock_crft.yaml │ │ │ ├── iosxe_mock_data.yaml │ │ │ ├── iosxe_mock_data_asr.yaml │ │ │ ├── iosxe_mock_data_asr1k_ha.yaml │ │ │ ├── iosxe_mock_data_asr_standby.yaml │ │ │ ├── iosxe_mock_data_c8kv.yaml │ │ │ ├── iosxe_mock_data_cat3k.yaml │ │ │ ├── iosxe_mock_data_cat4k.yaml │ │ │ ├── iosxe_mock_data_cat8k.yaml │ │ │ ├── iosxe_mock_data_cat9k_ha_reload.yaml │ │ │ ├── iosxe_mock_data_cat9k_reload.yaml │ │ │ ├── iosxe_mock_data_ewc.yaml │ │ │ ├── iosxe_mock_data_ewlc.yaml │ │ │ ├── iosxe_mock_data_isr.yaml │ │ │ ├── iosxe_mock_data_sdwan.yaml │ │ │ ├── iosxe_mock_data_syslog.yaml │ │ │ ├── iosxe_mock_data_vwlc.yaml │ │ │ ├── iosxe_mock_quad.yaml │ │ │ ├── iosxe_mock_stack.yaml │ │ │ ├── iosxe_reset_standby.txt │ │ │ ├── iosxe_stack_reload.txt │ │ │ └── iosxe_stack_switchover.txt │ │ ├── iosxr │ │ │ ├── iosxr_asr9k_mock_data.yaml │ │ │ ├── iosxr_mock_copy.yaml │ │ │ ├── iosxr_mock_data.yaml │ │ │ ├── iosxr_mock_data_standby.yaml │ │ │ ├── iosxr_mock_reload.yaml │ │ │ ├── iosxr_moonshine_data.yaml │ │ │ ├── iosxr_ncs540_mock_data.yaml │ │ │ ├── iosxr_ncs540_reload.txt │ │ │ ├── iosxr_ncs5k_mock_data.yaml │ │ │ ├── iosxr_ncs5k_reload.txt │ │ │ ├── iosxr_spitfire_mock_data.yaml │ │ │ ├── login_banner.txt │ │ │ ├── login_banner_asr9k_ha.txt │ │ │ ├── redundancy_switchover.txt │ │ │ ├── show_version.txt │ │ │ └── spitfire │ │ │ │ ├── build-info.txt │ │ │ │ ├── redundancy_switchover.txt │ │ │ │ ├── show_platform.txt │ │ │ │ └── show_version.txt │ │ ├── ironware │ │ │ └── ironware_mock_data.yaml │ │ ├── ise │ │ │ └── ise_mock_data.yaml │ │ ├── junos │ │ │ └── junos_mock_data.yaml │ │ ├── linux │ │ │ └── linux_mock_data.yaml │ │ ├── nd │ │ │ └── nd_mock_data.yaml │ │ ├── nxos │ │ │ ├── n9k_reload.txt │ │ │ ├── nxos_aci_reload.txt │ │ │ ├── nxos_mock_copy.yaml │ │ │ ├── nxos_mock_data.yaml │ │ │ ├── nxos_mock_data_aci.yaml │ │ │ ├── nxos_mock_data_n5k.yaml │ │ │ ├── nxos_mock_data_reload.yaml │ │ │ ├── nxos_mock_data_standby.yaml │ │ │ ├── nxos_mock_n9k.yaml │ │ │ ├── nxos_n5k_reload.txt │ │ │ ├── nxos_n5k_show_version.txt │ │ │ └── nxos_repeat_poap_reload.yaml │ │ ├── nxos_mds │ │ │ └── mds_mock_data.yaml │ │ ├── ons │ │ │ └── ons_mock_data.yaml │ │ ├── sdwan │ │ │ ├── viptela_boot_log.txt │ │ │ └── viptela_mock_data.yaml │ │ ├── slxos │ │ │ └── slxos_mock_data.yaml │ │ ├── sros │ │ │ └── sros_mock_data.yaml │ │ ├── staros │ │ │ └── staros_mock_data.yaml │ │ ├── vos │ │ │ └── vos_mock_data.yaml │ │ └── windows │ │ │ ├── dir.txt │ │ │ └── windows_mock_data.yaml │ ├── ssh_host_key │ ├── test_copy_service.py │ ├── test_ha_reload.py │ ├── test_plugin_aireos.py │ ├── test_plugin_aireos_ha.py │ ├── test_plugin_apic.py │ ├── test_plugin_asa.py │ ├── test_plugin_asa_fp2k.py │ ├── test_plugin_cheetah_ap.py │ ├── test_plugin_cimc.py │ ├── test_plugin_comware.py │ ├── test_plugin_confd.py │ ├── test_plugin_confd_csp.py │ ├── test_plugin_confd_esc.py │ ├── test_plugin_confd_nfvis.py │ ├── test_plugin_dnos10.py │ ├── test_plugin_dnos6.py │ ├── test_plugin_eos.py │ ├── test_plugin_fxos.py │ ├── test_plugin_fxos_fp2k.py │ ├── test_plugin_fxos_fp4k.py │ ├── test_plugin_fxos_ftd.py │ ├── test_plugin_gaia.py │ ├── test_plugin_generic.py │ ├── test_plugin_hvrp.py │ ├── test_plugin_ios.py │ ├── test_plugin_ios_ha.py │ ├── test_plugin_ios_iol.py │ ├── test_plugin_ios_pagent.py │ ├── test_plugin_iosxe.py │ ├── test_plugin_iosxe_cat3k.py │ ├── test_plugin_iosxe_cat3k_ewlc.py │ ├── test_plugin_iosxe_cat4k.py │ ├── test_plugin_iosxe_cat8k.py │ ├── test_plugin_iosxe_cat9k.py │ ├── test_plugin_iosxe_cat9k_c9100ap.py │ ├── test_plugin_iosxe_cat9k_vwlc.py │ ├── test_plugin_iosxe_csr1000v.py │ ├── test_plugin_iosxe_csr1000v_vewlc.py │ ├── test_plugin_iosxe_ha.py │ ├── test_plugin_iosxe_iec3400.py │ ├── test_plugin_iosxe_quad.py │ ├── test_plugin_iosxe_sdwan.py │ ├── test_plugin_iosxe_stack.py │ ├── test_plugin_iosxe_switchover.py │ ├── test_plugin_iosxr.py │ ├── test_plugin_iosxr_asr9k.py │ ├── test_plugin_iosxr_ha.py │ ├── test_plugin_iosxr_ha_asr9k.py │ ├── test_plugin_iosxr_iosxrv.py │ ├── test_plugin_iosxr_iosxrv9k.py │ ├── test_plugin_iosxr_moonshine.py │ ├── test_plugin_iosxr_ncs5k.py │ ├── test_plugin_iosxr_spitfire.py │ ├── test_plugin_ironware.py │ ├── test_plugin_ise.py │ ├── test_plugin_junos.py │ ├── test_plugin_linux.py │ ├── test_plugin_nd.py │ ├── test_plugin_nxos.py │ ├── test_plugin_nxos_aci.py │ ├── test_plugin_nxos_mds.py │ ├── test_plugin_nxos_n5k.py │ ├── test_plugin_nxos_n7k.py │ ├── test_plugin_nxos_n9k.py │ ├── test_plugin_nxos_nxosv.py │ ├── test_plugin_ons.py │ ├── test_plugin_sdwan.py │ ├── test_plugin_slxos.py │ ├── test_plugin_sonic.py │ ├── test_plugin_sros.py │ ├── test_plugin_staros.py │ ├── test_plugin_vos.py │ ├── test_plugin_windows.py │ └── test_utils.py │ ├── utils.py │ ├── vos │ ├── __init__.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ ├── statemachine.py │ └── statements.py │ └── windows │ ├── __init__.py │ ├── patterns.py │ ├── service_implementation.py │ ├── settings.py │ └── statemachine.py ├── tests └── tools └── changelog_script.py /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @CiscoTestAutomation/pyats-genie-devs -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Python compiled files 2 | *.pyc 3 | *.pyo 4 | __pycache__/ 5 | *.log 6 | 7 | # Cython files 8 | *.c 9 | *.so 10 | 11 | # Developer files 12 | .project 13 | .pydevproject 14 | 15 | # Pycharm files 16 | .idea 17 | 18 | # Rope files 19 | .ropeproject 20 | 21 | # Swap files (VI) 22 | *.sw* 23 | 24 | # backup files 25 | *.bak 26 | 27 | # rope project files 28 | *.ropeproject 29 | 30 | # temp files 31 | *~ 32 | 33 | # build folder 34 | __build__/ 35 | build/ 36 | dist/ 37 | 38 | # Artifacts caused by "make develop" 39 | *.egg-info 40 | 41 | # coverage.py artifacts 42 | htmlcov/ 43 | .coverage* 44 | 45 | # filesystem stuff on Mac 46 | .DS_Store 47 | 48 | # unicon log file 49 | uni.log 50 | 51 | # Extra files placed by cisco_shared into examples 52 | *dyntopo/src/dyntopo/laas/examples/dyntopo_laas 53 | *dyntopo/src/dyntopo/xrut/examples/dyntopo_xrut 54 | 55 | # Files resulting from a git meld merge 56 | *.orig 57 | 58 | # VSCode 59 | .vscode 60 | .history 61 | 62 | # ignore auto generate docs 63 | docs/user_guide/services/service_dialogs.rst 64 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.rst 2 | 3 | recursive-include src *.py *.yaml 4 | 5 | global-exclude *.dll 6 | global-exclude *.pyc 7 | global-exclude *.pyo 8 | global-exclude *.so 9 | -------------------------------------------------------------------------------- /docs/_static/css/custom.css: -------------------------------------------------------------------------------- 1 | @media screen and (min-width: 1100px) { 2 | .wy-nav-content { 3 | max-width: 1000px !important ; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /docs/api/modules.rst: -------------------------------------------------------------------------------- 1 | Unicon API Reference 2 | ==================== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | unicon 8 | -------------------------------------------------------------------------------- /docs/api/unicon.bases.linux.rst: -------------------------------------------------------------------------------- 1 | unicon.bases.linux package 2 | ========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicon.bases.linux.connection module 8 | ------------------------------------ 9 | 10 | .. automodule:: unicon.bases.linux.connection 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | unicon.bases.linux.connection_provider module 16 | --------------------------------------------- 17 | 18 | .. automodule:: unicon.bases.linux.connection_provider 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | unicon.bases.linux.services module 24 | ---------------------------------- 25 | 26 | .. automodule:: unicon.bases.linux.services 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: unicon.bases.linux 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /docs/api/unicon.bases.routers.rst: -------------------------------------------------------------------------------- 1 | unicon.bases.routers package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicon.bases.routers.connection module 8 | -------------------------------------- 9 | 10 | .. automodule:: unicon.bases.routers.connection 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | unicon.bases.routers.connection_provider module 16 | ----------------------------------------------- 17 | 18 | .. automodule:: unicon.bases.routers.connection_provider 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | unicon.bases.routers.services module 24 | ------------------------------------ 25 | 26 | .. automodule:: unicon.bases.routers.services 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: unicon.bases.routers 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /docs/api/unicon.bases.rst: -------------------------------------------------------------------------------- 1 | unicon.bases package 2 | ==================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | unicon.bases.linux 10 | unicon.bases.routers 11 | 12 | Submodules 13 | ---------- 14 | 15 | unicon.bases.settings module 16 | ---------------------------- 17 | 18 | .. automodule:: unicon.bases.settings 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | 24 | Module contents 25 | --------------- 26 | 27 | .. automodule:: unicon.bases 28 | :members: 29 | :undoc-members: 30 | :show-inheritance: 31 | -------------------------------------------------------------------------------- /docs/api/unicon.core.rst: -------------------------------------------------------------------------------- 1 | unicon.core package 2 | =================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicon.core.errors module 8 | ------------------------- 9 | 10 | .. automodule:: unicon.core.errors 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | unicon.core.manager module 16 | -------------------------- 17 | 18 | .. automodule:: unicon.core.manager 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | unicon.core.pluginmanager module 24 | -------------------------------- 25 | 26 | .. automodule:: unicon.core.pluginmanager 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: unicon.core 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /docs/api/unicon.database.rst: -------------------------------------------------------------------------------- 1 | unicon.database package 2 | ======================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicon.database.database module 8 | ------------------------------- 9 | 10 | .. automodule:: unicon.database.database 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: unicon.database 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/api/unicon.eal.backend.rst: -------------------------------------------------------------------------------- 1 | unicon.eal.backend package 2 | ========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicon.eal.backend.pty_backend module 8 | ------------------------------------- 9 | 10 | .. automodule:: unicon.eal.backend.pty_backend 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: unicon.eal.backend 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/api/unicon.statemachine.rst: -------------------------------------------------------------------------------- 1 | unicon.statemachine package 2 | =========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicon.statemachine.statemachine module 8 | --------------------------------------- 9 | 10 | .. automodule:: unicon.statemachine.statemachine 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | unicon.statemachine.statetransition module 16 | ------------------------------------------ 17 | 18 | .. automodule:: unicon.statemachine.statetransition 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | 24 | Module contents 25 | --------------- 26 | 27 | .. automodule:: unicon.statemachine 28 | :members: 29 | :undoc-members: 30 | :show-inheritance: 31 | -------------------------------------------------------------------------------- /docs/changelog/2016/december.rst: -------------------------------------------------------------------------------- 1 | December 2016 2 | ============== 3 | 4 | December 06 5 | ------------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.1.0b1 11 | 12 | Features: 13 | ^^^^^^^^^ 14 | 15 | - Added Moonshine support for pyATS. 16 | -------------------------------------------------------------------------------- /docs/changelog/2016/february.rst: -------------------------------------------------------------------------------- 1 | February 2016 2 | ============= 3 | 4 | February 1 - v1.0.0 5 | ------------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v1.0.0 11 | 12 | 13 | Features: 14 | ^^^^^^^^^ 15 | 16 | - New pty based expect backend library. 17 | - 100% CPU bug fix 18 | - Aireos Implementation. 19 | 20 | -------------------------------------------------------------------------------- /docs/changelog/2016/may.rst: -------------------------------------------------------------------------------- 1 | May 2016 2 | ======== 3 | 4 | May 4 - v2.0.0 5 | -------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.0.0 11 | 12 | 13 | Features: 14 | ^^^^^^^^^ 15 | 16 | - Unicon integration with pyATS topology 17 | - Support for IOSXE platform 18 | - Support for linux platform 19 | - Support for NXOS vdc - Unicon Device logging enhancements 20 | - Shorthand notations for Dialog callbacks 21 | - Renamed `config` service to `Configure` 22 | - Bug fixes 23 | -------------------------------------------------------------------------------- /docs/changelog/2016/november.rst: -------------------------------------------------------------------------------- 1 | November 2016 2 | ============= 3 | 4 | November 25 - v2.2.0 5 | -------------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.2.0 11 | 12 | Features and Bug Fixes 13 | ^^^^^^^^^^^^^^^^^^^^^^ 14 | 15 | - Support for NXOSv, iosxrv9, csr1000v, IOSv virtual devices 16 | - SSH based connection for both routers & server enhancements 17 | - Fixed Unicon and parsergen interoperability issue fixed 18 | - Ping service support for sweep ping 19 | - Switchover service enhanced (no wait for standby ) 20 | - Unicon expect timeout issue fixed 21 | - Linux plugin disconnect issue fixed 22 | - Pattern changes for Nxos login and config state 23 | - Unicon expect buffer sync issue fixed 24 | - orphaned processes on disconnect fixed 25 | -------------------------------------------------------------------------------- /docs/changelog/2016/october.rst: -------------------------------------------------------------------------------- 1 | October 2016 2 | ============ 3 | 4 | October 1 5 | --------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.1.0b15 11 | 12 | Features: 13 | ^^^^^^^^^ 14 | 15 | - Further increased post-prompt wait for iosxrv plugin to better ensure device 16 | is ready for configuration before configuration is attempted. 17 | 18 | - Refactored iosxrv9k plugin to use common device wait logic, added additional 19 | patterns after CI failures seen. 20 | 21 | October 27 22 | ---------- 23 | 24 | .. csv-table:: Module Versions 25 | :header: "Modules", "Versions" 26 | 27 | ``unicon``, v2.1.0b17 28 | 29 | Features 30 | ^^^^^^^^ 31 | 32 | - Linux reconnect issue fixed 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /docs/changelog/2017/jan.rst: -------------------------------------------------------------------------------- 1 | Jan 2017 2 | ======== 3 | 4 | Jan 4 5 | ----- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.2.1b1 11 | 12 | Features and Bug Fixes 13 | ^^^^^^^^^^^^^^^^^^^^^^ 14 | - Cheetah AP support 15 | -------------------------------------------------------------------------------- /docs/changelog/2017/july.rst: -------------------------------------------------------------------------------- 1 | July 2017 2 | ========= 3 | 4 | July 10 - v2.3.2 5 | ---------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.3.2 11 | 12 | 13 | Upgrade Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install --upgrade unicon 19 | 20 | 21 | Features and Bug Fixes: 22 | ^^^^^^^^^^^^^^^^^^^^^^^ 23 | 24 | The following changes were introduced: 25 | 26 | - Device mocking unit test infrastructure 27 | 28 | - Added developer documentation 29 | 30 | - Added ping unit tests to ios plugin 31 | -------------------------------------------------------------------------------- /docs/changelog/2017/october.rst: -------------------------------------------------------------------------------- 1 | October 2017 2 | ============ 3 | 4 | October 25 - v2.3.6 5 | ------------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.3.6 11 | 12 | 13 | Upgrade Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install --upgrade unicon 19 | 20 | 21 | Features and Bug Fixes: 22 | ^^^^^^^^^^^^^^^^^^^^^^^ 23 | 24 | - Prompt recovery feature added for Dialog, connection and selected services. 25 | 26 | - Updated iosv, nxosv, iosxrv and iosxrv9k plugins to ensure connect works 27 | properly against an Esxi vCenter backend. 28 | -------------------------------------------------------------------------------- /docs/changelog/2018/apr.rst: -------------------------------------------------------------------------------- 1 | April 2018 2 | ========== 3 | 4 | April 30 - v3.1.0 5 | ----------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v3.1.0 11 | 12 | 13 | Upgrade Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install --upgrade unicon 19 | 20 | # to use the new robot-framework dependencies, d: 21 | bash$ pip install unicon[robot] 22 | 23 | 24 | Features and Bug Fixes: 25 | ^^^^^^^^^^^^^^^^^^^^^^^ 26 | - Updated XR prompt pattern to match complete prompt 27 | 28 | - Added back os.sync to send method as this was causing issues on some platforms. 29 | 30 | - Updates in generic plugin escape handler 31 | After connecting to a device via console server, do not send 'enter' 32 | if an authentication prompt is shown 33 | 34 | - added ``unicon.robot`` module: now Unicon comes with robot-framework keywords. 35 | 36 | - note that you must install robotframework in order to import ``unicon.robot`` 37 | module. 38 | -------------------------------------------------------------------------------- /docs/changelog/2018/january.rst: -------------------------------------------------------------------------------- 1 | January 2018 2 | ============ 3 | 4 | January 8 - v2.3.9 5 | -------------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v2.3.9 11 | 12 | 13 | Upgrade Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install --upgrade unicon 19 | 20 | 21 | Features and Bug Fixes: 22 | ^^^^^^^^^^^^^^^^^^^^^^^ 23 | 24 | - Fixed connect failure on the iosxr family of plugins by repairing 25 | enable and config prompts. 26 | -------------------------------------------------------------------------------- /docs/changelog/2018/jun.rst: -------------------------------------------------------------------------------- 1 | June 2018 2 | ========= 3 | 4 | 5 | Jun 7 - v3.1.2 6 | -------------- 7 | 8 | .. csv-table:: Module Versions 9 | :header: "Modules", "Versions" 10 | 11 | ``unicon``, v3.1.2 12 | 13 | 14 | Upgrade Instructions 15 | ^^^^^^^^^^^^^^^^^^^^ 16 | 17 | .. code-block:: bash 18 | 19 | bash$ pip install --upgrade unicon 20 | 21 | Features and Bug Fixes: 22 | ^^^^^^^^^^^^^^^^^^^^^^^ 23 | 24 | - NOTE : This version has been re-released under a previously released 25 | version but now has additional content. 26 | 27 | - Generic plugin fixes: 28 | 29 | - Fix generic HA reload class to handle console interchange after reload. 30 | 31 | - Added prompt_recovery option for generic sync_state service. 32 | -------------------------------------------------------------------------------- /docs/changelog/2018/oct.rst: -------------------------------------------------------------------------------- 1 | October 2018 2 | ============ 3 | 4 | Oct 9 - v3.4.0 5 | --------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v3.4.0 11 | 12 | 13 | Upgrade Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install --upgrade unicon 19 | 20 | Features and Bug Fixes 21 | ^^^^^^^^^^^^^^^^^^^^^^ 22 | 23 | - fixed unicon logging with pyATS where forkeds/pcalls were not being 24 | respected 25 | 26 | - added new feature where now each device gets its own overall send/receive 27 | log 28 | 29 | - significantly optimized unicon log handling in general 30 | 31 | - optimized log output to be more human friendly, indicating which device 32 | it's coming from 33 | 34 | - removed blinker package dependency 35 | 36 | - modified yaml.load to yaml.safe_load for CVE-2017-18342 37 | 38 | - Linux prompt pattern updated for ESA WSA and SMA appliances 39 | 40 | - Update Confd/NFVIS plugin to allow default hostname of nfvis 41 | -------------------------------------------------------------------------------- /docs/changelog/2019/dec.rst: -------------------------------------------------------------------------------- 1 | December 2019 2 | ============= 3 | 4 | December 17th 5 | ------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v19.12 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | - core 32 | 33 | - enhance Connection logfile to handle special characters in hostname and alias 34 | 35 | - generic plugin 36 | 37 | - add "Invalid host" error pattern for ping service 38 | 39 | - enhance copy service to handle wildcard copy 40 | 41 | - asa plugin 42 | 43 | - asa plugin is now using hostname in prompt patterns 44 | 45 | - aireos plugin 46 | 47 | - handle 'Press Enter to continue' prompt following certain command 48 | 49 | - enhance command error pattern which has % character before Error 50 | -------------------------------------------------------------------------------- /docs/changelog/2020/april.rst: -------------------------------------------------------------------------------- 1 | April 2020 2 | ============ 3 | 4 | April 28th 5 | ------------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v20.4 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | * Fixed unittests failures seen with multiprocessing on Mac-py38 environment 32 | 33 | * Added `goto_enable` and `standby_goto_enable` key to generic connect service to 34 | allow user to disable device behavior of going to enable state in every device 35 | connect call, Default is True not to interrupt intuitive device behavior 36 | 37 | * Added dialog callback for credentials 38 | 39 | * See also the unicon.plugins changelog. 40 | 41 | -------------------------------------------------------------------------------- /docs/changelog/2020/august.rst: -------------------------------------------------------------------------------- 1 | August 2020 2 | ============ 3 | 4 | August 25th 5 | ------------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v20.8 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | * Infrastructure changed to support multi-connections(dual, stack & quad) 32 | * Infrastructure changed to support learn os feature in generic plugin 33 | * Enhanced cli proxy feature, now can support HA device 34 | * Allowed to set the connection terminal size via ROWS and COLUMNS environment variables for the connection 35 | * Updated spawn read method to ignore non-utf8 decoder errors 36 | * Allowed prompt_recovery to pass from connection class variable to service variable 37 | * Added trim line option in the unicon logging to trim empty lines 38 | -------------------------------------------------------------------------------- /docs/changelog/2020/july.rst: -------------------------------------------------------------------------------- 1 | July 2020 2 | ============ 3 | 4 | July 28th 5 | ------------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v20.7 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | * Added deprecation warning for expect_log service 32 | 33 | * Fixed adapter issue to allow debug logging enable by device.connect(debug=True) 34 | 35 | * Enhanced verify connectivity functionality 36 | -------------------------------------------------------------------------------- /docs/changelog/2020/june.rst: -------------------------------------------------------------------------------- 1 | June 2020 2 | ============ 3 | 4 | July 7th 5 | ------------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v20.6 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | * Enhanced device connectivity verification functionality 32 | 33 | * Fixed bug in switch to vdc keywords 34 | 35 | * Removed old expect_log, use device.log.setLevel to enable/disable debug internal log 36 | 37 | * Updates to mock_device to handle keystrokes 38 | 39 | * Used %1B for Escape code instead of ESC in mock data 40 | -------------------------------------------------------------------------------- /docs/changelog/2020/may.rst: -------------------------------------------------------------------------------- 1 | May 2020 2 | ============ 3 | 4 | May 26th 5 | ------------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v20.5 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | * No new features 32 | 33 | -------------------------------------------------------------------------------- /docs/changelog/2020/october.rst: -------------------------------------------------------------------------------- 1 | October 2020 2 | ============ 3 | 4 | October 27th 5 | ------------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v20.10 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | 32 | * Removed pyats dependency from adapter 33 | * Updated UT for CICD docker container 34 | -------------------------------------------------------------------------------- /docs/changelog/2020/sept.rst: -------------------------------------------------------------------------------- 1 | September 2020 2 | ============== 3 | 4 | September 29th 5 | -------------- 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon``, v20.9 11 | 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon 19 | 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon 27 | 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | 32 | * Fixed learn_hostname for ha standby device 33 | * Updated dialog processor default timeout to use spawn timeout instead 34 | * Updated general connect function to use self.connected to check connectivity 35 | * Updated dual_rp connection when chassis type is specified, subconnection use single_rp chassis type 36 | -------------------------------------------------------------------------------- /docs/changelog/2021/august.rst: -------------------------------------------------------------------------------- 1 | August 2021 2 | ======== 3 | 4 | August 31st 5 | ------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon.plugins``, v21.8 11 | ``unicon``, v21.8 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon.plugins 19 | bash$ pip install unicon 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon.plugins 27 | bash$ pip install --upgrade unicon 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | 32 | N/A 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/changelog/2021/february.rst: -------------------------------------------------------------------------------- 1 | February 2021 2 | ============= 3 | 4 | february 26th 5 | ------------- 6 | 7 | 8 | -------------------------------------------------------------------------------- 9 | Features and Bug Fixes: 10 | -------------------------------------------------------------------------------- 11 | 12 | * Dialogs 13 | * Fix bug in dialog processing related to timeout statement 14 | 15 | * STATEMACHINE 16 | * Fix bug in detect_state method if last match is empty 17 | 18 | * Hostname learning 19 | * Passive hostname learning is enabled by default 20 | 21 | * Pluginmanager 22 | * Added warning message if plugin class is replaced with another class 23 | -------------------------------------------------------------------------------- /docs/changelog/2021/october.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | Fix 3 | -------------------------------------------------------------------------------- 4 | 5 | * playback 6 | * Modified mock 7 | * Updated create_yaml pattern to separate nested configure command calls 8 | * Fixed error handling for configure commands 9 | * Modified mock 10 | * Changed create_yaml behavior to store configure commands in mock_data yaml files 11 | 12 | 13 | -------------------------------------------------------------------------------- 14 | New 15 | -------------------------------------------------------------------------------- 16 | 17 | * dialog 18 | * Modified Statement 19 | * Moved statement_action_helper outside of Statement so it can 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/changelog/2021/september.rst: -------------------------------------------------------------------------------- 1 | September 2021 2 | ======== 3 | 4 | September 28 5 | ------ 6 | 7 | .. csv-table:: Module Versions 8 | :header: "Modules", "Versions" 9 | 10 | ``unicon.plugins``, v21.9 11 | ``unicon``, v21.9 12 | 13 | Install Instructions 14 | ^^^^^^^^^^^^^^^^^^^^ 15 | 16 | .. code-block:: bash 17 | 18 | bash$ pip install unicon.plugins 19 | bash$ pip install unicon 20 | 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | 26 | bash$ pip install --upgrade unicon.plugins 27 | bash$ pip install --upgrade unicon 28 | 29 | Features and Bug Fixes: 30 | ^^^^^^^^^^^^^^^^^^^^^^^ 31 | 32 | -------------------------------------------------------------------------------- 33 | New 34 | -------------------------------------------------------------------------------- 35 | * No new features 36 | 37 | -------------------------------------------------------------------------------- 38 | Fix 39 | -------------------------------------------------------------------------------- 40 | * No Changes 41 | -------------------------------------------------------------------------------- /docs/changelog/2022/august.rst: -------------------------------------------------------------------------------- 1 | August 2022 2 | ========== 3 | 4 | August 30 - Unicon v22.8 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v22.8 13 | ``unicon``, v22.8 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 | Fix 36 | -------------------------------------------------------------------------------- 37 | 38 | * connection parse_spawn_command 39 | * Fixed Although `login_creds='local'` is specified, `default` is selected 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/changelog/2022/july.rst: -------------------------------------------------------------------------------- 1 | July 2022 2 | ========== 3 | 4 | July 26 - Unicon v22.7 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v22.7 13 | ``unicon``, v22.7 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 | Fix 36 | -------------------------------------------------------------------------------- 37 | * Playback 38 | * Modified _mock_helper: 39 | * Added dictionary to support IOSXR mock data generation 40 | 41 | -------------------------------------------------------------------------------- /docs/changelog/2022/june.rst: -------------------------------------------------------------------------------- 1 | June 2022 2 | ========== 3 | 4 | June 28 - Unicon v22.6 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v22.6 13 | ``unicon``, v22.6 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 | New 41 | -------------------------------------------------------------------------------- 42 | 43 | * routers 44 | * Connection_provider 45 | * update designate handle for BaseStackRpConnectionProvider to support 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/changelog/2022/october.rst: -------------------------------------------------------------------------------- 1 | october 2022 2 | ========== 3 | 4 | October 25 - Unicon v22.10 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v22.10 13 | ``unicon``, v22.10 14 | 15 | Install Instructions 16 | ^^^^^^^^^^^^^^^^^^^^ 17 | 18 | .. code-block:: bash 19 | bash$ pip install unicon.plugins 20 | bash$ pip install unicon 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | bash$ pip install --upgrade unicon.plugins 26 | bash$ pip install --upgrade unicon 27 | Features and Bug Fixes: 28 | ^^^^^^^^^^^^^^^^^^^^^^^ 29 | 30 | 31 | Changelog: 32 | 33 | - No changes -------------------------------------------------------------------------------- /docs/changelog/2023/april.rst: -------------------------------------------------------------------------------- 1 | April 2023 2 | ========== 3 | 4 | April 25 - Unicon v23.4 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.4 13 | ``unicon``, v23.4 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 | -------------------------------------------------------------------------------- /docs/changelog/2023/february.rst: -------------------------------------------------------------------------------- 1 | February 2023 2 | ========== 3 | 4 | February 28 - Unicon v23.2 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.2 13 | ``unicon``, v23.2 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 | -------------------------------------------------------------------------------- /docs/changelog/2023/march.rst: -------------------------------------------------------------------------------- 1 | March 2023 2 | ========== 3 | 4 | March 28 - Unicon v23.3 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.3 13 | ``unicon``, v23.3 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 | -------------------------------------------------------------------------------- 41 | Fix 42 | -------------------------------------------------------------------------------- 43 | 44 | * iosxr 45 | * asr9k 46 | * Modified call_service in service_implementation 47 | * Added sleep between retry connect for Dual RP connection error 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/changelog/2023/september.rst: -------------------------------------------------------------------------------- 1 | September 2023 2 | ============== 3 | 4 | September 26 - Unicon v23.9 5 | --------------------------- 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.9 13 | ``unicon``, v23.9 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 | New 41 | -------------------------------------------------------------------------------- 42 | 43 | * unicon.routers.bases 44 | * Add device alias to service log 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/changelog/2024/august.rst: -------------------------------------------------------------------------------- 1 | August 2024 2 | ========== 3 | 4 | August 27 - Unicon v24.8 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v24.8 13 | ``unicon``, v24.8 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 | -------------------------------------------------------------------------------- /docs/changelog/2024/july.rst: -------------------------------------------------------------------------------- 1 | July 2024 2 | ========== 3 | 4 | July 30 - Unicon v24.7 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v24.7 13 | ``unicon``, v24.7 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 | * generic 44 | * Updated with `sleep_time` to handle the copy command 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/changelog/2024/november.rst: -------------------------------------------------------------------------------- 1 | November 2024 2 | ========== 3 | 4 | November 26 - Unicon v24.11 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v24.11 13 | ``unicon``, v24.11 14 | 15 | 16 | 17 | 18 | Changelogs 19 | ^^^^^^^^^^ 20 | -------------------------------------------------------------------------------- 21 | Fix 22 | -------------------------------------------------------------------------------- 23 | 24 | * unicon/bases 25 | * Router/connection_provider 26 | * Updated designate_handles to not change state of standby if it is locked. 27 | * Added quad device specific unlock_standby method to execute configs only on Active console 28 | 29 | 30 | -------------------------------------------------------------------------------- /docs/changelog/2024/october.rst: -------------------------------------------------------------------------------- 1 | October 2024 2 | ========== 3 | 4 | October 29 - Unicon v24.10 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v24.10 13 | ``unicon``, v24.10 14 | 15 | 16 | 17 | 18 | Changelogs 19 | ^^^^^^^^^^ 20 | -------------------------------------------------------------------------------- 21 | Fix 22 | -------------------------------------------------------------------------------- 23 | 24 | * generic 25 | * service_implementations/Configure 26 | * update the pattern for update_hostname in the configure service. 27 | 28 | * iosxr/spitfire 29 | * patterns 30 | * remove the config and enable pattern 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/changelog/undistributed/template.rst: -------------------------------------------------------------------------------- 1 | Only one changelog file per pull request. Combine these two templates where applicable. 2 | 3 | Templates 4 | ========= 5 | 6 | -------------------------------------------------------------------------------- 7 | New 8 | -------------------------------------------------------------------------------- 9 | * 10 | * : 11 | * 12 | 13 | -------------------------------------------------------------------------------- 14 | Fix 15 | -------------------------------------------------------------------------------- 16 | * 17 | * : 18 | * 19 | 20 | Examples 21 | ======== 22 | 23 | -------------------------------------------------------------------------------- 24 | New 25 | -------------------------------------------------------------------------------- 26 | * Module 27 | * Modified Class: 28 | * Changed variable. 29 | * Updated some value to some value 30 | 31 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2020/august.rst: -------------------------------------------------------------------------------- 1 | August 2020 2 | ------------- 3 | 4 | .. csv-table:: Module Versions 5 | :header: "Modules", "Versions" 6 | 7 | ``unicon.plugins``, v20.8 8 | 9 | 10 | Install Instructions 11 | ^^^^^^^^^^^^^^^^^^^^ 12 | 13 | .. code-block:: bash 14 | 15 | bash$ pip install unicon.plugins 16 | 17 | 18 | Upgrade Instructions 19 | ^^^^^^^^^^^^^^^^^^^^ 20 | 21 | .. code-block:: bash 22 | 23 | bash$ pip install --upgrade unicon.plugins 24 | 25 | 26 | Features and Bug Fixes: 27 | ^^^^^^^^^^^^^^^^^^^^^^^ 28 | 29 | * Updated terminal size settings for NXOS/ACI/N9K and linux plugins. 30 | 31 | * [APIC] Added 'Error' to the list of error_patterns 32 | 33 | * [ASA] Added statement to handle for 'Proceed with reload?' 34 | 35 | * [IOSXE] Changed IOSXE plugin shell_prompt (non-greedy match on wildcard) 36 | * [IOSXE] Added stack and quad plugins to support devices with stack/quad chassis type 37 | 38 | * [IOSXR] Updated IOSXR/ncs5k STANDBY_STATE_REGEX in the setttings 39 | * [IOSXR] Added asr9k/ncs5k ha reload service 40 | 41 | * [Generic] Added learn_os feature for generic plugins redirect to corresponding plugin connection 42 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2020/may.rst: -------------------------------------------------------------------------------- 1 | May 2020 2 | ------------- 3 | 4 | .. csv-table:: Module Versions 5 | :header: "Modules", "Versions" 6 | 7 | ``unicon.plugins``, v20.5 8 | 9 | 10 | Install Instructions 11 | ^^^^^^^^^^^^^^^^^^^^ 12 | 13 | .. code-block:: bash 14 | 15 | bash$ pip install unicon.plugins 16 | 17 | 18 | Upgrade Instructions 19 | ^^^^^^^^^^^^^^^^^^^^ 20 | 21 | .. code-block:: bash 22 | 23 | bash$ pip install --upgrade unicon.plugins 24 | 25 | 26 | Features and Bug Fixes: 27 | ^^^^^^^^^^^^^^^^^^^^^^^ 28 | 29 | * Updated reset_standby logic 30 | 31 | * Added IOSXE cat9k plugin unit test 32 | 33 | * Updated shell pattern on IOSXE and added the corresponding unit test 34 | 35 | * Fixed bash_console access in case of spitfire plugin 36 | 37 | * Added dialog to the enable->disable statemachine transition under IOSXE 38 | 39 | * Fixing enable pattern in IOSXR plugin 40 | 41 | * Additional NXOS error patterns 42 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2020/october.rst: -------------------------------------------------------------------------------- 1 | October 2020 2 | ------------ 3 | 4 | .. csv-table:: Module Versions 5 | :header: "Modules", "Versions" 6 | 7 | ``unicon.plugins``, v20.10 8 | 9 | 10 | Install Instructions 11 | ^^^^^^^^^^^^^^^^^^^^ 12 | 13 | .. code-block:: bash 14 | 15 | bash$ pip install unicon.plugins 16 | 17 | 18 | Upgrade Instructions 19 | ^^^^^^^^^^^^^^^^^^^^ 20 | 21 | .. code-block:: bash 22 | 23 | bash$ pip install --upgrade unicon.plugins 24 | 25 | 26 | Features and Bug Fixes: 27 | ^^^^^^^^^^^^^^^^^^^^^^^ 28 | 29 | * [Generic] Fix switchover service issue while trying to bring standby rp to enable mode 30 | 31 | * [IOSXE] Enhance stack switchover service to handle username/password prompt 32 | * [IOSXE] Enhancing IOSXE configure service for supporting wireless controllers different prompts 33 | 34 | * [NXOS] Added plugin specific configure service allowing commit functionality 35 | 36 | * [Linux] Added regex pattern for handling ESXi server prompt 37 | 38 | * [JUNOS] Changed self.commit_cmd from 'commit' to 'commit synchronize' 39 | * [JUNOS] Added regex pattern to self.CONFIGURE_ERROR_PATTERN 40 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2021/october.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | Fix 3 | -------------------------------------------------------------------------------- 4 | 5 | * nxos 6 | * Modified copy service 7 | * Fixed to handle source_file properly 8 | 9 | * iosxe 10 | * Refactored rommon state transition, reload and rommon services 11 | 12 | * generic 13 | * Added buffer_wait statement and refactored chatty_term_wait code 14 | * Added wait to config transition to avoid false negatives in config transition 15 | * Add match for unconfigured WLC to default hostname pattern 16 | 17 | 18 | -------------------------------------------------------------------------------- 19 | New 20 | -------------------------------------------------------------------------------- 21 | 22 | * iosxe/cat9k 23 | * Added support for container shell 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2022/october.rst: -------------------------------------------------------------------------------- 1 | October 2022 2 | ========== 3 | 4 | October 25 - Unicon.Plugins v22.10 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v22.10 13 | ``unicon``, v22.10 14 | 15 | Install Instructions 16 | ^^^^^^^^^^^^^^^^^^^^ 17 | 18 | .. code-block:: bash 19 | bash$ pip install unicon.plugins 20 | bash$ pip install unicon 21 | Upgrade Instructions 22 | ^^^^^^^^^^^^^^^^^^^^ 23 | 24 | .. code-block:: bash 25 | bash$ pip install --upgrade unicon.plugins 26 | bash$ pip install --upgrade unicon 27 | Features and Bug Fixes: 28 | ^^^^^^^^^^^^^^^^^^^^^^^ 29 | 30 | -------------------------------------------------------------------------------- 31 | Fix 32 | -------------------------------------------------------------------------------- 33 | * nxos/patterns 34 | * Modified NxosPatterns: 35 | * Modified config_prompt to handle bell character -------------------------------------------------------------------------------- /docs/changelog_plugins/2023/april.rst: -------------------------------------------------------------------------------- 1 | April 2023 2 | ========== 3 | 4 | April 25 - Unicon.Plugins v23.4 5 | ------------------------------- 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.4 13 | ``unicon``, v23.4 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 | * linux 44 | * Update prompt stripping implementation 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2023/july.rst: -------------------------------------------------------------------------------- 1 | July 2023 2 | ========= 3 | 4 | July 24 - Unicon.Plugins v23.7 5 | ------------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.7 13 | ``unicon``, v23.7 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 | * iosxe 44 | * Update confirm pattern and statements to support Abort Copy 45 | * Added configuration error patterns 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2023/june.rst: -------------------------------------------------------------------------------- 1 | June 2023 2 | ========== 3 | 4 | June 27 - Unicon.Plugins v23.6 5 | ------------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.6 13 | ``unicon``, v23.6 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 | * iosxe 44 | * Update mock data for rommon boot unittest 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2023/march.rst: -------------------------------------------------------------------------------- 1 | March 2023 2 | ========== 3 | 4 | March 28 - Unicon.Plugins v23.3 5 | ------------------------------- 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v23.3 13 | ``unicon``, v23.3 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 | -------------------------------------------------------------------------------- 41 | Fix 42 | -------------------------------------------------------------------------------- 43 | 44 | * nxos 45 | * Update rommon state support to support automated boot 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2024/august.rst: -------------------------------------------------------------------------------- 1 | August 2024 2 | ========== 3 | 4 | August 27 - Unicon.Plugins v24.8 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v24.8 13 | ``unicon``, v24.8 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 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2024/july.rst: -------------------------------------------------------------------------------- 1 | July 2024 2 | ========== 3 | 4 | July 30 - Unicon.Plugins v24.7 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v24.7 13 | ``unicon``, v24.7 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 | * iosxe 44 | * add "disable_selinux" parameter to bash_console service, to automatically 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2025/february.rst: -------------------------------------------------------------------------------- 1 | February 2025 2 | ========== 3 | 4 | February 25 - Unicon.Plugins v25.2 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v25.2 13 | ``unicon``, v25.2 14 | 15 | 16 | 17 | 18 | Changelogs 19 | ^^^^^^^^^^ 20 | -------------------------------------------------------------------------------- 21 | Fix 22 | -------------------------------------------------------------------------------- 23 | 24 | * generic 25 | * Updates to setup patterns 26 | * Update connection refused handler to clear line after max count 27 | * Update token discovery to use rv1 parsers 28 | * Update token discovery to handle standby locked devices 29 | 30 | * staros 31 | * Update prompt pattern 32 | 33 | * iosxe 34 | * Updated the enable, disable and maintenance states to support `(unlicensed)` prompt 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/changelog_plugins/2025/march.rst: -------------------------------------------------------------------------------- 1 | March 2025 2 | ========== 3 | 4 | March 25 - Unicon.Plugins v25.3 5 | ------------------------ 6 | 7 | 8 | 9 | .. csv-table:: Module Versions 10 | :header: "Modules", "Versions" 11 | 12 | ``unicon.plugins``, v25.3 13 | ``unicon``, v25.3 14 | 15 | 16 | 17 | 18 | Changelogs 19 | ^^^^^^^^^^ 20 | -------------------------------------------------------------------------------- /docs/changelog_plugins/changelog_modify_generice_rommon_prompt_pattern_20241028185708.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | Fix 3 | -------------------------------------------------------------------------------- 4 | * Generic 5 | * Modified rommon_prompt regex pattern to accommodate various outputs 6 | -------------------------------------------------------------------------------- /docs/changelog_plugins/undistributed/template.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | Fix 3 | -------------------------------------------------------------------------------- 4 | * 5 | * 6 | -------------------------------------------------------------------------------- /docs/developer_guide/images/bench.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/docs/developer_guide/images/bench.jpg -------------------------------------------------------------------------------- /docs/developer_guide/images/connection.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/docs/developer_guide/images/connection.jpeg -------------------------------------------------------------------------------- /docs/developer_guide/images/plugins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/docs/developer_guide/images/plugins.jpg -------------------------------------------------------------------------------- /docs/developer_guide/images/statemachine.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/docs/developer_guide/images/statemachine.jpeg -------------------------------------------------------------------------------- /docs/user_guide/examples/1_eal_simple_sendex.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unicon.eal.expect import Spawn, TimeoutError 3 | router_command = os.path.join(os.getcwd(), 'router.sh') 4 | prompt = 'sim-router' 5 | enable_prompt = prompt + '#' 6 | disable_prompt = prompt + '>' 7 | s = Spawn(router_command) 8 | try: 9 | s.sendline() 10 | s.expect([r'username:\s?$', r'login:\s?$'], timeout=5) 11 | s.sendline('admin') 12 | s.expect([r'password:\s?$'], timeout=5) 13 | s.sendline('lab') 14 | s.expect([disable_prompt]) 15 | s.sendline('enable') 16 | s.expect([r'password:\s?$'], timeout=5) 17 | s.sendline('lablab') 18 | s.expect([enable_prompt]) 19 | s.sendline('show clock') 20 | s.expect([enable_prompt]) 21 | except TimeoutError as err: 22 | print('errored becuase of timeout') 23 | 24 | -------------------------------------------------------------------------------- /docs/user_guide/examples/2_dialog_with_three_callbacks.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unicon.eal.expect import Spawn, TimeoutError 3 | from unicon.eal.dialogs import Statement, Dialog 4 | 5 | router_command = os.path.join(os.getcwd(), 'router.sh') 6 | prompt = 'sim-router' 7 | enable_prompt = prompt + '#' 8 | disable_prompt = prompt + '>' 9 | 10 | # callback to send password 11 | def send_password(spawn, password='lab'): 12 | spawn.sendline(password) 13 | 14 | # callback to send username 15 | def send_username(spawn, username="admin"): 16 | spawn.sendline(username) 17 | 18 | # callback to send new line 19 | def send_new_line(spawn): 20 | spawn.sendline() 21 | 22 | # construct the dialog 23 | d = Dialog([ 24 | [r'enter to continue \.\.\.', send_new_line, None, True, False], 25 | [r'username:\s?$', send_username, None, True, False], 26 | [r'password:\s?$', send_password, None, True, False], 27 | [disable_prompt, None, None, False, False], 28 | ]) 29 | 30 | s = Spawn(router_command) 31 | 32 | # at this stage we are anticipating the program to wait for a new line 33 | d.process(s) 34 | s.close() 35 | -------------------------------------------------------------------------------- /docs/user_guide/examples/3_dialog_with_one_callback.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unicon.eal.expect import Spawn, TimeoutError 3 | from unicon.eal.dialogs import Statement, Dialog 4 | 5 | router_command = os.path.join(os.getcwd(), 'router.sh') 6 | prompt = 'sim-router' 7 | enable_prompt = prompt + '#' 8 | disable_prompt = prompt + '>' 9 | 10 | # callback to send any command or a new line character 11 | def send_command(spawn, command=None): 12 | if command is not None: 13 | spawn.sendline(command) 14 | else: 15 | spawn.sendline() 16 | 17 | # construct the dialog 18 | d = Dialog([ 19 | [r'enter to continue \.\.\.', send_command, None, True, False], 20 | [r'username:\s?$', send_command, {'command': 'admin'}, True, False], 21 | [r'password:\s?$', send_command, {'command': 'lab'}, True, False], 22 | [disable_prompt, None, None, False, False], 23 | ]) 24 | 25 | s = Spawn(router_command) 26 | 27 | # at this stage we are anticipating the program to wait for a new line 28 | d.process(s) 29 | 30 | s.close() 31 | -------------------------------------------------------------------------------- /docs/user_guide/examples/4_using_lambda.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unicon.eal.expect import Spawn, TimeoutError 3 | from unicon.eal.dialogs import Statement, Dialog 4 | 5 | router_command = os.path.join(os.getcwd(), 'router.sh') 6 | prompt = 'sim-router' 7 | enable_prompt = prompt + '#' 8 | disable_prompt = prompt + '>' 9 | 10 | # construct the dialog 11 | d = Dialog([ 12 | [r'enter to continue \.\.\.', lambda spawn: spawn.sendline(), None, True, False], 13 | [r'username:\s?$', lambda spawn: spawn.sendline("admin"), None, True, False], 14 | [r'password:\s?$', lambda spawn: spawn.sendline("lab"), None, True, False], 15 | [disable_prompt, None, None, False, False], 16 | ]) 17 | 18 | s = Spawn(router_command) 19 | 20 | # at this stage we are anticipating the program to wait for a new line 21 | d.process(s) 22 | s.close() 23 | -------------------------------------------------------------------------------- /docs/user_guide/examples/5_using_shorthand.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unicon.eal.expect import Spawn, TimeoutError 3 | from unicon.eal.dialogs import Statement, Dialog 4 | 5 | router_command = os.path.join(os.getcwd(), 'router.sh') 6 | prompt = 'sim-router' 7 | enable_prompt = prompt + '#' 8 | disable_prompt = prompt + '>' 9 | 10 | # construct the dialog 11 | # we can see how shorthand notation makes the code look even more leaner. 12 | d = Dialog([ 13 | [r'enter to continue \.\.\.', 'sendline()', None, True, False], 14 | [r'username:\s?$', 'sendline(admin)', None, True, False], 15 | [r'password:\s?$', 'sendline(lab)', None, True, False], 16 | [disable_prompt, None, None, False, False], 17 | ]) 18 | 19 | s = Spawn(router_command) 20 | 21 | # at this stage we are anticipating the program to wait for a new line 22 | d.process(s) 23 | s.close() 24 | -------------------------------------------------------------------------------- /docs/user_guide/services/ftd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/docs/user_guide/services/ftd.png -------------------------------------------------------------------------------- /docs/user_guide/services/fxos_fp9k.rst: -------------------------------------------------------------------------------- 1 | FXOS/FP9K 2 | ========= 3 | 4 | This section lists the services which are supported with Firepower Extensible Operating System (FXOS) Unicon plugin 5 | for Firepower 9000 series platforms. This plugin is used when `os=fxos` and `platform=fp9k` are specified. 6 | 7 | This plugin is based on the Firepower 4000 series, see `FXOS/FP4K `__ 8 | -------------------------------------------------------------------------------- /docs/user_guide/services/index.rst: -------------------------------------------------------------------------------- 1 | API/Services 2 | ============ 3 | 4 | This part of the document covers all the services supported by Unicon. 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | what_are_services 10 | generic_services 11 | aci 12 | asa_fp2k 13 | cimc 14 | confd 15 | ftd 16 | fxos 17 | fxos_fp4k 18 | fxos_fp9k 19 | gaia 20 | iosxe 21 | iosxe_c9800_ewc_ap 22 | iosxr 23 | junos 24 | linux 25 | nso 26 | nxos 27 | nxos_mds 28 | sdwan 29 | sros 30 | staros 31 | vos 32 | windows 33 | 34 | .. sectionauthor:: ATS Team 35 | -------------------------------------------------------------------------------- /docs/user_guide/services/nso.rst: -------------------------------------------------------------------------------- 1 | NSO 2 | === 3 | 4 | The NSO plugin is based on ConfD, see `ConfD `__ 5 | -------------------------------------------------------------------------------- /docs/user_guide/services/windows.rst: -------------------------------------------------------------------------------- 1 | Windows 2 | ======= 3 | 4 | The Unicon Windows plugin allows you to connect to Windows systems with command line interface (CMD shell). 5 | 6 | This is an experimental plugin, there are some issues with ANSI stripping and powershell is not supported. 7 | 8 | The following generic services are available: 9 | 10 | * `execute`_ 11 | * `send`_ 12 | * `sendline`_ 13 | * `expect`_ 14 | 15 | .. _execute: generic_services.html#execute 16 | .. _send: generic_services.html#send 17 | .. _sendline: generic_services.html#sendline 18 | .. _expect: generic_services.html#expect 19 | 20 | -------------------------------------------------------------------------------- /src/unicon/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = '25.4' 2 | 3 | supported_chassis = [ 4 | 'single_rp', 5 | 'dual_rp', 6 | 'stack', 7 | 'quad', 8 | ] 9 | 10 | supported_os = [ 11 | 'aci', 12 | 'aireos', 13 | 'apic', 14 | 'asa', 15 | 'cheetah', 16 | 'cimc', 17 | 'comware', 18 | 'confd', 19 | 'dnos6', 20 | 'dnos10', 21 | 'eos', 22 | 'fxos', 23 | 'gaia', 24 | 'generic', 25 | 'hvrp', 26 | 'ios', 27 | 'iosxe', 28 | 'iosxr', 29 | 'ironware', 30 | 'ise', 31 | 'junos', 32 | 'linux', 33 | 'nd', 34 | 'nso', 35 | 'nxos', 36 | 'ons', 37 | 'sdwan', 38 | 'slxos', 39 | 'sonic', 40 | 'sros', 41 | 'staros', 42 | 'viptela', 43 | 'vos', 44 | 'windows' 45 | ] 46 | -------------------------------------------------------------------------------- /src/unicon/plugins/aireos/ap/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.generic import ServiceList, GenericSingleRpConnection, GenericDualRPConnection 3 | from unicon.plugins.generic.connection_provider import GenericSingleRpConnectionProvider 4 | 5 | from .settings import AireosAPSettings 6 | from .statemachine import AireosAPStateMachine 7 | 8 | 9 | class AireosAPConnection(GenericSingleRpConnection): 10 | os = 'aireos' 11 | platform = 'ap' 12 | chassis_type = 'single_rp' 13 | state_machine_class = AireosAPStateMachine 14 | connection_provider_class = GenericSingleRpConnectionProvider 15 | subcommand_list = ServiceList 16 | settings = AireosAPSettings() 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/aireos/ap/settings.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.generic.settings import GenericSettings 2 | 3 | 4 | class AireosAPSettings(GenericSettings): 5 | def __init__(self): 6 | super().__init__() 7 | self.HA_INIT_EXEC_COMMANDS = [ 8 | 'terminal length 0', 9 | 'terminal width 0', 10 | 'exec-timeout 0 0', 11 | 'logging console disable' 12 | ] 13 | self.HA_INIT_CONFIG_COMMANDS = [] 14 | 15 | self.ERROR_PATTERN = [ 16 | r'^%\s*[Ii]nvalid input detected', 17 | r'^%\s*[Ii]ncomplete' 18 | ] 19 | -------------------------------------------------------------------------------- /src/unicon/plugins/aireos/ap/statemachine.py: -------------------------------------------------------------------------------- 1 | from unicon.eal.dialogs import Dialog 2 | from unicon.statemachine import Path, State, StateMachine 3 | from unicon.plugins.generic.patterns import GenericPatterns 4 | from unicon.plugins.generic.statements import GenericStatements 5 | from unicon.plugins.generic.statements import default_statement_list, authentication_statement_list 6 | 7 | statements = GenericStatements() 8 | 9 | patterns = GenericPatterns() 10 | 11 | 12 | class AireosAPStateMachine(StateMachine): 13 | def create(self): 14 | 15 | disable = State('disable', patterns.disable_prompt) 16 | enable = State('enable', patterns.enable_prompt) 17 | 18 | self.add_state(enable) 19 | self.add_state(disable) 20 | 21 | enable_to_disable = Path(enable, disable, 'disable', None) 22 | disable_to_enable = Path(disable, enable, 'enable', 23 | Dialog([statements.enable_password_stmt, statements.bad_password_stmt])) 24 | 25 | self.add_path(disable_to_enable) 26 | self.add_path(enable_to_disable) 27 | 28 | self.add_default_statements(default_statement_list) 29 | -------------------------------------------------------------------------------- /src/unicon/plugins/apic/__init__.py: -------------------------------------------------------------------------------- 1 | from .connection import AciApicConnection 2 | -------------------------------------------------------------------------------- /src/unicon/plugins/apic/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from unicon.plugins.generic.service_patterns import ReloadPatterns 4 | 5 | 6 | class ApicReloadPatterns(ReloadPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.restart_proceed = r'^(.*?)This command will restart (this device|the APIC), Proceed\? \[y/N\]' 10 | self.factory_reset = r'^(.*?)Do you want to restore this APIC to factory settings\? The system will be REBOOTED. \(Y/n\):' 11 | self.press_any_key = r'^(.*?)Press any key to continue' 12 | self.login = r'^(.*?)login:' 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/apic/settings.py: -------------------------------------------------------------------------------- 1 | """ Defines the settings for aci based unicon connections """ 2 | 3 | __author__ = "dwapstra" 4 | 5 | from unicon.plugins.generic.settings import GenericSettings 6 | 7 | 8 | class AciSettings(GenericSettings): 9 | """" Generic platform settings """ 10 | def __init__(self): 11 | """ initialize 12 | """ 13 | super().__init__() 14 | self.TERM = 'vt100' 15 | self.HA_INIT_EXEC_COMMANDS = [ 16 | 'terminal length 0', 17 | 'terminal width 0' 18 | ] 19 | self.HA_INIT_CONFIG_COMMANDS = [] 20 | self.ERROR_PATTERN = [ 21 | r'^(%\s*)?Error', 22 | ] 23 | 24 | self.POST_RELOAD_WAIT = 330 25 | self.RELOAD_RECONNECT_ATTEMPTS = 3 26 | self.RELOAD_TIMEOUT = 420 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/ASAv/__init__.py: -------------------------------------------------------------------------------- 1 | from unicon.bases.routers.connection import BaseSingleRpConnection 2 | from .statemachine import ASAStateMachine 3 | from unicon.plugins.asa.provider import ASAConnectionProvider 4 | from unicon.plugins.generic import ServiceList 5 | from .settings import ASAvSettings 6 | from .service_implementation import ASAReload 7 | 8 | class ASAvServiceList(ServiceList): 9 | def __init__(self): 10 | super().__init__() 11 | self.reload = ASAReload 12 | 13 | class ASAvConnection(BaseSingleRpConnection): 14 | os = 'asa' 15 | platform = 'asav' 16 | chassis_type = 'single_rp' 17 | state_machine_class = ASAStateMachine 18 | connection_provider_class = ASAConnectionProvider 19 | subcommand_list = ASAvServiceList 20 | settings = ASAvSettings() 21 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/ASAv/service_implementation.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.generic.service_implementation import Reload 2 | from unicon.eal.dialogs import Dialog, Statement 3 | from unicon.plugins.asa.ASAv.service_statements import asa_reload_stmt_list 4 | 5 | class ASAReload(Reload): 6 | def __init__(self, connection, context, **kwargs): 7 | super().__init__(connection, context, **kwargs) 8 | self.start_state = 'enable' 9 | self.end_state = 'enable' 10 | self.dialog = Dialog(asa_reload_stmt_list) 11 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/ASAv/settings.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.asa.settings import ASASettings 2 | 3 | class ASAvSettings(ASASettings): 4 | def __init__(self): 5 | super().__init__() 6 | self.CONNECTION_TIMEOUT = 300 7 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/__init__.py: -------------------------------------------------------------------------------- 1 | from unicon.bases.routers.connection import BaseSingleRpConnection 2 | from .statemachine import ASAStateMachine 3 | from .provider import ASAConnectionProvider 4 | from unicon.plugins.generic import ServiceList 5 | from .settings import ASASettings 6 | from .service_implementation import ASAExecute, ASAReload 7 | 8 | class ASAServiceList(ServiceList): 9 | def __init__(self): 10 | super().__init__() 11 | self.execute = ASAExecute 12 | self.reload = ASAReload 13 | 14 | class ASAConnection(BaseSingleRpConnection): 15 | os = 'asa' 16 | platform = None 17 | chassis_type = 'single_rp' 18 | state_machine_class = ASAStateMachine 19 | connection_provider_class = ASAConnectionProvider 20 | subcommand_list = ASAServiceList 21 | settings = ASASettings() 22 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/fp2k/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from unicon.plugins.fxos.patterns import FxosPatterns 4 | 5 | 6 | class AsaFp2kPatterns(FxosPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.fxos_prompt = r'^(.*?)firepower.*?#\s*$' 10 | self.broken_pipe = r'.*Connection to .*Broken pipe' 11 | self.reload_confirm = r'^(.*?)Proceed with reload\? \[confirm\]' 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/fp2k/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from unicon.plugins.fxos.settings import FxosSettings 4 | 5 | 6 | class AsaFp2kSettings(FxosSettings): 7 | """" Generic platform settings """ 8 | def __init__(self): 9 | """ initialize 10 | """ 11 | super().__init__() 12 | self.HA_INIT_EXEC_COMMANDS = [] 13 | self.HA_INIT_CONFIG_COMMANDS = [] 14 | 15 | self.ERROR_PATTERN = [ 16 | r'^%?\s*?Syntax error:', 17 | r'^\s*?% Invalid command' 18 | ] 19 | 20 | self.PROMPT_RECOVERY_COMMANDS = ['\x01\x0b', '\r', '\x03', '\r'] 21 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/provider.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.generic.connection_provider import GenericSingleRpConnectionProvider 2 | 3 | from . import statements 4 | 5 | from unicon.eal.dialogs import Dialog 6 | 7 | 8 | class ASAConnectionProvider(GenericSingleRpConnectionProvider): 9 | 10 | def get_connection_dialog(self): 11 | dialog = super().get_connection_dialog() 12 | dialog += Dialog(statements.connection_statements) 13 | return dialog 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/asa/service_implementation.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | 4 | from unicon.eal.dialogs import Dialog 5 | from unicon.plugins.generic.service_implementation import Execute as GenericExecute, \ 6 | Reload as GenericReload 7 | 8 | from .patterns import (ASAPatterns) 9 | from .statements import execute_statements, reload_statements 10 | 11 | class ASAExecute(GenericExecute): 12 | 13 | def __init__(self, connection, context, **kwargs): 14 | super().__init__(connection, context, **kwargs) 15 | self.dialog += Dialog(execute_statements) 16 | 17 | class ASAReload(GenericReload): 18 | 19 | def __init__(self, connection, context, **kwargs): 20 | super().__init__(connection, context, **kwargs) 21 | self.dialog += Dialog(reload_statements) -------------------------------------------------------------------------------- /src/unicon/plugins/asa/settings.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.generic.settings import GenericSettings 2 | 3 | 4 | class ASASettings(GenericSettings): 5 | def __init__(self): 6 | super().__init__() 7 | self.EXEC_TIMEOUT = 100 8 | self.SIZE = 8096 9 | self.HA_INIT_EXEC_COMMANDS = [ 10 | 'terminal pager 0', 11 | ] 12 | self.HA_INIT_CONFIG_COMMANDS = [] 13 | 14 | # When connecting to a device via telnet, how long to pause before 15 | # checking the spawn buffer. 16 | self.ESCAPE_CHAR_CALLBACK_PAUSE_SEC = 1 17 | 18 | # sendline is called if the spawn buffer is empty after a pause, or 19 | # after trying a pause/spawn buffer check this many times. 20 | self.ESCAPE_CHAR_CALLBACK_PAUSE_CHECK_RETRIES = 5 21 | 22 | # Sometimes a copy operation can fail due to network issues, 23 | # so copy at most this many times. 24 | self.MAX_COPY_ATTEMPTS = 2 25 | self.ERROR_PATTERN = [ 26 | r'^ERROR:', 27 | r'^WARNING:', 28 | r'\*{1,} WARNING \*{1,}', 29 | r'^Removing.*?failed.*?$' 30 | ] 31 | -------------------------------------------------------------------------------- /src/unicon/plugins/cheetah/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/src/unicon/plugins/cheetah/__init__.py -------------------------------------------------------------------------------- /src/unicon/plugins/cheetah/ap/patterns.py: -------------------------------------------------------------------------------- 1 | """ Generic Cheetah AP Patterns. """ 2 | 3 | __author__ = "Naveen " 4 | 5 | from unicon.plugins.generic.patterns import GenericPatterns 6 | 7 | 8 | class CheetahAPPatterns(GenericPatterns): 9 | 10 | def __init__(self): 11 | super().__init__() 12 | self.ap_shell_prompt = r'^(.*?)\w+:\/(.*?)#\s?$' -------------------------------------------------------------------------------- /src/unicon/plugins/cheetah/ap/service_implementation.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | 4 | from unicon.plugins.generic.service_implementation import \ 5 | Execute as GenericExecute 6 | from unicon.plugins.generic.service_implementation import \ 7 | Reload as GenericReload 8 | from unicon.eal.dialogs import Dialog 9 | from unicon.plugins.iosxe.service_statements import confirm 10 | 11 | from .service_statement import ap_reload_list 12 | 13 | class Execute(GenericExecute): 14 | def call_service(self, command=None, reply=Dialog([]), timeout=None, *args, 15 | **kwargs): 16 | command = list() if command is None else command 17 | super().call_service(command, 18 | reply=reply + Dialog([confirm,]), 19 | timeout=timeout, *args, **kwargs) 20 | 21 | class Reload(GenericReload): 22 | def __init__(self, connection, context, **kwargs): 23 | super().__init__(connection, context, **kwargs) 24 | self.dialog = self.dialog + Dialog(ap_reload_list) -------------------------------------------------------------------------------- /src/unicon/plugins/cheetah/ap/service_patterns.py: -------------------------------------------------------------------------------- 1 | """AP Reload Service Patterns""" 2 | 3 | from unicon.plugins.generic.service_patterns import ReloadPatterns 4 | 5 | class APReloadPatterns(ReloadPatterns): 6 | def __init__(self): 7 | super().__init__() 8 | self.ap_shell_prompt = r'^Proceed with reload (command (\W+cold\W)?)?(\?) (\[)+confirm+(\])$' -------------------------------------------------------------------------------- /src/unicon/plugins/cheetah/ap/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | from unicon.plugins.generic.settings import GenericSettings 4 | 5 | 6 | class ApSettings(GenericSettings): 7 | def __init__(self): 8 | super().__init__() 9 | 10 | self.HA_INIT_EXEC_COMMANDS = [ 11 | 'exec-timeout 0', 12 | 'terminal length 0', 13 | 'terminal width 0', 14 | 'show version', 15 | 'logging console disable', 16 | ] -------------------------------------------------------------------------------- /src/unicon/plugins/cimc/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | from unicon.plugins.generic.patterns import GenericPatterns 4 | 5 | class CimcPatterns(GenericPatterns): 6 | def __init__(self): 7 | super().__init__() 8 | self.prompt = r'^(.*?)\S+\s?(/\w+)*\s?#\s*$' 9 | self.enter_yes_or_no = r"^(.*?)Enter 'yes' or 'no' to confirm.*->\s*$" 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/cimc/settings.py: -------------------------------------------------------------------------------- 1 | """ Defines the settings for cimc based unicon connections """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | from unicon.plugins.generic.settings import GenericSettings 6 | 7 | 8 | class CimcSettings(GenericSettings): 9 | """" Generic platform settings """ 10 | def __init__(self): 11 | """ initialize 12 | """ 13 | super().__init__() 14 | self.HA_INIT_EXEC_COMMANDS = [] 15 | self.HA_INIT_CONFIG_COMMANDS = [] -------------------------------------------------------------------------------- /src/unicon/plugins/cimc/statemachine.py: -------------------------------------------------------------------------------- 1 | """ State machine for Cimc """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | 6 | import re 7 | 8 | from unicon.plugins.cimc.patterns import CimcPatterns 9 | 10 | from unicon.statemachine import State, Path, StateMachine 11 | from unicon.eal.dialogs import Dialog, Statement 12 | 13 | from unicon.core.errors import SubCommandFailure, StateMachineError 14 | 15 | from .statements import CimcStatements 16 | 17 | patterns = CimcPatterns() 18 | statements = CimcStatements() 19 | 20 | default_statement_list = [statements.more_prompt_stmt] 21 | 22 | 23 | class CimcStateMachine(StateMachine): 24 | 25 | def __init__(self, hostname=None): 26 | super().__init__(hostname) 27 | 28 | def create(self): 29 | shell = State('shell', patterns.prompt) 30 | self.add_state(shell) 31 | self.add_default_statements(default_statement_list) 32 | -------------------------------------------------------------------------------- /src/unicon/plugins/cimc/statements.py: -------------------------------------------------------------------------------- 1 | """ 2 | CIMC statements 3 | """ 4 | from unicon.eal.dialogs import Statement 5 | from unicon.plugins.generic.statements import GenericStatements 6 | 7 | 8 | from .patterns import CimcPatterns 9 | pat = CimcPatterns() 10 | 11 | class CimcStatements(GenericStatements): 12 | """ 13 | Class that defines the Statements for CIMC platform 14 | implementation 15 | """ 16 | 17 | def __init__(self): 18 | ''' 19 | All CIMC Statements 20 | ''' 21 | super().__init__() 22 | self.enter_yes_or_no_stmt = Statement(pattern=pat.enter_yes_or_no, 23 | action='sendline(yes)', 24 | args=None, 25 | loop_continue=True, 26 | continue_timer=False) 27 | 28 | -------------------------------------------------------------------------------- /src/unicon/plugins/comware/patterns.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Renato Almeida de Oliveira 3 | Contact: renato.almeida.oliveira@gmail.com 4 | https://twitter.com/ORenato_Almeida 5 | https://www.youtube.com/c/RenatoAlmeidadeOliveira 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | import re 10 | 11 | from unicon.plugins.generic.patterns import GenericPatterns 12 | 13 | 14 | class HPComwarePatterns(GenericPatterns): 15 | def __init__(self): 16 | super().__init__() 17 | self.login_prompt = r'^ *login as: *$' 18 | self.user_exec_mode = r'^.*<%N>$' 19 | self.config_mode = r'^ *\[%N(-.*)?\]$' 20 | self.password = r'^.* password: $' 21 | self.save_confirm = r'The current configuration will be written to the device\. Are you sure\? \[Y/N\]:' 22 | self.file_save = r'^.*\(To leave the existing filename unchanged, press the enter key\):' 23 | self.overwrite = r'^.* exists, overwrite\? \[Y/N\]:' 24 | -------------------------------------------------------------------------------- /src/unicon/plugins/comware/service_statements.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Renato Almeida de Oliveira 3 | Contact: renato.almeida.oliveira@gmail.com 4 | https://twitter.com/ORenato_Almeida 5 | https://www.youtube.com/c/RenatoAlmeidadeOliveira 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | 10 | from unicon.eal.dialogs import Statement 11 | from unicon.plugins.comware.patterns import HPComwarePatterns 12 | 13 | from time import sleep 14 | 15 | patterns = HPComwarePatterns() 16 | 17 | 18 | def send_response(spawn, response=""): 19 | sleep(0.5) 20 | spawn.sendline(response) 21 | 22 | 23 | def sendPath(spawn, path=None): 24 | sleep(0.5) 25 | if path is not None: 26 | spawn.sendline(path) 27 | else: 28 | spawn.sendline() 29 | 30 | 31 | save_confirm = Statement(pattern=patterns.save_confirm, 32 | action=send_response, args={'response': 'Y'}, 33 | loop_continue=True, 34 | continue_timer=False) 35 | 36 | -------------------------------------------------------------------------------- /src/unicon/plugins/comware/settings.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Renato Almeida de Oliveira 3 | Contact: renato.almeida.oliveira@gmail.com 4 | https://twitter.com/ORenato_Almeida 5 | https://www.youtube.com/c/RenatoAlmeidadeOliveira 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | 10 | from unicon.plugins.generic.settings import GenericSettings 11 | 12 | 13 | class HPSettings(GenericSettings): 14 | 15 | def __init__(self): 16 | # inherit any parent settings 17 | super().__init__() 18 | self.CONNECTION_TIMEOUT = 60*5 19 | self.ESCAPE_CHAR_CALLBACK_PRE_SENDLINE_PAUSE_SEC = 1 20 | self.HA_INIT_EXEC_COMMANDS = ['screen-length disable'] 21 | self.HA_INIT_CONFIG_COMMANDS = [] -------------------------------------------------------------------------------- /src/unicon/plugins/confd/csp/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | 4 | from unicon.plugins.confd import ConfdServiceList, ConfdConnection, ConfdConnectionProvider 5 | from .statemachine import CspStateMachine 6 | from .settings import CspSettings 7 | from . import service_implementation as csp_svc 8 | 9 | 10 | class CspServiceList(ConfdServiceList): 11 | def __init__(self): 12 | super().__init__() 13 | delattr(self, 'cli_style') 14 | self.reload = csp_svc.Reload 15 | 16 | 17 | class CspSingleRPConnection(ConfdConnection): 18 | os = 'confd' 19 | platform = 'csp' 20 | chassis_type = 'single_rp' 21 | state_machine_class = CspStateMachine 22 | connection_provider_class = ConfdConnectionProvider 23 | subcommand_list = CspServiceList 24 | settings = CspSettings() 25 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/csp/patterns.py: -------------------------------------------------------------------------------- 1 | """ CSP regex patterns """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | 6 | from ..patterns import ConfdPatterns 7 | 8 | class CspPatterns(ConfdPatterns): 9 | def __init__(self): 10 | super().__init__() 11 | self.cisco_prompt = r'^(.*?)(%N#)\s*$' 12 | self.cisco_config_prompt = r'^(.*?)(%N\(config.*\)#)\s*$' 13 | self.cisco_commit_changes_prompt = r'Uncommitted changes found, commit them\? \[yes/no/CANCEL\]' 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/csp/service_patterns.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.patterns import UniconCorePatterns 3 | 4 | class ReloadPatterns(UniconCorePatterns): 5 | def __init__(self): 6 | super().__init__() 7 | self.reload_confirm = r'^(.*?)Are you sure you want to reboot the system\? \[no,yes\]\s*$' 8 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/csp/service_statements.py: -------------------------------------------------------------------------------- 1 | 2 | from time import sleep 3 | 4 | from unicon.eal.dialogs import Statement 5 | from .service_patterns import ReloadPatterns 6 | 7 | def send_response(spawn, response=""): 8 | sleep(0.5) 9 | spawn.sendline(response) 10 | 11 | 12 | pat = ReloadPatterns() 13 | 14 | reload_confirm_continue_stmt = Statement(pattern=pat.reload_confirm, 15 | action=send_response, args={'response': 'yes'}, 16 | loop_continue=True, 17 | continue_timer=False) 18 | 19 | reload_confirm_stmt = Statement(pattern=pat.reload_confirm, 20 | action=send_response, args={'response': 'yes'}, 21 | loop_continue=False, 22 | continue_timer=False) 23 | 24 | reload_continue_statement_list = [reload_confirm_continue_stmt] 25 | 26 | reload_statement_list = [reload_confirm_stmt] 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/csp/settings.py: -------------------------------------------------------------------------------- 1 | """ Defines the settings for ConfD/CSP based unicon connections """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | 6 | from ..settings import ConfdSettings 7 | 8 | 9 | class CspSettings(ConfdSettings): 10 | """" Generic platform settings """ 11 | def __init__(self): 12 | """ initialize 13 | """ 14 | super().__init__() 15 | self.CISCO_INIT_EXEC_COMMANDS = [] 16 | self.CISCO_INIT_CONFIG_COMMANDS = [ 17 | 'session paginate false' 18 | ] 19 | 20 | self.RELOAD_TIMEOUT = 600 21 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/esc/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | from unicon.plugins.confd import ConfdServiceList, ConfdConnection, ConfdConnectionProvider 4 | from unicon.plugins.confd.statemachine import ConfdStateMachine 5 | from unicon.plugins.confd.settings import ConfdSettings 6 | 7 | 8 | class EscServiceList(ConfdServiceList): 9 | def __init__(self): 10 | super().__init__() 11 | delattr(self, 'cli_style') 12 | 13 | 14 | class EscSingleRPConnection(ConfdConnection): 15 | os = 'confd' 16 | platform = 'esc' 17 | chassis_type = 'single_rp' 18 | state_machine_class = ConfdStateMachine 19 | connection_provider_class = ConfdConnectionProvider 20 | subcommand_list = EscServiceList 21 | settings = ConfdSettings() 22 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/nfvis/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | 4 | from unicon.plugins.confd import ConfdServiceList, ConfdConnection, ConfdConnectionProvider 5 | from .statemachine import NfvisStateMachine 6 | from unicon.plugins.confd.settings import ConfdSettings 7 | 8 | 9 | class NfvisServiceList(ConfdServiceList): 10 | def __init__(self): 11 | super().__init__() 12 | delattr(self, 'cli_style') 13 | 14 | 15 | class NfvisSingleRPConnection(ConfdConnection): 16 | os = 'confd' 17 | platform = 'nfvis' 18 | chassis_type = 'single_rp' 19 | state_machine_class = NfvisStateMachine 20 | connection_provider_class = ConfdConnectionProvider 21 | subcommand_list = NfvisServiceList 22 | settings = ConfdSettings() 23 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/nfvis/patterns.py: -------------------------------------------------------------------------------- 1 | """ NFVIS regex patterns """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | 6 | from ..patterns import ConfdPatterns 7 | 8 | class NfvisPatterns(ConfdPatterns): 9 | def __init__(self): 10 | super().__init__() 11 | self.cisco_prompt = r'^(.*?)(%N|nfvis)#\s*$' 12 | self.cisco_config_prompt = r'^(.*?)((%N|nfvis)\(config.*\)#)\s*$' 13 | self.cisco_commit_changes_prompt = r'Uncommitted changes found, commit them\? \[yes/no/CANCEL\]' 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/patterns.py: -------------------------------------------------------------------------------- 1 | """ ConfdD regex patterns """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | 6 | from unicon.plugins.generic.patterns import GenericPatterns 7 | 8 | class ConfdPatterns(GenericPatterns): 9 | def __init__(self): 10 | super().__init__() 11 | self.cisco_prompt = r'^(.*?)([-\.\w]+@[-\.\w]+#)\s*$' 12 | self.juniper_prompt = r'^(.*?)([-\.\w]+@[-\.\w]+>)\s*$' 13 | self.cisco_or_juniper_prompt = r'^(.*)([-\.\w]+@[-\.\w]+[#>])\s*$' 14 | self.cisco_config_prompt = r'^(.*?)([-\.\w]+@[-\.\w]+\(config.*\)#)\s*$' 15 | self.juniper_config_prompt = r'^(.*?)((\[edit\]\r\n)?[-\.\w]+@[-\.\w]+%)\s*$' 16 | self.cisco_or_juniper_config_prompt = r'^(.*?)((\[edit\]\r\n)?[-\.\w]+@[-\.\w]+(\(config.*\)#|%))\s*$' 17 | self.connected_console = r"^(.*?)connected from .* using console" 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/confd/statements.py: -------------------------------------------------------------------------------- 1 | """ 2 | ConfD statements 3 | """ 4 | from unicon.eal.dialogs import Statement 5 | from .patterns import ConfdPatterns 6 | 7 | 8 | pat = ConfdPatterns() 9 | 10 | 11 | def console_session(spawn, context): 12 | context['console'] = True 13 | 14 | 15 | class ConfdStatements(): 16 | """ 17 | Class that defines the Statements for Confd platform 18 | implementation 19 | """ 20 | def __init__(self): 21 | self.connected_console_stmt = Statement(pattern=pat.connected_console, 22 | action=console_session, 23 | args=None, 24 | loop_continue=True, 25 | continue_timer=False) 26 | 27 | 28 | 29 | confd_statements = ConfdStatements() 30 | 31 | confd_statement_list = [confd_statements.connected_console_stmt] 32 | 33 | -------------------------------------------------------------------------------- /src/unicon/plugins/dnos10/__init__.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Knox Hutchinson 3 | Contact: https://dataknox.dev 4 | https://twitter.com/data_knox 5 | https://youtube.com/c/dataknox 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | 10 | from unicon.bases.routers.connection import BaseSingleRpConnection 11 | from unicon.plugins.generic import GenericSingleRpConnectionProvider 12 | from .statemachine import Dnos10SingleRpStateMachine 13 | from .services import Dnos10ServiceList 14 | from .settings import Dnos10Settings 15 | 16 | 17 | class Dnos10SingleRPConnection(BaseSingleRpConnection): 18 | '''Dnos10SingleRPConnection 19 | 20 | Dell OS10 PowerSwitch support 21 | ''' 22 | os = 'dnos10' 23 | chassis_type = 'single_rp' 24 | state_machine_class = Dnos10SingleRpStateMachine 25 | connection_provider_class = GenericSingleRpConnectionProvider 26 | subcommand_list = Dnos10ServiceList 27 | settings = Dnos10Settings() 28 | -------------------------------------------------------------------------------- /src/unicon/plugins/dnos10/patterns.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Knox Hutchinson 3 | Contact: https://dataknox.dev 4 | https://twitter.com/data_knox 5 | https://youtube.com/c/dataknox 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | from unicon.plugins.generic.patterns import GenericPatterns 10 | 11 | 12 | class Dnos10Patterns(GenericPatterns): 13 | def __init__(self): 14 | super().__init__() 15 | self.login_prompt = r' *login here: *?' 16 | self.disable_mode = r'\w+>$' 17 | self.privileged_mode = r'\w+[^\(config\)]#$' 18 | self.config_mode = r'\w+\(config[-\w]+\)#$' 19 | self.password = r'Password:' 20 | -------------------------------------------------------------------------------- /src/unicon/plugins/dnos10/settings.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Knox Hutchinson 3 | Contact: https://dataknox.dev 4 | https://twitter.com/data_knox 5 | https://youtube.com/c/dataknox 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | 10 | from unicon.plugins.generic.settings import GenericSettings 11 | 12 | 13 | class Dnos10Settings(GenericSettings): 14 | 15 | def __init__(self): 16 | # inherit any parent settings 17 | super().__init__() 18 | self.CONNECTION_TIMEOUT = 60*5 19 | self.ESCAPE_CHAR_CALLBACK_PRE_SENDLINE_PAUSE_SEC = 1 20 | self.HA_INIT_EXEC_COMMANDS = [] 21 | self.HA_INIT_CONFIG_COMMANDS = [] -------------------------------------------------------------------------------- /src/unicon/plugins/dnos6/__init__.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Knox Hutchinson 3 | Contact: https://dataknox.dev 4 | https://twitter.com/data_knox 5 | https://youtube.com/c/dataknox 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | 10 | from unicon.bases.routers.connection import BaseSingleRpConnection 11 | from unicon.plugins.generic import GenericSingleRpConnectionProvider 12 | from .statemachine import Dnos6SingleRpStateMachine 13 | from .services import Dnos6ServiceList 14 | from .settings import Dnos6Settings 15 | 16 | 17 | class Dnos6SingleRPConnection(BaseSingleRpConnection): 18 | '''Dnos6SingleRPConnection 19 | 20 | Dell OS6 PowerSwitch support. 21 | ''' 22 | os = 'dnos6' 23 | chassis_type = 'single_rp' 24 | state_machine_class = Dnos6SingleRpStateMachine 25 | connection_provider_class = GenericSingleRpConnectionProvider 26 | subcommand_list = Dnos6ServiceList 27 | settings = Dnos6Settings() 28 | -------------------------------------------------------------------------------- /src/unicon/plugins/dnos6/patterns.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Knox Hutchinson 3 | Contact: https://dataknox.dev 4 | https://twitter.com/data_knox 5 | https://youtube.com/c/dataknox 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | from unicon.plugins.generic.patterns import GenericPatterns 10 | 11 | 12 | class Dnos6Patterns(GenericPatterns): 13 | def __init__(self): 14 | super().__init__() 15 | self.login_prompt = r' *login here: *?' 16 | self.disable_mode = r'\w+>$' 17 | self.privileged_mode = r'\w+[^\(config\)]#$' 18 | self.config_mode = r'\w+\(config[-\w]+\)#$' 19 | self.password = r'Password:' 20 | -------------------------------------------------------------------------------- /src/unicon/plugins/dnos6/settings.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Knox Hutchinson 3 | Contact: https://dataknox.dev 4 | https://twitter.com/data_knox 5 | https://youtube.com/c/dataknox 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | 10 | from unicon.plugins.generic.settings import GenericSettings 11 | 12 | 13 | class Dnos6Settings(GenericSettings): 14 | 15 | def __init__(self): 16 | # inherit any parent settings 17 | super().__init__() 18 | self.CONNECTION_TIMEOUT = 60*5 19 | self.ESCAPE_CHAR_CALLBACK_PRE_SENDLINE_PAUSE_SEC = 1 20 | self.HA_INIT_EXEC_COMMANDS = [] 21 | self.HA_INIT_CONFIG_COMMANDS = [] -------------------------------------------------------------------------------- /src/unicon/plugins/eos/__init__.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Richard Day 3 | Contact: https://www.linkedin.com/in/richardday/, https://github.com/rich-day 4 | 5 | Contents largely inspired by sample Unicon repo: 6 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 7 | ''' 8 | 9 | from unicon.bases.routers.connection import BaseSingleRpConnection 10 | from unicon.plugins.generic import GenericSingleRpConnectionProvider 11 | from .statemachine import EOSSingleRpStateMachine 12 | from .services import EOSServiceList 13 | from .settings import EOSSettings 14 | 15 | class EOSSingleRPConnection(BaseSingleRpConnection): 16 | ''' 17 | Support for Arista EOS platform 18 | ''' 19 | os = 'eos' 20 | platform = None 21 | chassis_type = 'single_rp' 22 | state_machine_class = EOSSingleRpStateMachine 23 | subcommand_list = EOSServiceList 24 | settings = EOSSettings() 25 | connection_provider_class = GenericSingleRpConnectionProvider 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/eos/patterns.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Richard Day 3 | Contact: https://www.linkedin.com/in/richardday/, https://github.com/rich-day 4 | 5 | Contents largely inspired by sample Unicon repo: 6 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 7 | ''' 8 | 9 | import re 10 | from unicon.plugins.generic.patterns import GenericPatterns 11 | 12 | 13 | class EOSPatterns(GenericPatterns): 14 | def __init__(self): 15 | super().__init__() 16 | self.login_prompt = r'^ *login: *?' 17 | self.disable_mode = r'^(.*?)\w+>$' 18 | self.privileged_mode = r'^(.*?)\w+[^\(config\)]#$' 19 | self.password = r'Password:' -------------------------------------------------------------------------------- /src/unicon/plugins/eos/settings.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Richard Day 3 | Contact: https://www.linkedin.com/in/richardday/, https://github.com/rich-day 4 | 5 | Contents largely inspired by sample Unicon repo: 6 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 7 | ''' 8 | 9 | from unicon.plugins.generic.settings import GenericSettings 10 | 11 | class EOSSettings(GenericSettings): 12 | 13 | def __init__(self): 14 | super().__init__() 15 | self.CONNECTION_TIMEOUT = 60*5 16 | self.HA_INIT_CONFIG_COMMANDS = [ 17 | 'no logging console' 18 | ] -------------------------------------------------------------------------------- /src/unicon/plugins/fxos/fp4k/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from .. import FxosConnectionProvider 4 | from .. import FxosConnection 5 | from .. import FxosServiceList 6 | 7 | from .settings import FxosFp4kSettings 8 | from .statemachine import FxosFp4kStateMachine 9 | from . import service_implementation as svc 10 | 11 | 12 | class FxosF4pkServiceList(FxosServiceList): 13 | """ fxos services. """ 14 | 15 | def __init__(self): 16 | super().__init__() 17 | self.reload = svc.Reload 18 | 19 | 20 | class FxosFp4kConnection(FxosConnection): 21 | """ 22 | Connection class for fxos/fp4k connections. 23 | """ 24 | os = 'fxos' 25 | platform = 'fp4k' 26 | chassis_type = 'single_rp' 27 | state_machine_class = FxosFp4kStateMachine 28 | connection_provider_class = FxosConnectionProvider 29 | subcommand_list = FxosF4pkServiceList 30 | settings = FxosFp4kSettings() 31 | -------------------------------------------------------------------------------- /src/unicon/plugins/fxos/fp4k/service_implementation.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.bases.routers.services import BaseService 3 | from ..service_implementation import Reload as FxosReload 4 | 5 | 6 | class Reload(FxosReload): 7 | 8 | def pre_service(self, *args, **kwargs): 9 | self.prompt_recovery = self.connection.prompt_recovery 10 | if 'prompt_recovery' in kwargs: 11 | self.prompt_recovery = kwargs.get('prompt_recovery') 12 | # switch to local-mgmt to execute the reboot command 13 | self.connection.fxos_mgmt() 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/fxos/fp4k/settings.py: -------------------------------------------------------------------------------- 1 | from ..settings import FxosSettings 2 | 3 | 4 | class FxosFp4kSettings(FxosSettings): 5 | """" FXOS/FP4k platform settings """ 6 | 7 | def __init__(self): 8 | super().__init__() 9 | 10 | # What pattern to wait for after system restart 11 | self.BOOT_WAIT_PATTERN = r'^.*?vdc 1 has come online' 12 | # How many times the boot_wait_msg should occur to determine boot has finished 13 | self.BOOT_WAIT_PATTERN_COUNT = 1 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/fxos/fp9k/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from .. import FxosConnectionProvider 4 | from .. import FxosConnection 5 | from .. import FxosSettings 6 | from .. import FxosServiceList 7 | 8 | from ..fp4k.statemachine import FxosFp4kStateMachine 9 | 10 | 11 | class FxosFp9kConnection(FxosConnection): 12 | """ 13 | Connection class for fxos/fp9k connections. 14 | """ 15 | os = 'fxos' 16 | platform = 'fp9k' 17 | chassis_type = 'single_rp' 18 | state_machine_class = FxosFp4kStateMachine 19 | connection_provider_class = FxosConnectionProvider 20 | subcommand_list = FxosServiceList 21 | settings = FxosSettings() 22 | -------------------------------------------------------------------------------- /src/unicon/plugins/fxos/ftd/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | -------------------------------------------------------------------------------- /src/unicon/plugins/fxos/ftd/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from ..settings import FxosSettings 4 | 5 | 6 | class FtdSettings(FxosSettings): 7 | """" Generic platform settings """ 8 | def __init__(self): 9 | """ initialize 10 | """ 11 | super().__init__() 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/gaia/settings.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: Sam Johnson 3 | Contact: samuel.johnson@gmail.com 4 | https://github.com/TestingBytes 5 | 6 | Contents largely inspired by sample Unicon repo: 7 | https://github.com/CiscoDevNet/pyats-plugin-examples/tree/master/unicon_plugin_example/src/unicon_plugin_example 8 | ''' 9 | 10 | from unicon.plugins.generic.settings import GenericSettings 11 | 12 | 13 | class GaiaSettings(GenericSettings): 14 | 15 | def __init__(self): 16 | # inherit any parent settings 17 | super().__init__() 18 | self.CONNECTION_TIMEOUT = 300 19 | self.ESCAPE_CHAR_CALLBACK_PRE_SENDLINE_PAUSE_SEC = 1 20 | self.HA_INIT_EXEC_COMMANDS = ['set clienv rows 0'] 21 | self.HA_INIT_CONFIG_COMMANDS = [] 22 | 23 | self.ERROR_PATTERN = [ 24 | r'^.*?command not found.*$', 25 | r'^.*?[Ii]nvalid command.*$' 26 | ] 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/hvrp/services.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from unicon.plugins.generic.service_implementation import Execute as GenericExec 4 | from unicon.plugins.ios.iosv import IosvServiceList 5 | 6 | logger = logging.getLogger(__name__) 7 | 8 | 9 | class Execute(GenericExec): 10 | ''' 11 | Demonstrating how to augment an existing service by updating its call 12 | service method 13 | ''' 14 | 15 | def call_service(self, *args, **kwargs): 16 | # custom... code here 17 | logger.info('execute service called') 18 | 19 | # call parent 20 | super().call_service(*args, **kwargs) 21 | 22 | 23 | class VrpServiceList(IosvServiceList): 24 | ''' 25 | class aggregating all service lists for this platform 26 | ''' 27 | 28 | def __init__(self): 29 | # use the parent services 30 | super().__init__() 31 | 32 | # overwrite and add our own 33 | self.execute = Execute 34 | -------------------------------------------------------------------------------- /src/unicon/plugins/hvrp/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.hvrp 4 | Authors: 5 | Miguel Botia (mibotiaf@cisco.com), Leonardo Anez (leoanez@cisco.com) 6 | Description: 7 | This module defines the HVRP settings to setup the unicon environment required for generic based unicon connection. 8 | """ 9 | 10 | from unicon.plugins.generic import GenericSettings 11 | 12 | 13 | class HvrpSettings(GenericSettings): 14 | """" Hvrp platform settings """ 15 | 16 | def __init__(self): 17 | super().__init__() 18 | self.HA_INIT_EXEC_COMMANDS = [ 19 | 'screen-length 0 temporary', 20 | 'undo terminal alarm', 21 | 'undo terminal logging', 22 | 'undo terminal debugging', 23 | 'undo terminal monitor' 24 | ] 25 | 26 | self.HA_INIT_CONFIG_COMMANDS = [] 27 | self.ERROR_PATTERN.append("Error:.*") 28 | self.CONFIGURE_ERROR_PATTERN.append(r'^Error:.*') 29 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/__init__.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.generic import ServiceList 2 | from unicon.bases.routers.connection import BaseSingleRpConnection 3 | from unicon.plugins.generic.statemachine import GenericSingleRpStateMachine 4 | from unicon.plugins.generic import GenericSingleRpConnectionProvider 5 | from unicon.plugins.ios.settings import IosSettings 6 | from unicon.plugins.ios import service_implementation as svc 7 | 8 | class IosServiceList(ServiceList): 9 | def __init__(self): 10 | super().__init__() 11 | self.ping = svc.Ping 12 | 13 | 14 | class IosSingleRpConnection(BaseSingleRpConnection): 15 | os = 'ios' 16 | chassis_type = 'single_rp' 17 | state_machine_class = GenericSingleRpStateMachine 18 | connection_provider_class = GenericSingleRpConnectionProvider 19 | subcommand_list = IosServiceList 20 | settings = IosSettings() 21 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/ap/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | 4 | from unicon.bases.routers.connection import BaseSingleRpConnection 5 | from unicon.plugins.generic.statemachine import GenericSingleRpStateMachine 6 | from unicon.plugins.generic import ServiceList 7 | from unicon.plugins.generic import GenericSingleRpConnectionProvider 8 | from unicon.plugins.ios.ap.settings import ApSettings 9 | from unicon.plugins.ios.ap import service_implementation as svc 10 | 11 | 12 | class ApServiceList(ServiceList): 13 | def __init__(self): 14 | super().__init__() 15 | self.execute = svc.Execute 16 | 17 | 18 | class ApSingleRpConnection(BaseSingleRpConnection): 19 | os = 'ios' 20 | platform = 'ap' 21 | chassis_type = 'single_rp' 22 | state_machine_class = GenericSingleRpStateMachine 23 | connection_provider_class = GenericSingleRpConnectionProvider 24 | subcommand_list = ApServiceList 25 | settings = ApSettings() 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/ap/service_implementation.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | 4 | from unicon.plugins.generic.service_implementation import \ 5 | Execute as GenericExecute 6 | from unicon.eal.dialogs import Dialog 7 | from unicon.plugins.iosxe.service_statements import confirm 8 | 9 | 10 | class Execute(GenericExecute): 11 | 12 | def __init__(self, connection, context, **kwargs): 13 | super().__init__(connection, context, **kwargs) 14 | self.dialog += Dialog([confirm]) 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/ap/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | from unicon.plugins.generic.settings import GenericSettings 4 | 5 | 6 | class ApSettings(GenericSettings): 7 | def __init__(self): 8 | super().__init__() 9 | 10 | self.HA_INIT_EXEC_COMMANDS = [ 11 | 'debug capwap console cli', 12 | 'terminal length 0', 13 | 'terminal width 0', 14 | 'show version', 15 | 'logging console disable' 16 | ] 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/iol/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.plugins.generic import GenericDualRPConnection, HAServiceList 4 | 5 | from .service_implementation import IosIolSwitchoverService 6 | 7 | 8 | class IosIolHAServiceList(HAServiceList): 9 | def __init__(self): 10 | super().__init__() 11 | self.switchover = IosIolSwitchoverService 12 | 13 | 14 | class IosIolDualRPConnection(GenericDualRPConnection): 15 | os = 'ios' 16 | platform = 'iol' 17 | subcommand_list = IosIolHAServiceList 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/iol/service_implementation.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.eal.dialogs import Dialog 4 | from unicon.plugins.generic.service_implementation import HAReloadService 5 | 6 | from .service_statements import ios_iol_ha_reload_statement_list 7 | 8 | 9 | class IosIolSwitchoverService(HAReloadService): 10 | """iol reuses HAReloadService for SwitchoverService""" 11 | 12 | def __init__(self, connection, context, **kwargs): 13 | super().__init__(connection, context, **kwargs) 14 | self.command = 'redundancy switch-activity force' 15 | self.dialog = Dialog(ios_iol_ha_reload_statement_list) 16 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/iol/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.plugins.generic.service_patterns import HaReloadPatterns 4 | 5 | 6 | class IosIolHaReloadPatterns(HaReloadPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.reload_switch_prompt = \ 10 | r'^.*This will reload the active unit and force a switch of activity \[confirm\]\s*$' 11 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/iol/service_statements.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.eal.dialogs import Statement 4 | from unicon.plugins.generic.service_statements import ha_reload_statement_list 5 | 6 | from .service_patterns import IosIolHaReloadPatterns 7 | 8 | patterns = IosIolHaReloadPatterns() 9 | 10 | reload_switch = Statement(pattern=patterns.reload_switch_prompt, 11 | action='sendline()', 12 | args=None, 13 | loop_continue=True, 14 | continue_timer=True) 15 | 16 | ios_iol_ha_reload_statement_list = ha_reload_statement_list + [reload_switch] 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/iosv/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | 4 | from unicon.plugins.ios import IosServiceList, IosSingleRpConnection 5 | from unicon.plugins.ios.iosv import service_implementation as svc 6 | from .statemachine import IosvSingleRpStateMachine 7 | from .setting import IosvSettings 8 | 9 | 10 | class IosvServiceList(IosServiceList): 11 | def __init__(self): 12 | super().__init__() 13 | self.reload = svc.Reload 14 | self.shellexec = svc.Shell 15 | self.config = svc.Config 16 | self.configure = svc.Configure 17 | self.execute = svc.Execute 18 | self.rommon = svc.Rommon 19 | 20 | 21 | class IosvSingleRpConnection(IosSingleRpConnection): 22 | os = 'ios' 23 | platform = 'iosv' 24 | chassis_type = 'single_rp' 25 | state_machine_class = IosvSingleRpStateMachine 26 | subcommand_list = IosvServiceList 27 | settings = IosvSettings() 28 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/iosv/service_statements.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from .patterns import IosvPatterns 4 | from unicon.eal.dialogs import Statement 5 | 6 | patterns = IosvPatterns() 7 | 8 | dest_file_startup = Statement(pattern=patterns.dest_file_startup, 9 | action="sendline()", 10 | loop_continue=True, 11 | continue_timer=False) 12 | 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/iosv/setting.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from unicon.plugins.generic.settings import GenericSettings 4 | 5 | class IosvSettings(GenericSettings): 6 | """ Timeouts for virtual platforms are increased to account for 7 | a busy execution server. 8 | """ 9 | def __init__(self): 10 | super().__init__() 11 | self.CONNECTION_TIMEOUT = 480 12 | self.EXPECT_TIMEOUT = 60 13 | 14 | # Wait this much time between telnetting to the device and 15 | # hitting . Lack of a delay was causing connection timeouts 16 | # when running on a LaaS server in vCenter Esxi mode. 17 | # 18 | self.ESCAPE_CHAR_CALLBACK_PRE_SENDLINE_PAUSE_SEC = 1 19 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/pagent/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | 4 | from unicon.plugins.ios import IosServiceList, IosSingleRpConnection 5 | from unicon.plugins.ios.settings import IosSettings 6 | from .statemachine import IosPagentSingleRpStateMachine 7 | from ..settings import IosSettings 8 | 9 | 10 | class IosPagentServiceList(IosServiceList): 11 | def __init__(self): 12 | super().__init__() 13 | 14 | 15 | class IosvSingleRpConnection(IosSingleRpConnection): 16 | os = 'ios' 17 | platform = 'pagent' 18 | chassis_type = 'single_rp' 19 | state_machine_class = IosPagentSingleRpStateMachine 20 | subcommand_list = IosPagentServiceList 21 | settings = IosSettings() 22 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/pagent/patterns.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.generic.patterns import GenericPatterns 3 | 4 | class IosPagentPatterns(GenericPatterns): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.emu_prompt = r'^(.*?)([\w-]+)\(\w+:.*?\)#\s*$' 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/service_implementation.py: -------------------------------------------------------------------------------- 1 | """ Generic IOS service implementations. """ 2 | 3 | __author__ = "Sanjana Bhutani" 4 | 5 | from unicon.plugins.generic.service_implementation import \ 6 | Ping as GenericPing 7 | 8 | class Ping(GenericPing): 9 | def call_service(self, addr, command="", *, vrf=None, **kwargs): 10 | command = command if command else \ 11 | "ping vrf {vrf}".format(vrf=vrf) if vrf else "ping" 12 | super().call_service(addr=addr, command=command, **kwargs) 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/ios/settings.py: -------------------------------------------------------------------------------- 1 | """ Generic IOS Settings. """ 2 | 3 | __author__ = "Sanjana Bhutani " 4 | 5 | from unicon.plugins.generic.settings import GenericSettings 6 | 7 | class IosSettings(GenericSettings): 8 | 9 | def __init__(self): 10 | super().__init__() 11 | 12 | self.ERROR_PATTERN = [ 13 | r'^%\s*[Ii]nvalid (command|input)', 14 | r'^%\s*[Ii]ncomplete (command|input)', 15 | r'^%\s*[Aa]mbiguous (command|input)' 16 | ] 17 | self.CONFIGURE_ERROR_PATTERN = [ 18 | r'^%\s*[Ii]nvalid (command|input|number)' 19 | ] 20 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat3k/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | 4 | from .statemachine import IosXECat3kSingleRpStateMachine 5 | from unicon.plugins.iosxe import IosXEServiceList, IosXESingleRpConnection 6 | from unicon.plugins.iosxe.cat3k import service_implementation as svc 7 | from .setting import IosXECat3kSettings 8 | 9 | 10 | class IosXECat3kServiceList(IosXEServiceList): 11 | def __init__(self): 12 | super().__init__() 13 | self.reload = svc.Reload 14 | self.shellexec = svc.Shell 15 | self.rommon = svc.Rommon 16 | 17 | 18 | class IosXECat3kSingleRpConnection(IosXESingleRpConnection): 19 | platform = 'cat3k' 20 | os = 'iosxe' 21 | chassis_type = 'single_rp' 22 | state_machine_class = IosXECat3kSingleRpStateMachine 23 | subcommand_list = IosXECat3kServiceList 24 | settings = IosXECat3kSettings() 25 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat3k/ewlc/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.plugins.iosxe.cat3k import IosXECat3kServiceList, \ 4 | IosXECat3kSingleRpConnection 5 | from .service_implementation import IosXECat3kEwlcCopy 6 | 7 | 8 | class IosXECat3kEwlcServiceList(IosXECat3kServiceList): 9 | def __init__(self): 10 | super().__init__() 11 | self.copy = IosXECat3kEwlcCopy 12 | 13 | 14 | class IosXECat3kEwlcSingleRpConnection(IosXECat3kSingleRpConnection): 15 | model = 'ewlc' 16 | subcommand_list = IosXECat3kEwlcServiceList 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat3k/ewlc/service_implementation.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.eal.dialogs import Dialog 4 | from unicon.plugins.generic.service_implementation import Copy 5 | 6 | 7 | class IosXECat3kEwlcCopy(Copy): 8 | def call_service(self, reply=Dialog([]), vrf=None, *args, **kwargs): 9 | if vrf is not None: 10 | kwargs['extra_options'] = kwargs.setdefault('extra_options', '') \ 11 | + ' vrf {}'.format(vrf) 12 | super().call_service(reply=reply, *args, **kwargs) 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat3k/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | from unicon.plugins.iosxe.patterns import IosXEPatterns 4 | 5 | 6 | class IosXECat3kPatterns(IosXEPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.tcpdump = ".*listening on lfts.*$" 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat3k/service_statements.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | from unicon.eal.dialogs import Statement 4 | from .patterns import IosXECat3kPatterns 5 | from .setting import IosXECat3kSettings 6 | 7 | patterns = IosXECat3kPatterns() 8 | settings = IosXECat3kSettings() 9 | 10 | 11 | tcpdump_continue = Statement(pattern=patterns.tcpdump, 12 | action=lambda spawn: spawn.sendline(""), 13 | loop_continue=False, 14 | continue_timer=False) 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat3k/setting.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | from unicon.plugins.iosxe.settings import IosXESettings 4 | 5 | 6 | class IosXECat3kSettings(IosXESettings): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.RELOAD_TIMEOUT = 600 11 | self.CONNECTION_TIMEOUT = 600 # Big timeout to handle transition rommon->enable 12 | self.STATE_TRANSITION_TIMEOUT = 30 13 | 14 | self.BOOT_FILESYSTEM = 'flash:' 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat3k/statemachine.py: -------------------------------------------------------------------------------- 1 | __author__ = "Giacomo Trifilo " 2 | 3 | from unicon.plugins.iosxe.statemachine import IosXESingleRpStateMachine 4 | from .patterns import IosXECat3kPatterns 5 | from unicon.statemachine import State, Path 6 | from unicon.eal.dialogs import Dialog 7 | 8 | patterns = IosXECat3kPatterns() 9 | 10 | 11 | class IosXECat3kSingleRpStateMachine(IosXESingleRpStateMachine): 12 | def create(self): 13 | super().create() 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat4k/__init__.py: -------------------------------------------------------------------------------- 1 | """ CAT4K IOS-XE connection implementation. 2 | """ 3 | 4 | from unicon.plugins.iosxe import IosXESingleRpConnection, IosXEDualRPConnection 5 | 6 | from .. import IosXEServiceList 7 | 8 | from .settings import IosXECat4kSettings 9 | from . import service_implementation as svc 10 | from .connection_provider import Cat4kDualRpConnectionProvider 11 | 12 | 13 | class IosXECat4kServiceList(IosXEServiceList): 14 | def __init__(self): 15 | super().__init__() 16 | self.execute= svc.Execute 17 | self.config=svc.Configure 18 | self.reload=svc.Reload 19 | 20 | class IosXECat4kSingleRpConnection(IosXESingleRpConnection): 21 | platform = 'cat4k' 22 | settings=IosXECat4kSettings() 23 | 24 | class IosXECat4kDualRPConnection(IosXEDualRPConnection): 25 | platform = 'cat4k' 26 | chassis_type= 'dual_rp' 27 | connection_provider_class=Cat4kDualRpConnectionProvider 28 | subcommand_list = IosXECat4kServiceList 29 | settings=IosXECat4kSettings() -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat4k/patterns.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.iosxe.patterns import IosXEPatterns 2 | 3 | class IosXECat4kPatterns(IosXEPatterns): 4 | def __init__(self): 5 | super().__init__() 6 | self.restart = r'^(.*)estarting system(.*)' 7 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat4k/service_statements.py: -------------------------------------------------------------------------------- 1 | from unicon.eal.dialogs import Statement 2 | from .patterns import IosXECat4kPatterns 3 | from .settings import IosXECat4kSettings 4 | 5 | patterns = IosXECat4kPatterns() 6 | settings = IosXECat4kSettings() 7 | 8 | 9 | change_rp = Statement(pattern=patterns.restart, 10 | action=lambda spawn: spawn.close, 11 | loop_continue=False, 12 | continue_timer=False) 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat4k/settings.py: -------------------------------------------------------------------------------- 1 | """ CAT4K IOS-XE Settings. """ 2 | 3 | from unicon.plugins.iosxe.settings import IosXESettings 4 | 5 | class IosXECat4kSettings(IosXESettings): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.CONNECTION_TIMEOUT=10 10 | self.RELOAD_TIMEOUT = 300 11 | self.CONNECTION_TIMEOUT = 300 12 | # prompt wait delay 13 | self.ESCAPE_CHAR_PROMPT_WAIT = 0.5 14 | # prompt wait retries 15 | # (wait time: 0.5, 1, 1.5 == total wait: 3s) 16 | self.ESCAPE_CHAR_PROMPT_WAIT_RETRIES = 3 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat4k/statemachine.py: -------------------------------------------------------------------------------- 1 | from typing import Pattern 2 | from unicon.plugins.iosxe.statemachine import IosXEDualRpStateMachine 3 | from .patterns import IosXECat4kPatterns 4 | from unicon.statemachine import State, Path 5 | from unicon.eal.dialogs import Dialog 6 | 7 | patterns = IosXECat4kPatterns() 8 | 9 | 10 | class IosXEC4t3kDualRpStateMachine(IosXEDualRpStateMachine): 11 | def create(self): 12 | super().create() 13 | 14 | stby_lock = State('stby_locked', '' ) 15 | self.add_state(stby_lock) -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat8k/__init__.py: -------------------------------------------------------------------------------- 1 | """ cat8k IOS-XE connection implementation. 2 | """ 3 | 4 | __author__ = "Lukas McClelland " 5 | 6 | from .. import IosXEServiceList 7 | from .settings import IosXECat8kSettings 8 | from . import service_implementation as svc 9 | from .statemachine import IosXECat8kSingleRpStateMachine 10 | 11 | from unicon.plugins.iosxe import IosXESingleRpConnection 12 | 13 | 14 | class IosXECat8kServiceList(IosXEServiceList): 15 | def __init__(self): 16 | super().__init__() 17 | self.switchover = svc.SwitchoverService 18 | self.reload = svc.Reload 19 | 20 | 21 | class IosXECat8kSingleRpConnection(IosXESingleRpConnection): 22 | platform = 'cat8k' 23 | state_machine_class = IosXECat8kSingleRpStateMachine 24 | subcommand_list = IosXECat8kServiceList 25 | settings = IosXECat8kSettings() 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat8k/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Lukas McClelland " 2 | 3 | from ..patterns import IosXEPatterns 4 | class ReloadPatterns(IosXEPatterns): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.boot_interrupt_prompt = r'Preparing to autoboot. \[Press Ctrl-C to interrupt\]' 9 | class SwitchoverPatterns: 10 | def __init__(self): 11 | self.save_config = r'.*System configuration has been modified\.\s*Save\?\s*\[yes\/no\]:\s*$' 12 | self.build_config= r'Building configuration' 13 | self.prompt_switchover = r'Proceed with switchover to standby RP\? \[confirm\]\s*$' 14 | self.switchover_complete = r'console active.\s+Press RETURN to get started!?' 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat8k/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "Lukas McClelland " 2 | 3 | from unicon.plugins.iosxe.settings import IosXESettings 4 | 5 | 6 | class IosXECat8kSettings(IosXESettings): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.POST_SWITCHOVER_WAIT = 30 11 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat9k/c9800/__init__.py: -------------------------------------------------------------------------------- 1 | """ C9800 connection implementation. 2 | """ 3 | 4 | from unicon.plugins.iosxe import IosXESingleRpConnection, IosXEDualRPConnection 5 | 6 | from .. import IosXEServiceList 7 | 8 | from .statemachine import IosXEc9800SingleRpStateMachine 9 | from .settings import IosXEc9800Settings 10 | from .. import service_implementation as svc 11 | 12 | 13 | class IosXEc9800ServiceList(IosXEServiceList): 14 | def __init__(self): 15 | super().__init__() 16 | self.reload = svc.Reload 17 | self.rommon = svc.Rommon 18 | 19 | 20 | class IosXEc9800SingleRpConnection(IosXESingleRpConnection): 21 | platform = 'cat9k' 22 | model = 'c9800' 23 | state_machine_class = IosXEc9800SingleRpStateMachine 24 | subcommand_list = IosXEc9800ServiceList 25 | settings = IosXEc9800Settings() 26 | 27 | 28 | class IosXEc9800DualRPConnection(IosXEDualRPConnection): 29 | platform = 'cat9k' 30 | model = 'c9800' 31 | settings = IosXEc9800Settings() 32 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat9k/c9800/settings.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe.cat9k.settings import IosXECat9kSettings 3 | 4 | 5 | class IosXEc9800Settings(IosXECat9kSettings): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat9k/c9800/statemachine.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe.cat9k.statemachine import IosXECat9kSingleRpStateMachine 3 | 4 | 5 | class IosXEc9800SingleRpStateMachine(IosXECat9kSingleRpStateMachine): 6 | 7 | def create(self): 8 | super().create() 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat9k/c9800cl/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe.cat9k.c9800 import IosXEc9800ServiceList, IosXEc9800SingleRpConnection, IosXEc9800DualRPConnection 3 | from unicon.plugins.iosxe import service_implementation as svc 4 | 5 | class IosXEc9800CLServiceList(IosXEc9800ServiceList): 6 | def __init__(self): 7 | super().__init__() 8 | self.rommon = svc.Rommon 9 | 10 | 11 | 12 | class IosXEc9800CLSingleRpConnection(IosXEc9800SingleRpConnection): 13 | os = 'iosxe' 14 | platform = 'cat9k' 15 | model = 'c9800_cl' 16 | subcommand_list = IosXEc9800CLServiceList 17 | 18 | 19 | class IosXEc9800CLDualRpConnection(IosXEc9800DualRPConnection): 20 | os = 'iosxe' 21 | platform = 'cat9k' 22 | model = 'c9800_cl' 23 | subcommand_list = IosXEc9800CLServiceList 24 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat9k/patterns.py: -------------------------------------------------------------------------------- 1 | 2 | from ..patterns import IosXEPatterns 3 | 4 | 5 | class IosXECat9kPatterns(IosXEPatterns): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.boot_interrupt_prompt = r'Preparing to autoboot. \[Press Ctrl-C to interrupt\]' 10 | self.container_shell_prompt = r'^(.*?)\n(/(\S+)?)+\s+#\s*$' 11 | self.container_ssh_prompt = r'^(.*?)(\w\w-){6,}.*?[\$#]\s*$' 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat9k/settings.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe.settings import IosXESettings 3 | 4 | 5 | class IosXECat9kSettings(IosXESettings): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.FIND_BOOT_IMAGE = False 10 | self.BOOT_TIMEOUT = 420 11 | self.CONTAINER_EXIT_CMDS = ['exit\r', '\x03\x03\x03'] 12 | 13 | self.ROMMON_INIT_COMMANDS = [ 14 | "set" 15 | ] 16 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/cat9k/statements.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.eal.dialogs import Statement 3 | from unicon.plugins.generic.service_statements import ( 4 | save_env, confirm_reset, reload_confirm, reload_confirm_ios, reload_confirm_iosxe) 5 | 6 | from .patterns import IosXECat9kPatterns 7 | 8 | patterns = IosXECat9kPatterns() 9 | 10 | 11 | boot_interrupt_stmt = Statement( 12 | pattern=patterns.boot_interrupt_prompt, 13 | action='send(\x03)', 14 | args=None, 15 | loop_continue=True, 16 | continue_timer=False) 17 | 18 | 19 | reload_to_rommon_statement_list = [save_env, 20 | confirm_reset, 21 | reload_confirm, 22 | reload_confirm_ios, 23 | reload_confirm_iosxe, 24 | boot_interrupt_stmt] 25 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/csr1000v/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from unicon.plugins.iosxe import IosXEServiceList, IosXESingleRpConnection 4 | 5 | from .settings import IosXECsr1000vSettings 6 | from .statemachine import IosXECsr1000vSingleRpStateMachine 7 | 8 | 9 | class IosXECsr1000vServiceList(IosXEServiceList): 10 | pass 11 | 12 | 13 | class IosXECsr1000vSingleRpConnection(IosXESingleRpConnection): 14 | platform = 'csr1000v' 15 | state_machine_class = IosXECsr1000vSingleRpStateMachine 16 | subcommand_list = IosXECsr1000vServiceList 17 | settings = IosXECsr1000vSettings() 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/csr1000v/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from unicon.plugins.iosxe.patterns import IosXEPatterns 4 | 5 | 6 | class IosXECsr1000vPatterns(IosXEPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/csr1000v/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from unicon.plugins.iosxe.settings import IosXESettings 4 | 5 | 6 | class IosXECsr1000vSettings(IosXESettings): 7 | def __init__(self): 8 | super().__init__() 9 | self.EXPECT_TIMEOUT = 60 10 | self.EXEC_TIMEOUT = 120 11 | self.CONFIG_TIMEOUT = 60 12 | 13 | # Wait this much time between telnetting to the device and 14 | # hitting . Lack of a delay was causing connection timeouts 15 | # against some image versions. 16 | self.ESCAPE_CHAR_CALLBACK_PRE_SENDLINE_PAUSE_SEC = 1 17 | 18 | # This class name was changed. Maintain the legacy name as well. 19 | Csr1000vSettings = IosXECsr1000vSettings 20 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/csr1000v/statemachine.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from unicon.statemachine import State, Path 4 | 5 | from unicon.plugins.iosxe.statemachine import IosXESingleRpStateMachine 6 | 7 | from .patterns import IosXECsr1000vPatterns 8 | 9 | patterns = IosXECsr1000vPatterns() 10 | 11 | 12 | class IosXECsr1000vSingleRpStateMachine(IosXESingleRpStateMachine): 13 | def create(self): 14 | super().create() 15 | 16 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/csr1000v/vewlc/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.plugins.iosxe.csr1000v import IosXECsr1000vServiceList, \ 4 | IosXECsr1000vSingleRpConnection 5 | from .service_implementation import IosXECsr1000vVewlcCopy 6 | 7 | 8 | class IosXECsr1000vVewlcServiceList(IosXECsr1000vServiceList): 9 | def __init__(self): 10 | super().__init__() 11 | self.copy = IosXECsr1000vVewlcCopy 12 | 13 | 14 | class IosXECsr1000vVewlcSingleRpConnection(IosXECsr1000vSingleRpConnection): 15 | model = 'vewlc' 16 | subcommand_list = IosXECsr1000vVewlcServiceList 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/csr1000v/vewlc/service_implementation.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.eal.dialogs import Dialog 4 | from unicon.plugins.generic.service_implementation import Copy 5 | 6 | 7 | class IosXECsr1000vVewlcCopy(Copy): 8 | def call_service(self, reply=Dialog([]), vrf=None, *args, **kwargs): 9 | if vrf is not None: 10 | kwargs['extra_options'] = kwargs.setdefault('extra_options', '') \ 11 | + ' vrf {}'.format(vrf) 12 | super().call_service(reply=reply, *args, **kwargs) 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/iec3400/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe import IosXEServiceList, IosXESingleRpConnection 3 | 4 | from .settings import IosXEIec3400Settings 5 | from . import service_implementation as svc 6 | from .statemachine import IosXEIec3400SingleRpStateMachine 7 | 8 | 9 | class IosXEIec3400ServiceList(IosXEServiceList): 10 | def __init__(self): 11 | super().__init__() 12 | self.reload = svc.Reload 13 | 14 | 15 | class IosXEIec3400SingleRpConnection(IosXESingleRpConnection): 16 | os = 'iosxe' 17 | platform = 'iec3400' 18 | chassis_type = 'single_rp' 19 | state_machine_class = IosXEIec3400SingleRpStateMachine 20 | subcommand_list = IosXEIec3400ServiceList 21 | settings = IosXEIec3400Settings() 22 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/iec3400/service_statements.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.eal.dialogs import Statement 3 | 4 | 5 | reload_proceed_stmt = Statement(pattern=r'.*Proceed with reload\?\[y/n]\s*$', 6 | action='sendline(y)', 7 | loop_continue=True, 8 | continue_timer=False) 9 | 10 | 11 | reload_statement_list = [ 12 | reload_proceed_stmt 13 | ] 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/iec3400/settings.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from unicon.plugins.iosxe.settings import IosXESettings 4 | 5 | 6 | class IosXEIec3400Settings(IosXESettings): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.RELOAD_TIMEOUT = 120 11 | 12 | self.HA_INIT_EXEC_COMMANDS = [] 13 | self.HA_INIT_CONFIG_COMMANDS = [] 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/iec3400/statemachine.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.generic.service_statements import generic_statements 3 | 4 | from unicon.plugins.iosxe.statemachine import IosXESingleRpStateMachine 5 | 6 | 7 | class IosXEIec3400SingleRpStateMachine(IosXESingleRpStateMachine): 8 | 9 | def create(self): 10 | super().create() 11 | config_to_enable = self.get_path('config', 'enable') 12 | config_to_enable.command = 'exit' 13 | 14 | self.add_default_statements([generic_statements.terminal_position_stmt]) 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/quad/__init__.py: -------------------------------------------------------------------------------- 1 | """ IOS-XE Quad connection implementation """ 2 | from unicon.bases.routers.connection import BaseQuadRpConnection 3 | from unicon.bases.routers.connection_provider import BaseQuadRpConnectionProvider 4 | 5 | from unicon.plugins.iosxe import HAIosXEServiceList 6 | 7 | from .settings import IosXEQuadSettings 8 | from .statemachine import IosXEQuadStateMachine 9 | from .service_implementation import QuadGetRPState, QuadSwitchover, QuadReload 10 | 11 | 12 | class IosXEQuadServiceList(HAIosXEServiceList): 13 | 14 | def __init__(self): 15 | super().__init__() 16 | self.get_rp_state = QuadGetRPState 17 | self.switchover = QuadSwitchover 18 | self.reload = QuadReload 19 | 20 | 21 | class IosXEQuadRPConnection(BaseQuadRpConnection): 22 | os = 'iosxe' 23 | platform = None 24 | chassis_type = 'quad' 25 | subcommand_list = IosXEQuadServiceList 26 | state_machine_class = IosXEQuadStateMachine 27 | connection_provider_class = BaseQuadRpConnectionProvider 28 | settings = IosXEQuadSettings() 29 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/quad/patterns.py: -------------------------------------------------------------------------------- 1 | """ IOS-XE Quad Patterns """ 2 | from unicon.plugins.iosxe.patterns import IosXEPatterns 3 | 4 | 5 | class IosXEQuadPatterns(IosXEPatterns): 6 | def __init__(self): 7 | super().__init__() 8 | 9 | self.rpr_state = r'RPR Mode: Remote supervisor is already active' 10 | self.unlock_state = r'RPR Mode: Remote Supervisor is no longer active' 11 | self.autoboot =r'Preparing to autoboot.+\[Press Ctrl-C to interrupt\]' 12 | self.ica = r'RPR Mode:.+Will boot as in-chassis active' 13 | self.proceed_switchover = r'^.*Proceed with switchover to standby RP\? \[confirm\]' 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/quad/settings.py: -------------------------------------------------------------------------------- 1 | """ IOS-XE Quad Settings """ 2 | 3 | from unicon.plugins.iosxe.settings import IosXESettings 4 | 5 | class IosXEQuadSettings(IosXESettings): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | 10 | # Quad detect rpr timeout 11 | self.DETECT_RPR_TIMEOUT = 1 12 | 13 | # Quad switchover timeout 14 | self.QUAD_SWITCHOVER_TIMEOUT = 600 15 | # Secs to sleep after switchover 16 | self.QUAD_SWITCHOVER_SLEEP = 30 17 | 18 | # Quad reload timeout 19 | self.QUAD_RELOAD_TIMEOUT = 600 20 | # Secs to sleep after reload 21 | self.QUAD_RELOAD_SLEEP = 60 22 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/quad/statemachine.py: -------------------------------------------------------------------------------- 1 | """ IOS-XE Quad State Machine """ 2 | from unicon.statemachine import State 3 | from unicon.plugins.iosxe.statemachine import IosXEDualRpStateMachine 4 | 5 | from .patterns import IosXEQuadPatterns 6 | 7 | patterns = IosXEQuadPatterns() 8 | 9 | class IosXEQuadStateMachine(IosXEDualRpStateMachine): 10 | 11 | def create(self): 12 | super().create() 13 | 14 | # Add RPR state 15 | rpr = State('rpr', patterns.rpr_state) 16 | self.add_state(rpr) 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/quad/utils.py: -------------------------------------------------------------------------------- 1 | """ Quad Utilities """ 2 | 3 | import re 4 | 5 | from unicon.plugins.iosxe.stack.utils import StackUtils 6 | 7 | 8 | class QuadUtils(StackUtils): 9 | 10 | def is_peer_standby_hot(self, connection, timeout=None): 11 | """ Check whether peer rp is in STANDBY HOT state 12 | 13 | Args: 14 | connection (`obj`): connection object 15 | timeout (`int`): execute timeout 16 | Returns: 17 | result (`bool`): True if peer in STANDBY HOT state, else False 18 | """ 19 | timeout = timeout or connection.settings.EXEC_TIMEOUT 20 | 21 | output = connection.execute("show redundancy states | in peer", 22 | timeout=timeout) 23 | 24 | if 'STANDBY HOT' in output: 25 | return True 26 | else: 27 | return False 28 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/sdwan/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe import IosXESingleRpConnection, IosXEServiceList, IosXEDualRPConnection 3 | from unicon.plugins.iosxe.sdwan.statemachine import SDWANSingleRpStateMachine, SDWANDualRpStateMachine 4 | from unicon.plugins.iosxe.sdwan import service_implementation as svc 5 | from unicon.plugins.iosxe.sdwan.settings import SDWANSettings 6 | 7 | class SDWANServiceList(IosXEServiceList): 8 | def __init__(self): 9 | super().__init__() 10 | self.configure = svc.SDWANConfigure 11 | 12 | class SDWANSingleRpConnection(IosXESingleRpConnection): 13 | os = 'iosxe' 14 | platform = 'sdwan' 15 | state_machine_class = SDWANSingleRpStateMachine 16 | subcommand_list = SDWANServiceList 17 | settings = SDWANSettings() 18 | 19 | class SDWANDualRpConnection(IosXEDualRPConnection): 20 | os = 'iosxe' 21 | platform = 'sdwan' 22 | state_machine_class = SDWANDualRpStateMachine 23 | subcommand_list = SDWANServiceList 24 | settings = SDWANSettings() 25 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/sdwan/service_implementation.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe.service_implementation import Configure 3 | 4 | class SDWANConfigure(Configure): 5 | def __init__(self, connection, context, **kwargs): 6 | super().__init__(connection, context, **kwargs) 7 | self.commit_cmd = "commit" 8 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/sdwan/settings.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe.settings import IosXESettings 3 | 4 | class SDWANSettings(IosXESettings): 5 | def __init__(self): 6 | super().__init__() 7 | self.HA_INIT_EXEC_COMMANDS = [ 8 | 'term length 0', 9 | 'term width 0', 10 | 'show sdwan software', 11 | 'show sdwan version', 12 | 'show version' 13 | ] 14 | self.HA_INIT_CONFIG_COMMANDS = [ 15 | 'no logging console' 16 | ] 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/sdwan/statemachine.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxe.statemachine import IosXESingleRpStateMachine, IosXEDualRpStateMachine 3 | from unicon.eal.dialogs import Dialog, Statement 4 | from ..patterns import IosXEPatterns 5 | 6 | patterns = IosXEPatterns() 7 | 8 | 9 | class SDWANSingleRpStateMachine(IosXESingleRpStateMachine): 10 | config_command = 'config-transaction' 11 | 12 | def create(self): 13 | super().create() 14 | self.get_path('config', 'enable').dialog += Dialog([ 15 | Statement(pattern=patterns.confirm_uncommited_changes, 16 | action='sendline(no)', loop_continue=True) 17 | ]) 18 | class SDWANDualRpStateMachine(IosXEDualRpStateMachine): 19 | config_command = 'config-transaction' 20 | 21 | def create(self): 22 | super().create() 23 | self.get_path('config', 'enable').dialog += Dialog([ 24 | Statement(pattern=patterns.confirm_uncommited_changes, 25 | action='sendline(no)', loop_continue=True) 26 | ]) 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/stack/exception.py: -------------------------------------------------------------------------------- 1 | class StackException(Exception): 2 | ''' base class ''' 3 | pass 4 | 5 | class StackMemberReadyException(StackException): 6 | """ 7 | Exception for when all the member of stack device is configured 8 | """ 9 | pass 10 | 11 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/stack/patterns.py: -------------------------------------------------------------------------------- 1 | """ IOS-XE Stack Patterns """ 2 | from unicon.plugins.iosxe.patterns import IosXEPatterns 3 | 4 | 5 | class StackIosXEPatterns(IosXEPatterns): 6 | def __init__(self): 7 | super().__init__() 8 | self.rommon_prompt = r'(.*)switch:\s?$' 9 | self.tcpdump = ".*listening on lfts.*$" -------------------------------------------------------------------------------- /src/unicon/plugins/iosxe/stack/settings.py: -------------------------------------------------------------------------------- 1 | """ Stack IOS-XE Settings. """ 2 | 3 | from unicon.plugins.iosxe.settings import IosXESettings 4 | 5 | class IosXEStackSettings(IosXESettings): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | 10 | # Switchover service timeout 11 | self.STACK_SWITCHOVER_TIMEOUT = 600 12 | # Switchover postcheck interval 13 | self.SWITCHOVER_POSTCHECK_INTERVAL = 30 14 | self.POST_SWITCHOVER_SLEEP = 90 15 | 16 | # Secs to sleep before reconnect device 17 | self.STACK_POST_RELOAD_SLEEP = 30 18 | # Secs to sleep before booting device 19 | self.STACK_ROMMON_SLEEP = 20 20 | # Stack reload timeout 21 | self.STACK_RELOAD_TIMEOUT = 900 22 | # Reload postcheck interval 23 | self.RELOAD_POSTCHECK_INTERVAL = 30 24 | # Timeout for boot 25 | self.STACK_BOOT_TIMEOUT = 1000 26 | 27 | self.CONFIGURE_ALLOW_STATE_CHANGE = True 28 | 29 | # Secs to sleep after booting the device 30 | self.STACK_ENABLE_SLEEP = 100 -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/asr9k/patterns.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.iosxr.patterns import IOSXRPatterns 2 | 3 | 4 | class IOSXRAsr9kPatterns(IOSXRPatterns): 5 | pass 6 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/asr9k/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Takashi Higashimura " 2 | 3 | from unicon.plugins.iosxr.service_patterns import IOSXRReloadPatterns 4 | 5 | class IOSXRASR9KReloadPatterns(IOSXRReloadPatterns): 6 | def __init__(self): 7 | super().__init__() 8 | self.system_config_completed = r"^(.*?)SYSTEM CONFIGURATION COMPLETED" 9 | self.reloading_node = r"^(.*?)Reloading node .*" 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/asr9k/settings.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.iosxr.settings import IOSXRSettings 2 | 3 | 4 | class IOSXRAsr9kSettings(IOSXRSettings): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.STANDBY_STATE_REGEX = r'Standby node .* is (.*)' 9 | 10 | # number of retries to reconnect after reloading 11 | self.RELOAD_RECONNECT_ATTEMPTS = 3 12 | self.POST_RELOAD_WAIT = 500 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/asr9k/statemachine.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from unicon.plugins.iosxr.statemachine import IOSXRSingleRpStateMachine 4 | from unicon.plugins.iosxr.statemachine import IOSXRDualRpStateMachine 5 | 6 | from unicon.plugins.iosxr.asr9k.patterns import IOSXRAsr9kPatterns 7 | from unicon.plugins.iosxr.statements import IOSXRStatements 8 | from unicon.statemachine import State, Path 9 | from unicon.eal.dialogs import Statement, Dialog 10 | 11 | 12 | patterns = IOSXRAsr9kPatterns() 13 | statements = IOSXRStatements() 14 | 15 | 16 | class IOSXRASR9KSingleRpStateMachine(IOSXRSingleRpStateMachine): 17 | pass 18 | 19 | 20 | class IOSXRASR9KDualRpStateMachine(IOSXRDualRpStateMachine): 21 | pass 22 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/errors.py: -------------------------------------------------------------------------------- 1 | __author__ = "Syed Raza " 2 | 3 | 4 | class RpNotRunningError(Exception): 5 | """ Raise when RP/LC are not in running state after doing a show controller dpc rm dpa """ 6 | pass 7 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/iosxrv/patterns.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.iosxr.patterns import IOSXRPatterns 2 | 3 | class IOSXRVPatterns(IOSXRPatterns): 4 | def __init__(self): 5 | super().__init__() 6 | self.xr_admin_prompt = r'(^.*?)RP/\S+\(admin\)#\s?$' 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/iosxrv9k/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Syed Raza " 2 | 3 | from unicon.plugins.iosxr.iosxrv9k.settings import IOSXRV9KSettings 4 | from unicon.plugins.iosxr.statemachine import IOSXRSingleRpStateMachine 5 | from unicon.plugins.iosxr import IOSXRServiceList 6 | from unicon.plugins.iosxr.iosxrv9k.connection_provider import IOSXRV9KSingleRpConnectionProvider 7 | from unicon.bases.routers.connection import BaseSingleRpConnection 8 | 9 | class IOSXRV9KSingleRpConnection(BaseSingleRpConnection): 10 | os = 'iosxr' 11 | platform = 'iosxrv9k' 12 | chassis_type = 'single_rp' 13 | state_machine_class = IOSXRSingleRpStateMachine 14 | connection_provider_class = IOSXRV9KSingleRpConnectionProvider 15 | subcommand_list = IOSXRServiceList 16 | settings = IOSXRV9KSettings() 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/iosxrv9k/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Syed Raza " 2 | 3 | from ..patterns import IOSXRPatterns 4 | 5 | # This module contains all the patterns required in the IOSXRV9K implementation. 6 | 7 | class IOSXRV9KPatterns(IOSXRPatterns): 8 | def __init__(self): 9 | super().__init__() 10 | self.xr_launch_final_message = r'^.*:\w+\.\d+\s:\s\w+\[\d+\]:\s+\%.*vm_manager started VM\s\w+.*' 11 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/patterns.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxr.patterns import IOSXRPatterns 3 | 4 | # This module contains all the patterns required in the Moonshine implementation. 5 | 6 | class MoonshinePatterns(IOSXRPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.shell_prompt = r'^(.*)%N.[0-9][1-9]*/[0-9][1-9]*/CPU[0-9][1-9]*\.*[0|1]*(\x1b\S+)?/*\s?[#\$].*$' 10 | self.enable_prompt = r'^(.*)RP/[0-9][1-9]*/[0-9][1-9]*/CPU[0-9][1-9]*:[a-zA-Z0-9_.{}+-]+#.*$' 11 | self.config_prompt = r'^(.*)RP/[0-9][1-9]*/[0-9][1-9]*/CPU[0-9][1-9]*:[a-zA-Z0-9_.{}+-]+\(config.*\)#.*$' 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/pty_backend.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unicon.eal.backend.pty_backend import Spawn 3 | 4 | class MoonshineSpawn(Spawn): 5 | def send(self, command, *args, **kwargs): 6 | """ Moonshine requires no os.sync() step in the 'send' method. """ 7 | if not isinstance(command, str): 8 | command = str(command) 9 | if self.is_writable(): 10 | msg = ">>> Unicon Sending :: {}".format(repr(command)) 11 | self.log.debug(msg) 12 | 13 | self.last_sent = command 14 | ret = os.write(self.fd, str.encode(command)) 15 | return ret 16 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "Isobel Ormiston " 2 | 3 | from unicon.plugins.iosxr.settings import IOSXRSettings 4 | 5 | class MoonshineSettings(IOSXRSettings): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.MOONSHINE_INIT_CONFIG_COMMANDS = [ 10 | 'no logging console' 11 | ] # @@@ Add any other config commands we want here. 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/statements.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.iosxr.statements import IOSXRStatements 2 | from unicon.plugins.iosxr.moonshine.patterns import MoonshinePatterns 3 | from unicon.eal.dialogs import Statement, Dialog 4 | from unicon.eal.helpers import sendline 5 | import time 6 | 7 | patterns = MoonshinePatterns() 8 | 9 | def shell_handler(spawn, context, session): 10 | """ handles Moonshine shell prompt 11 | """ 12 | print("In shell_handler, sending line exec") 13 | spawn.sendline('exec') 14 | 15 | 16 | class MoonshineStatements(IOSXRStatements): 17 | def __init__(self): 18 | super().__init__() 19 | self.shell_stmt = Statement(pattern=patterns.shell_prompt, 20 | action=shell_handler, 21 | args=None, 22 | loop_continue=True, 23 | continue_timer=False) 24 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/tests/ios_moonshine_clean.yaml: -------------------------------------------------------------------------------- 1 | bringup: 2 | BringUpWorker: 3 | module: dyntopo.xrut 4 | log_level: warning 5 | 6 | xrut: 7 | log_level: quiet 8 | dynamips_idlepc: 9 | ios: 0x609a07a0 10 | ios_pagent: 0x60e31274 11 | moonshine_host: ensoft-ucs4 12 | 13 | devices: 14 | r1: 15 | images: [/auto/xrut/images/enxr-router-spirit-64.vm] 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/tests/ios_moonshine_unicon_config.yaml: -------------------------------------------------------------------------------- 1 | testbed: 2 | name: ios_moonshine 3 | 4 | devices: 5 | r1: 6 | type: moonshine 7 | logical: True 8 | connections: 9 | defaults: {class: unicon.XRUTConnect} 10 | r2: 11 | type: ios_dynamips_pagent 12 | logical: True 13 | 14 | topology: 15 | r1: 16 | interfaces: 17 | if1.1: 18 | link: n1 19 | type: ethernet 20 | r2: 21 | interfaces: 22 | if2.1: 23 | link: n1 24 | type: ethernet 25 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/tests/moonshine_moonshine_clean.yaml: -------------------------------------------------------------------------------- 1 | bringup: 2 | BringUpWorker: 3 | module: dyntopo.xrut 4 | xrut: 5 | moonshine_host: ensoft-ucs4 6 | devices: 7 | r1: 8 | images: [/auto/xrut/images/enxr-router-spirit-64.vm] 9 | r2: 10 | images: [/auto/xrut/images/enxr-router-spirit-64.vm] 11 | 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/tests/moonshine_moonshine_unicon_config.yaml: -------------------------------------------------------------------------------- 1 | testbed: 2 | name: moonshine_moonshine 3 | 4 | devices: 5 | r1: 6 | type: moonshine 7 | logical: True 8 | connections: 9 | defaults: {class: unicon.XRUTConnect} 10 | r2: 11 | type: moonshine 12 | logical: True 13 | connections: 14 | defaults: {class: unicon.XRUTConnect} 15 | 16 | topology: 17 | r1: 18 | interfaces: 19 | if1.1: 20 | link: n1 21 | type: ethernet 22 | r2: 23 | interfaces: 24 | if2.1: 25 | link: n1 26 | type: ethernet 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/moonshine/tests/moonshine_test_job.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | from pyats.easypy import run 4 | 5 | def main(): 6 | test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 7 | config_testscript = os.path.join(test_path, 'tests', 'config_test.py') 8 | ping_testscript = os.path.join(test_path, 'tests', 'standalone_ping_test.py') 9 | 10 | run(testscript=config_testscript , uut1_name='r1', 11 | uut2_name='r2', uut1_if_name='if1.1', uut2_if_name='if2.1') 12 | run(testscript=ping_testscript , uut1_name='r1', 13 | uut2_name='r2', uut1_if_name='if1.1', uut2_if_name='if2.1') 14 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/ncs5k/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from unicon.plugins.generic.service_patterns import ReloadPatterns 4 | 5 | class Ncs5kReloadPatterns(ReloadPatterns): 6 | def __init__(self): 7 | super().__init__() 8 | self.system_config_completed = r"^(.*?)SYSTEM CONFIGURATION COMPLETED" 9 | self.reloading_node = r"^(.*?)Reloading node .*" 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/ncs5k/settings.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from ..settings import IOSXRSettings 4 | 5 | class NCS5KSettings(IOSXRSettings): 6 | def __init__(self): 7 | super().__init__() 8 | 9 | # prompt wait delay 10 | self.ESCAPE_CHAR_PROMPT_WAIT = 10 11 | 12 | # prompt wait retries 13 | self.ESCAPE_CHAR_PROMPT_WAIT_RETRIES = 3 14 | 15 | # number of retries to reconnect after reloading 16 | self.RELOAD_RECONNECT_ATTEMPTS = 3 17 | 18 | self.STANDBY_STATE_REGEX = r'Standby node .* is (.*)' 19 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Takashi Higashimura " 2 | 3 | from unicon.plugins.generic.service_patterns import ReloadPatterns 4 | 5 | 6 | class IOSXRSwitchoverPatterns: 7 | def __init__(self): 8 | self.prompt_switchover = r'^(.*?)Proceed with switchover .* \[confirm\]' 9 | self.rp_in_standby = r'^(.*?) is in standby' 10 | self.switchover_disallowed = r'^(.*?)Switchover disallowed' 11 | 12 | 13 | class IOSXRReloadPatterns(ReloadPatterns): 14 | def __init__(self): 15 | super().__init__() 16 | self.reload_module_prompt = r"^(.*?)Reload hardware module \? \[no,yes\].*$" 17 | self.wish_continue = r'Do you wish to continue\?\s*\[confirm\(y/n\)\]\s*$' 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/spitfire/errors.py: -------------------------------------------------------------------------------- 1 | __author__ = "Sritej K V R " 2 | 3 | -------------------------------------------------------------------------------- /src/unicon/plugins/iosxr/spitfire/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Takashi Higashimura " 2 | 3 | from unicon.plugins.iosxr.service_patterns import IOSXRReloadPatterns 4 | 5 | 6 | class IOSXRSpitfireReloadPatterns(IOSXRReloadPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.system_config_completed = r"^(.*?)SYSTEM CONFIGURATION COMPLETED" 10 | self.reloading_node = r"^(.*?)Reloading node .*" -------------------------------------------------------------------------------- /src/unicon/plugins/ironware/patterns.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.ironware.patterns 4 | 5 | Author: 6 | James Di Trapani - https://github.com/jamesditrapani 7 | 8 | Description: 9 | This subpackage defines patterns for the Ironware NOS 10 | """ 11 | 12 | import re 13 | 14 | from unicon.plugins.generic.patterns import GenericPatterns 15 | 16 | __author__ = "James Di Trapani " 17 | 18 | 19 | class IronWarePatterns(GenericPatterns): 20 | def __init__(self): 21 | super().__init__() 22 | # ssh@mlx8> 23 | self.disable_mode = r'^(.*?)[-\.\w]+@[-\.\w]+>$' 24 | 25 | # ssh@mlx8# 26 | self.privileged_mode = r'^(.*?)[-\.\w]+@[-\.\w]+#$' 27 | 28 | # ssh@mlx8(config)# 29 | self.config_mode = r'^(.*?)[-\.\w]+@[-\.\w]+\(config\)#$' 30 | -------------------------------------------------------------------------------- /src/unicon/plugins/ironware/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.ironware.settings 4 | 5 | Author: 6 | James Di Trapani - https://github.com/jamesditrapani 7 | 8 | Description: 9 | Define/Override Generic Settings specific to the Ironware NOS 10 | """ 11 | 12 | from unicon.plugins.generic.settings import GenericSettings 13 | 14 | __author__ = "James Di Trapani " 15 | 16 | 17 | class IronWareSettings(GenericSettings): 18 | 19 | def __init__(self): 20 | # inherit any parent settings 21 | super().__init__() 22 | self.CONNECTION_TIMEOUT = 60*5 23 | self.HA_INIT_EXEC_COMMANDS = ['terminal length 0'] 24 | self.HA_INIT_CONFIG_COMMANDS = [] 25 | -------------------------------------------------------------------------------- /src/unicon/plugins/ise/patterns.py: -------------------------------------------------------------------------------- 1 | from unicon.patterns import UniconCorePatterns 2 | 3 | 4 | class IsePatterns(UniconCorePatterns): 5 | def __init__(self): 6 | super().__init__() 7 | self.continue_connect = r'Are you sure you want to continue connecting \(yes/no(/\[fingerprint\])?\)' 8 | # Prompt on ise device is /#. 9 | # If user login as root on ise device then the device 10 | # behaves like linux. For root login on ise use os as linux. 11 | # self.prompt = r'.*([^#\s]#)\s?$' 12 | self.prompt = r'^(.*?)%N/[A-Za-z0-9_-]+[#>]\s?$' 13 | self.reuse_session = r'Enter session number to resume or press to start a new one:' 14 | self.config_prompt = r'^.*\(config.*\)#\s?$' 15 | self.more_prompt = r'^.*--More--.*' 16 | self.escape_char = r'Escape character is' 17 | self.enter_to_continue = r'Press to continue' 18 | 19 | -------------------------------------------------------------------------------- /src/unicon/plugins/ise/service_implementation.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.ise.patterns import IsePatterns 2 | from unicon.plugins.generic.service_implementation import \ 3 | Configure as GenericConfigure, \ 4 | Execute as GenericExecute 5 | 6 | 7 | class Execute(GenericExecute): 8 | 9 | def __init__(self, connection, context, **kwargs): 10 | # Connection object will have all the received details 11 | super().__init__(connection, context, **kwargs) 12 | self.start_state = 'shell' 13 | self.end_state = 'shell' 14 | 15 | 16 | class Configure(GenericConfigure): 17 | 18 | def __init__(self, connection, context, **kwargs): 19 | # Connection object will have all the received details 20 | super().__init__(connection, context, **kwargs) 21 | self.start_state = 'config' 22 | self.end_state = 'shell' 23 | -------------------------------------------------------------------------------- /src/unicon/plugins/ise/statemachine.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.ise.statemachine 4 | 5 | Authors: 6 | pyATS TEAM (pyats-support@cisco.com, pyats-support-ext@cisco.com) 7 | 8 | Description: 9 | This subpackage implements state machine for Ise 10 | """ 11 | 12 | from unicon.statemachine import Path, State, StateMachine 13 | from unicon.plugins.ise.patterns import IsePatterns 14 | 15 | p = IsePatterns() 16 | 17 | class IseStateMachine(StateMachine): 18 | def create(self): 19 | shell = State('shell', p.prompt) 20 | config = State('config', p.config_prompt) 21 | shell_to_config = Path(shell, config, 'config term', None) 22 | config_to_shell = Path(config, shell, 'end', None) 23 | self.add_state(shell) 24 | self.add_state(config) 25 | self.add_path(shell_to_config) 26 | self.add_path(config_to_shell) 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/junos/vsrx/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.junos 4 | 5 | Authors: 6 | pyATS TEAM (pyats-support@cisco.com, pyats-support-ext@cisco.com) 7 | 8 | Description: 9 | This subpackage implements Junos devices 10 | """ 11 | from unicon.plugins.junos import JunosSingleRpConnection 12 | from .statemachine import JunosVsrxSingleRpStateMachine 13 | 14 | 15 | class JunosVsrxSingleRpConnection(JunosSingleRpConnection): 16 | os = 'junos' 17 | platform = 'vsrx' 18 | chassis_type = 'single_rp' 19 | state_machine_class = JunosVsrxSingleRpStateMachine 20 | -------------------------------------------------------------------------------- /src/unicon/plugins/linux/connection_provider.py: -------------------------------------------------------------------------------- 1 | from unicon.bases.linux.connection_provider import BaseLinuxConnectionProvider 2 | from unicon.eal.dialogs import Dialog 3 | 4 | from .statements import (linux_pre_connection_statement_list, 5 | linux_auth_other_statement_list, 6 | linux_auth_username_password_statement_list, 7 | custom_auth_username_password_statements) 8 | 9 | 10 | class LinuxConnectionProvider(BaseLinuxConnectionProvider): 11 | """ 12 | Connection provided class for Linux connections. 13 | """ 14 | 15 | def get_connection_dialog(self): 16 | con = self.connection 17 | custom_user_pw_stmt = custom_auth_username_password_statements( 18 | self.connection.settings.LOGIN_PROMPT, 19 | self.connection.settings.PASSWORD_PROMPT 20 | ) 21 | return con.connect_reply \ 22 | + Dialog(linux_pre_connection_statement_list 23 | + linux_auth_other_statement_list 24 | + custom_user_pw_stmt 25 | + linux_auth_username_password_statement_list) 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/nd/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.nd 4 | 5 | Authors: 6 | pyATS TEAM (pyats-support-ext@cisco.com) 7 | 8 | Description: 9 | This subpackage implements ND 10 | """ 11 | 12 | # from unicon.plugins.linux import LinuxConnection 13 | from unicon.plugins.linux import LinuxConnection,LinuxServiceList 14 | from unicon.plugins.linux.statemachine import LinuxStateMachine 15 | from unicon.plugins.linux.connection_provider import LinuxConnectionProvider 16 | from unicon.plugins.linux.settings import LinuxSettings 17 | 18 | 19 | # from unicon.plugins.confd import ConfdConnection, ConfdServiceList, ConfdConnectionProvider 20 | # from unicon.plugins.confd.settings import ConfdSettings 21 | 22 | class NDConnection(LinuxConnection): 23 | """ 24 | Connection class for ND connections. 25 | Extends the Linux connection to function with 'nd' os. 26 | """ 27 | os = 'nd' 28 | state_machine_class = LinuxStateMachine 29 | connection_provider_class = LinuxConnectionProvider 30 | subcommand_list = LinuxServiceList 31 | settings = LinuxSettings() 32 | -------------------------------------------------------------------------------- /src/unicon/plugins/nso/__init__.py: -------------------------------------------------------------------------------- 1 | """ NSO (Network Service Orchestrator) CLI implementation """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | from unicon.plugins.confd import ConfdConnection, ConfdServiceList, ConfdConnectionProvider 6 | from unicon.plugins.confd.statemachine import ConfdStateMachine 7 | from unicon.plugins.confd.settings import ConfdSettings 8 | 9 | 10 | class NsoConnection(ConfdConnection): 11 | os = 'nso' 12 | platform = None 13 | chassis_type = 'single_rp' 14 | state_machine_class = ConfdStateMachine 15 | connection_provider_class = ConfdConnectionProvider 16 | subcommand_list = ConfdServiceList 17 | settings = ConfdSettings() 18 | 19 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/aci/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from .connection import AciN9KConnection # noqa 4 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/aci/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from ..patterns import NxosPatterns 4 | 5 | 6 | class AciPatterns(NxosPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.enable_prompt = r'^(.*?)((%N)|\(none\))#' 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/aci/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "dwapstra" 2 | 3 | from unicon.plugins.generic.service_patterns import ReloadPatterns 4 | 5 | class AciN9kReloadPatterns(ReloadPatterns): 6 | def __init__(self): 7 | super().__init__() 8 | self.restart_proceed = r'^(.*?)This command will reload the chassis, Proceed \(y/n\)\? \[n\]:' 9 | self.factory_reset = r'^(.*?)This command will wipe out this device, Proceed\? \[y/N\]' 10 | self.login = r'^(.*?)login:' 11 | self.discovery_done = r'^(.*)This switch is now part of the ACI fabric' 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/aci/settings.py: -------------------------------------------------------------------------------- 1 | """ Defines the settings for aci based unicon connections """ 2 | 3 | __author__ = "dwapstra" 4 | 5 | from ..setting import NxosSettings 6 | 7 | 8 | class AciSettings(NxosSettings): 9 | """" Generic platform settings """ 10 | def __init__(self): 11 | """ initialize 12 | """ 13 | super().__init__() 14 | self.TERM = 'vt100' 15 | self.HA_INIT_EXEC_COMMANDS = [] 16 | self.HA_INIT_CONFIG_COMMANDS = [] 17 | self.ESCAPE_CHAR_PROMPT_WAIT = 1 18 | self.POST_RELOAD_WAIT = 30 19 | 20 | self.ENV = { 21 | 'ROWS': 24, 22 | 'COLUMNS': 255 23 | } 24 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/aci/statemachine.py: -------------------------------------------------------------------------------- 1 | """ State machine for Aci """ 2 | 3 | __author__ = "dwapstra" 4 | 5 | from unicon.statemachine import State, Path 6 | 7 | from ..statemachine import NxosSingleRpStateMachine 8 | from .patterns import AciPatterns 9 | 10 | patterns = AciPatterns() 11 | 12 | 13 | class AciStateMachine(NxosSingleRpStateMachine): 14 | 15 | def create(self): 16 | super().create() 17 | enable = self.get_state('enable') 18 | enable.pattern = patterns.enable_prompt 19 | module = self.get_state('module') 20 | 21 | self.remove_path(enable, module) 22 | 23 | enable_to_module = Path(enable, module, 'vsh_lc', None) 24 | 25 | self.add_path(enable_to_module) 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/mds/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | from unicon.plugins.nxos.patterns import NxosPatterns 4 | 5 | 6 | class NxosMdsPatterns(NxosPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | 10 | self.shell_prompt = r'^(.*)%N\(shell\)>\s?.*$' 11 | self.tie_prompt = r'^(.*)%N\(tie.*?\)#\s*$' 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/n5k/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from .. import (NxosServiceList, NxosSingleRpConnection, 4 | NxosSingleRpConnectionProvider, NxosSettings, ) 5 | 6 | from ..statemachine import NxosSingleRpStateMachine 7 | 8 | from unicon.plugins.nxos.n5k import service_implementation as svc 9 | 10 | class NxosN5kServiceList(NxosServiceList): 11 | def __init__(self): 12 | super().__init__() 13 | self.reload = svc.Reload 14 | 15 | 16 | 17 | class NxosN5kSingleRpConnection(NxosSingleRpConnection): 18 | os = 'nxos' 19 | platform = 'n5k' 20 | chassis_type = 'single_rp' 21 | state_machine_class = NxosSingleRpStateMachine 22 | connection_provider_class = NxosSingleRpConnectionProvider 23 | subcommand_list = NxosN5kServiceList 24 | settings = NxosSettings() 25 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/n5k/service_implementation.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.nxos.service_implementation import Reload as BaseReload 2 | from unicon.eal.dialogs import Dialog 3 | from .service_statements import nxos_reload_statement_list 4 | 5 | class Reload(BaseReload): 6 | def __init__(self, connection, context, **kwargs): 7 | super().__init__(connection, context, **kwargs) 8 | self.dialog = Dialog(nxos_reload_statement_list) 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/n5k/service_patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from unicon.plugins.nxos.service_patterns \ 4 | import ReloadPatterns as BaseNxosReloadPatterns 5 | 6 | class NxosN5kReloadPatterns(BaseNxosReloadPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.reload_confirm_nxos = r'.*This command will reboot the system[\n\r]*Do you want to continue\?\s*\(y/n\)\s*\[n\]\s*$' 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/n7k/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Dave Wapstra ' 2 | 3 | from unicon.plugins.nxos import ( 4 | NxosServiceList, HANxosServiceList, 5 | NxosSingleRpConnection, NxosDualRPConnection) 6 | 7 | from .setting import Nxos7kSettings 8 | from .connection_provider import Nxos7kSingleRpConnectionProvider, Nxos7kDualRpConnectionProvider 9 | 10 | 11 | class Nxos7kServiceList(NxosServiceList): 12 | def __init__(self): 13 | super().__init__() 14 | 15 | 16 | class HANxos7kServiceList(HANxosServiceList): 17 | def __init__(self): 18 | super().__init__() 19 | 20 | 21 | class Nxos7kSingleRpConnection(NxosSingleRpConnection): 22 | platform = 'n7k' 23 | subcommand_list = Nxos7kServiceList 24 | settings = Nxos7kSettings() 25 | connection_provider_class = Nxos7kSingleRpConnectionProvider 26 | 27 | 28 | class Nxos7kDualRPConnection(NxosDualRPConnection): 29 | platform = 'n7k' 30 | subcommand_list = HANxos7kServiceList 31 | settings = Nxos7kSettings() 32 | connection_provider_class = Nxos7kDualRpConnectionProvider 33 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/n7k/setting.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Dave Wapstra ' 2 | 3 | from unicon.plugins.nxos.setting import NxosSettings 4 | 5 | 6 | class Nxos7kSettings(NxosSettings): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/n9k/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.plugins.nxos import NxosServiceList, HANxosServiceList 4 | from unicon.plugins.nxos import NxosSingleRpConnection, NxosDualRPConnection 5 | 6 | from .setting import Nxos9kSettings 7 | from .service_implementation import Nxos9kReload, HANxos9kReloadService 8 | 9 | 10 | class Nxos9kServiceList(NxosServiceList): 11 | def __init__(self): 12 | super().__init__() 13 | self.reload = Nxos9kReload 14 | 15 | 16 | class HANxos9kServiceList(HANxosServiceList): 17 | def __init__(self): 18 | super().__init__() 19 | self.reload = HANxos9kReloadService 20 | 21 | 22 | class Nxos9kSingleRpConnection(NxosSingleRpConnection): 23 | platform = 'n9k' 24 | subcommand_list = Nxos9kServiceList 25 | settings = Nxos9kSettings() 26 | 27 | 28 | class Nxos9kDualRPConnection(NxosDualRPConnection): 29 | platform = 'n9k' 30 | subcommand_list = HANxos9kServiceList 31 | settings = Nxos9kSettings() 32 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/n9k/setting.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.plugins.nxos.setting import NxosSettings 4 | 5 | 6 | class Nxos9kSettings(NxosSettings): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.MAX_BOOT_ATTEMPTS = 3 11 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/nxosv/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from .statemachine import NxosvSingleRpStateMachine 4 | from .connection_provider import NxosvSingleRpConnectionProvider 5 | from unicon.plugins.nxos import NxosServiceList 6 | from unicon.plugins.nxos import NxosSingleRpConnection 7 | from unicon.plugins.nxos.nxosv.setting import NxosvSettings 8 | 9 | 10 | class NxosvSingleRpConnection(NxosSingleRpConnection): 11 | os = 'nxos' 12 | platform = 'nxosv' 13 | chassis_type = 'single_rp' 14 | state_machine_class = NxosvSingleRpStateMachine 15 | connection_provider_class = NxosvSingleRpConnectionProvider 16 | subcommand_list = NxosServiceList 17 | settings = NxosvSettings() 18 | 19 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/nxosv/connection_provider.py: -------------------------------------------------------------------------------- 1 | from unicon.eal.dialogs import Dialog 2 | 3 | from unicon.plugins.nxos.connection_provider\ 4 | import NxosSingleRpConnectionProvider 5 | 6 | from unicon.plugins.nxos.nxosv.service_statements\ 7 | import additional_connection_dialog 8 | 9 | class NxosvSingleRpConnectionProvider(NxosSingleRpConnectionProvider): 10 | 11 | def get_connection_dialog(self): 12 | dialog = super().get_connection_dialog() 13 | dialog += Dialog(additional_connection_dialog) 14 | return dialog 15 | 16 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/nxosv/patterns.py: -------------------------------------------------------------------------------- 1 | from ..patterns import NxosPatterns 2 | 3 | class NxosvPatterns(NxosPatterns): 4 | def __init__(self): 5 | super().__init__() 6 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/nxosv/service_patterns.py: -------------------------------------------------------------------------------- 1 | 2 | class NxosvReloadPatterns: 3 | """ NXOSv related patterns. """ 4 | 5 | def __init__ (self): 6 | # Relaxed patterns, for example the following line was 7 | # seen on a NXOSv console during startup: 8 | # login: 2016 Sep 27 14:07:35 switch %PLATFORM-2-MOD_DETECT: Module 2 detected (Serial number TM00C39B67C) Module-Type NX-OSv Ethernet Module Model N7K-F248XP-25 9 | self.username = r'^.*([Uu]sername|[Ll]ogin): ?' 10 | self.password = r'^.*[Pp]assword: ?' 11 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/nxosv/service_statements.py: -------------------------------------------------------------------------------- 1 | from unicon.eal.dialogs import Statement 2 | from unicon.plugins.generic.service_statements import login_handler 3 | from unicon.plugins.generic.service_statements import password_handler 4 | 5 | from .service_patterns import NxosvReloadPatterns 6 | 7 | from ..service_statements import additional_connection_dialog\ 8 | as nxos_additional_connection_dialog 9 | 10 | # Additional statement specific to nxosv 11 | pat = NxosvReloadPatterns() 12 | 13 | login_stmt = Statement(pattern=pat.username, 14 | action=login_handler, 15 | args=None, 16 | loop_continue=True, 17 | continue_timer=False) 18 | 19 | password_stmt = Statement(pattern=pat.password, 20 | action=password_handler, 21 | args=None, 22 | loop_continue=False, 23 | continue_timer=False) 24 | 25 | additional_connection_dialog = [login_stmt, password_stmt] 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/nxosv/setting.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.nxos.setting import NxosSettings 2 | 3 | class NxosvSettings(NxosSettings): 4 | 5 | def __init__(self): 6 | """ Timeouts for virtual platforms are increased to account for 7 | a busy execution server. 8 | """ 9 | super().__init__() 10 | self.CONNECTION_TIMEOUT = 480 11 | self.EXPECT_TIMEOUT = 60 12 | 13 | # Wait this much time between telnetting to the device and 14 | # hitting . Lack of a delay was causing connection timeouts 15 | # when running on a LaaS server in vCenter Esxi mode. 16 | # 17 | self.ESCAPE_CHAR_CALLBACK_PRE_SENDLINE_PAUSE_SEC = 1 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/nxos/nxosv/statemachine.py: -------------------------------------------------------------------------------- 1 | __author__ = "Myles Dear " 2 | 3 | from ..statemachine import NxosSingleRpStateMachine 4 | from unicon.plugins.generic.statements import GenericStatements 5 | from unicon.statemachine import State, Path, StateMachine 6 | from .patterns import NxosPatterns 7 | 8 | patterns = NxosPatterns() 9 | 10 | 11 | class NxosvSingleRpStateMachine(NxosSingleRpStateMachine): 12 | def create(self): 13 | super().create() 14 | enable = self.get_state('enable') 15 | 16 | # Add relaxed prompt to ensure connection succeeds when device 17 | # is coming up. 18 | # Saw the following line in the nxosv log: 19 | # switch# 2016 Sep 28 18:37:47 switch %PLATFORM-2-MOD_DETECT: Module 3 detected (Serial number TM0024CC3FD) Module-Type NX-OSv Ethernet Module Model N7K-F248XP-25 20 | enable.add_state_pattern(patterns.enable_prompt) 21 | -------------------------------------------------------------------------------- /src/unicon/plugins/ons/__init__.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.generic import GenericSingleRpConnection 2 | from unicon.plugins.generic import ServiceList 3 | 4 | from .settings import OnsSettings 5 | from .statemachine import OnsSingleRpStateMachine 6 | from .connection_provider import OnsSingleRpConnectionProvider 7 | 8 | 9 | class OnsServiceList(ServiceList): 10 | def __init__(self): 11 | super().__init__() 12 | 13 | 14 | class OnsSingleRpConnection(GenericSingleRpConnection): 15 | os = 'ons' 16 | chassis_type = 'single_rp' 17 | state_machine_class = OnsSingleRpStateMachine 18 | connection_provider_class = OnsSingleRpConnectionProvider 19 | subcommand_list = OnsServiceList 20 | settings = OnsSettings() 21 | -------------------------------------------------------------------------------- /src/unicon/plugins/ons/patterns.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.iosxr.patterns import IOSXRPatterns 3 | 4 | class OnsPatterns(IOSXRPatterns): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.tl1_prompt = r'(.*?)^\s*>\s*$' 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/ons/settings.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.plugins.generic.settings import GenericSettings 3 | 4 | class OnsSettings(GenericSettings): 5 | def __init__(self): 6 | super().__init__() 7 | self.HA_INIT_EXEC_COMMANDS = [] 8 | self.HA_INIT_CONFIG_COMMANDS = [] 9 | -------------------------------------------------------------------------------- /src/unicon/plugins/ons/statemachine.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.statemachine import State, Path 3 | from unicon.eal.dialogs import Statement, Dialog 4 | 5 | from unicon.statemachine import State, Path, StateMachine 6 | 7 | from .patterns import OnsPatterns 8 | 9 | patterns = OnsPatterns() 10 | 11 | 12 | class OnsSingleRpStateMachine(StateMachine): 13 | 14 | def create(self): 15 | tl1 = State('tl1', patterns.tl1_prompt) 16 | self.add_state(tl1) 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/sdwan/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | from unicon.bases.routers.connection import BaseSingleRpConnection 4 | 5 | from .viptela import ViptelaSingleRPConnection 6 | 7 | 8 | class SDWANConnection(ViptelaSingleRPConnection): 9 | os = 'viptela' 10 | platform = None 11 | chassis_type = 'single_rp' 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/sdwan/iosxe/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | import warnings 4 | from unicon.plugins.iosxe.sdwan import SDWANSingleRpConnection 5 | 6 | 7 | class SDWANConnection(SDWANSingleRpConnection): 8 | os = 'sdwan' 9 | platform = 'iosxe' 10 | 11 | def __init__(self, *args, **kwargs): 12 | warnings.warn(message = "This plugin is deprecated and replaced by 'iosxe/sdwan'", 13 | category = DeprecationWarning) 14 | super().__init__(*args, **kwargs) 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/sdwan/viptela/patterns.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.confd.patterns import ConfdPatterns 2 | 3 | class ViptelaPatterns(ConfdPatterns): 4 | def __init__(self): 5 | super().__init__() 6 | self.cisco_prompt = r'^(.*?)((%N|vedge|vsmart|vmanage)#)\s*$' 7 | self.cisco_config_prompt = r'^(.*?)(%N\(config.*\)#)\s*$' 8 | self.cisco_commit_changes_prompt = r'Uncommitted changes found, commit them\? \[yes/no/CANCEL\]' 9 | self.shell_prompt = r'^(.*?%N\s?([-\w\]/~\s:\d]+)?[>\$~%#])\s?$' 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/sdwan/viptela/service_patterns.py: -------------------------------------------------------------------------------- 1 | 2 | from unicon.patterns import UniconCorePatterns 3 | 4 | class ReloadPatterns(UniconCorePatterns): 5 | def __init__(self): 6 | super().__init__() 7 | self.system_ready = r'^(.*?)System Ready' 8 | self.factory_reset_prompt = r'^(.*?)Are you sure you want to reset to factory defaults\? \[yes,NO\]' 9 | self.reboot_prompt = r'(.*?)Are you sure you want to reboot\? \[yes,NO\]' 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/sdwan/viptela/settings.py: -------------------------------------------------------------------------------- 1 | from unicon.plugins.confd.settings import ConfdSettings 2 | 3 | 4 | class ViptelaSettings(ConfdSettings): 5 | """" Generic platform settings """ 6 | def __init__(self): 7 | """ initialize 8 | """ 9 | super().__init__() 10 | self.CISCO_INIT_EXEC_COMMANDS = [ 11 | 'screen-length 0', 12 | 'screen-width 256', 13 | 'idle-timeout 0', 14 | 'autowizard false' 15 | ] 16 | self.CISCO_INIT_CONFIG_COMMANDS = [] 17 | 18 | self.ERROR_PATTERN = [ 19 | 'Error:', 20 | 'syntax error', 21 | 'Aborted', 22 | 'result false' 23 | ] 24 | 25 | self.ESCAPE_CHAR_CHATTY_TERM_WAIT = 0.1 26 | 27 | self.IGNORE_CHATTY_TERM_OUTPUT = True 28 | 29 | self.RELOAD_TIMEOUT = 900 30 | self.RELOAD_WAIT = 300 31 | self.RELOAD_RECONNECT_ATTEMPTS = 3 32 | -------------------------------------------------------------------------------- /src/unicon/plugins/slxos/patterns.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.slxos 4 | Authors: 5 | Fabio Pessoa Nunes (https://www.linkedin.com/in/fpessoanunes/) 6 | Description: 7 | Module for defining all the Patterns required for the 8 | Slxos implementation 9 | """ 10 | 11 | from unicon.plugins.generic.patterns import GenericPatterns 12 | 13 | 14 | class SlxosPatterns(GenericPatterns): 15 | """ 16 | Class defines all the patterns required 17 | for Slxos 18 | """ 19 | def __init__(self): 20 | super().__init__() 21 | 22 | self.default_hostname_pattern = r'SLX' 23 | self.username = r'^.*[Ll]ogin:\s*$' 24 | self.password = r'^.*[Pp]assword:\s*$' 25 | # SLX# 26 | self.enable_prompt = r'^(.*?)(.*|%N|SLX)#\s*$' 27 | # SLX(config)# 28 | self.config_prompt = r'^\S+\(config\)#\s*$' 29 | self.save_confirm = r'This operation will (back up the current|modify your startup) configuration\. Do you want to continue\? \[y/n\]:\s*$' 30 | -------------------------------------------------------------------------------- /src/unicon/plugins/slxos/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.slxos 4 | Author: 5 | Fabio Pessoa Nunes (https://www.linkedin.com/in/fpessoanunes/) 6 | Description: 7 | This module defines the Slxos settings to setup 8 | the unicon environment required for generic based 9 | unicon connection 10 | """ 11 | 12 | from unicon.plugins.generic import GenericSettings 13 | 14 | 15 | class SlxosSettings(GenericSettings): 16 | """" Slxos platform settings """ 17 | 18 | def __init__(self): 19 | super().__init__() 20 | self.HA_INIT_EXEC_COMMANDS = [ 21 | 'terminal length 0', 22 | 'terminal timeout 0', 23 | 'no terminal monitor', 24 | 'show version' 25 | ] 26 | self.HA_INIT_CONFIG_COMMANDS = [] 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/sonic/__init__.py: -------------------------------------------------------------------------------- 1 | """ SONiC (Software for Open Networking in the Cloud) CLI implementation """ 2 | 3 | __author__ = "Liam Gerrior " 4 | 5 | from unicon.plugins.linux import LinuxConnection, LinuxServiceList, LinuxConnectionProvider 6 | from unicon.plugins.linux.statemachine import LinuxStateMachine 7 | from unicon.plugins.linux.settings import LinuxSettings 8 | 9 | 10 | class SonicConnection(LinuxConnection): 11 | os = 'sonic' 12 | platform = None 13 | chassis_type = 'single_rp' 14 | state_machine_class = LinuxStateMachine 15 | connection_provider_class = LinuxConnectionProvider 16 | subcommand_list = LinuxServiceList 17 | settings = LinuxSettings() 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/sonic/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module: 3 | unicon.plugins.sonic 4 | 5 | Authors: 6 | pyATS TEAM (pyats-support@cisco.com, pyats-support-ext@cisco.com) 7 | 8 | Description: 9 | This module defines the SONiC settings to setup 10 | the unicon environment required for SONiC based 11 | unicon connection 12 | """ 13 | from unicon.plugins.linux.settings import LinuxSettings 14 | 15 | 16 | class SonicSettings(LinuxSettings): 17 | """" Linux platform settings """ 18 | def __init__(self): 19 | """ initialize 20 | """ 21 | super().__init__() 22 | 23 | # Default error pattern 24 | self.ERROR_PATTERN.extend([ 25 | r'^Error: No such command .*$', 26 | r'^Error: Too many matches: .*$' 27 | ]) 28 | -------------------------------------------------------------------------------- /src/unicon/plugins/sros/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.patterns import UniconCorePatterns 4 | 5 | 6 | class SrosPatterns(UniconCorePatterns): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.continue_connect = r'Are you sure you want to continue connecting \(yes/no(/\[fingerprint\])?\)' 11 | self.permission_denied = r'^Permission denied, please try again\.\s?$' 12 | self.mdcli_prompt = r'^(.*?)(\[[^\]]*\])?[\r\n]+[AB]:.*@%N[#$]\s?$' 13 | self.classiccli_prompt = r'^(.*?)\*?[AB]:%N(>.*)?[#$]\s?$' 14 | self.discard_uncommitted = r'Discard uncommitted changes\? \[y,n\]' 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/sros/setting.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.plugins.generic import GenericSettings 4 | 5 | 6 | class SrosSettings(GenericSettings): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.DEFAULT_CLI_ENGINE = 'classiccli' 11 | 12 | self.MDCLI_CONFIGURE_DEFAULT_MODE = 'private' 13 | 14 | self.MD_INIT_EXEC_COMMANDS = [ 15 | 'environment console length 512', 16 | 'environment console width 512' 17 | ] 18 | self.MD_INIT_CONFIG_COMMANDS = [] 19 | 20 | self.CLASSIC_INIT_EXEC_COMMANDS = [ 21 | 'environment no more', 22 | 'environment no saved-ind-prompt' 23 | ] 24 | self.CLASSIC_INIT_CONFIG_COMMANDS = [] 25 | 26 | self.DEFAULT_LEARNED_HOSTNAME = r'([^@# \t\n\r\f\v]+)' 27 | self.LEARN_PATTERN = r'([^@# \t\n\r\f\v]+)' 28 | 29 | self.ERROR_PATTERN.append("^Error: .*") 30 | self.CONFIGURE_ERROR_PATTERN.append("^Error: .*") 31 | -------------------------------------------------------------------------------- /src/unicon/plugins/sros/statemachine.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Difu Hu ' 2 | 3 | from unicon.statemachine import State, Path, StateMachine 4 | 5 | from .patterns import SrosPatterns 6 | 7 | patterns = SrosPatterns() 8 | 9 | 10 | class SrosSingleRpStateMachine(StateMachine): 11 | 12 | def create(self): 13 | mdcli = State('mdcli', patterns.mdcli_prompt) 14 | classiccli = State('classiccli', patterns.classiccli_prompt) 15 | 16 | mdcli_to_classiccli = Path(mdcli, classiccli, '//') 17 | classiccli_to_mdcli = Path(classiccli, mdcli, '//') 18 | 19 | self.add_state(mdcli) 20 | self.add_state(classiccli) 21 | 22 | self.add_path(mdcli_to_classiccli) 23 | self.add_path(classiccli_to_mdcli) 24 | -------------------------------------------------------------------------------- /src/unicon/plugins/staros/settings.py: -------------------------------------------------------------------------------- 1 | """ Defines the settings for staros based unicon connections """ 2 | 3 | __author__ = "dwapstra" 4 | 5 | from unicon.plugins.generic.settings import GenericSettings 6 | 7 | 8 | class StarosSettings(GenericSettings): 9 | """" Generic platform settings """ 10 | def __init__(self): 11 | """ initialize 12 | """ 13 | super().__init__() 14 | 15 | self.HA_INIT_EXEC_COMMANDS = [ 16 | 'terminal length 0', 17 | 'terminal width 512', 18 | 'no timestamps' 19 | ] 20 | self.HA_INIT_CONFIG_COMMANDS = [] 21 | 22 | self.ERROR_PATTERN = [ 23 | r'^Failure:', 24 | ] 25 | 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/src/unicon/plugins/tests/__init__.py -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/src/unicon/plugins/tests/mock/__init__.py -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock/mock_device_sros.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import logging 4 | import argparse 5 | 6 | from unicon.mock.mock_device import MockDevice 7 | 8 | logger = logging.getLogger(__name__) 9 | 10 | 11 | class MockDeviceSROS(MockDevice): 12 | 13 | def __init__(self, *args, **kwargs): 14 | super().__init__(*args, device_os='sros', **kwargs) 15 | self.invalid_command_response = "Error: Bad command " 16 | 17 | 18 | def main(args=None): 19 | 20 | if not args: 21 | parser = argparse.ArgumentParser() 22 | parser.add_argument('--state', help='initial state') 23 | parser.add_argument('--hostname', help='Device hostname (default: Router') 24 | parser.add_argument('-d', action='store_true', help='Debug') 25 | args = parser.parse_args() 26 | 27 | if args.d: 28 | logging.getLogger(__name__).setLevel(logging.DEBUG) 29 | 30 | state = args.state or 'connect_ssh' 31 | hostname = args.hostname or 'Router' 32 | md = MockDeviceSROS(hostname=hostname, state=state) 33 | md.run() 34 | 35 | 36 | if __name__ == "__main__": 37 | main() 38 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/confd/csp_reload.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CiscoTestAutomation/unicon.plugins/b6cc3f032caae9e5c8e9cb4dee95f4ace5b6687a/src/unicon/plugins/tests/mock_data/confd/csp_reload.txt -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/generic/generic_mock_data_linux.yaml: -------------------------------------------------------------------------------- 1 | connect_ssh: 2 | preface: | 3 | The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established. 4 | RSA key fingerprint is a1:07:ac:9b:8c:c2:db:c5:4c:dc:70:b5:09:2a:a5:b1. 5 | prompt: "Are you sure you want to continue connecting (yes/no)? " 6 | commands: 7 | "yes": 8 | new_state: password 9 | 10 | password: 11 | prompt: "cisco@localhost password: " 12 | commands: 13 | "cisco": 14 | new_state: exec 15 | 16 | exec: 17 | prompt: "Linux$ " 18 | commands: 19 | "uname -a": 20 | response: | 21 | Linux linux-box.cisco.com 4.18.0-240.22.1.el8_3.x86_64 #1 SMP Thu Mar 25 14:36:04 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/ios/ios_mock_clear.yaml: -------------------------------------------------------------------------------- 1 | 2 | clear_logging: 3 | prompt: Clear logging buffer [confirm] 4 | commands: &clear_cmds 5 | "": 6 | new_state: enable 7 | "y": 8 | new_state: enable 9 | 10 | clear_xcon_all: 11 | prompt: Reprovision all xconnects? [confirm] 12 | commands: *clear_cmds 13 | 14 | clear_counters: 15 | prompt: Clear "show interface" counters on all interfaces [confirm] 16 | commands: *clear_cmds 17 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/iosxe/c9k_boot_rommon.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Initializing Hardware...... 4 | 5 | System Bootstrap, Version 17.3.6r, RELEASE SOFTWARE (P) 6 | Compiled Tue 09/15/2020 14:10:33.03 by rel 7 | 8 | Current ROMMON image : Primary 9 | Last reset cause : SoftwareReload 10 | 11 | 12 | Preparing to autoboot. [Press Ctrl-C to interrupt] 0 13 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/iosxe/iosxe_mock_crft.yaml: -------------------------------------------------------------------------------- 1 | 2 | enable_crft: 3 | prompt: "%N#" 4 | commands: 5 | "dir flash:/CRFT_*": |4 6 | 7 | Directory of flash:/CRFT_* 8 | 9 | 10 | Directory of flash:/ 11 | 12 | 13 | 655502 -rw- 796729 Oct 22 2021 19:35:59 +00:00 CRFT__ott-c9300-22__000001__C930024T_2021-10-22_19-35-59.tar.gz 14 | 15 | 11353194496 bytes total (1054248960 bytes free) 16 | 17 | 18 | "dir": | 19 | Directory of flash:/ 20 | 21 | 655385 -rw- 5242880 Oct 22 2021 18:39:51 +00:00 ssd 22 | 23 | 11353194496 bytes total (1055051776 bytes free) 24 | 25 | "verify /md5 CRFT__ott-c9300-22__000001__C930024T_2021-10-22_19-35-59.tar.gz": "" 26 | "delete /force flash:CRFT_*": "" 27 | "dir flash:CRFT_*": "" 28 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/iosxr/iosxr_asr9k_mock_data.yaml: -------------------------------------------------------------------------------- 1 | asr9k_ha_login: 2 | preface: file|mock_data/iosxr/login_banner_asr9k_ha.txt 3 | commands: 4 | "": 5 | new_state: login 6 | 7 | asr9k_ha_password: 8 | prompt: "Password:" 9 | commands: 10 | "admin": 11 | # response: "\n" 12 | new_state: asr9k_ha_enable 13 | 14 | asr9k_ha_enable: 15 | prompt: "RP/0/RP0/CPU0:%N#" 16 | commands: 17 | "end": 18 | new_state: enable 19 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/iosxr/iosxr_ncs540_mock_data.yaml: -------------------------------------------------------------------------------- 1 | 2 | ncs540_enable: 3 | prompt: "RP/0/RP0/CPU0:%N#" 4 | commands: 5 | "terminal length 0": "" 6 | "terminal width 0": "" 7 | "reload": 8 | new_state: ncs540_reload_proceed 9 | "configure terminal": 10 | new_state: ncs540_config 11 | "config term": 12 | new_state: ncs540_config 13 | 14 | ncs540_config: 15 | prompt: "RP/0/RP0/CPU0:%N(config)#" 16 | commands: 17 | "end": 18 | new_state: ncs540_enable 19 | 20 | ncs540_reload_proceed: 21 | prompt: "Proceed with reload? [confirm]" 22 | commands: 23 | "": 24 | response: file|mock_data/iosxr/iosxr_ncs540_reload.txt 25 | new_state: ncs540__press_return 26 | timing: 27 | - 0:,1,0.005 28 | 29 | ncs540__press_return: 30 | prompt: "" 31 | commands: 32 | "": 33 | new_state: ncs540_enable 34 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/iosxr/login_banner_asr9k_ha.txt: -------------------------------------------------------------------------------- 1 | Press RETURN to get started. 2 | 3 | 4 | 5 | SYSTEM CONFIGURATION IN PROCESS 6 | 7 | 8 | The startup configuration for this device is presently loading. 9 | This may take a few minutes. You will be notified upon completion. 10 | 11 | Please do not attempt to reconfigure the device until this process is complete. 12 | 13 | SYSTEM CONFIGURATION COMPLETED -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/iosxr/spitfire/show_version.txt: -------------------------------------------------------------------------------- 1 | Wed Jan 9 21:10:53.333 UTC 2 | Cisco IOS XR Software, Version 7.0.1.119I 3 | Copyright (c) 2013-2018 by Cisco Systems, Inc. 4 | 5 | Label: 7.0.1.119I 6 | 7 | NCS-Spitfire 8 | System uptime is 18 hours, 50 minutes 9 | 10 | - xr-mandatory 7.0.1.119Iv1.0.0-1 11 | - Built on sjc-ads-8354:/nobackup/gpunathi/new-xr-dev/ at Thu Jan 10 18:03:23 2019 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/ise/ise_mock_data.yaml: -------------------------------------------------------------------------------- 1 | 2 | ise_resume_session: 3 | preface: |4 4 | Following disconnected ssh sessions are available to resume. 5 | [1] 875.User-Friday_Jan_17_08:26:00_2020 6 | [2] 25035.User-Friday_Jan_17_08:22:48_2020 7 | [3] 23881.User-Friday_Jan_17_08:22:21_2020 8 | [4] 19982.User-Friday_Jan_17_08:04:58_2020 9 | prompt: "Enter session number to resume or press to start a new one:" 10 | commands: 11 | "": 12 | response: "Last failed login on Wed Jan 15 10:43:10 2020 from 1.1.1.1" 13 | new_state: ise_exec 14 | 15 | 16 | ise_exec: 17 | prompt: dc-ise-1/User> 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/ons/ons_mock_data.yaml: -------------------------------------------------------------------------------- 1 | 2 | tl1: 3 | prompt: ">" 4 | commands: 5 | "help": | 6 | command help 7 | "ACT-USER:ONS:admin:100::admin;": |2 8 | TID-000 1998-06-20 14:30:00 9 | M 001 COMPLD 10 | DXT:2003-01-02 14-04-49,0; 11 | "ACT-USER:ONS:admin:100::test;": "login failure" 12 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/mock_data/windows/windows_mock_data.yaml: -------------------------------------------------------------------------------- 1 | windows_connect: 2 | prompt: "administrator@10.22.175.104's password: " 3 | commands: 4 | "cisco": 5 | response: | 6 | Microsoft Windows [Version 6.1.7601] 7 | Copyright (c) 2009 Microsoft Corporation. All rights reserved. 8 | 9 | new_state: windows_exec 10 | 11 | windows_exec: 12 | prompt: "administrator@WIN7 C:\\Users\\Administrator>" 13 | commands: 14 | "dir": file|mock_data/windows/dir.txt 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/test_plugin_confd_esc.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unittests for ConfD/ESC plugin 3 | 4 | Uses the mock_device.py script to test the connect, execute and configure services. 5 | 6 | """ 7 | 8 | __author__ = "Dave Wapstra " 9 | 10 | 11 | import re 12 | import unittest 13 | 14 | from unicon import Connection 15 | 16 | 17 | class TestNsoPluginConnect(unittest.TestCase): 18 | 19 | def test_connect_cisco_exec(self): 20 | c = Connection(hostname='esc', 21 | start=['mock_device_cli --os confd --state juniper_exec'], 22 | os='confd', 23 | platform='esc', 24 | username='admin', 25 | tacacs_password='admin') 26 | c.connect() 27 | 28 | if __name__ == "__main__": 29 | unittest.main() 30 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/test_plugin_iosxe_csr1000v.py: -------------------------------------------------------------------------------- 1 | 2 | import unittest 3 | 4 | from unicon import Connection 5 | 6 | 7 | class TestIosXEConfigure(unittest.TestCase): 8 | 9 | def test_config_no_service_prompt_config(self): 10 | c = Connection(hostname='Switch', 11 | start=['mock_device_cli --os iosxe --state enable_no_service_prompt_config'], 12 | os='iosxe', 13 | platform='csr100v', 14 | init_exec_commands=[], 15 | init_config_commands=[], 16 | settings=dict(POST_DISCONNECT_WAIT_SEC=0, GRACEFUL_DISCONNECT_WAIT_SEC=0.2), 17 | log_buffer=True 18 | ) 19 | c.connect() 20 | c.configure(['no logging console']) 21 | c.disconnect() 22 | 23 | 24 | if __name__ == "__main__": 25 | unittest.main() 26 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/test_plugin_ise.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from unittest.mock import patch 3 | 4 | import unicon 5 | from unicon import Connection 6 | from unicon.eal.dialogs import Dialog 7 | 8 | 9 | @patch.object(unicon.settings.Settings, 'POST_DISCONNECT_WAIT_SEC', 0) 10 | @patch.object(unicon.settings.Settings, 'GRACEFUL_DISCONNECT_WAIT_SEC', 0) 11 | class TestISEPluginConnect(unittest.TestCase): 12 | 13 | def test_connect_resume(self): 14 | c = Connection(hostname='dc-ise-1', 15 | start=['mock_device_cli --os ise --state ise_resume_session'], 16 | os='ise') 17 | c.connect() 18 | c.disconnect() 19 | 20 | 21 | if __name__ == "__main__": 22 | unittest.main() 23 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/test_plugin_nxos_nxosv.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unittests for NXOS/NXOSv plugin 3 | 4 | Uses the mock_device.py script to test the plugin. 5 | 6 | """ 7 | 8 | __author__ = "Dave Wapstra " 9 | 10 | 11 | import re 12 | import unittest 13 | 14 | from unicon import Connection 15 | from unicon.core.errors import SubCommandFailure 16 | 17 | 18 | class TestNxosNxosvPluginConnect(unittest.TestCase): 19 | 20 | def test_login_connect(self): 21 | c = Connection(hostname='switch', 22 | start=['mock_device_cli --os nxos --state exec'], 23 | os='nxos', 24 | platform='nxosv', 25 | username='cisco', 26 | tacacs_password='cisco') 27 | c.connect() 28 | assert c.spawn.match.match_output == 'end\r\nswitch# ' 29 | 30 | if __name__ == "__main__": 31 | unittest.main() 32 | -------------------------------------------------------------------------------- /src/unicon/plugins/tests/test_plugin_windows.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unittests for windows plugin 3 | 4 | Uses the mock_device.py script to test the plugin. 5 | 6 | """ 7 | 8 | __copyright__ = "# Copyright (c) 2018 by cisco Systems, Inc. All rights reserved." 9 | __author__ = "dwapstra" 10 | 11 | 12 | import unittest 13 | 14 | from unicon import Connection 15 | from unicon.core.errors import SubCommandFailure 16 | 17 | 18 | class TestWindowsPluginConnect(unittest.TestCase): 19 | 20 | @classmethod 21 | def setUpClass(cls): 22 | cls.c = Connection(hostname='WIN7', 23 | start=['mock_device_cli --os windows --state windows_connect'], 24 | os='windows', 25 | credentials={'default': {'usernane': 'cisco', 'password': 'cisco'}} 26 | ) 27 | 28 | cls.c.connect() 29 | 30 | def test_execute(self): 31 | r = self.c.execute('dir') 32 | self.assertEqual(len(r), 1202) 33 | 34 | 35 | if __name__ == "__main__": 36 | unittest.main() 37 | 38 | -------------------------------------------------------------------------------- /src/unicon/plugins/vos/patterns.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dave Wapstra " 2 | 3 | """ 4 | Pattern best practices: 5 | 6 | Use ^ to match start of string or start of line (this will speed up pattern matching significantly) 7 | Use .*? to do a non-greedy match at the start of regex 8 | """ 9 | 10 | from unicon.plugins.generic.patterns import GenericPatterns 11 | 12 | 13 | class VosPatterns(GenericPatterns): 14 | def __init__(self): 15 | super().__init__() 16 | self.prompt = r'^(.*?)([\r\n]|\x1b\[K)admin:\s*' 17 | self.press_enter_space_q = r"^.*?\x1b\[1mPress for 1 line, for one page, or to quit\x1b\[0m" 18 | self.paging_options = r"^.*?\x1b\[1m\r\noptions: q=quit, n=next, p=prev, b=begin, e=end \(lines (\d+) - (\d+) of (\d+)\) : \x1b\[0m" 19 | self.continue_prompt = r'.*Continue \(y/n\)\?' 20 | -------------------------------------------------------------------------------- /src/unicon/plugins/vos/settings.py: -------------------------------------------------------------------------------- 1 | """ Defines the settings for uc based unicon connections """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | from unicon.plugins.generic.settings import GenericSettings 6 | 7 | 8 | class VosSettings(GenericSettings): 9 | """" Generic platform settings """ 10 | def __init__(self): 11 | """ initialize 12 | """ 13 | super().__init__() 14 | self.HA_INIT_EXEC_COMMANDS = [ 15 | 'set cli pagination off' 16 | ] 17 | self.HA_INIT_CONFIG_COMMANDS = [] 18 | -------------------------------------------------------------------------------- /src/unicon/plugins/vos/statemachine.py: -------------------------------------------------------------------------------- 1 | """ State machine for Uc """ 2 | 3 | __author__ = "Dave Wapstra " 4 | 5 | 6 | import re 7 | 8 | from unicon.core.errors import SubCommandFailure, StateMachineError 9 | from unicon.statemachine import State, Path, StateMachine 10 | from unicon.eal.dialogs import Dialog, Statement 11 | 12 | from .patterns import VosPatterns 13 | patterns = VosPatterns() 14 | 15 | from .statements import vos_default_statement_list 16 | 17 | 18 | class VosStateMachine(StateMachine): 19 | 20 | def __init__(self, hostname=None): 21 | super().__init__(hostname) 22 | 23 | def create(self): 24 | shell = State('shell', patterns.prompt) 25 | self.add_state(shell) 26 | self.add_default_statements(vos_default_statement_list) 27 | -------------------------------------------------------------------------------- /src/unicon/plugins/windows/patterns.py: -------------------------------------------------------------------------------- 1 | __copyright__ = "# Copyright (c) 2018 by cisco Systems, Inc. All rights reserved." 2 | __author__ = "dwapstra" 3 | 4 | from unicon.plugins.generic.patterns import GenericPatterns 5 | 6 | class WindowsPatterns(GenericPatterns): 7 | def __init__(self): 8 | super().__init__() 9 | self.prompt = r'^(.*?)\S+@%N\s+.*?>\s*(\x1b.*)?$' 10 | -------------------------------------------------------------------------------- /src/unicon/plugins/windows/settings.py: -------------------------------------------------------------------------------- 1 | """ Defines the settings for windows based unicon connections """ 2 | 3 | __copyright__ = "# Copyright (c) 2018 by cisco Systems, Inc. All rights reserved." 4 | __author__ = "dwapstra" 5 | 6 | from unicon.plugins.generic.settings import GenericSettings 7 | 8 | 9 | class WindowsSettings(GenericSettings): 10 | """" Generic platform settings """ 11 | def __init__(self): 12 | """ initialize 13 | """ 14 | super().__init__() 15 | -------------------------------------------------------------------------------- /src/unicon/plugins/windows/statemachine.py: -------------------------------------------------------------------------------- 1 | """ State machine for Windows """ 2 | 3 | __copyright__ = "# Copyright (c) 2018 by cisco Systems, Inc. All rights reserved." 4 | __author__ = "dwapstra" 5 | 6 | 7 | import re 8 | 9 | from unicon.plugins.windows.patterns import WindowsPatterns 10 | from unicon.plugins.generic.statements import GenericStatements 11 | 12 | from unicon.statemachine import State, Path, StateMachine 13 | from unicon.eal.dialogs import Dialog, Statement 14 | 15 | from unicon.core.errors import SubCommandFailure, StateMachineError 16 | 17 | patterns = WindowsPatterns() 18 | statements = GenericStatements() 19 | 20 | 21 | class WindowsStateMachine(StateMachine): 22 | 23 | def __init__(self, hostname=None): 24 | super().__init__(hostname) 25 | 26 | def create(self): 27 | shell = State('shell', patterns.prompt) 28 | self.add_state(shell) 29 | -------------------------------------------------------------------------------- /tests: -------------------------------------------------------------------------------- 1 | src/unicon/plugins/tests --------------------------------------------------------------------------------