├── .cookiecutter.json
├── .dockerignore
├── .github
├── CODEOWNERS
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── PULL_REQUEST_TEMPLATE
│ └── pull_request_template.md
├── dependabot.yml
└── workflows
│ ├── ci.yml
│ ├── oui_filepull.yml
│ ├── proto_filepull.yml
│ └── proto_num_filepull.yml
├── .gitignore
├── .readthedocs.yml
├── .yamllint.yml
├── Dockerfile
├── LICENSE
├── README.md
├── changes
├── +main.housekeeping
├── .gitignore
├── .gitkeep
└── 723.fixed
├── development_scripts.py
├── docs
├── admin
│ ├── install.md
│ ├── release_notes
│ │ ├── index.md
│ │ ├── version_0.1.md
│ │ ├── version_0.2.md
│ │ ├── version_1.0.md
│ │ ├── version_1.1.md
│ │ ├── version_1.10.md
│ │ ├── version_1.11.md
│ │ ├── version_1.12.md
│ │ ├── version_1.13.md
│ │ ├── version_1.14.md
│ │ ├── version_1.15.md
│ │ ├── version_1.2.md
│ │ ├── version_1.3.md
│ │ ├── version_1.4.md
│ │ ├── version_1.5.md
│ │ ├── version_1.6.md
│ │ ├── version_1.7.md
│ │ ├── version_1.8.md
│ │ └── version_1.9.md
│ ├── uninstall.md
│ └── upgrade.md
├── assets
│ ├── acl-workflow.drawio
│ ├── extra.css
│ ├── favicon.ico
│ ├── networktocode_bw.png
│ ├── networktocode_logo.png
│ ├── networktocode_logo.svg
│ └── overrides
│ │ └── partials
│ │ └── copyright.html
├── dev
│ ├── arch_decision.md
│ ├── attribution.md
│ ├── classy
│ │ └── parser.md
│ ├── code_reference
│ │ ├── acl.md
│ │ ├── asn.md
│ │ ├── bandwidth.md
│ │ ├── banner.md
│ │ ├── configs.md
│ │ ├── dns.md
│ │ ├── hash.md
│ │ ├── index.md
│ │ ├── interface.md
│ │ ├── ip.md
│ │ ├── lib_helpers.md
│ │ ├── lib_mapping.md
│ │ ├── mac.md
│ │ ├── nist.md
│ │ ├── os_version.md
│ │ ├── password.md
│ │ ├── ping.md
│ │ ├── protocol_mapper.md
│ │ ├── regex.md
│ │ ├── route.md
│ │ ├── time.md
│ │ ├── utils.md
│ │ └── vlan.md
│ ├── contributing.md
│ ├── dev_adr.md
│ ├── dev_config.md
│ ├── dev_environment.md
│ ├── extending.md
│ ├── include_parser_list.md
│ └── release_checklist.md
├── images
│ ├── .keep
│ ├── acl-workflow.png
│ ├── icon-Netutils.png
│ └── networktocode_logo.svg
├── index.md
└── user
│ ├── faq.md
│ ├── include_jinja_list.md
│ ├── lib_getting_started.md
│ ├── lib_mapper
│ ├── aerleon.md
│ ├── aerleon_reverse.md
│ ├── ansible.md
│ ├── ansible_reverse.md
│ ├── capirca.md
│ ├── capirca_reverse.md
│ ├── dna_center.md
│ ├── dna_center_reverse.md
│ ├── forwardnetworks.md
│ ├── forwardnetworks_reverse.md
│ ├── hierconfig.md
│ ├── hierconfig_reverse.md
│ ├── napalm.md
│ ├── napalm_reverse.md
│ ├── netmiko.md
│ ├── netmiko_reverse.md
│ ├── netutilsparser.md
│ ├── netutilsparser_reverse.md
│ ├── nist.md
│ ├── nist_reverse.md
│ ├── ntctemplates.md
│ ├── ntctemplates_reverse.md
│ ├── pyats.md
│ ├── pyats_reverse.md
│ ├── pyntc.md
│ ├── pyntc_reverse.md
│ ├── running_config.md
│ ├── scrapli.md
│ └── scrapli_reverse.md
│ ├── lib_overview.md
│ ├── lib_upgrade_paths.md
│ ├── lib_use_cases.md
│ ├── lib_use_cases_acl.md
│ ├── lib_use_cases_jinja_filters.md
│ ├── lib_use_cases_lib_mapper.md
│ ├── lib_use_cases_nist.md
│ ├── lib_use_cases_os_version.md
│ └── lib_use_cases_protocol_mappers.md
├── example.invoke.yml
├── flat_postprocess
├── oui_postprocess.py
├── oui_postprocess.ts
├── protocol_number_postprocess.py
├── protocol_number_postprocess.ts
├── protocol_postprocess.py
└── protocol_postprocess.ts
├── mkdocs.yml
├── netutils
├── __init__.py
├── _private
│ └── version.py
├── acl.py
├── asn.py
├── bandwidth.py
├── banner.py
├── config
│ ├── __init__.py
│ ├── clean.py
│ ├── compliance.py
│ ├── conversion.py
│ ├── parser.py
│ └── utils.py
├── constants.py
├── data_files
│ ├── __init__.py
│ ├── oui_mappings.py
│ ├── protocol_mappings.py
│ └── protocol_number_mappings.py
├── dns.py
├── hash.py
├── interface.py
├── ip.py
├── lib_helpers.py
├── lib_mapper.py
├── mac.py
├── nist.py
├── os_version.py
├── password.py
├── ping.py
├── protocol_mapper.py
├── py.typed
├── regex.py
├── route.py
├── running_config.py
├── time.py
├── utils.py
└── vlan.py
├── poetry.lock
├── pyproject.toml
├── tasks.py
├── tests
├── __init__.py
├── integration
│ └── __init__.py
└── unit
│ ├── __init__.py
│ ├── conftest.py
│ ├── jinja2_template
│ └── test.j2
│ ├── mock
│ ├── config
│ │ ├── clean
│ │ │ ├── standard_received.txt
│ │ │ └── standard_sent.txt
│ │ ├── compliance
│ │ │ ├── compliance
│ │ │ │ ├── arista_eos
│ │ │ │ │ ├── eos_bad_banner_backup.txt
│ │ │ │ │ ├── eos_bad_banner_feature.py
│ │ │ │ │ ├── eos_bad_banner_intended.txt
│ │ │ │ │ ├── eos_bad_banner_received.json
│ │ │ │ │ ├── eos_basic_backup.txt
│ │ │ │ │ ├── eos_basic_feature.py
│ │ │ │ │ ├── eos_basic_intended.txt
│ │ │ │ │ └── eos_basic_received.json
│ │ │ │ ├── aruba_aoscx
│ │ │ │ │ ├── aoscx_basic_backup.txt
│ │ │ │ │ ├── aoscx_basic_feature.py
│ │ │ │ │ ├── aoscx_basic_intended.txt
│ │ │ │ │ └── aoscx_basic_received.json
│ │ │ │ ├── bigip_f5
│ │ │ │ │ ├── bigip_basic_backup.txt
│ │ │ │ │ ├── bigip_basic_feature.py
│ │ │ │ │ ├── bigip_basic_intended.txt
│ │ │ │ │ └── bigip_basic_received.json
│ │ │ │ ├── cisco_aireos
│ │ │ │ │ ├── aireos_basic_backup.txt
│ │ │ │ │ ├── aireos_basic_feature.py
│ │ │ │ │ ├── aireos_basic_intended.txt
│ │ │ │ │ └── aireos_basic_received.json
│ │ │ │ ├── cisco_asa
│ │ │ │ │ ├── asa_basic_backup.txt
│ │ │ │ │ ├── asa_basic_feature.py
│ │ │ │ │ ├── asa_basic_intended.txt
│ │ │ │ │ └── asa_basic_received.json
│ │ │ │ ├── cisco_ios
│ │ │ │ │ ├── ios_basic_backup.txt
│ │ │ │ │ ├── ios_basic_feature.py
│ │ │ │ │ ├── ios_basic_intended.txt
│ │ │ │ │ └── ios_basic_received.json
│ │ │ │ ├── cisco_iosxr
│ │ │ │ │ ├── iosxr_basic_backup.txt
│ │ │ │ │ ├── iosxr_basic_feature.py
│ │ │ │ │ ├── iosxr_basic_intended.txt
│ │ │ │ │ └── iosxr_basic_received.json
│ │ │ │ ├── cisco_nxos
│ │ │ │ │ ├── nxos_basic_backup.txt
│ │ │ │ │ ├── nxos_basic_feature.py
│ │ │ │ │ ├── nxos_basic_intended.txt
│ │ │ │ │ └── nxos_basic_received.json
│ │ │ │ ├── extreme_netiron
│ │ │ │ │ ├── netiron_basic_backup.txt
│ │ │ │ │ ├── netiron_basic_feature.py
│ │ │ │ │ ├── netiron_basic_intended.txt
│ │ │ │ │ └── netiron_basic_received.json
│ │ │ │ ├── fortinet_fortios
│ │ │ │ │ ├── fortios_backup.txt
│ │ │ │ │ ├── fortios_feature.py
│ │ │ │ │ ├── fortios_intended.txt
│ │ │ │ │ └── fortios_received.json
│ │ │ │ ├── hp_comware
│ │ │ │ │ ├── hp_comware_bad_banner_backup.txt
│ │ │ │ │ ├── hp_comware_bad_banner_feature.py
│ │ │ │ │ ├── hp_comware_bad_banner_intended.txt
│ │ │ │ │ ├── hp_comware_bad_banner_received.json
│ │ │ │ │ ├── hp_comware_basic_backup.txt
│ │ │ │ │ ├── hp_comware_basic_feature.py
│ │ │ │ │ ├── hp_comware_basic_intended.txt
│ │ │ │ │ └── hp_comware_basic_received.json
│ │ │ │ ├── juniper_junos
│ │ │ │ │ ├── junos_backup.txt
│ │ │ │ │ ├── junos_feature.py
│ │ │ │ │ ├── junos_intended.txt
│ │ │ │ │ └── junos_received.json
│ │ │ │ ├── mikrotik_routeros
│ │ │ │ │ ├── routeros_backup.txt
│ │ │ │ │ ├── routeros_feature.py
│ │ │ │ │ ├── routeros_intended.txt
│ │ │ │ │ └── routeros_received.json
│ │ │ │ ├── mrv_optiswitch
│ │ │ │ │ ├── optiswitch_basic_backup.txt
│ │ │ │ │ ├── optiswitch_basic_feature.py
│ │ │ │ │ ├── optiswitch_basic_intended.txt
│ │ │ │ │ └── optiswitch_basic_received.json
│ │ │ │ ├── netscaler
│ │ │ │ │ ├── netscaler_basic_backup.txt
│ │ │ │ │ ├── netscaler_basic_feature.py
│ │ │ │ │ ├── netscaler_basic_intended.txt
│ │ │ │ │ └── netscaler_basic_received.json
│ │ │ │ ├── nokia_sros
│ │ │ │ │ ├── sros_basic_backup.txt
│ │ │ │ │ ├── sros_basic_feature.py
│ │ │ │ │ ├── sros_basic_intended.txt
│ │ │ │ │ └── sros_basic_received.json
│ │ │ │ ├── paloalto_panos
│ │ │ │ │ ├── paloalto_backup.txt
│ │ │ │ │ ├── paloalto_feature.py
│ │ │ │ │ ├── paloalto_intended.txt
│ │ │ │ │ └── paloalto_received.json
│ │ │ │ ├── rad_etx
│ │ │ │ │ ├── etx_basic_backup.txt
│ │ │ │ │ ├── etx_basic_feature.py
│ │ │ │ │ ├── etx_basic_intended.txt
│ │ │ │ │ └── etx_basic_received.json
│ │ │ │ ├── ruckus_fastiron
│ │ │ │ │ ├── fastiron_basic_backup.txt
│ │ │ │ │ ├── fastiron_basic_feature.py
│ │ │ │ │ ├── fastiron_basic_intended.txt
│ │ │ │ │ └── fastiron_basic_received.json
│ │ │ │ └── ubiquiti_airos
│ │ │ │ │ ├── airos_backup.txt
│ │ │ │ │ ├── airos_feature.py
│ │ │ │ │ ├── airos_intended.txt
│ │ │ │ │ └── airos_received.json
│ │ │ ├── config_section_not_parsed
│ │ │ │ ├── arista_eos
│ │ │ │ │ ├── eos_basic_feature.py
│ │ │ │ │ ├── eos_basic_received.json
│ │ │ │ │ └── eos_basic_sent.txt
│ │ │ │ ├── bigip_f5
│ │ │ │ │ ├── bigipf5_basic_feature.py
│ │ │ │ │ ├── bigipf5_basic_received.json
│ │ │ │ │ └── bigipf5_basic_sent.txt
│ │ │ │ ├── cisco_aireos
│ │ │ │ │ ├── aireos_basic_feature.py
│ │ │ │ │ ├── aireos_basic_received.json
│ │ │ │ │ └── aireos_basic_sent.txt
│ │ │ │ ├── cisco_asa
│ │ │ │ │ ├── asa_basic_feature.py
│ │ │ │ │ ├── asa_basic_received.json
│ │ │ │ │ └── asa_basic_sent.txt
│ │ │ │ ├── cisco_ios
│ │ │ │ │ ├── ios_basic_feature.py
│ │ │ │ │ ├── ios_basic_received.json
│ │ │ │ │ └── ios_basic_sent.txt
│ │ │ │ ├── cisco_iosxr
│ │ │ │ │ ├── iosxr_basic_feature.py
│ │ │ │ │ ├── iosxr_basic_received.json
│ │ │ │ │ └── iosxr_basic_sent.txt
│ │ │ │ ├── cisco_nxos
│ │ │ │ │ ├── nxos_basic_feature.py
│ │ │ │ │ ├── nxos_basic_received.json
│ │ │ │ │ └── nxos_basic_sent.txt
│ │ │ │ ├── juniper_junos
│ │ │ │ │ ├── _basic_feature.py
│ │ │ │ │ ├── _basic_received.json
│ │ │ │ │ └── _basic_sent.txt
│ │ │ │ ├── mikrotik_routeros
│ │ │ │ │ ├── routeros_feature.py
│ │ │ │ │ ├── routeros_received.json
│ │ │ │ │ └── routeros_sent.txt
│ │ │ │ ├── nokia_sros
│ │ │ │ │ ├── sros_feature.py
│ │ │ │ │ ├── sros_received.json
│ │ │ │ │ └── sros_sent.txt
│ │ │ │ └── paloalto_panos
│ │ │ │ │ ├── panos_feature.py
│ │ │ │ │ ├── panos_received.json
│ │ │ │ │ └── panos_sent.txt
│ │ │ ├── diff_network_config
│ │ │ │ ├── arista_eos
│ │ │ │ │ ├── eos_basic_base.txt
│ │ │ │ │ ├── eos_basic_intended.txt
│ │ │ │ │ └── eos_basic_received.txt
│ │ │ │ ├── bigip_f5
│ │ │ │ │ ├── bigipf5_basic_base.txt
│ │ │ │ │ ├── bigipf5_basic_intended.txt
│ │ │ │ │ └── bigipf5_basic_received.txt
│ │ │ │ ├── cisco_aireos
│ │ │ │ │ ├── aireos_basic_base.txt
│ │ │ │ │ ├── aireos_basic_intended.txt
│ │ │ │ │ └── aireos_basic_received.txt
│ │ │ │ ├── cisco_asa
│ │ │ │ │ ├── asa_basic_base.txt
│ │ │ │ │ ├── asa_basic_intended.txt
│ │ │ │ │ └── asa_basic_received.txt
│ │ │ │ ├── cisco_ios
│ │ │ │ │ ├── ios_basic_base.txt
│ │ │ │ │ ├── ios_basic_intended.txt
│ │ │ │ │ └── ios_basic_received.txt
│ │ │ │ ├── cisco_iosxr
│ │ │ │ │ ├── iosxr_basic_base.txt
│ │ │ │ │ ├── iosxr_basic_intended.txt
│ │ │ │ │ └── iosxr_basic_received.txt
│ │ │ │ ├── cisco_nxos
│ │ │ │ │ ├── nxos_basic_base.txt
│ │ │ │ │ ├── nxos_basic_intended.txt
│ │ │ │ │ └── nxos_basic_received.txt
│ │ │ │ ├── juniper_junos
│ │ │ │ │ ├── _basic_base.txt
│ │ │ │ │ ├── _basic_intended.txt
│ │ │ │ │ └── _basic_received.txt
│ │ │ │ ├── nokia_sros
│ │ │ │ │ ├── sros_base.txt
│ │ │ │ │ ├── sros_intended.txt
│ │ │ │ │ └── sros_received.txt
│ │ │ │ └── paloalto_panos
│ │ │ │ │ ├── panos_basic_base.txt
│ │ │ │ │ ├── panos_basic_intended.txt
│ │ │ │ │ └── panos_basic_received.txt
│ │ │ ├── feature_compliance
│ │ │ │ ├── ios_basic_actual.txt
│ │ │ │ ├── ios_basic_feature.py
│ │ │ │ ├── ios_basic_intended.txt
│ │ │ │ ├── ios_basic_received.py
│ │ │ │ ├── ios_dual_banner_actual.txt
│ │ │ │ ├── ios_dual_banner_exec_actual.txt
│ │ │ │ ├── ios_dual_banner_exec_feature.py
│ │ │ │ ├── ios_dual_banner_exec_intended.txt
│ │ │ │ ├── ios_dual_banner_exec_received.py
│ │ │ │ ├── ios_dual_banner_feature.py
│ │ │ │ ├── ios_dual_banner_intended.txt
│ │ │ │ ├── ios_dual_banner_motd_actual.txt
│ │ │ │ ├── ios_dual_banner_motd_feature.py
│ │ │ │ ├── ios_dual_banner_motd_intended.txt
│ │ │ │ ├── ios_dual_banner_motd_received.py
│ │ │ │ ├── ios_dual_banner_received.py
│ │ │ │ ├── ios_empty_banner_actual.txt
│ │ │ │ ├── ios_empty_banner_feature.py
│ │ │ │ ├── ios_empty_banner_intended.txt
│ │ │ │ ├── ios_empty_banner_received.py
│ │ │ │ ├── ios_empty_both_actual.txt
│ │ │ │ ├── ios_empty_both_feature.py
│ │ │ │ ├── ios_empty_both_intended.txt
│ │ │ │ ├── ios_empty_both_received.py
│ │ │ │ ├── ios_empty_dst_actual.txt
│ │ │ │ ├── ios_empty_dst_feature.py
│ │ │ │ ├── ios_empty_dst_intended.txt
│ │ │ │ ├── ios_empty_dst_received.py
│ │ │ │ ├── ios_empty_src_actual.txt
│ │ │ │ ├── ios_empty_src_feature.py
│ │ │ │ ├── ios_empty_src_intended.txt
│ │ │ │ └── ios_empty_src_received.py
│ │ │ ├── find_unordered_cfg_lines
│ │ │ │ ├── ios_basic_actual.txt
│ │ │ │ ├── ios_basic_intended.txt
│ │ │ │ ├── ios_basic_received.py
│ │ │ │ ├── ios_unordered_actual.txt
│ │ │ │ ├── ios_unordered_intended.txt
│ │ │ │ └── ios_unordered_received.py
│ │ │ └── section
│ │ │ │ ├── arista_eos
│ │ │ │ ├── eos_full_feature.py
│ │ │ │ ├── eos_full_received.txt
│ │ │ │ └── eos_full_sent.txt
│ │ │ │ ├── bigip_f5
│ │ │ │ ├── bigip_full_feature.py
│ │ │ │ ├── bigip_full_received.txt
│ │ │ │ └── bigip_full_sent.txt
│ │ │ │ ├── cisco_aireos
│ │ │ │ ├── aireos_full_feature.py
│ │ │ │ ├── aireos_full_received.txt
│ │ │ │ └── aireos_full_sent.txt
│ │ │ │ ├── cisco_asa
│ │ │ │ ├── asa_basic_feature.py
│ │ │ │ ├── asa_basic_received.txt
│ │ │ │ ├── asa_basic_sent.txt
│ │ │ │ ├── asa_full_feature.py
│ │ │ │ ├── asa_full_received.txt
│ │ │ │ └── asa_full_sent.txt
│ │ │ │ ├── cisco_ios
│ │ │ │ ├── ios_basic_feature.py
│ │ │ │ ├── ios_basic_received.txt
│ │ │ │ ├── ios_basic_sent.txt
│ │ │ │ ├── ios_full_feature.py
│ │ │ │ ├── ios_full_received.txt
│ │ │ │ └── ios_full_sent.txt
│ │ │ │ ├── cisco_iosxr
│ │ │ │ ├── iosxr_basic_feature.py
│ │ │ │ ├── iosxr_basic_received.txt
│ │ │ │ ├── iosxr_basic_sent.txt
│ │ │ │ ├── iosxr_full_feature.py
│ │ │ │ ├── iosxr_full_received.txt
│ │ │ │ └── iosxr_full_sent.txt
│ │ │ │ ├── cisco_nxos
│ │ │ │ ├── nxos_full_feature.py
│ │ │ │ ├── nxos_full_received.txt
│ │ │ │ ├── nxos_full_sent.txt
│ │ │ │ ├── nxos_none_feature.py
│ │ │ │ ├── nxos_none_received.txt
│ │ │ │ └── nxos_none_sent.txt
│ │ │ │ ├── juniper_junos
│ │ │ │ ├── junos_full_feature.py
│ │ │ │ ├── junos_full_received.txt
│ │ │ │ └── junos_full_sent.txt
│ │ │ │ ├── nokia_sros
│ │ │ │ ├── sros_basic_feature.py
│ │ │ │ ├── sros_basic_received.txt
│ │ │ │ ├── sros_basic_sent.txt
│ │ │ │ ├── sros_full_feature.py
│ │ │ │ ├── sros_full_received.txt
│ │ │ │ └── sros_full_sent.txt
│ │ │ │ └── paloalto_panos
│ │ │ │ ├── panos_full_feature.py
│ │ │ │ ├── panos_full_received.txt
│ │ │ │ └── panos_full_sent.txt
│ │ ├── conversion
│ │ │ └── paloalto_panos
│ │ │ │ ├── paloalto_basic_converted.txt
│ │ │ │ └── paloalto_basic_sent.txt
│ │ ├── parser
│ │ │ ├── base
│ │ │ │ ├── arista_eos
│ │ │ │ │ ├── eos_full_received.py
│ │ │ │ │ └── eos_full_sent.txt
│ │ │ │ ├── aruba_aoscx
│ │ │ │ │ ├── aoscx_full_received.py
│ │ │ │ │ └── aoscx_full_sent.txt
│ │ │ │ ├── aruba_os
│ │ │ │ │ ├── os_full_received.py
│ │ │ │ │ └── os_full_sent.txt
│ │ │ │ ├── bigip_f5
│ │ │ │ │ ├── bigip_full_received.py
│ │ │ │ │ └── bigip_full_sent.txt
│ │ │ │ ├── cisco_aireos
│ │ │ │ │ ├── aireos_full_received.py
│ │ │ │ │ └── aireos_full_sent.txt
│ │ │ │ ├── cisco_asa
│ │ │ │ │ ├── asa_full_received.py
│ │ │ │ │ ├── asa_full_sent.txt
│ │ │ │ │ ├── asa_nested_banner_received.py
│ │ │ │ │ └── asa_nested_banner_sent.txt
│ │ │ │ ├── cisco_ios
│ │ │ │ │ ├── ios_banner_newline_received.py
│ │ │ │ │ ├── ios_banner_newline_sent.txt
│ │ │ │ │ ├── ios_dual_banner_received.py
│ │ │ │ │ ├── ios_dual_banner_sent.txt
│ │ │ │ │ ├── ios_empty_banner_received.py
│ │ │ │ │ ├── ios_empty_banner_sent.txt
│ │ │ │ │ ├── ios_full_received.py
│ │ │ │ │ └── ios_full_sent.txt
│ │ │ │ ├── cisco_iosxr
│ │ │ │ │ ├── iosxr_full_received.py
│ │ │ │ │ └── iosxr_full_sent.txt
│ │ │ │ ├── cisco_nxos
│ │ │ │ │ ├── nxos_full_received.py
│ │ │ │ │ └── nxos_full_sent.txt
│ │ │ │ ├── extreme_netiron
│ │ │ │ │ ├── netiron_full_received.py
│ │ │ │ │ └── netiron_full_sent.txt
│ │ │ │ ├── fortinet_fortios
│ │ │ │ │ ├── fortios_full_received.py
│ │ │ │ │ └── fortios_full_sent.txt
│ │ │ │ ├── hp_comware
│ │ │ │ │ ├── hp_comware_received.py
│ │ │ │ │ └── hp_comware_sent.txt
│ │ │ │ ├── juniper_junos
│ │ │ │ │ ├── junos_full_received.py
│ │ │ │ │ └── junos_full_sent.txt
│ │ │ │ ├── mikrotik_routeros
│ │ │ │ │ ├── routeros_full_received.py
│ │ │ │ │ └── routeros_full_sent.txt
│ │ │ │ ├── mrv_optiswitch
│ │ │ │ │ ├── optiswitch_full_received.py
│ │ │ │ │ └── optiswitch_full_sent.txt
│ │ │ │ ├── netscaler
│ │ │ │ │ ├── netscaler_full_received.py
│ │ │ │ │ └── netscaler_full_sent.txt
│ │ │ │ ├── nokia_sros
│ │ │ │ │ ├── sros_baseconfig_received.py
│ │ │ │ │ ├── sros_baseconfig_sent.txt
│ │ │ │ │ ├── sros_full_received.py
│ │ │ │ │ └── sros_full_sent.txt
│ │ │ │ ├── nvidia_onyx
│ │ │ │ │ ├── onyx_full_received.py
│ │ │ │ │ └── onyx_full_sent.txt
│ │ │ │ ├── paloalto_panos
│ │ │ │ │ ├── panos_basic_received.py
│ │ │ │ │ ├── panos_basic_sent.txt
│ │ │ │ │ ├── panos_basic_set_received.py
│ │ │ │ │ ├── panos_basic_set_sent.txt
│ │ │ │ │ ├── panos_full_received.py
│ │ │ │ │ └── panos_full_sent.txt
│ │ │ │ ├── rad_etx
│ │ │ │ │ ├── etx_full_received.py
│ │ │ │ │ └── etx_full_sent.txt
│ │ │ │ ├── ruckus_fastiron
│ │ │ │ │ ├── fastiron_full_received.py
│ │ │ │ │ └── fastiron_full_sent.txt
│ │ │ │ └── ubiquiti_airos
│ │ │ │ │ ├── airos_full_received.py
│ │ │ │ │ └── airos_full_sent.txt
│ │ │ ├── find_all_children
│ │ │ │ └── cisco_ios
│ │ │ │ │ ├── ios_full_args.json
│ │ │ │ │ ├── ios_full_received.txt
│ │ │ │ │ ├── ios_full_sent.txt
│ │ │ │ │ ├── ios_re_args.json
│ │ │ │ │ ├── ios_re_received.txt
│ │ │ │ │ ├── ios_re_sent.txt
│ │ │ │ │ ├── ios_starts_args.json
│ │ │ │ │ ├── ios_starts_received.txt
│ │ │ │ │ └── ios_starts_sent.txt
│ │ │ └── find_children_w_parents
│ │ │ │ └── cisco_ios
│ │ │ │ ├── ios_full_args.json
│ │ │ │ ├── ios_full_received.txt
│ │ │ │ └── ios_full_sent.txt
│ │ └── sanitize
│ │ │ ├── all_received.txt
│ │ │ ├── all_sent.txt
│ │ │ └── paloalto_panos
│ │ │ ├── panos_clean_sanitized.txt
│ │ │ ├── panos_clean_sent.txt
│ │ │ ├── panos_dirty_sanitized.txt
│ │ │ └── panos_dirty_sent.txt
│ └── vlan
│ │ ├── to_config
│ │ ├── dup_unordered_line_received.json
│ │ ├── dup_unordered_line_sent.json
│ │ ├── empty_list.json
│ │ ├── empty_list_received.json
│ │ ├── larger_grouping_size_received.json
│ │ ├── larger_grouping_size_sent.json
│ │ ├── min_vlan_group_size_one_received.json
│ │ ├── min_vlan_group_size_one_sent.json
│ │ ├── min_vlan_group_size_two_received.json
│ │ ├── min_vlan_group_size_two_sent.json
│ │ ├── one_line_received.json
│ │ ├── one_line_sent.json
│ │ ├── smaller_lines_received.json
│ │ ├── smaller_lines_sent.json
│ │ ├── two_line_received.json
│ │ └── two_line_sent.json
│ │ └── to_list
│ │ ├── multi_line_received.json
│ │ ├── multi_line_sent.txt
│ │ ├── one_line_received.json
│ │ └── one_line_sent.txt
│ ├── test_acl.py
│ ├── test_asn.py
│ ├── test_bandwidth.py
│ ├── test_banner.py
│ ├── test_basics.py
│ ├── test_compliance.py
│ ├── test_config_clean.py
│ ├── test_conversion.py
│ ├── test_dns.py
│ ├── test_docs.py
│ ├── test_hash.py
│ ├── test_interface.py
│ ├── test_ip.py
│ ├── test_lib_helpers.py
│ ├── test_lib_helpers_optionals.py
│ ├── test_lib_mapper.py
│ ├── test_mac.py
│ ├── test_nist.py
│ ├── test_os_versions.py
│ ├── test_parser.py
│ ├── test_password.py
│ ├── test_ping.py
│ ├── test_private_version.py
│ ├── test_protocol_mapper.py
│ ├── test_regex.py
│ ├── test_route.py
│ ├── test_running_config.py
│ ├── test_sanitize.py
│ ├── test_time.py
│ ├── test_utils.py
│ ├── test_version.py
│ └── test_vlan.py
└── towncrier_template.j2
/.cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "cookiecutter": {
3 | "codeowner_github_usernames": "@itdependsnetworks @jeffkala @qduk",
4 | "full_name": "Network to Code, LLC",
5 | "email": "info@networktocode.com",
6 | "github_org": "networktocode",
7 | "description": "Common helper functions useful in network automation.",
8 | "project_name": "netutils",
9 | "project_slug": "netutils",
10 | "repo_url": "https://github.com/networktocode/netutils",
11 | "base_url": "netutils",
12 | "project_python_name": "netutils",
13 | "project_python_base_version": "3.9",
14 | "project_with_config_settings": "no",
15 | "generate_docs": "yes",
16 | "version": "1.15.1",
17 | "_drift_manager": {
18 | "template": "https://github.com/networktocode-llc/cookiecutter-ntc.git",
19 | "template_dir": "python",
20 | "template_ref": "main",
21 | "cookie_dir": "",
22 | "branch_prefix": "drift-manager",
23 | "pull_request_strategy": "create",
24 | "post_actions": [],
25 | "draft": false,
26 | "baked_commit_ref": "cb8b5e31dece5ab2663d2ffd218a96ca1ae794c5"
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | # Docker related
2 | development/Dockerfile
3 | development/docker-compose*.yml
4 | development/*.env
5 | *.env
6 | environments/
7 | Dockerfile
8 | docker-compose.yml
9 | .env
10 |
11 | # Python
12 | **/*.pyc
13 | **/*.pyo
14 | **/__pycache__/
15 | **/.pytest_cache/
16 | **/.venv/
17 |
18 |
19 | # Other
20 | docs/_build
21 | FAQ.md
22 | .git/
23 | .gitignore
24 | .github
25 | tasks.py
26 | LICENSE
27 | **/*.log
28 | **/.vscode/
29 | invoke*.yml
30 | tasks.py
31 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Default owner(s) of all files in this repository
2 | * @itdependsnetworks @jeffkala @qduk
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 🐛 Bug Report
3 | about: Report a reproducible bug in the current release of netutils
4 | ---
5 |
6 | ### Environment
7 | * Python version:
8 | * netutils version:
9 |
10 |
11 | ### Expected Behavior
12 |
13 |
14 |
15 | ### Observed Behavior
16 |
17 |
21 | ### Steps to Reproduce
22 | 1.
23 | 2.
24 | 3.
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: ✨ Feature Request
3 | about: Propose a new feature or enhancement
4 |
5 | ---
6 |
7 | ### Environment
8 | * netutils version:
9 |
10 |
13 | ### Proposed Functionality
14 |
15 |
20 | ### Use Case
21 |
22 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ## New Pull Request
2 |
3 | Have you:
4 | - [ ] Updated the README if necessary?
5 | - [ ] Updated any configuration settings?
6 | - [ ] Written a unit test?
7 |
8 | ## Change Notes
9 |
10 | ## Justification
11 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | ---
2 | version: 2
3 | updates:
4 | - package-ecosystem: "pip"
5 | directory: "/"
6 | schedule:
7 | interval: "weekly"
8 | allow:
9 | - dependency-type: "direct"
10 |
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # .readthedocs.yaml
3 | # Read the Docs configuration file
4 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
5 |
6 | # Required
7 | version: 2
8 |
9 | # Setup the build environment.
10 | build:
11 | os: "ubuntu-lts-latest"
12 | tools:
13 | python: "3.12"
14 | jobs:
15 | post_install:
16 | # Install poetry
17 | # https://python-poetry.org/docs/#installing-manually
18 | - "pip install poetry"
19 | # Install dependencies 'docs' dependency group
20 | # https://python-poetry.org/docs/managing-dependencies/#dependency-groups
21 | # VIRTUAL_ENV needs to be set manually for now.
22 | # See https://github.com/readthedocs/readthedocs.org/pull/11152/
23 | - "VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --only docs"
24 |
25 | mkdocs:
26 | configuration: "mkdocs.yml"
27 | fail_on_warning: true
28 |
--------------------------------------------------------------------------------
/.yamllint.yml:
--------------------------------------------------------------------------------
1 | ---
2 | extends: "default"
3 | rules:
4 | comments:
5 | min-spaces-from-content: 1
6 | empty-values: "enable"
7 | indentation:
8 | indent-sequences: "consistent"
9 | line-length: "disable"
10 | quoted-strings:
11 | quote-type: "double"
12 | ignore: |
13 | .venv/
14 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG PYTHON_VER="3.9"
2 |
3 | FROM python:${PYTHON_VER}-slim
4 |
5 | # Install Poetry manually via its installer script;
6 | # if we instead used "pip install poetry" it would install its own dependencies globally which may conflict with ours.
7 | # https://python-poetry.org/docs/master/#installing-with-the-official-installer
8 | # This also makes it so that Poetry will *not* be included in the "final" image since it's not installed to /usr/local/
9 | ARG POETRY_HOME=/opt/poetry
10 | ARG POETRY_INSTALLER_PARALLEL=true
11 | ARG POETRY_VERSION=2.1.3
12 | ARG POETRY_VIRTUALENVS_CREATE=false
13 | ADD https://install.python-poetry.org /tmp/install-poetry.py
14 | RUN python /tmp/install-poetry.py
15 |
16 | # Add poetry install location to the $PATH
17 | ENV PATH="${POETRY_HOME}/bin:${PATH}"
18 |
19 | RUN poetry config virtualenvs.create ${POETRY_VIRTUALENVS_CREATE} && \
20 | poetry config installer.parallel "${POETRY_INSTALLER_PARALLEL}"
21 |
22 | WORKDIR /local
23 | COPY . /local
24 |
25 | # Install the app
26 | RUN poetry install --with dev --all-extras
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache Software License 2.0
2 |
3 | Copyright (c) 2021-2025, Network to Code, LLC
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
--------------------------------------------------------------------------------
/changes/+main.housekeeping:
--------------------------------------------------------------------------------
1 | Rebaked from the cookie `main`.
2 |
--------------------------------------------------------------------------------
/changes/.gitignore:
--------------------------------------------------------------------------------
1 | !.gitignore
2 |
--------------------------------------------------------------------------------
/changes/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/changes/.gitkeep
--------------------------------------------------------------------------------
/changes/723.fixed:
--------------------------------------------------------------------------------
1 | Fix the GitHub release failures occurring in CI.
--------------------------------------------------------------------------------
/docs/admin/install.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | Option 1: Install from PyPI.
4 |
5 | ```bash
6 | $ pip install netutils
7 | ```
8 |
9 | Option 2: Install from PyPI with optional requirements.
10 |
11 | ```bash
12 | $ pip install netutils[napalm]
13 | pip install netutils
14 | ```
15 |
16 | Option 3: Manually install via Poetry.
17 |
18 | ```bash
19 | git clone https://github.com/networktocode/netutils.git
20 | cd netutils
21 | curl -sSL https://install.python-poetry.org | python3 -
22 | poetry install
23 | ```
24 |
25 | Option 4: Install from a GitHub branch, such as develop as shown below.
26 |
27 | ```bash
28 | $ pip install git+https://github.com/networktocode/netutils.git@develop
29 | ```
30 |
31 | ### Optional Dependencies
32 | One of the requirements of this library is to avoid having dependencies; however, including a few optional dependencies in an opt in fashion allows `netutils` to remain lean while offering some powerful addons.
33 |
34 | Installing the optional dependencies is only needed when the user needs access to the functions using the dependencies. As an example `get_napalm_getters()` which will provide a mapping of available NAPALM getters based on currently installed NAPALM libraries, if NAPALM is not installed the function simply raises an exception and warns the user that the library is not installed.
35 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/index.md:
--------------------------------------------------------------------------------
1 | # Release Notes
2 |
3 | All the published release notes can be found via the navigation menu. All patch releases are included in the same minor release (e.g. `v1.2`) document.
4 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_0.1.md:
--------------------------------------------------------------------------------
1 | # v0.1 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Initial Release
6 |
7 | ## [v0.1.1] - 2021-05
8 |
9 | ### Added
10 |
11 | - Update travis configuration to release a new version from CI/CD pipeline.
12 |
13 | ## [v0.1.0] - 2021-03-19
14 |
15 | - Initial release.
16 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.0.md:
--------------------------------------------------------------------------------
1 | # v1.0 Release Notes
2 |
3 |
4 | ## Release Overview
5 |
6 | - Commit to SemVer
7 | - F5 fixes
8 |
9 | ## v1.0.0 - 2021-11
10 |
11 | ### Added
12 |
13 | - [#69](https://github.com/networktocode/netutils/issues/69) Normalise banner delimiter for IOS to ^C & support parsing delimiter ^.
14 |
15 | ### Fixed
16 |
17 | - [#79](https://github.com/networktocode/netutils/issues/79) F5 parser fix for irules with multiline single command lines.
18 |
19 | ### Removed
20 |
21 | - [#83](https://github.com/networktocode/netutils/issues/83) Remove support for old function 'is_fqdn_valid' as prep for 1.0.0.
22 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.1.md:
--------------------------------------------------------------------------------
1 | # v1.1 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added Nokia SrOS
6 |
7 | ## [v1.1.0] - 2022-04
8 |
9 | ### Added
10 |
11 | - [#90](https://github.com/networktocode/netutils/issues/90) Uptime Conversions.
12 | - [#102](https://github.com/networktocode/netutils/issues/102) Add Ansible mapping for Nokia SrOS.
13 | - [#105](https://github.com/networktocode/netutils/issues/105) Add min_grouping_sizing to vlanlist_to_config method.
14 | - [#106](https://github.com/networktocode/netutils/issues/106) Add Nokia SrOS Config Parser.
15 |
16 | ### Changed
17 |
18 | - [#104](https://github.com/networktocode/netutils/issues/104) Optimize vlanconfig_to_list using builtin Regex methods.
19 |
20 | ### Fixed
21 |
22 | - [#99](https://github.com/networktocode/netutils/issues/99) Fixed decimal place in bits_to_name.
23 | - [#107](https://github.com/networktocode/netutils/issues/107) Fix issue when backup or intended is empty.
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.10.md:
--------------------------------------------------------------------------------
1 | # v1.10 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added Functionality to ip_network filter to support method calls with kwargs.
6 | - Fix configuration parsers to allow newlines, no longer auto strip all newlines.
7 |
8 | ## [v1.10.0] 2024-09
9 |
10 | ### Added
11 | - [534](https://github.com/networktocode/netutils/pull/534) Extend ip_network extension to support method calls with kwargs.
12 |
13 | ### Changed
14 | - [570](https://github.com/networktocode/netutils/pull/570) OUI File Updates.
15 | - [571](https://github.com/networktocode/netutils/pull/571) PROTOCOL File Updates.
16 |
17 | ### Fixed
18 |
19 | - [569](https://github.com/networktocode/netutils/pull/569) Fix banner parsers auto striping all newlines. Allow newlines in banners.
20 | - [574](https://github.com/networktocode/netutils/pull/574) Fix ntc_template reverse mapping for cisco xe.
21 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.11.md:
--------------------------------------------------------------------------------
1 | # v1.11 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Release is the same as v1.10.1
6 |
7 | ## [v1.11.0] 2024-12
8 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.12.md:
--------------------------------------------------------------------------------
1 | # v1.12 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added Python 3.13 support.
6 | - Removed Python 3.8 support.
7 |
8 | ## [v1.12.0] 2025-01
9 |
10 | ### Added
11 | - [593](https://github.com/networktocode/netutils/pull/593) Add nokia_srl to the mappers.
12 |
13 | ### Changed
14 |
15 | - [603](https://github.com/networktocode/netutils/pull/603) Add support for Python 3.8 and add Python 3.13.
16 |
17 | ### Fixed
18 |
19 | - [602](https://github.com/networktocode/netutils/pull/602) Fix ASA banner config parsing.
20 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.13.md:
--------------------------------------------------------------------------------
1 | # v1.13 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added is_reversible_wildcardmask, netmask_to_wildcardmask, and wildcardmask_to_netmask functions.
6 | - Added aruba_os and aruba_osswitch parsers.
7 |
8 | ## [v1.13.0] 2025-03
9 |
10 | ### Added
11 |
12 | - [616](https://github.com/networktocode/netutils/pull/616) Added is_reversible_wildcardmask, netmask_to_wildcardmask, and wildcardmask_to_netmask functions.
13 | - [620](https://github.com/networktocode/netutils/pull/620) Add cisco_wlc_ssh mapping to ntctemplates lib mapper.
14 | - [632](https://github.com/networktocode/netutils/pull/632) Added aruba_os and aruba_osswitch parsers.
15 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.14.md:
--------------------------------------------------------------------------------
1 | # v1.14 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Library mapping updates and fixes.
6 | - NIST library updates and fixes for CVE reporting.
7 | - Documentation fixes.
8 | - Palo Alto brace configuration fixes.
9 |
10 | ## [v1.14.0] 2025-07
11 |
12 | ### Added
13 |
14 | - [644](https://github.com/networktocode/netutils/pull/644) Add ability to get the lib mapper in a os centric view versus a lib centric view.
15 | - [646](https://github.com/networktocode/netutils/pull/646) Add Additional SROS Tests.
16 | - [649](https://github.com/networktocode/netutils/pull/649) Add RUNNING_CONFIG_MAPPER to help map platform to running configuration command.
17 |
18 | ### Changed
19 |
20 | - [652](https://github.com/networktocode/netutils/pull/652) Flatbot OUI File Updates.
21 | - [653](https://github.com/networktocode/netutils/pull/653) Flatbot PROTOCOL File Updates.
22 | - [662](https://github.com/networktocode/netutils/pull/662) NIST library updates and fixes.
23 |
24 | ### Fixed
25 |
26 | - [640](https://github.com/networktocode/netutils/pull/640) Fix documentation issues.
27 | - [641](https://github.com/networktocode/netutils/pull/641) Fix documentation for Jinja examples.
28 | - [651](https://github.com/networktocode/netutils/pull/651) Fix Palo set format config parsing for curly brace.
29 |
30 | ## [v1.14.1] 2025-07
31 |
32 | ### Changed
33 |
34 | - [672](https://github.com/networktocode/netutils/pull/672) Update running configuration commands to be full versions. Flatbot OUI and PROTOCOL file updates.
35 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.15.md:
--------------------------------------------------------------------------------
1 |
2 | # v1.15 Release Notes
3 |
4 | This document describes all new features and changes in the release. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5 |
6 | ## Release Overview
7 |
8 | - Add parser support for Rad ETX.
9 | - Update the library to the NTC 2025 development standards.
10 |
11 | ## [v1.15.1 (2025-10-20)](https://github.com/networktocode/netutils/releases/tag/v1.15.1)
12 |
13 | ### Added
14 |
15 | - [#704](https://github.com/networktocode/netutils/issues/704) - Added show running config mapper for 22 additional operating systems.
16 |
17 | ## [v1.15.0 (2025-09-05)](https://github.com/networktocode/netutils/releases/tag/v1.15.0)
18 |
19 | ### Added
20 |
21 | - [#692](https://github.com/networktocode/netutils/issues/692) - Add Rad ETX config parser.
22 |
23 | ### Housekeeping
24 |
25 | - [#675](https://github.com/networktocode/netutils/issues/675) - Replaced black, bandit, flake8 and pydocstyle with ruff.
26 | - [#675](https://github.com/networktocode/netutils/issues/675) - Updated tasks.py with newest task list.
27 | - [#675](https://github.com/networktocode/netutils/issues/675) - Updated to using pyinvoke for development environment definition.
28 | - Fix CI for Flatbot to install Ruff and remove black.
29 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.2.md:
--------------------------------------------------------------------------------
1 | # v1.2 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added type hints and mypy testing
6 | - Encrypt type7 updated
7 |
8 |
9 | ## [v1.2.0] - 2022-08
10 |
11 | ### Added
12 |
13 | - [#128](https://github.com/networktocode/netutils/issues/128) Documentation for Nokia SROS duplicate lines/duplicate line detection
14 | - [#138](https://github.com/networktocode/netutils/issues/138) Added nxos_ssh to Napalm mapper
15 |
16 | ### Changed
17 |
18 | - [#113](https://github.com/networktocode/netutils/issues/113) Updated lib mapping docs
19 | - [#115](https://github.com/networktocode/netutils/issues/115) Switched build backend to poetry-core
20 | - [#121](https://github.com/networktocode/netutils/issues/121) Update banner parsing for EOS
21 | - [#129](https://github.com/networktocode/netutils/issues/129) Add type hints to the whole project and mypy testing setup and CI
22 | - [#134](https://github.com/networktocode/netutils/issues/134) Updated CODEOWNERS
23 |
24 | ### Fixed
25 |
26 | - [#122](https://github.com/networktocode/netutils/issues/122) Fixed encrypt type7
27 |
28 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.3.md:
--------------------------------------------------------------------------------
1 | # v1.3 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added IOS Config parsing for get_path and get_path_with_children methods.
6 | - Added OUI mappings and built a `flat ci` process to manage freshness of data.
7 | - Added first getter feature with Napalm Getter feature.
8 | - Converted to mkdocs docs.
9 | - Added Citrix NetScaler Parser.
10 | - Removed support for Python 3.6.
11 |
12 | ## [v1.3.0] - 2022-11
13 |
14 | ### Added
15 |
16 | - [#146](https://github.com/networktocode/netutils/pull/146) Added IOS Config parsing for get_path and get_path_with_children methods.
17 | - [#148](https://github.com/networktocode/netutils/pull/148) Added OUI mappings and built a `flat ci` process to manage freshness of data.
18 | - [#149](https://github.com/networktocode/netutils/pull/149) Added first getter feature with Napalm Getter feature.
19 | - [#153](https://github.com/networktocode/netutils/pull/153) Added Citrix NetScaler Parser.
20 |
21 | ### Changed
22 |
23 | - [#152](https://github.com/networktocode/netutils/pull/152) Converted to mkdocs docs.
24 | - [#154](https://github.com/networktocode/netutils/pull/154) Update testing mock strategy for config parsers.
25 | - [#155](https://github.com/networktocode/netutils/pull/155) Update links to render properly on rtd and pypi.
26 | - [#159](https://github.com/networktocode/netutils/pull/159) Change how dunder version is created.
27 |
28 | ### Removed
29 |
30 | - [#152](https://github.com/networktocode/netutils/pull/152) Removed support for Python 3.6.
31 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.7.md:
--------------------------------------------------------------------------------
1 | # v1.7 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added the ability to hash a value via `hash_data` function.
6 | - Added the ability to sort IPs a value via `get_ips_sorted` function.
7 | - Added lib_mapper entries for `ruckus_smartzone`, `cisco_xe`, `huawei` and `cisco_xr`.
8 |
9 | ## [v1.7.0] - 2024-03
10 |
11 | ### Added
12 |
13 | - [#373](https://github.com/networktocode/netutils/pull/373) Added the ability to hash a value via `hash_data` function.
14 | - [#374](https://github.com/networktocode/netutils/pull/374) Added `ruckus_smartzone` to lib_mapper.
15 | - [#451](https://github.com/networktocode/netutils/pull/451) Added `forward` mappings.
16 | - [#473](https://github.com/networktocode/netutils/pull/473) Added the ability to sort IPs a value via `get_ips_sorted` function.
17 |
18 | ### Changed
19 |
20 | - [#369](https://github.com/networktocode/netutils/pull/369) Update doc string example to include the import statement.
21 | - [#429](https://github.com/networktocode/netutils/pull/429) Updated `cisco_xe` mappings.
22 | - [#443](https://github.com/networktocode/netutils/pull/443) Updated `ansible` platform mappers.
23 | - [#466](https://github.com/networktocode/netutils/pull/466) Improve performance of jinja2_convenience_function by not importing NAPALM when called.
24 |
25 | ### Fixed
26 |
27 | - [#429](https://github.com/networktocode/netutils/pull/429) Fixed `huawei` and `cisco_xr` mapping.
28 | - [#445](https://github.com/networktocode/netutils/pull/445) Fixed dual banner issue.
29 |
--------------------------------------------------------------------------------
/docs/admin/release_notes/version_1.9.md:
--------------------------------------------------------------------------------
1 | # v1.9 Release Notes
2 |
3 | ## Release Overview
4 |
5 | - Added NIST URL creation and platform mapper.
6 | - Added DNA Center platform mappings.
7 | - Improved error message when duplicate line is parsed.
8 |
9 | ## [v1.9.1] 2024-08
10 |
11 | ### Changed
12 |
13 | - [557](https://github.com/networktocode/netutils/pull/557) OUI File Updates.
14 | - [558](https://github.com/networktocode/netutils/pull/558) PROTOCOL File Updates.
15 |
16 | ### Fixed
17 |
18 | - [553](https://github.com/networktocode/netutils/pull/553) Fixes incorrect cisco_xe to ntc-templates library mapping.
19 |
20 | ## [v1.9.0] 2024-07
21 |
22 | ### Added
23 |
24 | - [489](https://github.com/networktocode/netutils/pull/489) Added NIST URL creation and platform mapper.
25 | - [519](https://github.com/networktocode/netutils/pull/519) Added DNA Center forward and reverse platform mappings.
26 |
27 | ### Changed
28 |
29 | - [539](https://github.com/networktocode/netutils/pull/539) Provide more descriptive error message when duplicate line is parsed.
30 |
--------------------------------------------------------------------------------
/docs/admin/uninstall.md:
--------------------------------------------------------------------------------
1 | # Uninstall
2 |
3 | Uninstall from environment.
4 |
5 | ```bash
6 | pip uninstall netutils
7 | ```
8 |
--------------------------------------------------------------------------------
/docs/admin/upgrade.md:
--------------------------------------------------------------------------------
1 | # Upgrading the Library
2 |
3 | Upgrade from PyPI.
4 |
5 | ```bash
6 | pip install netutils --upgrade
7 | ```
8 |
--------------------------------------------------------------------------------
/docs/assets/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/docs/assets/favicon.ico
--------------------------------------------------------------------------------
/docs/assets/networktocode_bw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/docs/assets/networktocode_bw.png
--------------------------------------------------------------------------------
/docs/assets/networktocode_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/docs/assets/networktocode_logo.png
--------------------------------------------------------------------------------
/docs/assets/overrides/partials/copyright.html:
--------------------------------------------------------------------------------
1 |
2 | {% if config.copyright %}
3 |
4 | {{ config.copyright }}
5 |
6 |
Apache-2.0 LICENSE
7 | {% endif %}
8 |
9 |
10 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/dev/arch_decision.md:
--------------------------------------------------------------------------------
1 | # Architecture Decision Records
2 |
3 | The intention is to document deviations from a standard pattern.
4 |
--------------------------------------------------------------------------------
/docs/dev/classy/parser.md:
--------------------------------------------------------------------------------
1 | ---
2 | classy_dotted_path: netutils.config.parser.BaseConfigParser
3 | ---
4 | # Classy Doc
5 |
--------------------------------------------------------------------------------
/docs/dev/code_reference/acl.md:
--------------------------------------------------------------------------------
1 | # ACLs
2 |
3 | ::: netutils.acl
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/asn.md:
--------------------------------------------------------------------------------
1 | # BGP ASNs
2 |
3 | ::: netutils.asn
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/bandwidth.md:
--------------------------------------------------------------------------------
1 | # Bandwidth
2 |
3 | ::: netutils.bandwidth
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/banner.md:
--------------------------------------------------------------------------------
1 | # Banner
2 |
3 | ::: netutils.banner
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/configs.md:
--------------------------------------------------------------------------------
1 | # Configs
2 |
3 | ::: netutils.config
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/dns.md:
--------------------------------------------------------------------------------
1 | # DNS
2 |
3 | ::: netutils.dns
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/hash.md:
--------------------------------------------------------------------------------
1 | # Hash
2 |
3 | ::: netutils.hash
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/index.md:
--------------------------------------------------------------------------------
1 | # Code Reference
2 |
3 | Auto-generated code reference documentation from docstrings. This is the official method to document examples of using the code, this ensures that there is always an example and that the example is accurate.
4 |
--------------------------------------------------------------------------------
/docs/dev/code_reference/interface.md:
--------------------------------------------------------------------------------
1 | # Interface
2 |
3 | ::: netutils.interface
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/ip.md:
--------------------------------------------------------------------------------
1 | # IP Address
2 |
3 | ::: netutils.ip
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/lib_helpers.md:
--------------------------------------------------------------------------------
1 | # Library Helpers
2 |
3 | ::: netutils.lib_helpers
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/lib_mapping.md:
--------------------------------------------------------------------------------
1 | # Library Mapping
2 |
3 | ::: netutils.lib_mapper
4 | options:
5 | show_submodules: True
6 |
7 | Review how to use code within the [user documentation](../../user/lib_use_cases_lib_mapper.md)
--------------------------------------------------------------------------------
/docs/dev/code_reference/mac.md:
--------------------------------------------------------------------------------
1 | # Mac Address
2 |
3 | ::: netutils.mac
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/nist.md:
--------------------------------------------------------------------------------
1 | # NIST URLs
2 |
3 | ::: netutils.nist
4 | options:
5 | show_submodules: True
6 |
--------------------------------------------------------------------------------
/docs/dev/code_reference/os_version.md:
--------------------------------------------------------------------------------
1 | # OS Version
2 |
3 | ::: netutils.os_version
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/password.md:
--------------------------------------------------------------------------------
1 | # Passwords
2 |
3 | ::: netutils.password
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/ping.md:
--------------------------------------------------------------------------------
1 | # Ping
2 |
3 | ::: netutils.ping
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/protocol_mapper.md:
--------------------------------------------------------------------------------
1 | # Protocol Mapper
2 |
3 | ::: netutils.protocol_mapper
4 | options:
5 | show_submodules: True
6 |
7 | Review how to use code within the [user documentation](../../user/lib_use_cases_protocol_mappers.md)
--------------------------------------------------------------------------------
/docs/dev/code_reference/regex.md:
--------------------------------------------------------------------------------
1 | # Regex
2 |
3 | ::: netutils.regex
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/route.md:
--------------------------------------------------------------------------------
1 | # Route
2 |
3 | ::: netutils.route
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/time.md:
--------------------------------------------------------------------------------
1 | # Time
2 |
3 | ::: netutils.time
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/code_reference/utils.md:
--------------------------------------------------------------------------------
1 | # Protocol Mapper
2 |
3 | ::: netutils.utils
4 | options:
5 | show_submodules: True
6 |
7 | Review how to use code within the [user documentation](../../user/lib_use_cases_jinja_filters.md)
--------------------------------------------------------------------------------
/docs/dev/code_reference/vlan.md:
--------------------------------------------------------------------------------
1 | # VLAN
2 |
3 | ::: netutils.vlan
4 | options:
5 | show_submodules: True
--------------------------------------------------------------------------------
/docs/dev/dev_adr.md:
--------------------------------------------------------------------------------
1 | # Architecture Decision Records
2 |
3 | The intention is to document deviations from a standard pattern.
4 |
5 | ## Optional Import for OUI Mapping
6 |
7 | The following code is purposeful to ensure that we only import the large `OUI_MAPPINGS` if required. This does not effect the jinja mappings which will load the larger oui_mappings file.
8 |
9 | ```python
10 | @_valid_mac
11 | def get_oui(mac: str) -> str:
12 | from netutils.oui_mappings import OUI_MAPPINGS # pylint: disable=import-outside-toplevel
13 | ```
14 | ## Has Lib
15 |
16 | _Pending updates from napalm inclusion_
--------------------------------------------------------------------------------
/docs/dev/extending.md:
--------------------------------------------------------------------------------
1 | # Extending the Library
2 |
3 | Extending the library is welcome, however it is best to open an issue first, to ensure that a PR would be accepted and makes sense in terms of features and design.
4 |
5 |
--------------------------------------------------------------------------------
/docs/dev/include_parser_list.md:
--------------------------------------------------------------------------------
1 | | OS Name | Parser Class |
2 | | ---------- | ------ |
3 | | arista_eos | netutils.config.parser.EOSConfigParser |
4 | | aruba_aoscx | netutils.config.parser.ArubaConfigCXParser |
5 | | aruba_os | netutils.config.parser.ArubaConfigOSParser |
6 | | aruba_osswitch | netutils.config.parser.ArubaConfigOSParser |
7 | | bigip_f5 | netutils.config.parser.F5ConfigParser |
8 | | cisco_aireos | netutils.config.parser.AIREOSConfigParser |
9 | | cisco_asa | netutils.config.parser.ASAConfigParser |
10 | | cisco_ios | netutils.config.parser.IOSConfigParser |
11 | | cisco_iosxr | netutils.config.parser.IOSXRConfigParser |
12 | | cisco_nxos | netutils.config.parser.NXOSConfigParser |
13 | | citrix_netscaler | netutils.config.parser.NetscalerConfigParser |
14 | | extreme_netiron | netutils.config.parser.NetironConfigParser |
15 | | fortinet_fortios | netutils.config.parser.FortinetConfigParser |
16 | | hp_comware | netutils.config.parser.HPComwareConfigParser |
17 | | juniper_junos | netutils.config.parser.JunosConfigParser |
18 | | linux | netutils.config.parser.LINUXConfigParser |
19 | | mikrotik_routeros | netutils.config.parser.RouterOSConfigParser |
20 | | mrv_optiswitch | netutils.config.parser.OptiswitchConfigParser |
21 | | netscaler | netutils.config.parser.NetscalerConfigParser |
22 | | nokia_sros | netutils.config.parser.NokiaConfigParser |
23 | | nvidia_onyx | netutils.config.parser.NvidiaOnyxConfigParser |
24 | | paloalto_panos | netutils.config.parser.PaloAltoNetworksConfigParser |
25 | | rad_etx | netutils.config.parser.RadEtxConfigParser |
26 | | ruckus_fastiron | netutils.config.parser.FastironConfigParser |
27 | | ubiquiti_airos | netutils.config.parser.UbiquitiAirOSConfigParser |
--------------------------------------------------------------------------------
/docs/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/docs/images/.keep
--------------------------------------------------------------------------------
/docs/images/acl-workflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/docs/images/acl-workflow.png
--------------------------------------------------------------------------------
/docs/images/icon-Netutils.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/docs/images/icon-Netutils.png
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | hide:
3 | - navigation
4 | ---
5 |
6 | --8<-- "README.md"
7 |
--------------------------------------------------------------------------------
/docs/user/faq.md:
--------------------------------------------------------------------------------
1 | # Frequently Asked Questions
2 |
3 | ## Which OS Config types have Parsers?
4 |
5 | The documentation is provided in the [development docs](../dev/dev_config.md#current-included-parsers)
6 |
7 | For creating new Parsers, see the [new parsers](../dev/dev_config.md#new-parsers) docs.
8 |
9 | ## Can you provide an example of how to use the functions?
10 |
11 | The documentation is always provided in the function for [code docs](../dev/code_reference/index.md) for each function. There is additional documentation in [Use Cases](../user/lib_use_cases.md) and subsequent sections.
12 |
13 | ## Optional Dependencies
14 | One of the requirements of this library is to avoid having dependencies; however, including a few optional dependencies in an opt in fashion allows `netutils` to remain lean while offering some powerful addons.
15 |
16 | Installing the optional dependencies is only needed when the user needs access to the functions using the dependencies. If the dependency is not installed the function simply raises an exception and warns the user that the library is not installed.
17 |
--------------------------------------------------------------------------------
/docs/user/lib_getting_started.md:
--------------------------------------------------------------------------------
1 | # Getting Started with the Library
2 |
3 | The library's primary use case is providing Python functions for the community. The primary way to use it is the same as any Python library. You `import` the functions, and use them, there are many examples on the [Use Cases](./lib_use_cases.md) page.
4 |
5 | ## Install the Library
6 |
7 | To install the library, please follow the instructions detailed in the [Installation Guide](../admin/install.md).
8 |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/aerleon.md:
--------------------------------------------------------------------------------
1 | | AERLEON | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | arista | → | arista_eos |
4 | | aruba | → | aruba_aoscx |
5 | | brocade | → | brocade_nos |
6 | | cisco | → | cisco_ios |
7 | | ciscoasa | → | cisco_asa |
8 | | cisconx | → | cisco_nxos |
9 | | ciscoxr | → | cisco_xr |
10 | | cloudarmor | → | cloudarmor |
11 | | gce | → | gce |
12 | | gcp_hf | → | gcp_hf |
13 | | ipset | → | ipset |
14 | | iptables | → | iptables |
15 | | juniper | → | juniper_junos |
16 | | juniperevo | → | juniper_junos |
17 | | k8s | → | k8s |
18 | | msmpc | → | juniper_junos |
19 | | nsxt | → | vmware_nsxt |
20 | | nsxv | → | vmware_nsxv |
21 | | openconfig | → | openconfig |
22 | | packetfilter | → | packetfilter |
23 | | paloalto | → | paloalto_panos |
24 | | pcap | → | pcap |
25 | | sonic | → | sonic |
26 | | speedway | → | speedway |
27 | | srx | → | juniper_junos |
28 | | srxlo | → | juniper_junos |
29 | | windows | → | windows |
30 | | windows_advfirewall | → | windows |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/aerleon_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | AERLEON |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista |
4 | | aruba_aoscx | → | aruba |
5 | | brocade_nos | → | brocade |
6 | | cisco_asa | → | ciscoasa |
7 | | cisco_ios | → | cisco |
8 | | cisco_nxos | → | cisconx |
9 | | cisco_xe | → | cisco |
10 | | cisco_xr | → | ciscoxr |
11 | | cloudarmor | → | cloudarmor |
12 | | gce | → | gce |
13 | | gcp_hf | → | gcp_hf |
14 | | ipset | → | ipset |
15 | | iptables | → | iptables |
16 | | juniper_junos | → | juniper |
17 | | k8s | → | k8s |
18 | | openconfig | → | openconfig |
19 | | packetfilter | → | packetfilter |
20 | | paloalto_panos | → | paloalto |
21 | | pcap | → | pcap |
22 | | sonic | → | sonic |
23 | | speedway | → | speedway |
24 | | vmware_nsxt | → | nsxt |
25 | | vmware_nsxv | → | nsxv |
26 | | windows | → | windows |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/ansible.md:
--------------------------------------------------------------------------------
1 | | ANSIBLE | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | a10.acos_axapi.a10 | → | a10 |
4 | | arista.eos.eos | → | arista_eos |
5 | | arubanetworks.aoscx | → | aruba_aoscx |
6 | | ciena.saos6.saos6 | → | ciena_saos |
7 | | cisco.asa.asa | → | cisco_asa |
8 | | cisco.ios.ios | → | cisco_ios |
9 | | cisco.iosxr.iosxr | → | cisco_xr |
10 | | cisco.meraki.meraki | → | cisco_meraki |
11 | | cisco.nxos.nxos | → | cisco_nxos |
12 | | community.network.ce | → | huawei |
13 | | community.network.cnos | → | lenovo_cnos |
14 | | community.network.enos | → | lenovo_enos |
15 | | community.network.eric_eccli | → | ericsson_ipos |
16 | | community.network.exos | → | extreme_exos |
17 | | community.network.icx | → | ruckus_icx |
18 | | community.network.ironware | → | extreme_netiron |
19 | | community.network.netvisor | → | pluribus |
20 | | community.network.nos | → | extreme_nos |
21 | | community.network.routeros | → | mikrotik_routeros |
22 | | community.network.slxos | → | extreme_slx |
23 | | community.network.sros | → | nokia_sros |
24 | | community.network.voss | → | extreme_vsp |
25 | | dellemc.enterprise_sonic.sonic | → | sonic |
26 | | dellemc.os10.0s10 | → | dell_os10 |
27 | | dellemc.os6.os6 | → | dell_os6 |
28 | | dellemc.os9.os9 | → | dell_os9 |
29 | | f5networks.f5_bigip.bigip | → | bigip_f5 |
30 | | fortinet.fortios.fortios | → | fortinet |
31 | | junipernetworks.junos.junos | → | juniper_junos |
32 | | nokia.srl | → | nokia_srl |
33 | | paloaltonetworks.panos.panos | → | paloalto_panos |
34 | | vyos.vyos.vyos | → | vyos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/ansible_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | ANSIBLE |
2 | | ---------- | -- | ------ |
3 | | a10 | → | a10.acos_axapi.a10 |
4 | | arista_eos | → | arista.eos.eos |
5 | | aruba_aoscx | → | arubanetworks.aoscx |
6 | | bigip_f5 | → | f5networks.f5_bigip.bigip |
7 | | ciena_saos | → | ciena.saos6.saos6 |
8 | | cisco_asa | → | cisco.asa.asa |
9 | | cisco_ios | → | cisco.ios.ios |
10 | | cisco_meraki | → | cisco.meraki.meraki |
11 | | cisco_nxos | → | cisco.nxos.nxos |
12 | | cisco_xe | → | cisco.ios.ios |
13 | | cisco_xr | → | cisco.iosxr.iosxr |
14 | | dell_os10 | → | dellemc.os10.0s10 |
15 | | dell_os6 | → | dellemc.os6.os6 |
16 | | dell_os9 | → | dellemc.os9.os9 |
17 | | ericsson_ipos | → | community.network.eric_eccli |
18 | | extreme_exos | → | community.network.exos |
19 | | extreme_netiron | → | community.network.ironware |
20 | | extreme_nos | → | community.network.nos |
21 | | extreme_slx | → | community.network.slxos |
22 | | extreme_vsp | → | community.network.voss |
23 | | fortinet | → | fortinet.fortios.fortios |
24 | | huawei | → | community.network.ce |
25 | | juniper_junos | → | junipernetworks.junos.junos |
26 | | lenovo_cnos | → | community.network.cnos |
27 | | lenovo_enos | → | community.network.enos |
28 | | mikrotik_routeros | → | community.network.routeros |
29 | | nokia_srl | → | nokia.srl |
30 | | nokia_sros | → | community.network.sros |
31 | | paloalto_panos | → | paloaltonetworks.panos.panos |
32 | | pluribus | → | community.network.netvisor |
33 | | ruckus_icx | → | community.network.icx |
34 | | sonic | → | dellemc.enterprise_sonic.sonic |
35 | | vyos | → | vyos.vyos.vyos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/capirca.md:
--------------------------------------------------------------------------------
1 | | CAPIRCA | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | arista | → | arista_eos |
4 | | aruba | → | aruba_aoscx |
5 | | brocade | → | brocade_nos |
6 | | cisco | → | cisco_ios |
7 | | ciscoasa | → | cisco_asa |
8 | | cisconx | → | cisco_nxos |
9 | | ciscoxr | → | cisco_xr |
10 | | cloudarmor | → | cloudarmor |
11 | | gce | → | gce |
12 | | gcp_hf | → | gcp_hf |
13 | | ipset | → | ipset |
14 | | iptables | → | iptables |
15 | | juniper | → | juniper_junos |
16 | | juniperevo | → | juniper_junos |
17 | | k8s | → | k8s |
18 | | msmpc | → | juniper_junos |
19 | | nsxt | → | vmware_nsxt |
20 | | nsxv | → | vmware_nsxv |
21 | | openconfig | → | openconfig |
22 | | packetfilter | → | packetfilter |
23 | | paloalto | → | paloalto_panos |
24 | | pcap | → | pcap |
25 | | sonic | → | sonic |
26 | | speedway | → | speedway |
27 | | srx | → | juniper_junos |
28 | | srxlo | → | juniper_junos |
29 | | windows | → | windows |
30 | | windows_advfirewall | → | windows |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/capirca_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | CAPIRCA |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista |
4 | | aruba_aoscx | → | aruba |
5 | | brocade_nos | → | brocade |
6 | | cisco_asa | → | ciscoasa |
7 | | cisco_ios | → | cisco |
8 | | cisco_nxos | → | cisconx |
9 | | cisco_xe | → | cisco |
10 | | cisco_xr | → | ciscoxr |
11 | | cloudarmor | → | cloudarmor |
12 | | gce | → | gce |
13 | | gcp_hf | → | gcp_hf |
14 | | ipset | → | ipset |
15 | | iptables | → | iptables |
16 | | juniper_junos | → | juniper |
17 | | k8s | → | k8s |
18 | | openconfig | → | openconfig |
19 | | packetfilter | → | packetfilter |
20 | | paloalto_panos | → | paloalto |
21 | | pcap | → | pcap |
22 | | sonic | → | sonic |
23 | | speedway | → | speedway |
24 | | vmware_nsxt | → | nsxt |
25 | | vmware_nsxv | → | nsxv |
26 | | windows | → | windows |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/dna_center.md:
--------------------------------------------------------------------------------
1 | | DNA_CENTER | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | IOS | → | cisco_ios |
4 | | IOS-XE | → | cisco_ios |
5 | | IOS-XR | → | cisco_xr |
6 | | NX-OS | → | cisco_nxos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/dna_center_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | DNA_CENTER |
2 | | ---------- | -- | ------ |
3 | | cisco_ios | → | IOS |
4 | | cisco_nxos | → | NX-OS |
5 | | cisco_xr | → | IOS-XR |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/forwardnetworks.md:
--------------------------------------------------------------------------------
1 | | FORWARDNETWORKS | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | ARISTA_EOS | → | arista_eos |
4 | | ARUBA_SWITCH | → | aruba_aoscx |
5 | | ASA | → | cisco_asa |
6 | | EXTREME_NOS | → | extreme_netiron |
7 | | F5 | → | bigip_f5 |
8 | | FORTINET | → | fortinet |
9 | | IOS | → | cisco_ios |
10 | | IOS_XE | → | cisco_ios |
11 | | IOS_XR | → | cisco_xr |
12 | | JUNOS | → | juniper_junos |
13 | | LINUX | → | linux |
14 | | LINUX_OVS_OFCTL | → | linux |
15 | | NETSCALER | → | netscaler |
16 | | NXOS | → | cisco_nxos |
17 | | PAN_OS | → | paloalto_panos |
18 | | SRX | → | juniper_junos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/forwardnetworks_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | FORWARDNETWORKS |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | ARISTA_EOS |
4 | | aruba_aoscx | → | ARUBA_SWITCH |
5 | | bigip_f5 | → | F5 |
6 | | cisco_asa | → | ASA |
7 | | cisco_ios | → | IOS |
8 | | cisco_nxos | → | NXOS |
9 | | cisco_xe | → | IOS |
10 | | cisco_xr | → | IOS_XR |
11 | | extreme_netiron | → | EXTREME_NOS |
12 | | fortinet | → | FORTINET |
13 | | juniper_junos | → | JUNOS |
14 | | linux | → | LINUX |
15 | | netscaler | → | NETSCALER |
16 | | paloalto_panos | → | PAN_OS |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/hierconfig.md:
--------------------------------------------------------------------------------
1 | | HIERCONFIG | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | eos | → | arista_eos |
4 | | fastiron | → | ruckus_fastiron |
5 | | ios | → | cisco_ios |
6 | | iosxe | → | cisco_ios |
7 | | iosxr | → | cisco_xr |
8 | | junos | → | juniper_junos |
9 | | nxos | → | cisco_nxos |
10 | | vyos | → | vyos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/hierconfig_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | HIERCONFIG |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | eos |
4 | | cisco_ios | → | ios |
5 | | cisco_nxos | → | nxos |
6 | | cisco_xe | → | ios |
7 | | cisco_xr | → | iosxr |
8 | | juniper_junos | → | junos |
9 | | ruckus_fastiron | → | fastiron |
10 | | vyos | → | vyos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/napalm.md:
--------------------------------------------------------------------------------
1 | | NAPALM | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | aoscx | → | aruba_aoscx |
4 | | asa | → | cisco_asa |
5 | | cisco_wlc_ssh | → | cisco_wlc |
6 | | eos | → | arista_eos |
7 | | f5 | → | bigip_f5 |
8 | | fortios | → | fortinet |
9 | | huawei_vrp | → | huawei |
10 | | ios | → | cisco_ios |
11 | | iosxr | → | cisco_xr |
12 | | junos | → | juniper_junos |
13 | | nxos | → | cisco_nxos |
14 | | nxos_ssh | → | cisco_nxos |
15 | | panos | → | paloalto_panos |
16 | | ros | → | mikrotik_routeros |
17 | | srl | → | nokia_srl |
18 | | sros | → | nokia_sros |
19 | | vyos | → | vyos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/napalm_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | NAPALM |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | eos |
4 | | aruba_aoscx | → | aoscx |
5 | | bigip_f5 | → | f5 |
6 | | cisco_asa | → | asa |
7 | | cisco_ios | → | ios |
8 | | cisco_nxos | → | nxos |
9 | | cisco_wlc | → | cisco_wlc_ssh |
10 | | cisco_xe | → | ios |
11 | | cisco_xr | → | iosxr |
12 | | fortinet | → | fortios |
13 | | huawei | → | huawei_vrp |
14 | | juniper_junos | → | junos |
15 | | mikrotik_routeros | → | ros |
16 | | nokia_srl | → | srl |
17 | | nokia_sros | → | sros |
18 | | paloalto_panos | → | panos |
19 | | vyos | → | vyos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/netutilsparser.md:
--------------------------------------------------------------------------------
1 | | NETUTILSPARSER | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista_eos |
4 | | aruba_aoscx | → | aruba_aoscx |
5 | | aruba_os | → | aruba_os |
6 | | aruba_osswitch | → | aruba_osswitch |
7 | | bigip_f5 | → | bigip_f5 |
8 | | cisco_aireos | → | cisco_aireos |
9 | | cisco_asa | → | cisco_asa |
10 | | cisco_ios | → | cisco_ios |
11 | | cisco_iosxr | → | cisco_xr |
12 | | cisco_nxos | → | cisco_nxos |
13 | | citrix_netscaler | → | citrix_netscaler |
14 | | extreme_netiron | → | extreme_netiron |
15 | | fortinet_fortios | → | fortinet |
16 | | hp_comware | → | hp_comware |
17 | | juniper_junos | → | juniper_junos |
18 | | linux | → | linux |
19 | | mikrotik_routeros | → | mikrotik_routeros |
20 | | mrv_optiswitch | → | mrv_optiswitch |
21 | | netscaler | → | netscaler |
22 | | nokia_sros | → | nokia_sros |
23 | | nvidia_onyx | → | nvidia_onyx |
24 | | paloalto_panos | → | paloalto_panos |
25 | | rad_etx | → | rad_etx |
26 | | ruckus_fastiron | → | ruckus_fastiron |
27 | | ubiquiti_airos | → | ubiquiti_airos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/netutilsparser_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | NETUTILSPARSER |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista_eos |
4 | | aruba_aoscx | → | aruba_aoscx |
5 | | aruba_os | → | aruba_os |
6 | | aruba_osswitch | → | aruba_osswitch |
7 | | bigip_f5 | → | bigip_f5 |
8 | | cisco_aireos | → | cisco_aireos |
9 | | cisco_asa | → | cisco_asa |
10 | | cisco_ios | → | cisco_ios |
11 | | cisco_nxos | → | cisco_nxos |
12 | | cisco_xe | → | cisco_ios |
13 | | cisco_xr | → | cisco_iosxr |
14 | | citrix_netscaler | → | citrix_netscaler |
15 | | extreme_netiron | → | extreme_netiron |
16 | | fortinet | → | fortinet_fortios |
17 | | hp_comware | → | hp_comware |
18 | | juniper_junos | → | juniper_junos |
19 | | linux | → | linux |
20 | | mikrotik_routeros | → | mikrotik_routeros |
21 | | mrv_optiswitch | → | mrv_optiswitch |
22 | | netscaler | → | netscaler |
23 | | nokia_sros | → | nokia_sros |
24 | | nvidia_onyx | → | nvidia_onyx |
25 | | paloalto_panos | → | paloalto_panos |
26 | | rad_etx | → | rad_etx |
27 | | ruckus_fastiron | → | ruckus_fastiron |
28 | | ubiquiti_airos | → | ubiquiti_airos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/nist.md:
--------------------------------------------------------------------------------
1 | | NIST | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | arista:eos | → | arista_eos |
4 | | arubanetworks:arubaos | → | aruba_os |
5 | | cisco:adaptive_security_appliance_software | → | cisco_asa |
6 | | cisco:ios | → | cisco_ios |
7 | | cisco:ios_xe | → | cisco_xe |
8 | | cisco:ios_xr | → | cisco_xr |
9 | | cisco:nx-os | → | cisco_nxos |
10 | | juniper:junos | → | juniper_junos |
11 | | paloaltonetworks:pan-os | → | paloalto_panos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/nist_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | NIST |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista:eos |
4 | | aruba_os | → | arubanetworks:arubaos |
5 | | cisco_asa | → | cisco:adaptive_security_appliance_software |
6 | | cisco_ios | → | cisco:ios |
7 | | cisco_nxos | → | cisco:nx-os |
8 | | cisco_xe | → | cisco:ios_xe |
9 | | cisco_xr | → | cisco:ios_xr |
10 | | juniper_junos | → | juniper:junos |
11 | | paloalto_panos | → | paloaltonetworks:pan-os |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/pyats.md:
--------------------------------------------------------------------------------
1 | | PYATS | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | asa | → | cisco_asa |
4 | | bigip | → | bigip_f5 |
5 | | dnac | → | cisco_dnac |
6 | | ios | → | cisco_ios |
7 | | iosxe | → | cisco_ios |
8 | | iosxr | → | cisco_xr |
9 | | junos | → | juniper_junos |
10 | | linux | → | linux |
11 | | nxos | → | cisco_nxos |
12 | | sros | → | nokia_sros |
13 | | viptela | → | cisco_viptella |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/pyats_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | PYATS |
2 | | ---------- | -- | ------ |
3 | | bigip_f5 | → | bigip |
4 | | cisco_asa | → | asa |
5 | | cisco_dnac | → | dnac |
6 | | cisco_ios | → | iosxe |
7 | | cisco_nxos | → | nxos |
8 | | cisco_viptella | → | viptela |
9 | | cisco_xe | → | iosxe |
10 | | cisco_xr | → | iosxr |
11 | | juniper_junos | → | junos |
12 | | linux | → | linux |
13 | | nokia_sros | → | sros |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/pyntc.md:
--------------------------------------------------------------------------------
1 | | PYNTC | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | arista_eos_eapi | → | arista_eos |
4 | | cisco_aireos_ssh | → | cisco_wlc |
5 | | cisco_asa_ssh | → | cisco_asa |
6 | | cisco_ios_ssh | → | cisco_ios |
7 | | cisco_nxos_nxapi | → | cisco_nxos |
8 | | f5_tmos_icontrol | → | bigip_f5 |
9 | | juniper_junos_netconf | → | juniper_junos |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/pyntc_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | PYNTC |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista_eos_eapi |
4 | | bigip_f5 | → | f5_tmos_icontrol |
5 | | cisco_asa | → | cisco_asa_ssh |
6 | | cisco_ios | → | cisco_ios_ssh |
7 | | cisco_nxos | → | cisco_nxos_nxapi |
8 | | cisco_wlc | → | cisco_aireos_ssh |
9 | | cisco_xe | → | cisco_ios_ssh |
10 | | juniper_junos | → | juniper_junos_netconf |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/running_config.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | RUNNING_CONFIG_COMMAND |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | show running-config |
4 | | aruba_os | → | show running-configuration |
5 | | aruba_osswitch | → | show running-config |
6 | | aruba_procurve | → | show running-config |
7 | | checkpoint_gaia | → | clish -c "show configuration" |
8 | | cisco_ios | → | show running-config |
9 | | cisco_nxos | → | show running-config |
10 | | cisco_wlc | → | show run-config commands |
11 | | cisco_xr | → | show running-config |
12 | | dell_os10 | → | show running-config |
13 | | dell_os9 | → | show running-config |
14 | | extreme_exos | → | show configuration |
15 | | extreme_slx | → | show running-config |
16 | | extreme_vsp | → | show running-config |
17 | | fortinet | → | show full-configuration |
18 | | hp_procurve | → | show running-config |
19 | | juniper_junos | → | show configuration | display set |
20 | | mikrotik_routeros | → | /export |
21 | | nokia_srl | → | info |
22 | | nokia_sros | → | admin display-config |
23 | | rad_etx | → | info |
24 | | ruckus_fastiron | → | show running-config |
25 | | ubiquiti_edge | → | show configuration |
26 | | ubiquiti_edgerouter | → | show configuration |
27 | | ubiquiti_edgeswitch | → | show configuration |
28 | | vyos | → | show configuration |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/scrapli.md:
--------------------------------------------------------------------------------
1 | | SCRAPLI | | NORMALIZED |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista_eos |
4 | | aruba_aoscx | → | aruba_aoscx |
5 | | cisco_iosxe | → | cisco_ios |
6 | | cisco_iosxr | → | cisco_xr |
7 | | cisco_nxos | → | cisco_nxos |
8 | | juniper_junos | → | juniper_junos |
9 | | nokia_srlinux | → | nokia_srl |
--------------------------------------------------------------------------------
/docs/user/lib_mapper/scrapli_reverse.md:
--------------------------------------------------------------------------------
1 | | NORMALIZED | | SCRAPLI |
2 | | ---------- | -- | ------ |
3 | | arista_eos | → | arista_eos |
4 | | aruba_aoscx | → | aruba_aoscx |
5 | | cisco_ios | → | cisco_iosxe |
6 | | cisco_nxos | → | cisco_nxos |
7 | | cisco_xe | → | cisco_iosxe |
8 | | cisco_xr | → | cisco_iosxr |
9 | | juniper_junos | → | juniper_junos |
10 | | nokia_srl | → | nokia_srlinux |
--------------------------------------------------------------------------------
/docs/user/lib_overview.md:
--------------------------------------------------------------------------------
1 | # Library Overview
2 |
3 | A Python library that is a collection of functions for common network automation tasks.
4 |
5 | This library intends to keep the following tenets:
6 |
7 | - Must not be any dependencies required to run the library.
8 | - May be some optional dependencies, to be managed by the user in opt in fashion.
9 | - Shall prefer functions over classes.
10 | - Shall prefer a folder and file structure that is flat.
11 | - Shall leverage docstrings as the primary documentation mechanism.
12 | - Must provide examples in every public function.
13 | - Shall retain a high test coverage.
14 |
15 | ## Description/Overview
16 |
17 | A Python library that is a collection of functions that are used in the common network automation tasks. Tasks such as converting a BGP ASN to and from dotted format, normalizing an interface name, or "type 5" encrypting a password. The intention is to centralize these functions while keeping the library light.
18 |
19 |
20 | ## Audience (User Personas) - Who should use this Library?
21 |
22 | The intended audience is those who are programming network automation tasks with Python. Whether you are a seasoned veteran or a casual scripter, this library should help to reduce duplication between various reinventing the wheel.
23 |
24 | ## Authors and Maintainers
25 |
26 | - @itdependsnetworks
27 | - @jeffkala
28 | - @qduk
29 |
--------------------------------------------------------------------------------
/docs/user/lib_upgrade_paths.md:
--------------------------------------------------------------------------------
1 | # Upgrade Paths
2 |
3 | The `UPGRADE_PATHS` definition in constants is maintained based on the following rules:
4 |
5 | * They are not considered vendor recommendations, instead an interpretation based on the open source contributor.
6 | * There is no expectation they will be updated, as such issues requesting updates will be closed but PRs to update--following the below rules--will be accepted.
7 | * The lists can only be modified by added to during any patch or minor version.
8 | * The list cannot be modified in any other way.
9 | * Generate a new versioned list, e.g. PANOS_OFFICIAL_V2 vs PANOS_OFFICIAL_V1 and create an alternate list.
10 | * During major version changes (e.g. 1.x.x to 2.x.x) lists may be removed.
11 |
--------------------------------------------------------------------------------
/docs/user/lib_use_cases_os_version.md:
--------------------------------------------------------------------------------
1 | # OS Version Tools
2 |
3 | The OS Version Tools are used for working with versioning systems.
4 |
5 | ## Version Parsing/Deconstruction
6 | Version parsing takes the software version given as a string, and deconstructs that value into the standards of the vendor. The version parsing takes place in the `netutils.os_version` module. This is necessary when specific values or flags from a software version are required to make a logical decision.
7 |
8 | Current Version Parsers:
9 |
10 | - Default Parser
11 | - Juniper JunOS
12 |
13 | **See the following Default and Juniper JunOS parsed versions:**
14 |
15 | ```python
16 | >>> from netutils.os_version import version_metadata
17 |
18 | >>> version_metadata("Cisco", "IOS", "15.5")
19 | {
20 | "major": "15",
21 | "minor": "5",
22 | "vendor_metadata": False,
23 | }
24 | >>> version_metadata("juniper", "junos", "12.4R")
25 | {
26 | "isservice": False,
27 | "ismaintenance": False,
28 | "isfrs": True,
29 | "isspecial": False,
30 | "service": None,
31 | "service_build": None,
32 | "service_respin": None,
33 | "main": "12",
34 | "minor": "4",
35 | "type": "R",
36 | "build": None,
37 | "major": "12",
38 | "patch": None,
39 | "vendor_metadata": True,
40 | }
41 | ```
42 |
--------------------------------------------------------------------------------
/example.invoke.yml:
--------------------------------------------------------------------------------
1 | ---
2 | "netutils":
3 | python_ver: "3.9"
4 | local: false
5 | # image_name: "netutils"
6 | # image_ver: "latest"
7 | # pwd: "."
8 |
--------------------------------------------------------------------------------
/flat_postprocess/oui_postprocess.py:
--------------------------------------------------------------------------------
1 | """Python code used to postprocess Flat github action data related to OUI mappings."""
2 |
3 | import re
4 | import sys
5 | from urllib.request import urlopen
6 |
7 | HEX_RE = r"^(?P[A-Fa-f0-9]{6})\s+\(.*\)[^a-zA-Z0-9]+(?P.*)$"
8 | OUI_MAPPINGS = {}
9 |
10 | if __name__ == "__main__":
11 | if len(sys.argv) == 3:
12 | with urlopen("https://standards-oui.ieee.org").read().decode("utf-8") as oui_textfile: # nosec B310
13 | with open(sys.argv[1], "w", encoding="utf-8") as oui_mappings:
14 | oui_mappings.write(oui_textfile)
15 |
16 | with open(sys.argv[1], "r", encoding="utf-8") as oui_file:
17 | for line in oui_file:
18 | if re.search(HEX_RE, line):
19 | group_regex_values = re.search(HEX_RE, line).groupdict()
20 | if group_regex_values.get("hex") and group_regex_values.get("company"):
21 | OUI_MAPPINGS.update({group_regex_values.get("hex").lower(): group_regex_values.get("company")})
22 |
23 | with open(sys.argv[1], "w", encoding="utf-8") as oui_mappings:
24 | oui_mappings.write('"""Dictionary object to store OUI information."""\n')
25 | oui_mappings.write("# pylint: disable=too-many-lines\n")
26 | oui_mappings.write("import typing\n\n")
27 | oui_mappings.write("OUI_MAPPINGS: typing.Dict[str, str] = {\n")
28 | for mac, company in sorted(OUI_MAPPINGS.items()):
29 | oui_mappings.write(f' "{mac}": "{company}",\n')
30 | oui_mappings.write("}\n")
31 |
--------------------------------------------------------------------------------
/flat_postprocess/oui_postprocess.ts:
--------------------------------------------------------------------------------
1 | // Forwards the execution to the python script
2 | const py_run = Deno.run({
3 | cmd: ['python', './flat_postprocess/oui_postprocess.py'].concat(Deno.args),
4 | });
5 |
6 | await py_run.status();
7 |
--------------------------------------------------------------------------------
/flat_postprocess/protocol_number_postprocess.py:
--------------------------------------------------------------------------------
1 | """Python code used to postprocess Flat github action data related to Protocol mappings."""
2 |
3 | import csv
4 | import os
5 | import sys
6 | from urllib.request import urlopen
7 |
8 | if __name__ == "__main__":
9 | if len(sys.argv) == 2:
10 | URL = "https://www.iana.org/assignments/protocol-numbers/protocol-numbers-1.csv"
11 | oui_textfile = urlopen(URL).read().decode("utf-8") # noqa: S310 pylint: disable=consider-using-with
12 | with open(sys.argv[1], "w", encoding="utf-8") as proto_mappings:
13 | proto_mappings.write(oui_textfile)
14 |
15 | protocol_mapping = {}
16 | reverse_mapping = {}
17 | with open(sys.argv[1], encoding="utf-8") as file:
18 | next(file)
19 | reader = csv.reader(file)
20 | for row in reader:
21 | number = row[0]
22 | name = row[1]
23 | if not number.isnumeric():
24 | continue
25 | if not name:
26 | continue
27 | name = name.replace(" (deprecated)", "")
28 | protocol_mapping[name] = int(number)
29 | reverse_mapping[int(number)] = name
30 |
31 | with open(sys.argv[1], "w", encoding="utf-8") as proto_mappings:
32 | proto_mappings.write('"""Dictionary object to store Protocol Number."""\n')
33 | proto_mappings.write("from typing import Dict\n")
34 | proto_mappings.write(f"PROTO_NAME_TO_NUM: Dict[str, int] = {protocol_mapping}")
35 | proto_mappings.write("\n")
36 | proto_mappings.write(f"PROTO_NUM_TO_NAME: Dict[int, str] = {reverse_mapping}")
37 |
38 | os.system(f"ruff format {sys.argv[1]}") # noqa: S605
39 |
--------------------------------------------------------------------------------
/flat_postprocess/protocol_number_postprocess.ts:
--------------------------------------------------------------------------------
1 | // Forwards the execution to the python script
2 | const py_run = Deno.run({
3 | // Run `python ./flat_postprocess/protocol_number_postprocess.py netutils/data_files/protocol_number_mappings.py` to test locally.
4 | cmd: ["python", "./flat_postprocess/protocol_number_postprocess.py"].concat(Deno.args),
5 | });
6 |
7 | await py_run.status();
8 |
--------------------------------------------------------------------------------
/flat_postprocess/protocol_postprocess.ts:
--------------------------------------------------------------------------------
1 | // Forwards the execution to the python script
2 | const py_run = Deno.run({
3 | // Run `python ./flat_postprocess/protocol_postprocess.py netutils/data_files/protocol_mappings.py` to test locally.
4 | cmd: ["python", "./flat_postprocess/protocol_postprocess.py"].concat(Deno.args),
5 | });
6 |
7 | await py_run.status();
8 |
--------------------------------------------------------------------------------
/netutils/__init__.py:
--------------------------------------------------------------------------------
1 | """Initialization file for library."""
2 |
3 | from importlib import metadata
4 |
5 | __version__ = metadata.version(__name__)
6 |
--------------------------------------------------------------------------------
/netutils/asn.py:
--------------------------------------------------------------------------------
1 | """Functions for working with BGP ASNs."""
2 |
3 |
4 | def asn_to_int(asplain: str) -> int:
5 | """Convert AS Number to standardized asplain notation as an integer.
6 |
7 | Args:
8 | asplain: An `asplain` notated BGP ASN with community.
9 |
10 | Returns:
11 | Integer value within of the given asplain value provided.
12 |
13 | Examples:
14 | >>> from netutils.asn import asn_to_int
15 | >>> asn_to_int("65000")
16 | 65000
17 | >>> asn_to_int("65000.111")
18 | 4259840111
19 | >>>
20 | """
21 | # ASN is in asdot notation
22 | if "." in asplain:
23 | asn_list = asplain.split(".")
24 | asn = int(f"{int(asn_list[0]):016b}{int(asn_list[1]):016b}", 2)
25 | return asn
26 | return int(asplain)
27 |
28 |
29 | def int_to_asdot(asn_int: int) -> str:
30 | """Convert integer to standardized asdot notation for BGP ASN.
31 |
32 | Args:
33 | asn_int: Integer value of the BGP ASN.
34 |
35 | Returns:
36 | `asdot` notated BGP ASN as a string.
37 |
38 | Examples:
39 | >>> from netutils.asn import int_to_asdot
40 | >>> int_to_asdot(65000)
41 | '65000'
42 | >>> int_to_asdot(4259840111)
43 | '65000.111'
44 | >>>
45 | """
46 | if isinstance(asn_int, str):
47 | asn_int = int(asn_int)
48 | if asn_int > 2**32 - 1 or asn_int < 1:
49 | raise ValueError(f"`{str(asn_int)}` is not within range of 1 - 2^32-1")
50 | if asn_int >= 2**16:
51 | asn1 = asn_int >> 16
52 | asn2 = asn_int & ((1 << 16) - 1)
53 | return f"{asn1}.{asn2}"
54 | return str(asn_int)
55 |
--------------------------------------------------------------------------------
/netutils/config/__init__.py:
--------------------------------------------------------------------------------
1 | """Initialization file for config methods."""
2 |
--------------------------------------------------------------------------------
/netutils/config/utils.py:
--------------------------------------------------------------------------------
1 | """Utility functions for working with device configurations."""
2 |
3 |
4 | def _open_file_config(cfg_path: str) -> str:
5 | """Open config file from local disk."""
6 | # This might fail, raising an IOError
7 | with open(cfg_path, encoding="utf-8") as filehandler:
8 | device_cfg = filehandler.read()
9 |
10 | return device_cfg.strip()
11 |
--------------------------------------------------------------------------------
/netutils/data_files/__init__.py:
--------------------------------------------------------------------------------
1 | """Initialize the data_files module."""
2 |
--------------------------------------------------------------------------------
/netutils/hash.py:
--------------------------------------------------------------------------------
1 | """Functions for hashing data."""
2 |
3 | import hashlib
4 | import typing as t
5 |
6 |
7 | def hash_data(data: bytes, algorithm: str) -> t.Any:
8 | """Convenience function primarily built to expose hashlib to Jinja.
9 |
10 | Args:
11 | data (bytes): Data to hash.
12 | algorithm (str): Hashing algorithm to use.
13 |
14 | Returns:
15 | bytes: Hashed data.
16 |
17 | Raises:
18 | AttributeError: Invalid algorithm specified.
19 |
20 | Examples:
21 | >>> from netutils.hash import hash_data
22 | >>> hash_data("test", "md5")
23 | '098f6bcd4621d373cade4e832627b4f6'
24 |
25 | >>> from jinja2 import Environment
26 | >>> from netutils.utils import jinja2_convenience_function
27 | >>>
28 | >>> env = Environment(trim_blocks=True, lstrip_blocks=True)
29 | >>> env.filters.update(jinja2_convenience_function())
30 | >>> template_str = "{{ 'test' | hash_data('md5') }}"
31 | >>> template = env.from_string(template_str)
32 | >>> result = template.render()
33 | >>> print(result)
34 | 098f6bcd4621d373cade4e832627b4f6
35 | """
36 | if not isinstance(data, bytes):
37 | data = str(data).encode()
38 | algorithm = algorithm.lower()
39 | hasher = getattr(hashlib, algorithm)
40 | return hasher(data).hexdigest()
41 |
--------------------------------------------------------------------------------
/netutils/ping.py:
--------------------------------------------------------------------------------
1 | """Functions to create a ping via pure Python."""
2 |
3 | import socket
4 |
5 |
6 | def tcp_ping(ip: str, port: int, timeout: int = 1) -> bool: # pylint: disable=invalid-name
7 | """Verifies whether a TCP port is open on a given IP address.
8 |
9 | Args:
10 | ip: An IP address in string format that is able to be converted by `ipaddress` library.
11 | port: A valid TCP port.
12 | timeout: The timeout in seconds before returning a False. Defaults to 1.
13 |
14 | Returns:
15 | The result as to whether or not you were able ping the IP address.
16 |
17 | Examples:
18 | >>> from netutils.ping import tcp_ping
19 | >>> tcp_ping("1.1.1.1", 443) # doctest: +SKIP
20 | True
21 | >>> tcp_ping("1.0.100.0", 27) # doctest: +SKIP
22 | False
23 | >>>
24 | """
25 | sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
26 | sckt.settimeout(int(timeout))
27 | try:
28 | sckt.connect((ip, int(port))) # pylint: disable=invalid-name
29 | sckt.shutdown(socket.SHUT_RDWR)
30 | return True
31 | # We really only want to know if the TCP connection timed out.
32 | # If anything else has happened the error should be raised.
33 | except socket.timeout:
34 | return False
35 | finally:
36 | sckt.close()
37 |
--------------------------------------------------------------------------------
/netutils/protocol_mapper.py:
--------------------------------------------------------------------------------
1 | """Protocol Mappers."""
2 |
3 | import typing as t
4 |
5 | from netutils.constants import PROTOCOLS
6 | from netutils.data_files.protocol_number_mappings import ( # noqa: F401 # pylint:disable=unused-import
7 | PROTO_NAME_TO_NUM,
8 | PROTO_NUM_TO_NAME,
9 | )
10 |
11 |
12 | def _number_to_name_mapper(proto: str) -> t.Dict[int, str]:
13 | """Create a dictionary that maps protocol port number to a name.
14 |
15 | Args:
16 | proto: Protocol to map ['tcp', 'udp', 'sctp', 'dccp']
17 |
18 | Returns:
19 | Dictionary of the number to name mapping.
20 | """
21 | proto_num_to_name = {}
22 |
23 | for key, value in PROTOCOLS.items():
24 | if proto.lower() in value["protocols"]:
25 | proto_num_to_name[value["port_number"]] = key.upper()
26 |
27 | return proto_num_to_name
28 |
29 |
30 | # https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
31 | # TCP port to name mapping.
32 | TCP_NUM_TO_NAME = _number_to_name_mapper("tcp")
33 |
34 | # TCP port name to number mapping
35 | TCP_NAME_TO_NUM = {value: key for (key, value) in TCP_NUM_TO_NAME.items()}
36 |
37 | # UDP port to name mapping.
38 | UDP_NUM_TO_NAME = _number_to_name_mapper("udp")
39 |
40 | # UDP port name to number mapping
41 | UDP_NAME_TO_NUM = {value: key for (key, value) in UDP_NUM_TO_NAME.items()}
42 |
43 | # SCTP port to name mapping.
44 | SCTP_NUM_TO_NAME = _number_to_name_mapper("sctp")
45 |
46 | # SCTP port name to number mapping
47 | SCTP_NAME_TO_NUM = {value: key for (key, value) in SCTP_NUM_TO_NAME.items()}
48 |
49 | # DCCP port to name mapping.
50 | DCCP_NUM_TO_NAME = _number_to_name_mapper("dccp")
51 |
52 | # DCCP port name to number mapping
53 | DCCP_NAME_TO_NUM = {value: key for (key, value) in DCCP_NUM_TO_NAME.items()}
54 |
--------------------------------------------------------------------------------
/netutils/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/netutils/py.typed
--------------------------------------------------------------------------------
/netutils/running_config.py:
--------------------------------------------------------------------------------
1 | """Configuration command lookup."""
2 |
3 | from netutils.lib_mapper import RUNNING_CONFIG_MAPPER
4 |
5 |
6 | def get_running_config_command(platform: str) -> str:
7 | """
8 | Get the running config command for a specific network platform.
9 |
10 | Args:
11 | platform: Platform name, like 'cisco_ios' or 'juniper_junos'.
12 |
13 | Returns:
14 | The corresponding command as a string, or 'show run' by default.
15 | """
16 | return RUNNING_CONFIG_MAPPER.get(platform.lower(), "show run")
17 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/tests/__init__.py
--------------------------------------------------------------------------------
/tests/integration/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/tests/integration/__init__.py
--------------------------------------------------------------------------------
/tests/unit/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/tests/unit/__init__.py
--------------------------------------------------------------------------------
/tests/unit/jinja2_template/test.j2:
--------------------------------------------------------------------------------
1 | 192.168.0.0 + 200 = {{ "192.168.0.0" | ip_addition(200) }}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/clean/standard_received.txt:
--------------------------------------------------------------------------------
1 | !
2 | version 12.4
3 | service timestamps debug datetime msec
4 | service timestamps log datetime msec
5 | no service password-encryption
6 | !
7 | hostname CSR1
8 | !
9 | !
10 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/clean/standard_sent.txt:
--------------------------------------------------------------------------------
1 | Building configuration...
2 | Current configuration : 1582 bytes
3 | !
4 | version 12.4
5 | service timestamps debug datetime msec
6 | service timestamps log datetime msec
7 | no service password-encryption
8 | !
9 | hostname CSR1
10 | !
11 | !
12 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/arista_eos/eos_bad_banner_backup.txt:
--------------------------------------------------------------------------------
1 | !
2 | banner login
3 | * GOOD DATA LINE 1
4 | * GOOD DATA LINE 2
5 | EOF
6 | !
7 | end
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/arista_eos/eos_bad_banner_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "banner", "ordered": True, "section": ["banner "]},
3 | ]
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/arista_eos/eos_bad_banner_intended.txt:
--------------------------------------------------------------------------------
1 | !
2 | banner login
3 | * GOOD DATA LINE 1
4 | * BAD DATA LINE 2
5 | EOF
6 | !
7 | end
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/arista_eos/eos_bad_banner_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "banner": {
3 | "actual": "banner login\n* GOOD DATA LINE 1\n* GOOD DATA LINE 2\nEOF",
4 | "cannot_parse": true,
5 | "compliant": false,
6 | "extra": "banner login\n* GOOD DATA LINE 1\n* GOOD DATA LINE 2\nEOF",
7 | "intended": "banner login\n* GOOD DATA LINE 1\n* BAD DATA LINE 2\nEOF",
8 | "missing": "banner login\n* GOOD DATA LINE 1\n* BAD DATA LINE 2\nEOF",
9 | "ordered_compliant": false,
10 | "unordered_compliant": false
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/arista_eos/eos_basic_backup.txt:
--------------------------------------------------------------------------------
1 | router bgp 65254
2 | router-id 10.0.20.6
3 | neighbor 10.11.11.13 remote-as 65253
4 | neighbor 10.11.11.13 maximum-routes 12000
5 | neighbor 10.11.11.21 remote-as 65253
6 | neighbor 10.11.11.21 maximum-routes 12000
7 | redistribute connected
8 | !
9 | banner login
10 | ********************************************************************
11 | * This system is the property of Allied Widget Co. *
12 | * UNAUTHORIZED ACCESS TO THIS DEVICE IS PROHIBITED *
13 | * *
14 | * You must have explicit, authorized permission to access or *
15 | * configure this device. Unauthorized attempts and actions to *
16 | * access or use this system may result in civil and/or criminal *
17 | * penalties. *
18 | * *
19 | * All activities performed on this deviceare logged and monitored. *
20 | ********************************************************************
21 | EOF
22 | !
23 | management api http-commands
24 | protocol http
25 | protocol unix-socket
26 | no shutdown
27 | !
28 | management api gnmi
29 | transport grpc default
30 | port 830
31 | !
32 | end
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/arista_eos/eos_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["router bgp "]},
3 | {"name": "banner", "ordered": True, "section": ["banner "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/arista_eos/eos_basic_intended.txt:
--------------------------------------------------------------------------------
1 | router bgp 65254
2 | router-id 10.0.20.6
3 | neighbor 10.11.11.13 remote-as 65253
4 | neighbor 10.11.11.13 maximum-routes 12000
5 | neighbor 10.11.11.21 remote-as 65253
6 | neighbor 10.11.11.21 maximum-routes 12000
7 | redistribute connected
8 | !
9 | banner login
10 | ********************************************************************
11 | * This system is the property of Allied Widget Co. *
12 | * UNAUTHORIZED ACCESS TO THIS DEVICE IS PROHIBITED *
13 | * *
14 | * You must have explicit, authorized permission to access or *
15 | * configure this device. Unauthorized attempts and actions to *
16 | * access or use this system may result in civil and/or criminal *
17 | * penalties. *
18 | * *
19 | * All activities performed on this deviceare logged and monitored. *
20 | ********************************************************************
21 | EOF
22 | !
23 | management api http-commands
24 | protocol http
25 | protocol unix-socket
26 | no shutdown
27 | !
28 | management api gnmi
29 | transport grpc default
30 | port 830
31 | !
32 | end
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/aruba_aoscx/aoscx_basic_backup.txt:
--------------------------------------------------------------------------------
1 | hostname spine-01
2 | banner motd !
3 | test motd banner
4 | !
5 | ntp server 10.20.1.9
6 | ntp server 10.20.1.8
7 | ntp server 10.20.1.7
8 | !
9 | access-list ip test
10 | 10 deny any 10.10.0.128/255.255.255.128 10.10.0.128/255.255.255.192
11 | 20 deny any 10.10.0.0/255.255.255.192 10.10.0.0/255.255.255.128
12 | 30 permit any any any
13 | !
14 | router bgp 65533
15 | bgp router-id 10.22.0.2
16 | maximum-paths 8
17 | timers bgp 1 3
18 | distance bgp 20 70
19 | neighbor 10.20.1.10 remote-as 65533
20 | neighbor 10.20.1.10 passive
21 | address-family ipv4 unicast
22 | neighbor 10.20.1.10 activate
23 | neighbor 10.20.1.10 route-map test-01 in
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/aruba_aoscx/aoscx_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["router bgp "]},
3 | {"name": "ntp", "ordered": False, "section": ["ntp server "]},
4 | {"name": "banner", "ordered": True, "section": ["banner "]},
5 | {"name": "acl", "ordered": True, "section": ["access-list "]},
6 | ]
7 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/aruba_aoscx/aoscx_basic_intended.txt:
--------------------------------------------------------------------------------
1 | hostname spine-01
2 | banner motd !
3 | ###############################################################################
4 | This is a test banner
5 | ###############################################################################
6 | !
7 | banner exec !
8 | ###############################################################################
9 | This is a test banner
10 | ###############################################################################
11 | !
12 | ntp server 10.20.1.7
13 | ntp server 10.20.1.8
14 | ntp server 10.20.1.9
15 | !
16 | access-list ip test
17 | 10 deny any 10.10.0.0/255.255.255.128 10.10.0.128/255.255.255.192
18 | 20 deny any 10.10.0.128/255.255.255.192 10.10.0.0/255.255.255.128
19 | 30 permit any any any
20 | !
21 | router bgp 65533
22 | bgp router-id 10.22.0.2
23 | maximum-paths 8
24 | timers bgp 1 3
25 | distance bgp 20 70
26 | neighbor 10.20.1.9 remote-as 65533
27 | neighbor 10.20.1.9 passive
28 | address-family ipv4 unicast
29 | neighbor 10.20.1.9 activate
30 | neighbor 10.20.1.9 route-map test-01 in
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/bigip_f5/bigip_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "rte", "ordered": True, "section": ["net route-domain "]},
3 | ]
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/bigip_f5/bigip_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "rte": {
3 | "actual": "net route-domain 0 {\n id 0\n vlans {\n proxy_transit\n http-tunnel\n socks-tunnel\n backend_transit\n }\n}",
4 | "cannot_parse": true,
5 | "compliant": true,
6 | "extra": "",
7 | "intended": "net route-domain 0 {\n id 0\n vlans {\n proxy_transit\n http-tunnel\n socks-tunnel\n backend_transit\n }\n}",
8 | "missing": "",
9 | "ordered_compliant": true,
10 | "unordered_compliant": true
11 | }
12 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_aireos/aireos_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "pfl", "ordered": True, "section": ["config wlan profiling "]},
3 | ]
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_aireos/aireos_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "pfl": {
3 | "actual": "config wlan profiling radius dhcp disable 14\nconfig wlan profiling radius http disable 14\nconfig wlan profiling local dhcp disable 14\nconfig wlan profiling local http disable 14\nconfig wlan profiling radius dhcp disable 15\nconfig wlan profiling radius http disable 15\nconfig wlan profiling local dhcp disable 15\nconfig wlan profiling local http disable 15\nconfig wlan profiling radius dhcp disable 16\nconfig wlan profiling radius http disable 16\nconfig wlan profiling local dhcp disable 16\nconfig wlan profiling local http disable 16",
4 | "cannot_parse": true,
5 | "compliant": true,
6 | "extra": "",
7 | "intended": "config wlan profiling radius dhcp disable 14\nconfig wlan profiling radius http disable 14\nconfig wlan profiling local dhcp disable 14\nconfig wlan profiling local http disable 14\nconfig wlan profiling radius dhcp disable 15\nconfig wlan profiling radius http disable 15\nconfig wlan profiling local dhcp disable 15\nconfig wlan profiling local http disable 15\nconfig wlan profiling radius dhcp disable 16\nconfig wlan profiling radius http disable 16\nconfig wlan profiling local dhcp disable 16\nconfig wlan profiling local http disable 16",
8 | "missing": "",
9 | "ordered_compliant": true,
10 | "unordered_compliant": true
11 | }
12 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_asa/asa_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "hostname", "ordered": False, "section": ["hostname"]},
3 | {"name": "logging", "ordered": False, "section": ["logging", "no logging"]},
4 | {"name": "aaa", "ordered": False, "section": ["aaa"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_asa/asa_basic_intended.txt:
--------------------------------------------------------------------------------
1 | hostname jcy-fw-01
2 | !
3 | logging enable
4 | logging timestamp
5 | logging standby
6 | logging buffer-size 1048576
7 | logging buffered informational
8 | logging trap informational
9 | logging asdm informational
10 | logging facility 21
11 | logging queue 0
12 | logging device-id hostname
13 | logging host Management 10.1.1.200
14 | no logging message 20202020
15 | !
16 | aaa-server TACACS+ protocol tacacs+
17 | reactivation-mode timed
18 | max-failed-attempts 5
19 | aaa-server TACACS+ (Management) host 10.1.1.100
20 | key 20202020
21 | aaa authentication serial console LOCAL
22 | aaa authentication ssh console TACACS+ LOCAL
23 | aaa authentication enable console TACACS+ LOCAL
24 | aaa authentication http console TACACS+ LOCAL
25 | aaa accounting command TACACS+
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_ios/ios_basic_backup.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.5
3 | !
4 | snmp-server ifindex persist
5 | snmp-server packetsize 4096
6 | snmp-server location San Fran
7 | access-list 1 permit 10.10.15.15
8 | access-list 1 permit 10.10.20.20
9 | !
10 | ntp server 192.168.0.100
11 | ntp server 192.168.0.101
12 | !
13 | banner login ^C
14 | ******************
15 | TEST BANNER
16 | ******************
17 | ^C
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_ios/ios_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["router bgp "]},
3 | {"name": "snmp", "ordered": True, "section": ["snmp-server "]},
4 | {"name": "ntp", "ordered": False, "section": ["ntp server "]},
5 | {"name": "banner", "ordered": True, "section": ["banner "]},
6 | ]
7 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_ios/ios_basic_intended.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.5
3 | !
4 | snmp-server ifindex persist
5 | snmp-server packetsize 4096
6 | snmp-server location SFO
7 | access-list 1 permit 10.10.15.15
8 | access-list 1 permit 10.10.20.20
9 | !
10 | ntp server 192.168.0.101
11 | ntp server 192.168.0.100
12 | !
13 | banner login ^
14 | ******************
15 | TEST BANNER
16 | ******************
17 | ^
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_ios/ios_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "bgp": {
3 | "compliant": true,
4 | "missing": "",
5 | "extra": "",
6 | "cannot_parse": true,
7 | "unordered_compliant": true,
8 | "ordered_compliant": true,
9 | "actual": "router bgp 100\n bgp router-id 10.6.6.5",
10 | "intended": "router bgp 100\n bgp router-id 10.6.6.5"
11 | },
12 | "snmp": {
13 | "actual": "snmp-server ifindex persist\nsnmp-server packetsize 4096\nsnmp-server location San Fran",
14 | "cannot_parse": true,
15 | "compliant": false,
16 | "extra": "snmp-server location San Fran",
17 | "intended": "snmp-server ifindex persist\nsnmp-server packetsize 4096\nsnmp-server location SFO",
18 | "missing": "snmp-server location SFO",
19 | "ordered_compliant": false,
20 | "unordered_compliant": false
21 | },
22 | "ntp": {
23 | "actual": "ntp server 192.168.0.100\nntp server 192.168.0.101",
24 | "cannot_parse": true,
25 | "compliant": true,
26 | "extra": "",
27 | "intended": "ntp server 192.168.0.101\nntp server 192.168.0.100",
28 | "missing": "",
29 | "ordered_compliant": false,
30 | "unordered_compliant": true
31 | },
32 | "banner": {
33 | "actual": "banner login ^C\n******************\n TEST BANNER\n******************\n^C",
34 | "cannot_parse": true,
35 | "compliant": true,
36 | "extra": "",
37 | "intended": "banner login ^C\n******************\n TEST BANNER\n******************\n^C",
38 | "missing": "",
39 | "ordered_compliant": true,
40 | "unordered_compliant": true
41 | }
42 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_iosxr/iosxr_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "host", "ordered": True, "section": ["hostname "]},
3 | {"name": "ntp", "ordered": True, "section": ["ntp"]},
4 | {"name": "banner", "ordered": True, "section": ["banner"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_iosxr/iosxr_basic_intended.txt:
--------------------------------------------------------------------------------
1 | hostname dfw1-core-01
2 | banner exec ~
3 | ****************
4 | Network to Code
5 | New York City, New York
6 | ****************
7 | ~
8 | banner motd ~
9 | *********************!!!IMPORTANT NOTICE!!!************************
10 | * This is a restricted system. All connections are logged. *
11 | * If you are not authorized to connect to this system, log *
12 | * off now. *
13 | * *
14 | * Violators will be prosecuted to the full extent of the law. *
15 | *******************************************************************
16 | * *
17 | **********************!!!AVIS IMPORTANT!!!*************************
18 | * L'acces au present systeme est limite et tous ses acces sont *
19 | * actuellement utilises. Si vous n'etes pas autorise a vous y *
20 | * raccorder, veuillez quitter ce systeme immediatement. *
21 | * *
22 | * Tout contrevenant sera poursuivi en vertu des mesures prevues *
23 | * par la loi. *
24 | *******************************************************************
25 | ~
26 | ntp
27 | server vrf management 10.44.158.184 source Loopback40302
28 | server vrf management 10.44.149.8 source Loopback40302
29 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_nxos/nxos_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["router bgp "]},
3 | {"name": "banner", "ordered": True, "section": ["banner "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/cisco_nxos/nxos_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "bgp": {
3 | "actual": "router bgp 65250\n router-id 10.0.10.4\n log-neighbor-changes\n address-family ipv4 unicast\n redistribute direct route-map PERMIT_CONN_ROUTES\n neighbor 10.10.10.6\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.10.10\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.10.14\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.10.18\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.11.5\n remote-as 65251\n address-family ipv4 unicast",
4 | "cannot_parse": true,
5 | "compliant": true,
6 | "extra": "",
7 | "intended": "router bgp 65250\n router-id 10.0.10.4\n log-neighbor-changes\n address-family ipv4 unicast\n redistribute direct route-map PERMIT_CONN_ROUTES\n neighbor 10.10.10.6\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.10.10\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.10.14\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.10.18\n remote-as 65250\n address-family ipv4 unicast\n neighbor 10.10.11.5\n remote-as 65251\n address-family ipv4 unicast",
8 | "missing": "",
9 | "ordered_compliant": true,
10 | "unordered_compliant": true
11 | },
12 | "banner": {
13 | "actual": "banner motd ^C\nThis is a test,\nbanner message.\n^C",
14 | "cannot_parse": true,
15 | "compliant": true,
16 | "extra": "",
17 | "intended": "banner motd ^C\nThis is a test,\nbanner message.\n^C",
18 | "missing": "",
19 | "ordered_compliant": true,
20 | "unordered_compliant": true
21 | }
22 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/extreme_netiron/netiron_basic_backup.txt:
--------------------------------------------------------------------------------
1 | !
2 | management-vrf MGMT
3 | default-max-frame-size 9216
4 | no route-only
5 | aaa authentication web-server default local
6 | aaa authentication enable default local radius
7 | aaa authentication login default local radius
8 | aaa authentication login privilege-mode
9 | aaa authorization exec default radius
10 | radius-server host 10.20.30.40 auth-port 1812 acct-port 1813 authentication-only key 0 secret
11 | radius-server host 10.20.30.40 auth-port 1812 acct-port 1813 authentication-only key 0 secret
12 | !
13 | !
14 | !
15 | !
16 | ntp
17 | disable serve
18 | source-interface loopback 1
19 | server 40.30.20.10
20 | !
21 | !
22 | cam-partition profile multi-service
23 | enable password-display
24 | enable telnet authentication
25 | enable aaa console
26 | logging host 40.30.20.11
27 | no logging buffered debugging
28 | logging console
29 | username root password 8 secret
30 | username root history secret
31 | enable-qos-statistics
32 | !
33 | !
34 | !
35 | snmp-server
36 | snmp-server community 2 secret ro 1
37 | snmp-server community 0 secret ro 1
38 | snmp-server enable mib np-qos-stat
39 | snmp-server max-ifindex-per-module 64
40 | snmp-server access-group 1
41 | hostname NETIRON-ROUTER
42 | no transceiver-type-check
43 | sflow enable
44 | sflow destination 40.30.20.10 2351
45 | sflow management-vrf-disable
46 | sflow polling-interval 2
47 | ssh access-group ipv6 IPV6-BLOCK-ALL
48 | ssh access-group 1
49 | !
50 | router isis
51 | net 49.0001.1932.0300.0001.00
52 | no hostname
53 | is-type level-2
54 | log adjacency
55 | address-family ipv4 unicast
56 | metric-style wide
57 | redistribute static route-map DEMO-ROUTE-MAP
58 | exit-address-family
59 |
60 | address-family ipv6 unicast
61 | exit-address-family
62 |
63 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/extreme_netiron/netiron_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "syslog", "ordered": False, "section": ["logging"]},
3 | {"name": "aaa", "ordered": False, "section": ["aaa"]},
4 | {"name": "isis", "ordered": True, "section": ["router isis"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/extreme_netiron/netiron_basic_intended.txt:
--------------------------------------------------------------------------------
1 | !
2 | management-vrf MGMT
3 | default-max-frame-size 9216
4 | no route-only
5 | aaa authentication web-server default local
6 | aaa authentication enable default local radius
7 | aaa authentication login default local radius
8 | aaa authentication login privilege-mode
9 | aaa authorization exec default radius
10 | radius-server host 10.20.30.40 auth-port 1812 acct-port 1813 authentication-only key 0 secret
11 | radius-server host 10.20.30.40 auth-port 1812 acct-port 1813 authentication-only key 0 secret
12 | !
13 | !
14 | !
15 | !
16 | ntp
17 | disable serve
18 | source-interface loopback 1
19 | server 40.30.20.10
20 | !
21 | !
22 | cam-partition profile multi-service
23 | enable password-display
24 | enable telnet authentication
25 | enable aaa console
26 | logging host 40.30.20.10
27 | no logging buffered debugging
28 | logging console
29 | username root password 8 secret
30 | username root history secret
31 | enable-qos-statistics
32 | !
33 | !
34 | !
35 | snmp-server
36 | snmp-server community 2 secret ro 1
37 | snmp-server community 0 secret ro 1
38 | snmp-server enable mib np-qos-stat
39 | snmp-server max-ifindex-per-module 64
40 | snmp-server access-group 1
41 | hostname NETIRON-ROUTER
42 | no transceiver-type-check
43 | sflow enable
44 | sflow destination 40.30.20.10 2351
45 | sflow management-vrf-disable
46 | sflow polling-interval 2
47 | ssh access-group ipv6 IPV6-BLOCK-ALL
48 | ssh access-group 1
49 | !
50 | !
51 | router isis
52 | net 49.0001.1932.0300.0001.00
53 | no hostname
54 | is-type level-2
55 | log adjacency
56 | address-family ipv4 unicast
57 | metric-style wide
58 | redistribute static route-map DEMO-ROUTE-MAP
59 | exit-address-family
60 |
61 | address-family ipv6 unicast
62 | exit-address-family
63 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/fortinet_fortios/fortios_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "global", "ordered": False, "section": ["config system global"]},
3 | {"name": "interfaces", "ordered": False, "section": ["config system virtual-switch"]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_banner_backup.txt:
--------------------------------------------------------------------------------
1 | #
2 | header motd "my banner"
3 | #
4 | hwtacacs nas-ip 1.1.1.1
5 | #
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_banner_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "header", "ordered": True, "section": ["header "]},
3 | ]
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_banner_intended.txt:
--------------------------------------------------------------------------------
1 | #
2 | header motd ^C
3 | ===================================================
4 | * GOOD DATA LINE 1
5 | * BAD DATA LINE 2
6 | ==================================================^C
7 | #
8 | hwtacacs nas-ip 1.1.1.4
9 | #
10 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_banner_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "header": {
3 | "compliant": false,
4 | "missing": "header motd ^C\n===================================================\n* GOOD DATA LINE 1\n* BAD DATA LINE 2\n==================================================^C",
5 | "extra": "header motd \"my banner\"",
6 | "cannot_parse": true,
7 | "unordered_compliant": false,
8 | "ordered_compliant": false,
9 | "actual": "header motd \"my banner\"",
10 | "intended": "header motd ^C\n===================================================\n* GOOD DATA LINE 1\n* BAD DATA LINE 2\n==================================================^C"
11 | }
12 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_basic_backup.txt:
--------------------------------------------------------------------------------
1 | sysname HP-JKT-01
2 | #
3 | dhcp enable
4 | dhcp server forbidden-ip 10.10.10.1 10.10.10.100
5 | dhcp server always-broadcast
6 | #
7 | dhcp server ip-pool CKP
8 | gateway-list 10.10.10.1
9 | domain-name intra.data.co.id
10 | expired day 30
11 | netbios-type b-node
12 | #
13 | bgp 65330
14 | router-id 10.10.10.254
15 | graceful-restart
16 | graceful-restart timer restart 120
17 | graceful-restart timer wait-for-rib 360
18 | peer 10.20.240.1 description ***Point to Point Connection**
19 | peer 10.20.240.1 ebgp-max-hop 10
20 | peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==
21 | address-family ipv4 unicast
22 | balance 4
23 | peer 10.30.240.1 enable
24 | peer 10.30.240.1 route-policy P2P-FirstTry import
25 | peer 10.30.240.1 route-policy P2P-FirstTry export
26 | #
27 | snmp-agent
28 | snmp-agent local-engineid 8000XXX123456789AB503C00000001
29 | snmp-agent community read RO
30 | snmp-agent community read read
31 | snmp-agent community read ro
32 | #
33 | acl advanced name HPE
34 | rule 1 permit source 10.180.50.254 0 destination 10.1.0.249 0
35 | rule 2 permit source 10.180.50.0 0.0.0.127 destination 10.1.4.62 0
36 | rule 3 permit source 10.180.50.0 0.0.0.127 destination 10.2.4.62 0
37 | #
38 | header motd #
39 | ===================================================
40 |
41 | !!! WARNING !!!
42 | system monitoring for law enforcement and other
43 | purpose. Unauthorized use of this machine may
44 | subject you to criminal prosecution and penalties
45 |
46 | ==================================================#
47 | #
48 | return
49 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["bgp "]},
3 | {"name": "snmp-agent", "ordered": True, "section": ["snmp-server "]},
4 | {"name": "dhcp", "ordered": False, "section": ["dhcp "]},
5 | {"name": "header", "ordered": True, "section": ["header "]},
6 | {"name": "acl", "ordered": True, "section": ["acl "]},
7 | ]
8 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_basic_intended.txt:
--------------------------------------------------------------------------------
1 | sysname HP-JKT-01
2 | #
3 | dhcp enable
4 | dhcp server forbidden-ip 10.10.10.1 10.10.10.100
5 | dhcp server always-broadcast
6 | #
7 | dhcp server ip-pool CKP
8 | gateway-list 10.10.10.1
9 | domain-name intra.data.co.id
10 | expired day 30
11 | netbios-type b-node
12 | #
13 | bgp 65330
14 | router-id 10.10.10.254
15 | graceful-restart
16 | graceful-restart timer restart 120
17 | graceful-restart timer wait-for-rib 360
18 | peer 10.20.240.1 description ***Point to Point Connection**
19 | peer 10.20.240.1 ebgp-max-hop 10
20 | peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==
21 | address-family ipv4 unicast
22 | balance 4
23 | peer 10.30.240.1 enable
24 | peer 10.30.240.1 route-policy P2P-FirstTry import
25 | peer 10.30.240.1 route-policy P2P-FirstTry export
26 | #
27 | snmp-agent
28 | snmp-agent local-engineid 8000XXX123456789AB503C00000001
29 | snmp-agent community read RO
30 | snmp-agent community read read
31 | snmp-agent community read ro
32 | #
33 | acl advanced name HPE
34 | rule 1 permit source 10.180.60.254 0 destination 10.1.0.249 0
35 | rule 2 permit source 10.180.60.0 0.0.0.127 destination 10.1.4.62 0
36 | rule 3 permit source 10.180.60.0 0.0.0.127 destination 10.2.4.62 0
37 | #
38 | header motd #
39 | ===================================================
40 |
41 | !!! WARNING !!!
42 | system monitoring for law enforcement and other
43 | purpose. Unauthorized use of this machine may
44 | subject you to criminal prosecution and penalties
45 |
46 | ==================================================#
47 | #
48 | return
49 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/juniper_junos/junos_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["set protocols bgp "]},
3 | ]
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/juniper_junos/junos_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "bgp": {
3 | "actual": "set protocols bgp local-as 65252\nset protocols bgp group p2p export send-direct\nset protocols bgp group p2p neighbor 10.10.0.22 peer-as 65252\nset protocols bgp group p2p neighbor 10.10.0.26 peer-as 65252\nset protocols bgp group p2p neighbor 10.11.11.6 peer-as 65253",
4 | "cannot_parse": true,
5 | "compliant": true,
6 | "extra": "",
7 | "intended": "set protocols bgp local-as 65252\nset protocols bgp group p2p export send-direct\nset protocols bgp group p2p neighbor 10.10.0.22 peer-as 65252\nset protocols bgp group p2p neighbor 10.10.0.26 peer-as 65252\nset protocols bgp group p2p neighbor 10.11.11.6 peer-as 65253",
8 | "missing": "",
9 | "ordered_compliant": true,
10 | "unordered_compliant": true
11 | }
12 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/mikrotik_routeros/routeros_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["/routing bgp instance"]},
3 | {"name": "snmp", "ordered": True, "section": ["/snmp"]},
4 | {"name": "ospf-networks", "ordered": True, "section": ["/routing ospf network"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/mikrotik_routeros/routeros_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "bgp": {
3 | "actual": "/routing bgp instance set default as=1234 router-id=10.127.1.3",
4 | "cannot_parse": true,
5 | "compliant": true,
6 | "extra": "",
7 | "intended": "/routing bgp instance set default as=1234 router-id=10.127.1.3",
8 | "missing": "",
9 | "ordered_compliant": true,
10 | "unordered_compliant": true
11 | },
12 | "snmp": {
13 | "actual": "/snmp community add addresses=::/0 name=somestringa\n/snmp set enabled=yes trap-community=somestring",
14 | "cannot_parse": true,
15 | "compliant": true,
16 | "extra": "",
17 | "intended": "/snmp community add addresses=::/0 name=somestringa\n/snmp set enabled=yes trap-community=somestring",
18 | "missing": "",
19 | "ordered_compliant": true,
20 | "unordered_compliant": true
21 | },
22 | "ospf-networks": {
23 | "actual": "/routing ospf network add area=backbone network=10.126.0.16/29",
24 | "cannot_parse": true,
25 | "compliant": false,
26 | "extra": "",
27 | "intended": "/routing ospf network add area=backbone network=10.126.0.16/29\n/routing ospf network add area=backbone network=10.127.1.3/32",
28 | "missing": "/routing ospf network add area=backbone network=10.127.1.3/32",
29 | "ordered_compliant": false,
30 | "unordered_compliant": false
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/mrv_optiswitch/optiswitch_basic_backup.txt:
--------------------------------------------------------------------------------
1 | ! version 2_1_10
2 | !
3 | rsyslog 10.1.1.4
4 | !
5 | hostname MRV-OS904-1
6 | !
7 | service advanced-vty
8 | service password-encryption
9 | !
10 | line vty
11 | exec-timeout global 90
12 | !
13 | port media-select copper 1-2
14 | !
15 | port description 1 TO-CUSTOMER
16 | port description 2 TO-POP
17 | port state disable 3-4
18 | no port advertise speed 1000 duplex half 1
19 | no port advertise speed 1000 duplex full 1
20 | port speed 100 1-2
21 | port duplex full 1-2
22 | !
23 | port flood-limiting rate 10m 1
24 | port flood-limiting unknown-unicast 1
25 | port flood-limiting multicast 1
26 | port flood-limiting broadcast 1
27 | !
28 | port tag-outbound-mode hybrid 1-2 1737
29 | !
30 | interface vlan vif416
31 | name CONTROL-VL
32 | tag 416
33 | ip 10.1.1.91/24
34 | ports 2
35 | management ssh 10.0.0.0/8
36 | management telnet 10.0.0.0/8
37 | management tftp 10.0.0.0/8
38 | management snmp 10.0.0.0/8
39 | !
40 | interface vlan vif1738
41 | name SERVICE
42 | tag 1738
43 | ports 1-2
44 | !
45 | ip route 10.0.0.0/8 10.1.1.1
46 | ip route 19.23.8.25/32 10.1.1.1
47 | !
48 | ntp
49 | server 10.1.1.2
50 | enable
51 | !
52 | ingress-counters set1 port 1 tag all
53 | !
54 | password long-mode
55 | !
56 | radius-server host 10.1.1.2 key ASU4602O551PTV6
57 | radius-server host 10.1.1.15 key ASU4602O551PTV6
58 | !
59 | aaa
60 | authentication login default local radius
61 | !
62 | snmp
63 | location dc1
64 | community 10 read-only 10.0.0.0/8 secret
65 | authtrap
66 | trapsess 10.1.1.2 2 secret
67 | trapsess 10.1.1.15 2 secret
68 | !
69 | fan temperature 30 27
70 | !
71 | lldp
72 | port 1 receive
73 | port 2 receive
74 | port 3 receive
75 | port 4 receive
76 | enable
77 | !
78 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/mrv_optiswitch/optiswitch_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "syslog", "ordered": False, "section": ["rsyslog"]},
3 | {"name": "aaa", "ordered": False, "section": ["aaa"]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/mrv_optiswitch/optiswitch_basic_intended.txt:
--------------------------------------------------------------------------------
1 | ! version 2_1_10
2 | !
3 | rsyslog 10.1.1.5
4 | !
5 | hostname MRV-OS904-1
6 | !
7 | service advanced-vty
8 | service password-encryption
9 | !
10 | line vty
11 | exec-timeout global 90
12 | !
13 | port media-select copper 1-2
14 | !
15 | port description 1 TO-CUSTOMER
16 | port description 2 TO-POP
17 | port state disable 3-4
18 | no port advertise speed 1000 duplex half 1
19 | no port advertise speed 1000 duplex full 1
20 | port speed 100 1-2
21 | port duplex full 1-2
22 | !
23 | port flood-limiting rate 10m 1
24 | port flood-limiting unknown-unicast 1
25 | port flood-limiting multicast 1
26 | port flood-limiting broadcast 1
27 | !
28 | port tag-outbound-mode hybrid 1-2 1737
29 | !
30 | interface vlan vif416
31 | name CONTROL-VL
32 | tag 416
33 | ip 10.1.1.91/24
34 | ports 2
35 | management ssh 10.0.0.0/8
36 | management telnet 10.0.0.0/8
37 | management tftp 10.0.0.0/8
38 | management snmp 10.0.0.0/8
39 | !
40 | interface vlan vif1738
41 | name SERVICE
42 | tag 1738
43 | ports 1-2
44 | !
45 | ip route 10.0.0.0/8 10.1.1.1
46 | ip route 19.23.8.25/32 10.1.1.1
47 | !
48 | ntp
49 | server 10.1.1.2
50 | enable
51 | !
52 | ingress-counters set1 port 1 tag all
53 | !
54 | password long-mode
55 | !
56 | radius-server host 10.1.1.2 key ASU4602O551PTV6
57 | radius-server host 10.1.1.15 key ASU4602O551PTV6
58 | !
59 | aaa
60 | authentication login default local radius
61 | !
62 | snmp
63 | location dc1
64 | community 10 read-only 10.0.0.0/8 secret
65 | authtrap
66 | trapsess 10.1.1.2 2 secret
67 | trapsess 10.1.1.15 2 secret
68 | !
69 | fan temperature 30 27
70 | !
71 | lldp
72 | port 1 receive
73 | port 2 receive
74 | port 3 receive
75 | port 4 receive
76 | enable
77 | !
78 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/mrv_optiswitch/optiswitch_basic_received.json:
--------------------------------------------------------------------------------
1 | {"aaa": {"actual": "aaa\n authentication login default local radius",
2 | "cannot_parse": true,
3 | "compliant": true,
4 | "extra": "",
5 | "intended": "aaa\n authentication login default local radius",
6 | "missing": "",
7 | "ordered_compliant": true,
8 | "unordered_compliant": true},
9 | "syslog": {"actual": "rsyslog 10.1.1.4",
10 | "cannot_parse": true,
11 | "compliant": false,
12 | "extra": "rsyslog 10.1.1.4",
13 | "intended": "rsyslog 10.1.1.5",
14 | "missing": "rsyslog 10.1.1.5",
15 | "ordered_compliant": false,
16 | "unordered_compliant": false}}
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/netscaler/netscaler_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "user", "ordered": False, "section": ["set system user "]},
3 | {"name": "cmdPolicy", "ordered": False, "section": ["add system cmdPolicy "]},
4 | {"name": "ssl", "ordered": False, "section": ["add ssl ", "bind ssl "]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/nokia_sros/sros_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "System Configuration", "ordered": False, "section": ["System Configuration"]},
3 | {"name": "System Security Configuration", "ordered": True, "section": ["System Security Configuration"]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/paloalto_panos/paloalto_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "management", "ordered": False, "section": ["set mgt-config "]},
3 | ]
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/paloalto_panos/paloalto_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "management": {
3 | "actual": "set mgt-config users readonly permissions role-based vsysreader localhost.localdomain vsys vsys1\nset mgt-config users readonly phash passhash\nset mgt-config users user1 permissions role-based superuser yes\nset mgt-config users user1 phash passhash",
4 | "cannot_parse": true,
5 | "compliant": true,
6 | "extra": "",
7 | "intended": "set mgt-config users readonly permissions role-based vsysreader localhost.localdomain vsys vsys1\nset mgt-config users readonly phash passhash\nset mgt-config users user1 permissions role-based superuser yes\nset mgt-config users user1 phash passhash",
8 | "missing": "",
9 | "ordered_compliant": true,
10 | "unordered_compliant": true
11 | }
12 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/rad_etx/etx_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "terminal", "ordered": False, "section": ["terminal"]},
3 | {"name": "management", "ordered": False, "section": ["management"]},
4 | {"name": "router", "ordered": False, "section": ["router"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/ruckus_fastiron/fastiron_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "snmp", "ordered": False, "section": ["snmp-server"]},
3 | {"name": "aaa", "ordered": False, "section": ["aaa"]},
4 | {"name": "mstp", "ordered": True, "section": ["mstp"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/ruckus_fastiron/fastiron_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "aaa": {
3 | "actual": "aaa authentication web-server default local\naaa authentication login default local",
4 | "cannot_parse": true,
5 | "compliant": true,
6 | "extra": "",
7 | "intended": "aaa authentication web-server default local\naaa authentication login default local",
8 | "missing": "",
9 | "ordered_compliant": true,
10 | "unordered_compliant": true
11 | },
12 | "mstp": {
13 | "actual": "mstp scope all\nmstp instance 0 vlan 1\nmstp instance 0 vlan 2000\nmstp instance 0 vlan 3000 to 3010\nmstp instance 0 vlan 3995\nmstp start",
14 | "cannot_parse": true,
15 | "compliant": true,
16 | "extra": "",
17 | "intended": "mstp scope all\nmstp instance 0 vlan 1\nmstp instance 0 vlan 2000\nmstp instance 0 vlan 3000 to 3010\nmstp instance 0 vlan 3995\nmstp start",
18 | "missing": "",
19 | "ordered_compliant": true,
20 | "unordered_compliant": true
21 | },
22 | "snmp": {
23 | "actual": "snmp-server community testcomm rw",
24 | "cannot_parse": true,
25 | "compliant": false,
26 | "extra": "snmp-server community testcomm rw",
27 | "intended": "snmp-server community testcamm rw",
28 | "missing": "snmp-server community testcamm rw",
29 | "ordered_compliant": false,
30 | "unordered_compliant": false
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/ubiquiti_airos/airos_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "radio_country_code", "ordered": True, "section": ["radio.1.countrycode"]},
3 | {"name": "snmp", "ordered": True, "section": ["snmp.community"]},
4 | {"name": "radio_mode", "ordered": True, "section": ["radio.1.mode"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/compliance/ubiquiti_airos/airos_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "radio_country_code": {
3 | "compliant": true,
4 | "missing": "",
5 | "extra": "",
6 | "cannot_parse": true,
7 | "unordered_compliant": true,
8 | "ordered_compliant": true,
9 | "actual": "radio.1.countrycode=840",
10 | "intended": "radio.1.countrycode=840"
11 | },
12 | "snmp": {
13 | "compliant": true,
14 | "missing": "",
15 | "extra": "",
16 | "cannot_parse": true,
17 | "unordered_compliant": true,
18 | "ordered_compliant": true,
19 | "actual": "snmp.community=admin",
20 | "intended": "snmp.community=admin"
21 | },
22 | "radio_mode": {
23 | "compliant": false,
24 | "missing": "radio.1.mode=master",
25 | "extra": "radio.1.mode=slave",
26 | "cannot_parse": true,
27 | "unordered_compliant": false,
28 | "ordered_compliant": false,
29 | "actual": "radio.1.mode=slave",
30 | "intended": "radio.1.mode=master"
31 | }
32 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/arista_eos/eos_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "ntp", "ordered": True, "section": ["ntp server "]},
3 | {"name": "snmp", "ordered": True, "section": ["snmp-server "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/arista_eos/eos_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "!\n\n!\nspanning-tree mode mstp\n!",
3 | "section_not_found": []
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/arista_eos/eos_basic_sent.txt:
--------------------------------------------------------------------------------
1 |
2 | ntp server 10.1.1.1
3 | ntp server 10.2.2.2 prefer
4 | !
5 | snmp-server contact John Smith
6 | snmp-server location Network to Code - NYC | NY
7 | snmp-server community networktocode ro
8 | snmp-server community secure rw
9 | snmp-server host 10.1.1.1 version 2c networktocode
10 | !
11 | spanning-tree mode mstp
12 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/bigip_f5/bigipf5_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "rte", "ordered": True, "section": ["net route "]},
3 | {"name": "domain", "ordered": True, "section": ["net route-domain "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/bigip_f5/bigipf5_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "net self app-servers-backend_selfIP {\n address 192.168.194.1/24\n allow-service all\n traffic-group traffic-group-local-only\n vlan backend_transit\n}",
3 | "section_not_found": []
4 | }
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/bigip_f5/bigipf5_basic_sent.txt:
--------------------------------------------------------------------------------
1 | net route Default {
2 | description "for managing system and internet updates"
3 | gw 192.168.192.10
4 | network default
5 | }
6 | net route-domain 0 {
7 | id 0
8 | vlans {
9 | proxy_transit
10 | http-tunnel
11 | socks-tunnel
12 | backend_transit
13 | }
14 | }
15 | net self app-servers-backend_selfIP {
16 | address 192.168.194.1/24
17 | allow-service all
18 | traffic-group traffic-group-local-only
19 | vlan backend_transit
20 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_aireos/aireos_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "mdns", "ordered": True, "section": ["config mdns "]},
3 | {"name": "port", "ordered": True, "section": ["config port "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_aireos/aireos_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "config lag enable",
3 | "section_not_found": []
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_aireos/aireos_basic_sent.txt:
--------------------------------------------------------------------------------
1 | config mdns snooping disable
2 | config lag enable
3 | config port adminmode 1 disable
4 | config port adminmode 2 disable
5 | config port adminmode 3 disable
6 | config port adminmode 4 disable
7 | config port adminmode 5 enable
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_asa/asa_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "hostname", "ordered": False, "section": ["hostname"]},
3 | {"name": "logging", "ordered": False, "section": ["logging", "no logging"]},
4 | {"name": "aaa", "ordered": False, "section": ["aaa"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_asa/asa_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "!\n\n!\nroute Management 0.0.0.0 0.0.0.0 10.1.1.1 1",
3 | "section_not_found": [
4 | "aaa"
5 | ]
6 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_asa/asa_basic_sent.txt:
--------------------------------------------------------------------------------
1 | hostname jcy-fw-01
2 | !
3 | logging enable
4 | logging timestamp
5 | logging standby
6 | logging buffer-size 1048576
7 | logging buffered informational
8 | logging trap informational
9 | logging asdm informational
10 | logging facility 21
11 | logging queue 0
12 | logging device-id hostname
13 | logging host Management 10.1.1.200
14 | no logging message 20202020
15 | !
16 | route Management 0.0.0.0 0.0.0.0 10.1.1.1 1
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_ios/ios_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["router bgp "]},
3 | {"name": "snmp", "ordered": True, "section": ["snmp-server "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_ios/ios_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "!\n\naccess-list 1 permit 10.10.15.15\naccess-list 1 permit 10.10.20.20",
3 | "section_not_found": []
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_ios/ios_basic_sent.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.5
3 | !
4 | snmp-server ifindex persist
5 | snmp-server packetsize 4096
6 | snmp-server location SFO
7 | access-list 1 permit 10.10.15.15
8 | access-list 1 permit 10.10.20.20
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_iosxr/iosxr_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "banner", "ordered": False, "section": ["banner"]},
3 | {"name": "bgp", "ordered": False, "section": ["router bgp"]},
4 | {"name": "ntp", "ordered": True, "section": ["ntp"]},
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_iosxr/iosxr_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "hostname dfw1-core-01",
3 | "section_not_found": [
4 | "bgp"
5 | ]
6 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_iosxr/iosxr_basic_sent.txt:
--------------------------------------------------------------------------------
1 | hostname dfw1-core-01
2 | banner exec ~
3 | ****************
4 | Network to Code
5 | New York City, New York
6 | ****************
7 | ~
8 | ntp
9 | server vrf management 10.44.158.184 source Loopback40302
10 | server vrf management 10.44.149.8 source Loopback40302
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_nxos/nxos_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "ntp", "ordered": True, "section": ["ntp server "]},
3 | {"name": "vlan", "ordered": True, "section": ["vlan "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_nxos/nxos_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "ip route 0.0.0.0/0 10.0.0.2",
3 | "section_not_found": []
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/cisco_nxos/nxos_basic_sent.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.1.1.1 use-vrf default
2 | ntp server 10.2.2.2 prefer use-vrf default
3 | ip route 0.0.0.0/0 10.0.0.2
4 | vlan 1,248
5 | vlan 248
6 | name vlan248
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/juniper_junos/_basic_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "bgp", "ordered": True, "section": ["set protocols bgp "]},
3 | {"name": "snmp", "ordered": True, "section": ["set snmp "]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/juniper_junos/_basic_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "set routing-instances mgmt_junos description mgmt",
3 | "section_not_found": []
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/juniper_junos/_basic_sent.txt:
--------------------------------------------------------------------------------
1 | set snmp view system-include oid .1 include
2 | set snmp community networktocode view system-include
3 | set snmp community networktocode authorization read-only
4 | set snmp community secure view system-include
5 | set snmp community secure authorization read-write
6 | set protocols bgp local-as 65252
7 | set protocols bgp group p2p export send-direct
8 | set protocols bgp group p2p neighbor 10.10.0.22 peer-as 65252
9 | set protocols bgp group p2p neighbor 10.10.0.26 peer-as 65252
10 | set protocols bgp group p2p neighbor 10.11.11.6 peer-as 65253
11 | set routing-instances mgmt_junos description mgmt
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/mikrotik_routeros/routeros_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "routing-filter", "ordered": True, "section": ["/routing filter"]},
3 | {"name": "ospf", "ordered": True, "section": ["/routing ospf"]},
4 | {"name": "snmp", "ordered": True, "section": ["/snmp"]},
5 | {"name": "ip-firewall", "ordered": True, "section": ["/ip firewall"]},
6 | ]
7 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/mikrotik_routeros/routeros_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "/system clock set time-zone-name=America/New_York\n/system identity set name=ag1.123site.nwk.nj\n/system logging add action=remote topics=error\n/system logging add action=remote topics=info",
3 |
4 | "section_not_found": ["ip-firewall"]
5 | }
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/mikrotik_routeros/routeros_sent.txt:
--------------------------------------------------------------------------------
1 | /routing filter add action=discard chain=ibgp-no-default-out prefix=10.127.1.0/24
2 | /routing filter add action=accept chain=ibgp-no-default-out prefix=10.64.0.0/10 prefix-length=22-32
3 | /routing ospf interface add dead-interval=8s hello-interval=2s interface=vlan3049-Transit-to-85Presidential network-type=point-to-point
4 | /routing ospf interface add cost=11 dead-interval=8s hello-interval=2s interface=vlan3166-Transit-HalseyCore-Agg1-to-Indigo-5 network-type=point-to-point
5 | /routing ospf network add area=backbone network=10.126.0.16/29
6 | /snmp set enabled=yes trap-community=somestring
7 | /system clock set time-zone-name=America/New_York
8 | /system identity set name=ag1.123site.nwk.nj
9 | /system logging add action=remote topics=error
10 | /system logging add action=remote topics=info
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/nokia_sros/sros_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "System Configuration", "ordered": False, "section": ["System Configuration"]},
3 | {"name": "System Security Configuration", "ordered": True, "section": ["System Security Configuration"]},
4 | ]
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/nokia_sros/sros_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "exit all\nconfigure\n\n\nSystem Login Control Configuration\n system\n login-control\n ssh\n inbound-max-sessions 30\n exit\n exit\n exit",
3 | "section_not_found": []
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/paloalto_panos/panos_feature.py:
--------------------------------------------------------------------------------
1 | features = [
2 | {"name": "Management Config", "ordered": False, "section": ["set mgt-config "]},
3 | {
4 | "name": "Panorama Config",
5 | "ordered": True,
6 | "section": ["set deviceconfig system service "],
7 | },
8 | ]
9 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/paloalto_panos/panos_received.json:
--------------------------------------------------------------------------------
1 | {
2 | "remaining_cfg": "set deviceconfig system permitted-ip 0.0.0.0/0\nset deviceconfig system domain example.com",
3 | "section_not_found": []
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/config_section_not_parsed/paloalto_panos/panos_sent.txt:
--------------------------------------------------------------------------------
1 | set deviceconfig system permitted-ip 0.0.0.0/0
2 | set deviceconfig system domain example.com
3 | set deviceconfig system service disable-telnet yes
4 | set deviceconfig system service disable-http yes
5 | set deviceconfig system service disable-snmp no
6 | set mgt-config users readonly permissions role-based vsysreader localhost.localdomain vsys vsys1
7 | set mgt-config users readonly phash passhash
8 | set mgt-config users user1 permissions role-based superuser yes
9 | set mgt-config users user1 phash passhash
10 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/arista_eos/eos_basic_base.txt:
--------------------------------------------------------------------------------
1 | interface Ethernet2
2 | no switchport
3 | ip address 10.11.11.14/30
4 | !
5 | interface Ethernet3
6 | no switchport
7 | ip address 10.11.11.18/30
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/arista_eos/eos_basic_intended.txt:
--------------------------------------------------------------------------------
1 | interface Ethernet2
2 | no switchport
3 | ip address 10.11.11.14/30
4 | !
5 | interface Ethernet3
6 | no switchport
7 | ip address 10.11.11.19/30
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/arista_eos/eos_basic_received.txt:
--------------------------------------------------------------------------------
1 | interface Ethernet3
2 | ip address 10.11.11.19/30
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/bigip_f5/bigipf5_basic_base.txt:
--------------------------------------------------------------------------------
1 | cm device-group gtm {
2 | devices {
3 | gns-elb01.7stacktech.com { }
4 | }
5 | network-failover disabled
6 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/bigip_f5/bigipf5_basic_intended.txt:
--------------------------------------------------------------------------------
1 | cm device-group gtm {
2 | devices {
3 | gns-elb02.7stacktech.com { }
4 | }
5 | network-failover disabled
6 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/bigip_f5/bigipf5_basic_received.txt:
--------------------------------------------------------------------------------
1 | cm device-group gtm {
2 | devices {
3 | gns-elb02.7stacktech.com { }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_aireos/aireos_basic_base.txt:
--------------------------------------------------------------------------------
1 | config interface vlan management 40
2 | config interface port management 5
3 | config interface address management 192.168.2.154 255.255.255.224 192.168.2.158
4 | config interface dhcp management primary 192.168.2.158
5 | config interface dhcp management proxy-mode disable
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_aireos/aireos_basic_intended.txt:
--------------------------------------------------------------------------------
1 | config interface vlan management 40
2 | config interface port management 5
3 | config interface address management 192.168.2.154 255.255.255.224 192.168.2.158
4 | config interface dhcp management primary 192.168.2.159
5 | config interface dhcp management proxy-mode disable
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_aireos/aireos_basic_received.txt:
--------------------------------------------------------------------------------
1 | config interface dhcp management primary 192.168.2.159
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_asa/asa_basic_base.txt:
--------------------------------------------------------------------------------
1 | hostname jcy-fw-01
2 | !
3 | logging enable
4 | logging timestamp
5 | logging standby
6 | logging buffer-size 1048576
7 | logging buffered informational
8 | logging trap informational
9 | logging asdm informational
10 | logging facility 21
11 | logging queue 0
12 | logging device-id hostname
13 | logging host Management 10.1.1.20
14 | no logging message 10101010
15 | !
16 | route Management 0.0.0.0 0.0.0.0 10.1.1.254 1
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_asa/asa_basic_intended.txt:
--------------------------------------------------------------------------------
1 | hostname jcy-fw-01
2 | !
3 | logging enable
4 | logging timestamp
5 | logging standby
6 | logging buffer-size 1048576
7 | logging buffered informational
8 | logging trap informational
9 | logging asdm informational
10 | logging facility 21
11 | logging queue 0
12 | logging device-id hostname
13 | logging host Management 10.1.1.200
14 | no logging message 20202020
15 | !
16 | route Management 0.0.0.0 0.0.0.0 10.1.1.1 1
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_asa/asa_basic_received.txt:
--------------------------------------------------------------------------------
1 | logging host Management 10.1.1.200
2 | no logging message 20202020
3 | route Management 0.0.0.0 0.0.0.0 10.1.1.1 1
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_ios/ios_basic_base.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.5
3 | !
4 | snmp-server ifindex persist
5 | snmp-server packetsize 4096
6 | snmp-server location San Fran
7 | access-list 1 permit 10.10.15.15
8 | access-list 1 permit 10.10.20.20
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_ios/ios_basic_intended.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.6
3 | !
4 | snmp-server ifindex persist
5 | snmp-server packetsize 4096
6 | snmp-server location SFO
7 | access-list 1 permit 10.10.15.15
8 | access-list 1 permit 10.10.20.20
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_ios/ios_basic_received.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.6
3 | snmp-server location SFO
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_iosxr/iosxr_basic_base.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.5
3 | !
4 | snmp-server ifindex persist
5 |
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_iosxr/iosxr_basic_intended.txt:
--------------------------------------------------------------------------------
1 | router bgp 40302
2 | bgp router-id 98.200.230.153
3 | !
4 | snmp-server ifindex persist
5 | snmp-server mibs qosmib persist
6 | snmp-server vrf management
7 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_iosxr/iosxr_basic_received.txt:
--------------------------------------------------------------------------------
1 | router bgp 40302
2 | bgp router-id 98.200.230.153
3 | snmp-server mibs qosmib persist
4 | snmp-server vrf management
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_nxos/nxos_basic_base.txt:
--------------------------------------------------------------------------------
1 | interface Ethernet1/1
2 | no switchport
3 | mac-address 0000.1100.2222
4 | ip address 10.10.10.5/30
5 | no shutdown
6 |
7 | interface Ethernet1/2
8 | no switchport
9 | mac-address 0011.1111.2222
10 | ip address 10.10.10.9/30
11 | no shutdown
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_nxos/nxos_basic_intended.txt:
--------------------------------------------------------------------------------
1 | interface Ethernet1/1
2 | no switchport
3 | mac-address 0000.1100.2222
4 | ip address 10.10.10.6/30
5 | no shutdown
6 |
7 | interface Ethernet1/2
8 | no switchport
9 | mac-address 0011.1111.2222
10 | ip address 10.10.10.9/30
11 | no shutdown
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/cisco_nxos/nxos_basic_received.txt:
--------------------------------------------------------------------------------
1 | interface Ethernet1/1
2 | ip address 10.10.10.6/30
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/juniper_junos/_basic_base.txt:
--------------------------------------------------------------------------------
1 | set interfaces ge-0/0/0 unit 0 family inet address 10.10.0.21/30
2 | set interfaces ge-0/0/1 unit 0 family inet address 10.10.0.25/30
3 | set interfaces ge-0/0/2 unit 0 family inet
4 | set interfaces ge-0/0/3 unit 0 family inet address 10.11.11.5/30
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/juniper_junos/_basic_intended.txt:
--------------------------------------------------------------------------------
1 | set interfaces ge-0/0/0 unit 0 family inet address 10.10.0.22/30
2 | set interfaces ge-0/0/1 unit 0 family inet address 10.10.0.25/30
3 | set interfaces ge-0/0/2 unit 0 family inet
4 | set interfaces ge-0/0/3 unit 0 family inet address 10.11.11.5/30
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/juniper_junos/_basic_received.txt:
--------------------------------------------------------------------------------
1 | set interfaces ge-0/0/0 unit 0 family inet address 10.10.0.22/30
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/nokia_sros/sros_base.txt:
--------------------------------------------------------------------------------
1 | exit all
2 | configure
3 | #--------------------------------------------------
4 | echo "System Configuration"
5 | #--------------------------------------------------
6 | system
7 | name "sros-r1"
8 | netconf
9 | auto-config-save
10 | no shutdown
11 | exit
12 | snmp
13 | streaming
14 | no shutdown
15 | exit
16 | packet-size 9216
17 | exit
18 | time
19 | sntp
20 | shutdown
21 | exit
22 | zone UTC
23 | exit
24 | bluetooth
25 | module A
26 | exit
27 | power off
28 | exit
29 | exit
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/nokia_sros/sros_intended.txt:
--------------------------------------------------------------------------------
1 | exit all
2 | configure
3 | #--------------------------------------------------
4 | echo "System Configuration"
5 | #--------------------------------------------------
6 | system
7 | name "core-router.example.com"
8 | netconf
9 | auto-config-save
10 | no shutdown
11 | exit
12 | snmp
13 | streaming
14 | no shutdown
15 | exit
16 | packet-size 9216
17 | exit
18 | time
19 | sntp
20 | shutdown
21 | exit
22 | zone EDT
23 | exit
24 | bluetooth
25 | module A
26 | exit
27 | power off
28 | exit
29 | exit
30 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/nokia_sros/sros_received.txt:
--------------------------------------------------------------------------------
1 | System Configuration
2 | system
3 | name "core-router.example.com"
4 | time
5 | zone EDT
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/paloalto_panos/panos_basic_base.txt:
--------------------------------------------------------------------------------
1 | set deviceconfig system permitted-ip 0.0.0.0/0
2 | set deviceconfig system domain example.com
3 | set deviceconfig system service disable-telnet yes
4 | set deviceconfig system service disable-http yes
5 | set deviceconfig system service disable-snmp no
6 | set mgt-config users readonly permissions role-based vsysreader localhost.localdomain vsys vsys1
7 | set mgt-config users readonly phash passhash
8 | set mgt-config users user1 permissions role-based superuser yes
9 | set mgt-config users user1 phash passhash
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/paloalto_panos/panos_basic_intended.txt:
--------------------------------------------------------------------------------
1 | set deviceconfig system permitted-ip 10.0.0.0/8
2 | set deviceconfig system domain example.com
3 | set deviceconfig system service disable-telnet yes
4 | set deviceconfig system service disable-http yes
5 | set deviceconfig system service disable-snmp no
6 | set mgt-config users readonly permissions role-based vsysreader localhost.localdomain vsys vsys1
7 | set mgt-config users readonly phash passhash
8 | set mgt-config users user1 permissions role-based superuser yes
9 | set mgt-config users user1 phash passhash
10 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/diff_network_config/paloalto_panos/panos_basic_received.txt:
--------------------------------------------------------------------------------
1 | set deviceconfig system permitted-ip 10.0.0.0/8
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_basic_actual.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.10
2 | ntp server 10.10.10.11
3 | ntp server 10.10.10.12
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_basic_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "ntp", "ordered": False, "section": ["ntp server "]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_basic_intended.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.10
2 | ntp server 10.10.10.12
3 | ntp server 10.10.10.11
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_basic_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "actual": "ntp server 10.10.10.10\nntp server 10.10.10.11\nntp server 10.10.10.12",
3 | "cannot_parse": True,
4 | "compliant": True,
5 | "extra": "",
6 | "intended": "ntp server 10.10.10.10\nntp server 10.10.10.12\nntp server 10.10.10.11",
7 | "missing": "",
8 | "ordered_compliant": False,
9 | "unordered_compliant": True,
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_actual.txt:
--------------------------------------------------------------------------------
1 | hostname dual-banner
2 | !
3 | banner exec ^C
4 | =========
5 | actual config exec banner
6 | -========
7 | ^C
8 | banner motd ^C
9 | ======
10 | actual config motd banner
11 | ======
12 | || ($hostname) ||
13 | ^C
14 | !
15 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_exec_actual.txt:
--------------------------------------------------------------------------------
1 | hostname dual-banner
2 | !
3 | banner exec ^C
4 | =========
5 | actual config exec banner
6 | -========
7 | ^C
8 | banner motd ^C
9 | ======
10 | actual config motd banner
11 | ======
12 | || ($hostname) ||
13 | ^C
14 | !
15 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_exec_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "exec banner", "ordered": False, "section": ["banner exec"]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_exec_intended.txt:
--------------------------------------------------------------------------------
1 | hostname dual-banner
2 | !
3 | banner exec ^C
4 | =========
5 | intended config exec banner
6 | -========
7 | ^C
8 | banner motd ^C
9 | ======
10 | intended config motd banner
11 | ======
12 | || ($hostname) ||
13 | ^C
14 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_exec_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "compliant": False,
3 | "missing": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C",
4 | "extra": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C",
5 | "cannot_parse": True,
6 | "unordered_compliant": False,
7 | "ordered_compliant": False,
8 | "actual": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C",
9 | "intended": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C",
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "dual banner", "ordered": False, "section": ["banner"]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_intended.txt:
--------------------------------------------------------------------------------
1 | hostname dual-banner
2 | !
3 | banner exec ^C
4 | =========
5 | intended config exec banner
6 | -========
7 | ^C
8 | banner motd ^C
9 | ======
10 | intended config motd banner
11 | ======
12 | || ($hostname) ||
13 | ^C
14 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_motd_actual.txt:
--------------------------------------------------------------------------------
1 | hostname dual-banner
2 | !
3 | banner exec ^C
4 | =========
5 | actual config exec banner
6 | -========
7 | ^C
8 | banner motd ^C
9 | ======
10 | actual config motd banner
11 | ======
12 | || ($hostname) ||
13 | ^C
14 | !
15 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_motd_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "motd banner", "ordered": False, "section": ["banner motd"]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_motd_intended.txt:
--------------------------------------------------------------------------------
1 | hostname dual-banner
2 | !
3 | banner exec ^C
4 | =========
5 | intended config exec banner
6 | -========
7 | ^C
8 | banner motd ^C
9 | ======
10 | intended config motd banner
11 | ======
12 | || ($hostname) ||
13 | ^C
14 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_motd_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "compliant": False,
3 | "missing": "banner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C",
4 | "extra": "banner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C",
5 | "cannot_parse": True,
6 | "unordered_compliant": False,
7 | "ordered_compliant": False,
8 | "actual": "banner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C",
9 | "intended": "banner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C",
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "compliant": False,
3 | "missing": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C\nbanner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C",
4 | "extra": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C\nbanner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C",
5 | "cannot_parse": True,
6 | "unordered_compliant": False,
7 | "ordered_compliant": False,
8 | "actual": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C\nbanner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C",
9 | "intended": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C\nbanner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C",
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_banner_actual.txt:
--------------------------------------------------------------------------------
1 | hostname emptybanner
2 | !
3 | banner motd ^C^C
4 | !
5 | line vty 0 4
6 | transport ssh
7 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_banner_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "banner", "ordered": False, "section": ["banner"]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_banner_intended.txt:
--------------------------------------------------------------------------------
1 | hostname emptybanner
2 | !
3 | banner motd ^C
4 | actual banner example
5 | ^C
6 | !
7 | line vty 0 4
8 | transport ssh
9 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_banner_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "actual": "banner motd ^C^C",
3 | "cannot_parse": True,
4 | "compliant": False,
5 | "extra": "banner motd ^C^C",
6 | "intended": "banner motd ^C\nactual banner example\n^C",
7 | "missing": "banner motd ^C\nactual banner example\n^C",
8 | "ordered_compliant": False,
9 | "unordered_compliant": False,
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_both_actual.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/tests/unit/mock/config/compliance/feature_compliance/ios_empty_both_actual.txt
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_both_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "ntp", "ordered": False, "section": ["ntp server "]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_both_intended.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/tests/unit/mock/config/compliance/feature_compliance/ios_empty_both_intended.txt
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_both_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "actual": "",
3 | "cannot_parse": True,
4 | "compliant": True,
5 | "extra": "",
6 | "intended": "",
7 | "missing": "",
8 | "ordered_compliant": True,
9 | "unordered_compliant": True,
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_dst_actual.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.10
2 | ntp server 10.10.10.11
3 | ntp server 10.10.10.12
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_dst_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "ntp", "ordered": False, "section": ["ntp server "]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_dst_intended.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/tests/unit/mock/config/compliance/feature_compliance/ios_empty_dst_intended.txt
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_dst_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "actual": "ntp server 10.10.10.10\nntp server 10.10.10.11\nntp server 10.10.10.12",
3 | "cannot_parse": True,
4 | "compliant": False,
5 | "extra": "ntp server 10.10.10.10\nntp server 10.10.10.11\nntp server 10.10.10.12",
6 | "intended": "",
7 | "missing": "",
8 | "ordered_compliant": False,
9 | "unordered_compliant": False,
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_src_actual.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/networktocode/netutils/985fd84e29f35ec0579b4cb6eab1ccbeb3bc5e18/tests/unit/mock/config/compliance/feature_compliance/ios_empty_src_actual.txt
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_src_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "ntp", "ordered": False, "section": ["ntp server "]}
2 | network_os = "cisco_ios"
3 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_src_intended.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.10
2 | ntp server 10.10.10.12
3 | ntp server 10.10.10.11
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/feature_compliance/ios_empty_src_received.py:
--------------------------------------------------------------------------------
1 | data = {
2 | "actual": "",
3 | "cannot_parse": True,
4 | "compliant": False,
5 | "extra": "",
6 | "intended": "ntp server 10.10.10.10\nntp server 10.10.10.12\nntp server 10.10.10.11",
7 | "missing": "ntp server 10.10.10.10\nntp server 10.10.10.12\nntp server 10.10.10.11",
8 | "ordered_compliant": False,
9 | "unordered_compliant": False,
10 | }
11 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/find_unordered_cfg_lines/ios_basic_actual.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.10
2 | ntp server 10.10.10.11
3 | ntp server 10.10.10.12
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/find_unordered_cfg_lines/ios_basic_intended.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.10
2 | ntp server 10.10.10.12
3 | ntp server 10.10.10.11
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/find_unordered_cfg_lines/ios_basic_received.py:
--------------------------------------------------------------------------------
1 | data = (
2 | True,
3 | [("ntp server 10.10.10.12", "ntp server 10.10.10.11"), ("ntp server 10.10.10.11", "ntp server 10.10.10.12")],
4 | )
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/find_unordered_cfg_lines/ios_unordered_actual.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.11
2 | ntp server 10.10.10.10
3 | ntp server 10.10.10.12
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/find_unordered_cfg_lines/ios_unordered_intended.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.10.10.10
2 | ntp server 10.10.10.11
3 | ntp server 10.10.10.13
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/find_unordered_cfg_lines/ios_unordered_received.py:
--------------------------------------------------------------------------------
1 | data = (
2 | False,
3 | [
4 | ("ntp server 10.10.10.10", "ntp server 10.10.10.11"),
5 | ("ntp server 10.10.10.11", "ntp server 10.10.10.10"),
6 | ("ntp server 10.10.10.13", "ntp server 10.10.10.12"),
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/arista_eos/eos_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "many", "ordered": True, "section": ["snmp-server ", "ntp server "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/arista_eos/eos_full_received.txt:
--------------------------------------------------------------------------------
1 | ntp server 10.1.1.1
2 | ntp server 10.2.2.2 prefer
3 | snmp-server contact John Smith
4 | snmp-server location Network to Code - NYC | NY
5 | snmp-server community networktocode ro
6 | snmp-server community secure rw
7 | snmp-server host 10.1.1.1 version 2c networktocode
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/bigip_f5/bigip_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "rte", "ordered": True, "section": ["net route-domain "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/bigip_f5/bigip_full_received.txt:
--------------------------------------------------------------------------------
1 | net route-domain 0 {
2 | id 0
3 | vlans {
4 | proxy_transit
5 | http-tunnel
6 | socks-tunnel
7 | backend_transit
8 | }
9 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_aireos/aireos_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "snmp", "ordered": True, "section": ["config snmp "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_aireos/aireos_full_received.txt:
--------------------------------------------------------------------------------
1 | config snmp version v1 disable
2 | config snmp version v2c disable
3 | config snmp community delete public
4 | config snmp community delete private
5 | config snmp version v3 disable
6 | config snmp v3user delete default
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_asa/asa_basic_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "aaa", "ordered": False, "section": ["aaa"]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_asa/asa_basic_received.txt:
--------------------------------------------------------------------------------
1 | aaa-server TACACS+ protocol tacacs+
2 | reactivation-mode timed
3 | max-failed-attempts 5
4 | aaa-server TACACS+ (Management) host 10.1.1.100
5 | key 20202020
6 | aaa authentication serial console LOCAL
7 | aaa authentication ssh console TACACS+ LOCAL
8 | aaa authentication enable console TACACS+ LOCAL
9 | aaa authentication http console TACACS+ LOCAL
10 | aaa accounting command TACACS+
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_asa/asa_basic_sent.txt:
--------------------------------------------------------------------------------
1 | hostname jcy-fw-01
2 | !
3 | logging enable
4 | logging timestamp
5 | logging standby
6 | logging buffer-size 1048576
7 | logging buffered informational
8 | logging trap informational
9 | logging asdm informational
10 | logging facility 21
11 | logging queue 0
12 | logging device-id hostname
13 | logging host Management 10.1.1.200
14 | no logging message 20202020
15 | !
16 | aaa-server TACACS+ protocol tacacs+
17 | reactivation-mode timed
18 | max-failed-attempts 5
19 | aaa-server TACACS+ (Management) host 10.1.1.100
20 | key 20202020
21 | aaa authentication serial console LOCAL
22 | aaa authentication ssh console TACACS+ LOCAL
23 | aaa authentication enable console TACACS+ LOCAL
24 | aaa authentication http console TACACS+ LOCAL
25 | aaa accounting command TACACS+
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_asa/asa_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "hostname & enable", "ordered": False, "section": ["hostname", "enable"]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_asa/asa_full_received.txt:
--------------------------------------------------------------------------------
1 | hostname jcy-fw-01
2 | enable password ntc123 encrypted
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_ios/ios_basic_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "BGP", "ordered": True, "section": ["router bgp "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_ios/ios_basic_received.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.5
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_ios/ios_basic_sent.txt:
--------------------------------------------------------------------------------
1 | router bgp 100
2 | bgp router-id 10.6.6.5
3 | !
4 | snmp-server ifindex persist
5 | snmp-server packetsize 4096
6 | snmp-server location SFO
7 | access-list 1 permit 10.10.15.15
8 | access-list 1 permit 10.10.20.20
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_ios/ios_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "many", "ordered": True, "section": ["interface ", "banner "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_iosxr/iosxr_basic_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "hostname", "ordered": False, "section": ["hostname "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_iosxr/iosxr_basic_received.txt:
--------------------------------------------------------------------------------
1 | hostname dfw1-core-01
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_iosxr/iosxr_basic_sent.txt:
--------------------------------------------------------------------------------
1 | hostname dfw1-core-01
2 | clock timezone EST America/NewYork
3 | logging trap informational
4 | logging archive
5 | device harddisk
6 | severity debugging
7 | file-size 100
8 | frequency daily
9 | archive-size 1500
10 | archive-length 6
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_iosxr/iosxr_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "aaa", "ordered": False, "section": ["aaa ", "tacacs"]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_iosxr/iosxr_full_received.txt:
--------------------------------------------------------------------------------
1 | tacacs source-interface Loopback40302 vrf management
2 | aaa accounting commands default start-stop group AUTH none
3 | aaa group server tacacs+ AUTH
4 | vrf management
5 | server-private 10.44.154.151 port 49
6 | key * *
7 | aaa authorization commands default group AUTH none
8 | aaa authentication login default group AUTH local
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_nxos/nxos_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "many", "ordered": True, "section": ["logging ", "router bgp "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_nxos/nxos_none_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "single_not_there", "ordered": True, "section": []}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_nxos/nxos_none_received.txt:
--------------------------------------------------------------------------------
1 | version 9.3(3) Bios:version
2 | hostname jcy-spine-01
3 | vdc jcy-spine-01 id 1
4 | limit-resource vlan minimum 16 maximum 4094
5 | limit-resource vrf minimum 2 maximum 4096
6 | limit-resource port-channel minimum 0 maximum 511
7 | limit-resource u4route-mem minimum 128 maximum 128
8 | limit-resource u6route-mem minimum 96 maximum 96
9 | limit-resource m4route-mem minimum 58 maximum 58
10 | limit-resource m6route-mem minimum 8 maximum 8
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/cisco_nxos/nxos_none_sent.txt:
--------------------------------------------------------------------------------
1 | version 9.3(3) Bios:version
2 | hostname jcy-spine-01
3 | vdc jcy-spine-01 id 1
4 | limit-resource vlan minimum 16 maximum 4094
5 | limit-resource vrf minimum 2 maximum 4096
6 | limit-resource port-channel minimum 0 maximum 511
7 | limit-resource u4route-mem minimum 128 maximum 128
8 | limit-resource u6route-mem minimum 96 maximum 96
9 | limit-resource m4route-mem minimum 58 maximum 58
10 | limit-resource m6route-mem minimum 8 maximum 8
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/juniper_junos/junos_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "many", "ordered": True, "section": ["set protocols bgp ", "set interfaces "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/juniper_junos/junos_full_received.txt:
--------------------------------------------------------------------------------
1 | set interfaces ge-0/0/0 unit 0 family inet address 10.10.0.21/30
2 | set interfaces ge-0/0/1 unit 0 family inet address 10.10.0.25/30
3 | set interfaces ge-0/0/2 unit 0 family inet
4 | set interfaces ge-0/0/3 unit 0 family inet address 10.11.11.5/30
5 | set interfaces ge-0/0/4 unit 0 family inet
6 | set interfaces ge-0/0/5 unit 0 family inet
7 | set interfaces ge-0/0/6 unit 0 family inet
8 | set interfaces ge-0/0/7 unit 0 family inet
9 | set interfaces fxp0 unit 0 description MANAGEMENT_INTEFACE__DO_NOT_CHANGE
10 | set interfaces fxp0 unit 0 family inet address 10.0.0.15/24
11 | set interfaces lo0 unit 0 family inet address 10.0.20.1/32
12 | set protocols bgp local-as 65252
13 | set protocols bgp group p2p export send-direct
14 | set protocols bgp group p2p neighbor 10.10.0.22 peer-as 65252
15 | set protocols bgp group p2p neighbor 10.10.0.26 peer-as 65252
16 | set protocols bgp group p2p neighbor 10.11.11.6 peer-as 65253
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/nokia_sros/sros_basic_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "System Configuration", "ordered": False, "section": ["System Configuration"]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/nokia_sros/sros_basic_received.txt:
--------------------------------------------------------------------------------
1 | System Configuration
2 | system
3 | name "sros-r1"
4 | netconf
5 | auto-config-save
6 | no shutdown
7 | exit
8 | time
9 | sntp
10 | shutdown
11 | exit
12 | zone UTC
13 | exit
14 | exit
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/nokia_sros/sros_basic_sent.txt:
--------------------------------------------------------------------------------
1 | exit all
2 | configure
3 | #--------------------------------------------------
4 | echo "System Configuration"
5 | #--------------------------------------------------
6 | system
7 | name "sros-r1"
8 | netconf
9 | auto-config-save
10 | no shutdown
11 | exit
12 | time
13 | sntp
14 | shutdown
15 | exit
16 | zone UTC
17 | exit
18 | exit
19 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/nokia_sros/sros_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {"name": "radius", "ordered": False, "section": ["configure system security radius "]}
2 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/nokia_sros/sros_full_received.txt:
--------------------------------------------------------------------------------
1 | configure system security radius operator-policy name:RADIUS
2 | configure system security radius auth-server RADIUS1 router-instance base ip-address 1.2.3.4 secret encrypted:al:d6:2f:b8:0a:85:7e:f1:f8:5a:bd:8f:55:83:l3:ad
3 | configure system security radius acc-server RADIUS1 router-instance base ip-address 5.6.7.8 secret encrypted:su:f2:1e:c5:5a:65:1b:d1:e0:2f:db:0a:71:56:f6:bf
4 | configure system security radius policy RADIUS nas-id PKB7J0VH77 nas-ip-address 126.65.111.173
5 | configure system security radius policy RADIUS servers 1 auth-server name:RADIUS1 auth-router-inst base priority 1 acc-server name:RADIUS1
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/nokia_sros/sros_full_sent.txt:
--------------------------------------------------------------------------------
1 | configure system security login-banner "\r\n***** DO NOT LOGIN UNLESS AUTHORIZED!!! *****\r\n"
2 | configure system security snmp community TEST host-address 20.81.6.14/28
3 | configure system security radius operator-policy name:RADIUS
4 | configure system security radius auth-server RADIUS1 router-instance base ip-address 1.2.3.4 secret encrypted:al:d6:2f:b8:0a:85:7e:f1:f8:5a:bd:8f:55:83:l3:ad
5 | configure system security radius acc-server RADIUS1 router-instance base ip-address 5.6.7.8 secret encrypted:su:f2:1e:c5:5a:65:1b:d1:e0:2f:db:0a:71:56:f6:bf
6 | configure system security radius policy RADIUS nas-id PKB7J0VH77 nas-ip-address 126.65.111.173
7 | configure system security radius policy RADIUS servers 1 auth-server name:RADIUS1 auth-router-inst base priority 1 acc-server name:RADIUS1
8 | configure system security domain authenticator authenticator radius:RADIUS
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/paloalto_panos/panos_full_feature.py:
--------------------------------------------------------------------------------
1 | feature = {
2 | "name": "many",
3 | "ordered": True,
4 | "section": ["set mgt-config", "set deviceconfig system panorama"],
5 | }
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/paloalto_panos/panos_full_received.txt:
--------------------------------------------------------------------------------
1 | set mgt-config users admin phash *
2 | set mgt-config users admin permissions role-based superuser yes
3 | set mgt-config users admin public-key thisisasuperduperlongbase64encodedstring
4 | set mgt-config users panadmin permissions role-based superuser yes
5 | set mgt-config users panadmin phash passwordhash
6 | set deviceconfig system panorama local-panorama panorama-server 10.0.0.1
7 | set deviceconfig system panorama local-panorama panorama-server-2 10.0.0.2
--------------------------------------------------------------------------------
/tests/unit/mock/config/compliance/section/paloalto_panos/panos_full_sent.txt:
--------------------------------------------------------------------------------
1 | set mgt-config users admin phash *
2 | set mgt-config users admin permissions role-based superuser yes
3 | set mgt-config users admin public-key thisisasuperduperlongbase64encodedstring
4 | set mgt-config users panadmin permissions role-based superuser yes
5 | set mgt-config users panadmin phash passwordhash
6 | set deviceconfig system hostname firewall1
7 | set deviceconfig system login-banner "
8 | ************************************************************************
9 | * firewall1.example.com * [PROD VM500 firewalls]
10 | ************************************************************************
11 | * WARNING *
12 | * Unauthorized access to this device or devices attached to *
13 | * or accessible from this network is strictly prohibited. *
14 | * Possession of passwords or devices enabling access to this *
15 | * device or devices does not constitute authorization. Unauthorized *
16 | * access will be prosecuted to the fullest extent of the law. *
17 | * *
18 | ************************************************************************
19 | "
20 | set deviceconfig system panorama local-panorama panorama-server 10.0.0.1
21 | set deviceconfig system panorama local-panorama panorama-server-2 10.0.0.2
--------------------------------------------------------------------------------
/tests/unit/mock/config/conversion/paloalto_panos/paloalto_basic_converted.txt:
--------------------------------------------------------------------------------
1 | set mgt-config users admin phash *
2 | set mgt-config users admin permissions role-based superuser yes
3 | set mgt-config users admin public-key thisisasuperduperlongbase64encodedstring
4 | set mgt-config users panadmin permissions role-based superuser yes
5 | set mgt-config users panadmin phash passwordhash
6 | set deviceconfig system hostname firewall1
7 | set deviceconfig system login-banner "
8 | ************************************************************************
9 | * firewall1.example.com * [PROD VM500 firewalls]
10 | ************************************************************************
11 | * WARNING *
12 | * Unauthorized access to this device or devices attached to *
13 | * or accessible from this network is strictly prohibited. *
14 | * Possession of passwords or devices enabling access to this *
15 | * device or devices does not constitute authorization. Unauthorized *
16 | * access will be prosecuted to the fullest extent of the law. *
17 | * *
18 | ************************************************************************
19 |
20 | "
21 | set deviceconfig system panorama local-panorama panorama-server 10.0.0.1
22 | set deviceconfig system panorama local-panorama panorama-server-2 10.0.0.2
--------------------------------------------------------------------------------
/tests/unit/mock/config/conversion/paloalto_panos/paloalto_basic_sent.txt:
--------------------------------------------------------------------------------
1 | config {
2 | mgt-config {
3 | users {
4 | admin {
5 | phash *;
6 | permissions {
7 | role-based {
8 | superuser yes;
9 | }
10 | }
11 | public-key thisisasuperduperlongbase64encodedstring;
12 | }
13 | panadmin {
14 | permissions {
15 | role-based {
16 | superuser yes;
17 | }
18 | }
19 | phash passwordhash;
20 | }
21 | }
22 | }
23 | devices {
24 | localhost.localdomain {
25 | deviceconfig {
26 | system {
27 | hostname firewall1;
28 | login-banner "
29 | ************************************************************************
30 | * firewall1.example.com * [PROD VM500 firewalls]
31 | ************************************************************************
32 | * WARNING *
33 | * Unauthorized access to this device or devices attached to *
34 | * or accessible from this network is strictly prohibited. *
35 | * Possession of passwords or devices enabling access to this *
36 | * device or devices does not constitute authorization. Unauthorized *
37 | * access will be prosecuted to the fullest extent of the law. *
38 | * *
39 | ************************************************************************
40 |
41 | ";
42 | panorama {
43 | local-panorama {
44 | panorama-server 10.0.0.1;
45 | panorama-server-2 10.0.0.2;
46 | }
47 | }
48 | }
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_asa/asa_nested_banner_received.py:
--------------------------------------------------------------------------------
1 | from netutils.config.parser import ConfigLine
2 |
3 | data = [
4 | ConfigLine(config_line="group-policy Grs-POLICY attributes", parents=()),
5 | ConfigLine(
6 | config_line=" banner value This is an",
7 | parents=("group-policy Grs-POLICY attributes",),
8 | ),
9 | ConfigLine(
10 | config_line=" banner value example nested banner",
11 | parents=("group-policy Grs-POLICY attributes",),
12 | ),
13 | ]
14 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_asa/asa_nested_banner_sent.txt:
--------------------------------------------------------------------------------
1 | group-policy Grs-POLICY attributes
2 | banner value This is an
3 | banner value example nested banner
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_ios/ios_banner_newline_received.py:
--------------------------------------------------------------------------------
1 | from netutils.config.parser import ConfigLine
2 |
3 | data = [
4 | ConfigLine(config_line="hostname banner_with_newline", parents=()),
5 | ConfigLine(config_line="banner login ^C", parents=()),
6 | ConfigLine(
7 | config_line="****************************************************\nWARNING TO UNAUTHORIZED USERS:\nThis system is for use by authorized users only.\n****************************************************\n^C",
8 | parents=("banner login ^C",),
9 | ),
10 | ConfigLine(config_line="line vty 0 4", parents=()),
11 | ConfigLine(config_line=" transport ssh", parents=("line vty 0 4",)),
12 | ]
13 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_ios/ios_banner_newline_sent.txt:
--------------------------------------------------------------------------------
1 | hostname banner_with_newline
2 | !
3 | banner login ^C
4 | ****************************************************
5 | WARNING TO UNAUTHORIZED USERS:
6 | This system is for use by authorized users only.
7 | ****************************************************
8 |
9 | ^C
10 | !
11 | line vty 0 4
12 | transport ssh
13 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_ios/ios_dual_banner_received.py:
--------------------------------------------------------------------------------
1 | from netutils.config.parser import ConfigLine
2 |
3 | data = [
4 | ConfigLine(config_line="hostname dual-banner", parents=()),
5 | ConfigLine(config_line="banner exec ^C", parents=()),
6 | ConfigLine(config_line="=========\nintended config exec banner\n-========\n^C", parents=("banner exec ^C",)),
7 | ConfigLine(config_line="banner motd ^C", parents=()),
8 | ConfigLine(
9 | config_line="======\nintended config motd banner\n======\n || ($hostname) ||\n^C", parents=("banner motd ^C",)
10 | ),
11 | ConfigLine(config_line=None, parents=()),
12 | ]
13 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_ios/ios_dual_banner_sent.txt:
--------------------------------------------------------------------------------
1 | hostname dual-banner
2 | !
3 | banner exec ^C
4 | =========
5 | intended config exec banner
6 | -========
7 | ^C
8 | banner motd ^C
9 | ======
10 | intended config motd banner
11 | ======
12 | || ($hostname) ||
13 | ^C
14 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_ios/ios_empty_banner_received.py:
--------------------------------------------------------------------------------
1 | from netutils.config.parser import ConfigLine
2 |
3 | data = [
4 | ConfigLine(config_line="hostname emptybanner", parents=()),
5 | ConfigLine(config_line="banner motd ^C^C", parents=()),
6 | ConfigLine(config_line="line vty 0 4", parents=()),
7 | ConfigLine(config_line=" transport ssh", parents=("line vty 0 4",)),
8 | ]
9 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/cisco_ios/ios_empty_banner_sent.txt:
--------------------------------------------------------------------------------
1 | hostname emptybanner
2 | !
3 | banner motd ^C^C
4 | !
5 | line vty 0 4
6 | transport ssh
7 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/hp_comware/hp_comware_sent.txt:
--------------------------------------------------------------------------------
1 | sysname HP-JKT-01
2 | #
3 | dhcp enable
4 | dhcp server forbidden-ip 10.10.10.1 10.10.10.100
5 | dhcp server always-broadcast
6 | #
7 | dhcp server ip-pool CKP
8 | gateway-list 10.10.10.1
9 | domain-name intra.data.co.id
10 | expired day 30
11 | netbios-type b-node
12 | #
13 | bgp 65330
14 | router-id 10.10.10.254
15 | graceful-restart
16 | graceful-restart timer restart 120
17 | graceful-restart timer wait-for-rib 360
18 | peer 10.20.240.1 description ***Point to Point Connection**
19 | peer 10.20.240.1 ebgp-max-hop 10
20 | peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==
21 | address-family ipv4 unicast
22 | balance 4
23 | peer 10.30.240.1 enable
24 | peer 10.30.240.1 route-policy P2P-FirstTry import
25 | peer 10.30.240.1 route-policy P2P-FirstTry export
26 | #
27 | snmp-agent
28 | snmp-agent local-engineid 8000XXX123456789AB503C00000001
29 | snmp-agent community read RO
30 | snmp-agent community read read
31 | snmp-agent community read ro
32 | #
33 | acl advanced name HPE
34 | rule 1 permit source 10.180.50.254 0 destination 10.1.0.249 0
35 | rule 2 permit source 10.180.50.0 0.0.0.127 destination 10.1.4.62 0
36 | rule 3 permit source 10.180.50.0 0.0.0.127 destination 10.2.4.62 0
37 | #
38 | header motd #
39 | ===================================================
40 |
41 | !!! WARNING !!!
42 | system monitoring for law enforcement and other
43 | purpose. Unauthorized use of this machine may
44 | subject you to criminal prosecution and penalties
45 |
46 | ==================================================#
47 | #
48 | return
49 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/mrv_optiswitch/optiswitch_full_sent.txt:
--------------------------------------------------------------------------------
1 | ! version 2_1_10
2 | !
3 | rsyslog 10.1.1.5
4 | !
5 | hostname MRV-OS904-1
6 | !
7 | service advanced-vty
8 | service password-encryption
9 | !
10 | line vty
11 | exec-timeout global 90
12 | !
13 | port media-select copper 1-2
14 | !
15 | port description 1 TO-CUSTOMER
16 | port description 2 TO-POP
17 | port state disable 3-4
18 | no port advertise speed 1000 duplex half 1
19 | no port advertise speed 1000 duplex full 1
20 | port speed 100 1-2
21 | port duplex full 1-2
22 | !
23 | port flood-limiting rate 10m 1
24 | port flood-limiting unknown-unicast 1
25 | port flood-limiting multicast 1
26 | port flood-limiting broadcast 1
27 | !
28 | port tag-outbound-mode hybrid 1-2 1737
29 | !
30 | interface vlan vif416
31 | name CONTROL-VL
32 | tag 416
33 | ip 10.1.1.91/24
34 | ports 2
35 | management ssh 10.0.0.0/8
36 | management telnet 10.0.0.0/8
37 | management tftp 10.0.0.0/8
38 | management snmp 10.0.0.0/8
39 | !
40 | interface vlan vif1738
41 | name SERVICE
42 | tag 1738
43 | ports 1-2
44 | !
45 | ip route 10.0.0.0/8 10.1.1.1
46 | ip route 19.23.8.25/32 10.1.1.1
47 | !
48 | ntp
49 | server 10.1.1.2
50 | enable
51 | !
52 | ingress-counters set1 port 1 tag all
53 | !
54 | password long-mode
55 | !
56 | radius-server host 10.1.1.2 key ASU4602O551PTV6
57 | radius-server host 10.1.1.15 key ASU4602O551PTV6
58 | !
59 | aaa
60 | authentication login default local radius
61 | !
62 | snmp
63 | location dc1
64 | community 10 read-only 10.0.0.0/8 secret
65 | authtrap
66 | trapsess 10.1.1.2 2 secret
67 | trapsess 10.1.1.15 2 secret
68 | !
69 | fan temperature 30 27
70 | !
71 | lldp
72 | port 1 receive
73 | port 2 receive
74 | port 3 receive
75 | port 4 receive
76 | enable
77 | !
78 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/paloalto_panos/panos_basic_sent.txt:
--------------------------------------------------------------------------------
1 | config {
2 | mgt-config {
3 | users {
4 | admin {
5 | phash *;
6 | permissions {
7 | role-based {
8 | superuser yes;
9 | }
10 | }
11 | public-key thisisasuperduperlongbase64encodedstring;
12 | }
13 | panadmin {
14 | permissions {
15 | role-based {
16 | superuser yes;
17 | }
18 | }
19 | phash passwordhash;
20 | }
21 | }
22 | }
23 | devices {
24 | localhost.localdomain {
25 | deviceconfig {
26 | system {
27 | hostname firewall1;
28 | login-banner "
29 | ************************************************************************
30 | * firewall1.example.com * [PROD VM500 firewalls]
31 | ************************************************************************
32 | * WARNING *
33 | * Unauthorized access to this device or devices attached to *
34 | * or accessible from this network is strictly prohibited. *
35 | * Possession of passwords or devices enabling access to this *
36 | * device or devices does not constitute authorization. Unauthorized *
37 | * access will be prosecuted to the fullest extent of the law. *
38 | * *
39 | ************************************************************************
40 |
41 | ";
42 | panorama {
43 | local-panorama {
44 | panorama-server 10.0.0.1;
45 | panorama-server-2 10.0.0.2;
46 | }
47 | }
48 | }
49 | }
50 | }
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/base/paloalto_panos/panos_basic_set_sent.txt:
--------------------------------------------------------------------------------
1 | set mgt-config users admin phash *
2 | set mgt-config users admin permissions role-based superuser yes
3 | set mgt-config users admin public-key thisisasuperduperlongbase64encodedstring
4 | set mgt-config users panadmin permissions role-based superuser yes
5 | set mgt-config users panadmin phash passwordhash
6 | set deviceconfig system hostname firewall1
7 | set deviceconfig system login-banner "
8 | ************************************************************************
9 | * firewall1.example.com * [PROD VM500 firewalls]
10 | ************************************************************************
11 | * WARNING *
12 | * Unauthorized access to this device or devices attached to *
13 | * or accessible from this network is strictly prohibited. *
14 | * Possession of passwords or devices enabling access to this *
15 | * device or devices does not constitute authorization. Unauthorized *
16 | * access will be prosecuted to the fullest extent of the law. *
17 | * *
18 | ************************************************************************"
19 |
20 | set deviceconfig system panorama local-panorama panorama-server 10.0.0.1
21 | set deviceconfig system panorama local-panorama panorama-server-2 10.0.0.2
22 | set network interface ethernet ethernet1/15 comment "test curly braces {REMOTE DEVICE}, {REMOTE PORT}"
23 |
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_all_children/cisco_ios/ios_full_args.json:
--------------------------------------------------------------------------------
1 | {
2 | "pattern": "call-home",
3 | "match_type": "exact"
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_all_children/cisco_ios/ios_full_received.txt:
--------------------------------------------------------------------------------
1 | call-home
2 | contact-email-addr sch-smart-licensing@cisco.com
3 | profile "CiscoTAC-1"
4 | active
5 | destination transport-method http
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_all_children/cisco_ios/ios_re_args.json:
--------------------------------------------------------------------------------
1 | {
2 | "pattern": "^call\\-*",
3 | "match_type": "regex"
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_all_children/cisco_ios/ios_re_received.txt:
--------------------------------------------------------------------------------
1 | call-home
2 | contact-email-addr sch-smart-licensing@cisco.com
3 | profile "CiscoTAC-1"
4 | active
5 | destination transport-method http
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_all_children/cisco_ios/ios_starts_args.json:
--------------------------------------------------------------------------------
1 | {
2 | "pattern": "call-",
3 | "match_type": "startswith"
4 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_all_children/cisco_ios/ios_starts_received.txt:
--------------------------------------------------------------------------------
1 | call-home
2 | contact-email-addr sch-smart-licensing@cisco.com
3 | profile "CiscoTAC-1"
4 | active
5 | destination transport-method http
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_children_w_parents/cisco_ios/ios_full_args.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent_pattern": "call-home",
3 | "child_pattern": " profile \"CiscoTAC-1\"",
4 | "match_type": "exact"
5 | }
--------------------------------------------------------------------------------
/tests/unit/mock/config/parser/find_children_w_parents/cisco_ios/ios_full_received.txt:
--------------------------------------------------------------------------------
1 | contact-email-addr sch-smart-licensing@cisco.com
2 | profile "CiscoTAC-1"
3 | active
4 | destination transport-method http
--------------------------------------------------------------------------------
/tests/unit/mock/config/sanitize/all_received.txt:
--------------------------------------------------------------------------------
1 | !
2 | version 12.4
3 | service timestamps debug datetime msec
4 | service timestamps log datetime msec
5 | no service password-encryption
6 | !
7 | hostname CSR1
8 | !
9 | !
10 | !
11 | username ntc privilege 15 password 0
12 | !
--------------------------------------------------------------------------------
/tests/unit/mock/config/sanitize/all_sent.txt:
--------------------------------------------------------------------------------
1 | !
2 | version 12.4
3 | service timestamps debug datetime msec
4 | service timestamps log datetime msec
5 | no service password-encryption
6 | !
7 | hostname CSR1
8 | !
9 | !
10 | !
11 | username ntc privilege 15 password 0 ntc123
12 | !
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/dup_unordered_line_received.json:
--------------------------------------------------------------------------------
1 | [
2 | "1-3,5,6"
3 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/dup_unordered_line_sent.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [2, 1, 2, 3, 5, 6]
3 | }
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/empty_list.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [],
3 | "return_empty": true
4 | }
5 |
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/empty_list_received.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/larger_grouping_size_received.json:
--------------------------------------------------------------------------------
1 | [
2 | "4-10,15-16,20,30"
3 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/larger_grouping_size_sent.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [
3 | 4,
4 | 5,
5 | 6,
6 | 7,
7 | 8,
8 | 15,
9 | 16,
10 | 9,
11 | 20,
12 | 30,
13 | 10
14 | ],
15 | "min_grouping_size": 2
16 | }
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/min_vlan_group_size_one_received.json:
--------------------------------------------------------------------------------
1 | [
2 | "4,5,9,10,15,20,30"
3 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/min_vlan_group_size_one_sent.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [
3 | 4,
4 | 5,
5 | 15,
6 | 9,
7 | 20,
8 | 30,
9 | 10
10 | ],
11 | "min_grouping_size": 1
12 | }
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/min_vlan_group_size_two_received.json:
--------------------------------------------------------------------------------
1 | [
2 | "4-5,9-10,15,20,30"
3 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/min_vlan_group_size_two_sent.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [
3 | 4,
4 | 5,
5 | 15,
6 | 9,
7 | 20,
8 | 30,
9 | 10
10 | ],
11 | "min_grouping_size": 2
12 | }
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/one_line_received.json:
--------------------------------------------------------------------------------
1 | [
2 | "1-3,5,6"
3 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/one_line_sent.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [1, 2, 3, 5, 6]
3 | }
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/smaller_lines_received.json:
--------------------------------------------------------------------------------
1 | [
2 | "1-3,5,6",
3 | "1000,1002,1004",
4 | "1006,1008,1010"
5 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/smaller_lines_sent.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [1, 2, 3, 5, 6, 1000, 1002, 1004, 1006, 1008, 1010],
3 | "first_line_len": 10,
4 | "other_line_len": 14
5 | }
6 |
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/two_line_received.json:
--------------------------------------------------------------------------------
1 | [
2 | "1-3,5,6,1000,1002,1004,1006,1008,1010,1012,1014",
3 | "1016,1018"
4 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_config/two_line_sent.json:
--------------------------------------------------------------------------------
1 | {
2 | "vlan_list": [1, 2, 3, 5, 6, 1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018]
3 | }
4 |
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_list/multi_line_received.json:
--------------------------------------------------------------------------------
1 | [
2 | 1025,
3 | 1069,
4 | 1070,
5 | 1071,
6 | 1072,
7 | 1114,
8 | 1173,
9 | 1174,
10 | 1175,
11 | 1176,
12 | 1177,
13 | 1178,
14 | 1179,
15 | 1180,
16 | 1181,
17 | 1501,
18 | 1502,
19 | 1504,
20 | 1505,
21 | 1506,
22 | 1507,
23 | 1509,
24 | 1510,
25 | 1514,
26 | 1515,
27 | 1516,
28 | 1517,
29 | 1518,
30 | 1519,
31 | 1533,
32 | 1534,
33 | 1535,
34 | 1536,
35 | 1537,
36 | 1538,
37 | 1539,
38 | 1540,
39 | 1541,
40 | 1545,
41 | 1599,
42 | 1912,
43 | 1913
44 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_list/multi_line_sent.txt:
--------------------------------------------------------------------------------
1 | switchport trunk allowed vlan 1025,1069-1072,1114,1173-1181,1501,1502
2 | switchport trunk allowed vlan add 1504-1507,1509,1510,1514-1519,1533-1541,1545
3 | switchport trunk allowed vlan add 1599,1912-1913
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_list/one_line_received.json:
--------------------------------------------------------------------------------
1 | [
2 | 1025,
3 | 1069,
4 | 1070,
5 | 1071,
6 | 1072,
7 | 1114,
8 | 1173,
9 | 1174,
10 | 1175,
11 | 1176,
12 | 1177,
13 | 1178,
14 | 1179,
15 | 1180,
16 | 1181,
17 | 1501,
18 | 1502
19 | ]
--------------------------------------------------------------------------------
/tests/unit/mock/vlan/to_list/one_line_sent.txt:
--------------------------------------------------------------------------------
1 | switchport trunk allowed vlan 1025,1069-1072,1114,1173-1181,1501,1502
--------------------------------------------------------------------------------
/tests/unit/test_asn.py:
--------------------------------------------------------------------------------
1 | """Test for the BGP ASN functions."""
2 |
3 | import pytest
4 |
5 | from netutils import asn
6 |
7 | asn_to_int = [
8 | {"sent": {"asplain": "6500"}, "received": 6500},
9 | {"sent": {"asplain": "6500.1111"}, "received": 425985111},
10 | {"sent": {"asplain": "6500.1"}, "received": 425984001},
11 | {"sent": {"asplain": "1.10"}, "received": 65546},
12 | {"sent": {"asplain": "0.65526"}, "received": 65526},
13 | ]
14 |
15 | int_to_asdot = [
16 | {"sent": {"asn_int": 6500}, "received": "6500"},
17 | {"sent": {"asn_int": 425985111}, "received": "6500.1111"},
18 | {"sent": {"asn_int": 425984001}, "received": "6500.1"},
19 | {"sent": {"asn_int": 65546}, "received": "1.10"},
20 | {"sent": {"asn_int": 65526}, "received": "65526"},
21 | {"sent": {"asn_int": "65526"}, "received": "65526"},
22 | {"sent": {"asn_int": "65535"}, "received": "65535"},
23 | {"sent": {"asn_int": "65536"}, "received": "1.0"},
24 | {"sent": {"asn_int": "425985111"}, "received": "6500.1111"},
25 | {"sent": {"asn_int": 4294967295}, "received": "65535.65535"},
26 | ]
27 |
28 | int_to_asdot_exceptions = [
29 | {"asn_int": "one22"},
30 | {"asn_int": "not_an_int"},
31 | {"asn_int": "4294967296"},
32 | {"asn_int": "0"},
33 | {"asn_int": -1},
34 | ]
35 |
36 |
37 | @pytest.mark.parametrize("data", asn_to_int)
38 | def test_asn_to_int(data):
39 | assert asn.asn_to_int(**data["sent"]) == data["received"]
40 |
41 |
42 | @pytest.mark.parametrize("data", int_to_asdot)
43 | def test_int_to_asdot(data):
44 | assert asn.int_to_asdot(**data["sent"]) == data["received"]
45 |
46 |
47 | @pytest.mark.parametrize("data", int_to_asdot_exceptions)
48 | def test_int_to_asdot_exceptions(data):
49 | with pytest.raises(ValueError):
50 | assert asn.int_to_asdot(**data)
51 |
--------------------------------------------------------------------------------
/tests/unit/test_basics.py:
--------------------------------------------------------------------------------
1 | """Basic tests that do not require netutils."""
2 |
3 | import os
4 | import re
5 | import unittest
6 |
7 | import toml
8 |
9 |
10 | class TestDocsReleaseNotes(unittest.TestCase):
11 | """Test that mkdocs has the release notes for the current version."""
12 |
13 | def test_version_file_found(self):
14 | """Verify that if the current version has no letters, which would see in alpha or beta has an associated release note file."""
15 | parent_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
16 | poetry_path = os.path.join(parent_path, "pyproject.toml")
17 | project_version = toml.load(poetry_path)["tool"]["poetry"]["version"]
18 |
19 | docs_path = os.path.join(parent_path, "docs")
20 | release_notes_files = [file for file in os.listdir(f"{docs_path}/admin/release_notes/") if file.endswith(".md")]
21 | version_pattern = re.compile(r"^(\d+)\.(\d+)\.\d+$")
22 |
23 | match = version_pattern.match(project_version)
24 | # If there is no match, then it is likely an alpha or beta version and we can skip this test.
25 | if match:
26 | major, minor = match.groups()
27 | version_str = f"version_{major}.{minor}.md"
28 | if version_str not in release_notes_files:
29 | self.fail(f"Release note file for version {version_str} not found in release notes folder.")
30 |
--------------------------------------------------------------------------------
/tests/unit/test_config_clean.py:
--------------------------------------------------------------------------------
1 | """Test for the config cleaning functions."""
2 |
3 | import glob
4 | import os
5 |
6 | import pytest
7 |
8 | from netutils.config import clean
9 | from netutils.constants import _PROVIDED_CLEAN_FILTERS, _PROVIDED_SANITIZE_FILTERS
10 |
11 | MOCK_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "mock", "config")
12 | TXT_FILE = "_sent.txt"
13 |
14 |
15 | @pytest.mark.parametrize("_file", glob.glob(f"{MOCK_DIR}/clean/*{TXT_FILE}"))
16 | def test_clean_config(_file, get_text_data):
17 | truncate_file = os.path.join(MOCK_DIR, _file[: -len(TXT_FILE)])
18 |
19 | sent_data = get_text_data(os.path.join(MOCK_DIR, _file))
20 | received_data = get_text_data(truncate_file + "_received.txt")
21 | assert clean.clean_config(sent_data, filters=_PROVIDED_CLEAN_FILTERS) == received_data
22 |
23 |
24 | @pytest.mark.parametrize("_file", glob.glob(f"{MOCK_DIR}/sanitize/*{TXT_FILE}"))
25 | def test_sanitize_config(_file, get_text_data):
26 | truncate_file = os.path.join(MOCK_DIR, _file[: -len(TXT_FILE)])
27 |
28 | sent_data = get_text_data(os.path.join(MOCK_DIR, _file))
29 | received_data = get_text_data(truncate_file + "_received.txt")
30 | assert clean.sanitize_config(sent_data, filters=_PROVIDED_SANITIZE_FILTERS) == received_data
31 |
--------------------------------------------------------------------------------
/tests/unit/test_conversion.py:
--------------------------------------------------------------------------------
1 | """Test that configurations properly convert from undesired format to desired"""
2 |
3 | import glob
4 | import os
5 |
6 | import pytest
7 |
8 | from netutils.config.conversion import (
9 | conversion_map,
10 | paloalto_panos_brace_to_set,
11 | )
12 |
13 | MOCK_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "mock", "config", "conversion")
14 |
15 | TXT_FILE = "_sent.txt"
16 | CONVERTED_FILE = "_converted.txt"
17 |
18 | conversion_files = []
19 |
20 | for network_os in list(conversion_map.keys()):
21 | for _file in glob.glob(f"{MOCK_DIR}/{network_os}/*{TXT_FILE}"):
22 | conversion_files.append([_file, network_os])
23 |
24 |
25 | @pytest.mark.parametrize("_file", conversion_files)
26 | def test_config_conversion(_file, get_text_data): # pylint: disable=redefined-outer-name
27 | truncate_file = os.path.join(MOCK_DIR, _file[0][: -len(TXT_FILE)])
28 |
29 | sent_cfg = get_text_data(os.path.join(MOCK_DIR, _file[0]))
30 | converted_cfg = paloalto_panos_brace_to_set(cfg=sent_cfg, cfg_type="string")
31 | received_data = get_text_data(truncate_file + "_converted.txt")
32 | assert converted_cfg == received_data
33 |
--------------------------------------------------------------------------------
/tests/unit/test_dns.py:
--------------------------------------------------------------------------------
1 | """Test for the DNS based functions."""
2 |
3 | import socket
4 |
5 | import pytest
6 |
7 | from netutils import dns, ip
8 |
9 | test_is_fqdn = [
10 | {"sent": "google.com", "received": True},
11 | {"sent": "yahoo.com", "received": True},
12 | {"sent": "nevergonnagiveyouup.pizza", "received": False},
13 | ]
14 |
15 | test_fqdn = [
16 | {"sent": "google.com"},
17 | {"sent": "yahoo.com"},
18 | ]
19 |
20 |
21 | @pytest.mark.parametrize("data", test_is_fqdn)
22 | def test_is_fqdn_resolvable(data):
23 | assert dns.is_fqdn_resolvable(data["sent"]) == data["received"]
24 |
25 |
26 | @pytest.mark.parametrize("data", test_fqdn)
27 | def test_fqdn_to_ip(data):
28 | assert ip.is_ip(dns.fqdn_to_ip(data["sent"])) is True
29 |
30 |
31 | def test_bad_hostname():
32 | """Test raise when routing_table is not a list."""
33 | with pytest.raises(socket.error):
34 | dns.fqdn_to_ip("nevergonnagiveyouup.pizza")
35 |
--------------------------------------------------------------------------------
/tests/unit/test_docs.py:
--------------------------------------------------------------------------------
1 | """Update docs tests to include assurance that development script ran."""
2 |
3 | import sys
4 |
5 | sys.path.append("...")
6 | from development_scripts import main # noqa:E402 pylint: disable=wrong-import-position
7 |
8 |
9 | def test_docs_generated():
10 | """Assert each generated file has been auto generated, run `python development_scripts.py` if failed."""
11 | assert main(test=True) is True
12 |
--------------------------------------------------------------------------------
/tests/unit/test_lib_helpers.py:
--------------------------------------------------------------------------------
1 | """Test for the lib_helpers definitions."""
2 |
3 | from unittest import mock
4 |
5 | import pytest
6 |
7 | from netutils.lib_helpers import get_napalm_getters
8 |
9 |
10 | @mock.patch.dict("sys.modules", {"napalm": None})
11 | def test_get_napalm_getters_napalm_not_installed():
12 | with pytest.raises(ImportError) as exc:
13 | get_napalm_getters()
14 | assert "Napalm must be installed for this function to operate." == str(exc.value)
15 |
--------------------------------------------------------------------------------
/tests/unit/test_lib_helpers_optionals.py:
--------------------------------------------------------------------------------
1 | """Test for the lib_helpers definitions when optional packages are installed."""
2 |
3 | from unittest import mock
4 |
5 | import pytest
6 |
7 | from netutils.lib_helpers import get_napalm_getters
8 |
9 |
10 | def test_get_napalm_getters_napalm_installed_default():
11 | pytest.importorskip("napalm")
12 | with mock.patch("napalm.get_network_driver"):
13 | napalm_getters = get_napalm_getters()
14 | assert all(item in napalm_getters.keys() for item in ["asa", "eos", "fortios"])
15 |
16 |
17 | def test_get_napalm_getters_napalm_installed_nxos_keys():
18 | pytest.importorskip("napalm")
19 | napalm_getters = get_napalm_getters()
20 | assert list(napalm_getters["nxos"].keys()) == [
21 | "get_arp_table",
22 | "get_bgp_config",
23 | "get_bgp_neighbors",
24 | "get_bgp_neighbors_detail",
25 | "get_config",
26 | "get_environment",
27 | "get_facts",
28 | "get_firewall_policies",
29 | "get_interfaces",
30 | "get_interfaces_counters",
31 | "get_interfaces_ip",
32 | "get_ipv6_neighbors_table",
33 | "get_lldp_neighbors",
34 | "get_lldp_neighbors_detail",
35 | "get_mac_address_table",
36 | "get_network_instances",
37 | "get_ntp_peers",
38 | "get_ntp_servers",
39 | "get_ntp_stats",
40 | "get_optics",
41 | "get_probes_config",
42 | "get_probes_results",
43 | "get_route_to",
44 | "get_snmp_information",
45 | "get_users",
46 | "get_vlans",
47 | ]
48 |
--------------------------------------------------------------------------------
/tests/unit/test_ping.py:
--------------------------------------------------------------------------------
1 | """Test for the ping based functions."""
2 |
3 | import socket
4 | from unittest import mock
5 |
6 | import pytest
7 |
8 | from netutils import ping
9 |
10 | ping_data = [
11 | {"sent": {"ip": "1.1.1.1", "port": 443}, "received": {"retval": True}},
12 | {"sent": {"ip": "192.0.2.0", "port": 443}, "received": {"retval": False}, "raises": socket.timeout},
13 | {"sent": {"ip": "1.1.1.1", "port": 443, "timeout": 3}, "received": {"retval": True}},
14 | {
15 | "sent": {"ip": "nevergonnagiveyouup.pizza", "port": 443},
16 | "received": {"retval": None, "raised": socket.gaierror},
17 | "raises": socket.gaierror,
18 | },
19 | ]
20 |
21 |
22 | @pytest.mark.parametrize("data", ping_data)
23 | def test_tcp_ping(data):
24 | with mock.patch("netutils.ping.socket.socket") as socket_mock:
25 | instance = socket_mock.return_value
26 | instance.connect.side_effect = data.get("raises")
27 | raised = data["received"].get("raised")
28 | if raised:
29 | pytest.raises(raised, ping.tcp_ping, **data["sent"])
30 | else:
31 | assert ping.tcp_ping(**data["sent"]) == data["received"]["retval"]
32 |
33 | if not data.get("raises"):
34 | instance.shutdown.assert_called_with(socket.SHUT_RDWR)
35 |
36 | timeout = data["sent"].get("timeout") or 1
37 | instance.settimeout.assert_called_with(timeout)
38 |
39 | ip = data["sent"].get("ip")
40 | port = data["sent"].get("port")
41 | instance.connect.assert_called_with((ip, port))
42 |
43 | instance.close.assert_called()
44 |
--------------------------------------------------------------------------------
/tests/unit/test_running_config.py:
--------------------------------------------------------------------------------
1 | """Tests for the running configuration command mapping."""
2 |
3 | import pytest
4 |
5 | from netutils import lib_mapper
6 | from netutils.running_config import get_running_config_command
7 |
8 |
9 | def test_running_config_mapper_keys_are_known():
10 | """Ensure all keys in RUNNING_CONFIG_MAPPER are in MAIN_LIB_MAPPER values."""
11 | unknown_keys = [key for key in lib_mapper.RUNNING_CONFIG_MAPPER if key not in lib_mapper.MAIN_LIB_MAPPER.values()]
12 | assert not unknown_keys, f"Unexpected keys in RUNNING_CONFIG_MAPPER: {unknown_keys}"
13 |
14 |
15 | @pytest.mark.parametrize("platform,expected_command", list(lib_mapper.RUNNING_CONFIG_MAPPER.items()))
16 | def test_get_running_config_command_known_platforms(platform, expected_command):
17 | """Test get_running_config_command returns correct command for known platforms."""
18 | assert get_running_config_command(platform) == expected_command
19 | assert get_running_config_command(platform.upper()) == expected_command # test case insensitivity
20 |
21 |
22 | def test_get_running_config_command_unknown_platform():
23 | """Test get_running_config_command returns default 'show run' for unknown platforms."""
24 | assert get_running_config_command("unknown_platform") == "show run"
25 | assert get_running_config_command("checkpoint_gaiAA") == "show run"
26 |
--------------------------------------------------------------------------------
/tests/unit/test_sanitize.py:
--------------------------------------------------------------------------------
1 | """Test for the network os sanitize functions."""
2 |
3 | import glob
4 | import os
5 |
6 | import pytest
7 |
8 | from netutils.config import compliance
9 | from netutils.config.conversion import paloalto_panos_clean_newlines
10 |
11 | MOCK_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "mock", "config", "sanitize")
12 |
13 | TXT_FILE = "_sent.txt"
14 | SANITIZE_FILE = "_sanitized.txt"
15 |
16 | sanitize_files = []
17 |
18 | for network_os in list(compliance.parser_map.keys()):
19 | for _file in glob.glob(f"{MOCK_DIR}/{network_os}/*{TXT_FILE}"):
20 | sanitize_files.append([_file, network_os])
21 |
22 |
23 | @pytest.mark.parametrize("_file", sanitize_files)
24 | def test_panos_newline_character(_file, get_text_data):
25 | truncate_file = os.path.join(MOCK_DIR, _file[0][: -len(TXT_FILE)])
26 |
27 | sent_cfg = get_text_data(os.path.join(MOCK_DIR, _file[0]))
28 | sanitized_cfg = paloalto_panos_clean_newlines(cfg=sent_cfg)
29 | received_data = get_text_data(truncate_file + "_sanitized.txt")
30 | assert sanitized_cfg == received_data
31 |
--------------------------------------------------------------------------------
/tests/unit/test_version.py:
--------------------------------------------------------------------------------
1 | """Basic test for version check."""
2 |
3 | import os
4 | import unittest
5 |
6 | import toml
7 |
8 | from netutils import __version__ as project_version
9 |
10 |
11 | class TestVersion(unittest.TestCase):
12 | """Test Version is the same."""
13 |
14 | def test_version(self):
15 | """Verify that pyproject.toml version is same as version specified in the package."""
16 | parent_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
17 | poetry_version = toml.load(f"{parent_path}/pyproject.toml")["tool"]["poetry"]["version"]
18 | self.assertEqual(project_version, poetry_version)
19 |
--------------------------------------------------------------------------------
/towncrier_template.j2:
--------------------------------------------------------------------------------
1 |
2 | # v{{ versiondata.version.split(".")[:2] | join(".") }} Release Notes
3 |
4 | This document describes all new features and changes in the release. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5 |
6 | ## Release Overview
7 |
8 | - Major features or milestones
9 | - Changes to compatibility with Nautobot and/or other apps, libraries etc.
10 |
11 | {% if render_title %}
12 | ## [v{{ versiondata.version }} ({{ versiondata.date }})](https://github.com/networktocode/netutils/releases/tag/v{{ versiondata.version}})
13 |
14 | {% endif %}
15 | {% for section, _ in sections.items() %}
16 | {% if sections[section] %}
17 | {% for category, val in definitions.items() if category in sections[section] %}
18 | {% if sections[section][category]|length != 0 %}
19 | ### {{ definitions[category]['name'] }}
20 |
21 | {% if definitions[category]['showcontent'] %}
22 | {% for text, values in sections[section][category].items() %}
23 | {% for item in text.split('\n') %}
24 | {% if values %}
25 | - {{ values|join(', ') }} - {{ item.strip() }}
26 | {% else %}
27 | - {{ item.strip() }}
28 | {% endif %}
29 | {% endfor %}
30 | {% endfor %}
31 |
32 | {% else %}
33 | - {{ sections[section][category]['']|join(', ') }}
34 |
35 | {% endif %}
36 | {% endif %}
37 | {% endfor %}
38 | {% else %}
39 | No significant changes.
40 |
41 | {% endif %}
42 | {% endfor %}
43 |
--------------------------------------------------------------------------------