├── .coveragerc ├── .dockerignore ├── .gitattributes ├── .github └── workflows │ └── pylint.yml ├── .gitignore ├── COPYRIGHT ├── DOCKER-EXAMPLES.md ├── Dockerfile ├── INSTALL-FEDORA-CENTOS.md ├── INSTALL-FREEBSD.md ├── INSTALL-OSX.md ├── INSTALL-RHEL.md ├── INSTALL-UBUNTU-DEBIAN.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── README.txt ├── RELEASE-NOTES.md ├── development.txt ├── docs ├── .readthedocs.yaml ├── Makefile ├── TableView.rst ├── conf.py ├── docreq.txt ├── index.rst ├── jnpr.junos.factory.rst ├── jnpr.junos.facts.rst ├── jnpr.junos.rst ├── jnpr.junos.utils.rst ├── juniper.png └── make.bat ├── entrypoint.sh ├── env-setup.sh ├── lib └── jnpr │ ├── __init__.py │ └── junos │ ├── __init__.py │ ├── _version.py │ ├── cfg │ ├── __init__.py │ ├── phyport │ │ ├── __init__.py │ │ ├── base.py │ │ ├── classic.py │ │ └── switch.py │ ├── resource.py │ ├── user.py │ └── user_ssh_key.py │ ├── cfgro │ ├── __init__.py │ └── srx.yml │ ├── command │ ├── __init__.py │ ├── chassis_fan.yml │ ├── cm_error.yml │ ├── ea_drd_error.yml │ ├── ea_fi_error.yml │ ├── ea_fi_statistics.yml │ ├── ea_fo_statistics.yml │ ├── ea_host_drop.yml │ ├── ea_li_error.yml │ ├── ea_lo_statistics.yml │ ├── ea_pt_statistics.yml │ ├── ea_wi_statistics.yml │ ├── ea_wo_statistics.yml │ ├── fpc_link_stats.yml │ ├── fpc_memory.yml │ ├── fpc_threads.yml │ ├── host_loopback_status.yml │ ├── ithrottle.yml │ ├── jnh_exceptions.yml │ ├── jnh_ifd_stream.yml │ ├── jnhexceptionpkt.yml │ ├── linecard_ethernet_statistics.yml │ ├── ospf_neighbor.yml │ ├── pci_error.yml │ ├── pfe_ddos_policer.yml │ ├── pre_classifier.yml │ ├── scheduler_info.yml │ ├── system_proc_ext.yml │ ├── system_queues.yml │ ├── task_io.yml │ ├── toe_pfe.yml │ ├── veriexec.yml │ ├── vmcores.yml │ ├── xm_drd_error.yml │ ├── xm_fi_error.yml │ ├── xm_fi_statistics.yml │ ├── xm_fo_statistics.yml │ ├── xm_host_drop.yml │ ├── xm_li_error.yml │ ├── xm_lo_statistics.yml │ ├── xm_pt_statistics.yml │ ├── xm_wi_statistics.yml │ └── xm_wo_statistics.yml │ ├── console.py │ ├── decorators.py │ ├── device.py │ ├── exception.py │ ├── factcache.py │ ├── factory │ ├── __init__.py │ ├── cfgtable.py │ ├── cmdtable.py │ ├── cmdview.py │ ├── factory_cls.py │ ├── factory_loader.py │ ├── optable.py │ ├── state_machine.py │ ├── table.py │ ├── to_json.py │ ├── view.py │ └── viewfields.py │ ├── facts │ ├── __example.py │ ├── __init__.py │ ├── current_re.py │ ├── domain.py │ ├── ethernet_mac_table.py │ ├── file_list.py │ ├── get_chassis_cluster_status.py │ ├── get_chassis_inventory.py │ ├── get_route_engine_information.py │ ├── get_software_information.py │ ├── get_virtual_chassis_information.py │ ├── ifd_style.py │ ├── iri_mapping.py │ ├── is_linux.py │ ├── personality.py │ ├── swver.py │ └── vmhost.py │ ├── jxml.py │ ├── ofacts │ ├── __init__.py │ ├── chassis.py │ ├── domain.py │ ├── ifd_style.py │ ├── personality.py │ ├── routing_engines.py │ ├── session.py │ ├── srx_cluster.py │ ├── switch_style.py │ └── swver.py │ ├── op │ ├── __init__.py │ ├── arp.yml │ ├── bfd.yml │ ├── bgp.yml │ ├── ccc.yml │ ├── ddos.yml │ ├── elsethernetswitchingtable.yml │ ├── ethernetswitchingtable.yml │ ├── ethport.yml │ ├── fpc.yml │ ├── idpattacks.yml │ ├── intopticdiag.yml │ ├── inventory.yml │ ├── isis.yml │ ├── l2circuit.yml │ ├── lacp.yml │ ├── ldp.yml │ ├── lldp.yml │ ├── nd.yml │ ├── ospf.yml │ ├── pfestats.yml │ ├── phyport.yml │ ├── ppm.yml │ ├── routes.yml │ ├── securityzone.yml │ ├── systemstorage.yml │ ├── taskmemory.yml │ ├── teddb.yml │ ├── vlan.yml │ └── xcvr.yml │ ├── resources │ ├── __init__.py │ ├── autosys.py │ ├── autosys.yml │ ├── bgp.py │ ├── bgp.yml │ ├── interface.py │ ├── interface.yml │ ├── staticroutes.py │ ├── staticroutes.yml │ ├── syslog.py │ ├── syslog.yml │ ├── user.py │ └── user.yml │ ├── rpcmeta.py │ ├── transport │ ├── __init__.py │ ├── _telnetlib │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __init__.py │ │ └── telnetlib.py │ ├── tty.py │ ├── tty_netconf.py │ ├── tty_serial.py │ ├── tty_ssh.py │ └── tty_telnet.py │ ├── utils │ ├── __init__.py │ ├── config.py │ ├── fs.py │ ├── ftp.py │ ├── scp.py │ ├── ssh_client.py │ ├── start_shell.py │ ├── sw.py │ └── util.py │ └── version.py ├── requirements.txt ├── setup.cfg ├── setup.py ├── static └── PyEZ.png ├── tests ├── __init__.py ├── functional │ ├── __init__.py │ ├── test_core.py │ ├── test_device_ssh.py │ ├── test_outbound_ssh.py │ ├── test_shell.py │ └── test_table.py └── unit │ ├── __init__.py │ ├── factory │ ├── __init__.py │ ├── rpc-reply │ │ ├── get-bfd-session-information.xml │ │ ├── get-configuration-user.xml │ │ ├── get-configuration.xml │ │ ├── get-interface-information.xml │ │ ├── get-lldp-neighbors-information.xml │ │ ├── get-route-summary-information.xml │ │ ├── get-software-information.xml │ │ ├── local-get-interface-information.xml │ │ ├── request_routing-engine_execute_command_sysctl_dummy.xml │ │ ├── show-utmd-status-use-Null.xml │ │ ├── show-utmd-status.xml │ │ ├── show_arp_no-resolve.xml │ │ ├── show_chassis_ethernet-switch_statistics.xml │ │ ├── show_cmerror_module_brief.xml │ │ ├── show_cmerror_module_brief_dummy_multiline.xml │ │ ├── show_devices_local.xml │ │ ├── show_host_loopback_status-summary.xml │ │ ├── show_icmp_statistics.xml │ │ ├── show_ithrottle_id_0.xml │ │ ├── show_link_stats.xml │ │ ├── show_luchip_0.xml │ │ ├── show_memory.xml │ │ ├── show_mtip-cge_summary.xml │ │ ├── show_pci_errors_2.xml │ │ ├── show_pq3_pci.xml │ │ ├── show_sched.xml │ │ ├── show_threads.xml │ │ ├── show_toe_pfe_0_xm_0_toe-inst_0_packet-stats.xml │ │ ├── show_ttp_statistics.xml │ │ ├── show_xmchip_0_li_interrupt-stats.xml │ │ ├── show_xmchip_0_lo_stats_0.xml │ │ ├── show_xmchip_0_pt_stats.xml │ │ └── user.xml │ ├── test_cfgtable.py │ ├── test_cmdtable.py │ ├── test_factory_cls.py │ ├── test_factory_loader.py │ ├── test_optable.py │ ├── test_table.py │ ├── test_to_json.py │ ├── test_view.py │ └── test_view_fields.py │ ├── facts │ ├── __init__.py │ ├── dupe_foo1.py │ ├── dupe_foo2.py │ ├── rpc-reply │ │ ├── bd_command.xml │ │ ├── chassis_backplane_serialnumber_get-chassis-inventory.xml │ │ ├── chassis_connect_not_master_get-chassis-inventory.xml │ │ ├── chassis_error_xml_get-chassis-inventory.xml │ │ ├── chassis_serialnumber_get-chassis-inventory.xml │ │ ├── cluster_false_get-chassis-cluster-status.xml │ │ ├── cluster_true_get-chassis-cluster-status.xml │ │ ├── current_re_empty_file-show.xml │ │ ├── current_re_empty_get-interface-information.xml │ │ ├── current_re_file-show.xml │ │ ├── current_re_get-interface-information.xml │ │ ├── current_re_jdm_get-software-information.xml │ │ ├── current_re_srx_index_err_file-show.xml │ │ ├── current_re_srx_index_err_get-interface-information.xml │ │ ├── current_re_srx_primary_file-show.xml │ │ ├── current_re_srx_primary_get-interface-information.xml │ │ ├── current_re_srx_secondary_file-show.xml │ │ ├── current_re_srx_secondary_get-interface-information.xml │ │ ├── domain_config_command.xml │ │ ├── domain_config_file-show.xml │ │ ├── domain_config_get-configuration.xml │ │ ├── domain_config_get-interface-information.xml │ │ ├── domain_file_command.xml │ │ ├── domain_file_file-show.xml │ │ ├── domain_file_get-configuration.xml │ │ ├── domain_file_get-interface-information.xml │ │ ├── els_get-ethernet-switching-table-information.xml │ │ ├── file_list2_file-list.xml │ │ ├── file_list_file-list.xml │ │ ├── ifd_style_classic_command.xml │ │ ├── ifd_style_classic_file-show.xml │ │ ├── ifd_style_classic_get-interface-information.xml │ │ ├── ifd_style_switch_file-show.xml │ │ ├── ifd_style_switch_get-interface-information.xml │ │ ├── ifd_style_switch_get-software-information.xml │ │ ├── ifd_style_switch_get-virtual-chassis-information.xml │ │ ├── iri_mapping2_file-show.xml │ │ ├── iri_mapping_file-show.xml │ │ ├── personality_ex_command.xml │ │ ├── personality_ex_file-show.xml │ │ ├── personality_ex_get-interface-information.xml │ │ ├── personality_ex_get-route-engine-information.xml │ │ ├── personality_ex_get-virtual-chassis-information.xml │ │ ├── personality_m_command.xml │ │ ├── personality_m_file-show.xml │ │ ├── personality_m_get-interface-information.xml │ │ ├── personality_m_get-route-engine-information.xml │ │ ├── personality_mx_command.xml │ │ ├── personality_mx_file-show.xml │ │ ├── personality_mx_get-interface-information.xml │ │ ├── personality_mx_get-route-engine-information.xml │ │ ├── personality_olive_command.xml │ │ ├── personality_olive_file-show.xml │ │ ├── personality_olive_get-interface-information.xml │ │ ├── personality_olive_get-route-engine-information.xml │ │ ├── personality_ptx_command.xml │ │ ├── personality_ptx_file-show.xml │ │ ├── personality_ptx_get-interface-information.xml │ │ ├── personality_ptx_get-route-engine-information.xml │ │ ├── personality_srx_branch_command.xml │ │ ├── personality_srx_branch_file-show.xml │ │ ├── personality_srx_branch_get-interface-information.xml │ │ ├── personality_srx_branch_get-route-engine-information.xml │ │ ├── personality_srx_high_end_command.xml │ │ ├── personality_srx_high_end_file-show.xml │ │ ├── personality_srx_high_end_get-interface-information.xml │ │ ├── personality_srx_high_end_get-route-engine-information.xml │ │ ├── personality_srx_mid_range_command.xml │ │ ├── personality_srx_mid_range_file-show.xml │ │ ├── personality_srx_mid_range_get-interface-information.xml │ │ ├── personality_srx_mid_range_get-route-engine-information.xml │ │ ├── personality_t_command.xml │ │ ├── personality_t_file-show.xml │ │ ├── personality_t_get-interface-information.xml │ │ ├── personality_t_get-route-engine-information.xml │ │ ├── personality_vmx_command.xml │ │ ├── personality_vmx_file-show.xml │ │ ├── personality_vmx_get-interface-information.xml │ │ ├── personality_vmx_get-route-engine-information.xml │ │ ├── personality_vptx_command.xml │ │ ├── personality_vptx_file-show.xml │ │ ├── personality_vptx_get-interface-information.xml │ │ ├── personality_vptx_get-route-engine-information.xml │ │ ├── re_info_dual_get-route-engine-information.xml │ │ ├── re_info_mx_vc_get-route-engine-information.xml │ │ ├── re_info_single_get-route-engine-information.xml │ │ ├── sw_info_bsys_get-software-information.xml │ │ ├── sw_info_dual_command.xml │ │ ├── sw_info_dual_file-show.xml │ │ ├── sw_info_dual_get-interface-information.xml │ │ ├── sw_info_dual_other_re_off.xml │ │ ├── sw_info_ex_file-show.xml │ │ ├── sw_info_ex_get-interface-information.xml │ │ ├── sw_info_ex_get-software-information.xml │ │ ├── sw_info_gnf_get-software-information.xml │ │ ├── sw_info_jdm_get-software-information.xml │ │ ├── sw_info_nfx_get-software-information.xml │ │ ├── sw_info_no_version_file-show.xml │ │ ├── sw_info_no_version_get-interface-information.xml │ │ ├── sw_info_no_version_get-software-information.xml │ │ ├── sw_info_no_version_get-virtual-chassis-information.xml │ │ ├── sw_info_simple_file-show.xml │ │ ├── sw_info_simple_get-interface-information.xml │ │ ├── sw_info_simple_get-software-information.xml │ │ ├── sw_info_simple_get-virtual-chassis-information.xml │ │ ├── sw_info_single_command.xml │ │ ├── sw_info_single_file-show.xml │ │ ├── sw_info_single_get-interface-information.xml │ │ ├── sw_info_srx_cluster_get-software-information.xml │ │ ├── sw_info_txp_file-show.xml │ │ ├── sw_info_txp_get-interface-information.xml │ │ ├── sw_info_txp_get-software-information.xml │ │ ├── sw_info_vc_command.xml │ │ ├── sw_info_vc_file-show.xml │ │ ├── sw_info_vc_get-interface-information.xml │ │ ├── sw_info_vc_get-virtual-chassis-information.xml │ │ ├── switch_style_none_command.xml │ │ ├── touch │ │ ├── vc_dual_master_get-virtual-chassis-information.xml │ │ ├── vc_get-virtual-chassis-information.xml │ │ ├── vc_mmvc_get-virtual-chassis-information.xml │ │ ├── vc_mmvcf_get-virtual-chassis-information.xml │ │ ├── vlan_get-ethernet-switching-table-information.xml │ │ ├── vmhost_error_request-shell-execute.xml │ │ ├── vmhost_false_request-shell-execute.xml │ │ ├── vmhost_true_command.xml │ │ ├── vmhost_true_get-route-engine-information.xml │ │ └── vmhost_true_request-shell-execute.xml │ ├── test__init__.py │ ├── test_current_re.py │ ├── test_domain.py │ ├── test_ethernet_mac_table.py │ ├── test_file_list.py │ ├── test_get_chassis_cluster_status.py │ ├── test_get_chassis_inventory.py │ ├── test_get_route_engine_information.py │ ├── test_get_software_information.py │ ├── test_get_virtual_chassis_information.py │ ├── test_ifd_style.py │ ├── test_iri_mapping.py │ ├── test_personality.py │ ├── test_swver.py │ └── test_vmhost.py │ ├── ofacts │ ├── __init__.py │ ├── rpc-reply │ │ ├── chassis_get-chassis-inventory.xml │ │ ├── chassis_get-configuration.xml │ │ ├── get-chassis-cluster-status.xml │ │ ├── get-route-engine-information.xml │ │ ├── get-route-engine-information_master.xml │ │ ├── get-route-engine-information_multi.xml │ │ ├── get-software-information.xml │ │ ├── get-software-information_RE0-RE0.xml │ │ ├── get-virtual-chassis-information.xml │ │ └── get-virtual-chassis-information_mmvcf.xml │ ├── test_chassis.py │ ├── test_domain.py │ ├── test_ifd_style.py │ ├── test_personality.py │ ├── test_routing_engines.py │ ├── test_srx_cluster.py │ ├── test_switch_style.py │ └── test_swver.py │ ├── rpc-reply │ ├── get-chassis-inventory.xml │ ├── get-configuration.json │ ├── get-configuration.xml │ ├── get-configuration_bgp_openconfig.xml │ ├── get-index-error.xml │ ├── get-permission-denied.xml │ ├── get-route-engine-information.xml │ ├── get-route-information.json │ ├── get-rpc-error.xml │ ├── get-software-information.xml │ ├── get-system-core-dumps.xml │ ├── get-system-uptime-information.xml │ ├── get-system-users-information.xml │ ├── get.xml │ ├── load-configuration-error.xml │ ├── show-cli-directory.xml │ ├── show-configuration-interfaces.xml │ ├── show-configuration.xml │ ├── show-interface-terse.json │ ├── show-interfaces-routing-instance-media-rpc.xml │ ├── show-interfaces-routing-instance-media.xml │ ├── show-interfaces-terse-asdf.xml │ ├── show-system-alarms.xml │ └── show-system-uptime-rpc.xml │ ├── templates │ └── config-example.xml │ ├── test_console.py │ ├── test_decorators.py │ ├── test_device.py │ ├── test_exception.py │ ├── test_factcache.py │ ├── test_junos.py │ ├── test_jxml.py │ ├── test_rpcmeta.py │ ├── testfile │ ├── transport │ ├── __init__.py │ ├── rpc-reply │ │ └── commit-configuration.xml │ ├── test_serial.py │ ├── test_tty.py │ ├── test_tty_netconf.py │ ├── test_tty_ssh.py │ └── test_tty_telnet.py │ └── utils │ ├── __init__.py │ ├── rpc-reply │ ├── check-in-service-upgrade.xml │ ├── checksum.xml │ ├── commit-configuration.xml │ ├── file-archive.xml │ ├── file-list_dir.xml │ ├── file-list_file.xml │ ├── file-list_symlink.xml │ ├── file-show.xml │ ├── get-chassis-inventory.xml │ ├── get-checksum-information.xml │ ├── get-configuration.xml │ ├── get-directory-usage-information.xml │ ├── get-directory-usage-information_error1.xml │ ├── get-directory-usage-information_error2.xml │ ├── get-route-engine-information.xml │ ├── get-routing-task-replication-state.xml │ ├── get-software-information.xml │ ├── get-storage-usage-linux.xml │ ├── get-system-storage.xml │ ├── local.xml │ ├── request-halt.xml │ ├── request-package-add.no_mx80_packages.xml │ ├── request-package-add.no_result.xml │ ├── request-package-add.xml │ ├── request-package-check-pending-install-error.xml │ ├── request-package-check-pending-install.xml │ ├── request-package-in-service-upgrade.xml │ ├── request-package-nonstop-upgrade.xml │ ├── request-package-rollback-multi-error.xml │ ├── request-package-rollback.xml │ ├── request-package-validate.xml │ ├── request-power-off.xml │ ├── request-reboot-at.xml │ ├── request-reboot-output.xml │ ├── request-reboot.xml │ ├── request-shell-execute.xml │ ├── request-system-storage-cleanup.xml │ ├── request-vmhost-package-add.xml │ ├── request-zeroize.xml │ ├── set-cli-working-directory.xml │ └── show-cli-directory.xml │ ├── test_config.py │ ├── test_fs.py │ ├── test_ftp.py │ ├── test_scp.py │ ├── test_start_shell.py │ ├── test_sw.py │ └── test_util.py ├── vagrant ├── README.md ├── ansible │ ├── Vagrantfile │ ├── group_vars │ │ └── all │ └── vagrant.yml └── puppet │ ├── README.md │ ├── Vagrantfile │ ├── manifests │ └── default.pp │ └── modules │ └── pyez │ ├── Modulefile │ ├── Rakefile │ ├── manifests │ ├── init.pp │ └── params.pp │ ├── metadata.json │ ├── spec │ ├── spec.opts │ └── spec_helper.rb │ └── tests │ └── init.pp └── versioneer.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | omit = 3 | lib/jnpr/junos/cfg/* 4 | lib/jnpr/junos/_version.py 5 | 6 | [report] 7 | show_missing = True 8 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | /docs 2 | /tests 3 | /vagrant 4 | /static 5 | INSTALL* 6 | COPYRIGHT 7 | LICENSE 8 | *.md 9 | *.txt 10 | !requirements.txt 11 | .coveragerc 12 | .gitignore 13 | .travis.yml 14 | MANIFEST.in 15 | env-setup.sh -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | lib/jnpr/junos/_version.py export-subst 2 | -------------------------------------------------------------------------------- /.github/workflows/pylint.yml: -------------------------------------------------------------------------------- 1 | name: Pylint 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ${{ matrix.os }} 13 | 14 | strategy: 15 | matrix: 16 | os: [ ubuntu-latest, windows-latest ] 17 | python-version: [ 3.9, '3.10', 3.11, 3.12 ] 18 | exclude: 19 | - os: windows-latest 20 | python-version: 3.9 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Set up Python ${{ matrix.python-version }} 25 | uses: actions/setup-python@v2 26 | with: 27 | python-version: ${{ matrix.python-version }} 28 | - name: Install dependencies 29 | run: | 30 | python -m pip install --upgrade pip 31 | pip install pylint 32 | pip install -r requirements.txt 33 | pip install -r development.txt 34 | pip install ntc_templates==1.4.1 35 | pip install textfsm==0.4.1 36 | pip install . 37 | 38 | - name: Run black tool 39 | run: | 40 | pip install -U black; 41 | black --check --diff --exclude="docs|build|tests|samples" . 42 | 43 | - name: Run unit tests 44 | run: | 45 | nose2 --with-coverage -vvv tests.unit 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | build 11 | README 12 | eggs 13 | parts 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib64 19 | env 20 | .venv 21 | 22 | # Documentation 23 | docs/_build 24 | 25 | # Installer logs 26 | pip-log.txt 27 | # 28 | # Unit test / coverage reports 29 | .coverage 30 | .tox 31 | nosetests.xml 32 | tests/unit/cover 33 | 34 | # Translations 35 | *.mo 36 | 37 | # Mr Developer 38 | .mr.developer.cfg 39 | .project 40 | .pydevproject 41 | 42 | MANIFEST 43 | 44 | # Testing 45 | .tox 46 | foo_* 47 | testfile 48 | 49 | # Vagrant 50 | .vagrant 51 | vagrant_ansible* 52 | 53 | # Chef 54 | vagrant/chef 55 | 56 | # Puppet 57 | vagrant/puppet/*.sh 58 | 59 | # Window File Explorer 60 | desktop.ini 61 | 62 | # Mac OS X Finder 63 | .DS_Store 64 | 65 | # PyCharm 66 | .idea 67 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 1999-2021, Juniper Networks Inc. 3 | 2013, Jeremy Schulman 4 | 5 | All rights reserved. 6 | 7 | License: Apache 2.0 8 | 9 | THIS SOFTWARE IS PROVIDED BY Juniper Networks Inc. ''AS IS'' AND ANY 10 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | DISCLAIMED. IN NO EVENT SHALL Juniper Networks Inc. BE LIABLE FOR ANY 13 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.12-alpine 2 | 3 | LABEL net.juniper.description="Junos PyEZ library for Python in a lightweight container." \ 4 | net.juniper.maintainer="jnpr-community-netdev@juniper.net" 5 | 6 | WORKDIR /source 7 | 8 | ## Copy project inside the containers 9 | ADD setup.* ./ 10 | ADD versioneer.py . 11 | ADD requirements.txt . 12 | ADD lib lib 13 | ADD entrypoint.sh /usr/local/bin/. 14 | 15 | ## Install dependancies and PyEZ 16 | RUN apk add --no-cache build-base python3-dev \ 17 | libxslt-dev libxml2-dev libffi-dev openssl-dev curl \ 18 | ca-certificates py3-pip bash 19 | 20 | RUN pip install --upgrade pip \ 21 | && pip install pipdeptree \ 22 | && python3 -m pip install -r requirements.txt \ 23 | && pip install . 24 | 25 | ## Clean up and start init 26 | RUN apk del -r --purge gcc make g++ \ 27 | && rm -rf /source/* \ 28 | && chmod +x /usr/local/bin/entrypoint.sh 29 | 30 | WORKDIR /scripts 31 | 32 | VOLUME /scripts 33 | 34 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] 35 | -------------------------------------------------------------------------------- /INSTALL-FREEBSD.md: -------------------------------------------------------------------------------- 1 | ### Installation on stock FreeBSD 2 | 3 | The following are instructions for setting up a system starting from a stock system image. 4 | 5 | Operating Systems 6 | --------------- 7 | - FreeBSD 10.4 8 | - FreeBSD 11.1 9 | 10 | FreeBSD contains py-junos-eznc in its official repositories. It could be installed from binary packages using pkg package manager or built from sources using ports collection. 11 | 12 | ## Installing from binary packages. 13 | 14 | ##### For Python 2.7 15 | sudo pkg install py27-junos-eznc 16 | 17 | ##### For Python 3.6 18 | sudo pkg install py36-junos-eznc 19 | 20 | ## Installing from ports collection 21 | 22 | #### For Python 2.7 23 | sudo make -C /usr/ports/net-mgmt/py-junos-eznc install clean FLAVOR=py27 24 | 25 | #### For Python 3.6 26 | sudo make -C /usr/ports/net-mgmt/py-junos-eznc install clean FLAVOR=py36 27 | 28 | ## Verify 29 | 30 | Once you've completed the above step, you should be able to create a `Device` instance, connect to a Junos system, and display the "facts", as illustrated in the README.md file. 31 | 32 | Enjoy! 33 | 34 | 35 | ## Installing from GitHub 36 | 37 | Development code can be installed directly from GitHub based on any branch, commit, or tag. 38 | 39 | ***Packages from Steps 1 and 2 are required.*** 40 | 41 | sudo pkg install git 42 | sudo pip install git+https://github.com/Juniper/py-junos-eznc.git 43 | 44 | or 45 | 46 | sudo pip install git+https://github.com/Juniper/py-junos-eznc.git@ 47 | -------------------------------------------------------------------------------- /INSTALL-RHEL.md: -------------------------------------------------------------------------------- 1 | ### Installation on RHEL 2 | 3 | The following are instructions for setting up a system starting from a stock system images. 4 | 5 | These instructions were tested on a 64-bit systems from https://github.com/opscode/bento, and using the _Junos PyEZ_ library version 2.6.4. 6 | 7 | Operating Systems 8 | --------------- 9 | - Red hat Enterprise Linux 8.1 (Ootpa) 10 | 11 | #### Step 1: Install Python and PIP 12 | 13 | ##### For Python 3.x: 14 | dnf install python3-pip python3-wheel 15 | 16 | #### Step 2: Install Junos PyEZ 17 | 18 | ##### For Python 3.x: 19 | sudo pip3 install junos-eznc 20 | 21 | #### Step 3: Verify 22 | 23 | Once you've completed the above step, you should be able to create a `Device` instance, connect to a Junos system, and display the "facts", as illustrated in the README.md file. 24 | 25 | Enjoy! 26 | 27 | #### Installing from GitHub 28 | 29 | Development code can be installed directly from GitHub based on any branch, commit, or tag. 30 | 31 | ***Step 1 and 3 still required.*** 32 | #### Alternate Step 4: Install Junos PyEZ from GitHub 33 | 34 | #### Step 4a: Install Git from OS packages 35 | pip3 install git 36 | 37 | #### Step 4b: Install Junos PyEZ from GitHub 38 | 39 | ##### For Python 3.x: 40 | pip3 install git+https://github.com/Juniper/py-junos-eznc.git 41 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include requirements.txt 2 | recursive-include lib *.yml 3 | include versioneer.py 4 | include lib/jnpr/junos/_version.py 5 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | ========== 2 | junos-eznc 3 | ========== 4 | -------------------------------------------------------------------------------- /development.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | 3 | coverage # http://nedbatchelder.com/code/coverage/ 4 | nose2 # https://docs.nose2.io/en/latest/ 5 | pep8 # https://github.com/jcrocholl/pep8 6 | pyflakes # https://launchpad.net/pyflakes 7 | coveralls # https://coveralls.io/ 8 | ntc_templates # user needs to explicitly install this 9 | cryptography 10 | -------------------------------------------------------------------------------- /docs/.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the version of Python and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.8" 13 | 14 | # Build documentation in the docs/ directory with Sphinx 15 | sphinx: 16 | configuration: docs/conf.py 17 | 18 | # We recommend specifying your dependencies to enable reproducible builds: 19 | # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 20 | python: 21 | install: 22 | - requirements: docs/docreq.txt 23 | -------------------------------------------------------------------------------- /docs/docreq.txt: -------------------------------------------------------------------------------- 1 | git+https://github.com/ryan-roemer/sphinx-bootstrap-theme.git#egg=sphinx-bootstrap-theme 2 | lxml>=3.2.4 3 | ncclient==0.6.15 4 | scp>=0.7.0 5 | jinja2>=2.7.1 6 | PyYAML>=5.1 7 | paramiko>=3.5.0 8 | six 9 | pyserial 10 | yamlordereddictloader 11 | pyparsing 12 | transitions 13 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. Junos PyEZ documentation master file, created by 2 | sphinx-quickstart on Thu May 8 10:38:09 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Junos PyEZ's documentation! 7 | ====================================== 8 | 9 | *Junos PyEZ* is a Python library to remotely manage/automate Junos devices 10 | 11 | Contents: 12 | 13 | .. toctree:: 14 | :maxdepth: 2 15 | 16 | jnpr.junos 17 | TableView 18 | 19 | 20 | Indices and tables 21 | ================== 22 | 23 | * :ref:`genindex` 24 | * :ref:`modindex` 25 | * :ref:`search` 26 | 27 | -------------------------------------------------------------------------------- /docs/jnpr.junos.factory.rst: -------------------------------------------------------------------------------- 1 | jnpr.junos.factory 2 | ========================== 3 | 4 | 5 | jnpr.junos.factory.cfgtable 6 | ---------------------------------- 7 | 8 | .. automodule:: jnpr.junos.factory.cfgtable 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | 13 | jnpr.junos.factory.factory_cls 14 | ------------------------------------- 15 | 16 | .. automodule:: jnpr.junos.factory.factory_cls 17 | :members: 18 | :undoc-members: 19 | :show-inheritance: 20 | 21 | jnpr.junos.factory.factory_loader 22 | ---------------------------------------- 23 | 24 | .. automodule:: jnpr.junos.factory.factory_loader 25 | :members: 26 | :undoc-members: 27 | :show-inheritance: 28 | 29 | jnpr.junos.factory.optable 30 | --------------------------------- 31 | 32 | .. automodule:: jnpr.junos.factory.optable 33 | :members: 34 | :undoc-members: 35 | :show-inheritance: 36 | 37 | jnpr.junos.factory.table 38 | ------------------------------- 39 | 40 | .. automodule:: jnpr.junos.factory.table 41 | :members: 42 | :undoc-members: 43 | :show-inheritance: 44 | 45 | jnpr.junos.factory.view 46 | ------------------------------ 47 | 48 | .. automodule:: jnpr.junos.factory.view 49 | :members: 50 | :undoc-members: 51 | :show-inheritance: 52 | 53 | jnpr.junos.factory.viewfields 54 | ------------------------------------ 55 | 56 | .. automodule:: jnpr.junos.factory.viewfields 57 | :members: 58 | :undoc-members: 59 | :show-inheritance: 60 | 61 | 62 | Module contents 63 | --------------- 64 | 65 | .. automodule:: jnpr.junos.factory 66 | :members: 67 | :undoc-members: 68 | :show-inheritance: 69 | -------------------------------------------------------------------------------- /docs/jnpr.junos.facts.rst: -------------------------------------------------------------------------------- 1 | jnpr.junos.facts 2 | ======================== 3 | 4 | .. automodule:: jnpr.junos.facts 5 | :synopsis: 6 | -------------------------------------------------------------------------------- /docs/jnpr.junos.rst: -------------------------------------------------------------------------------- 1 | jnpr.junos 2 | ================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | jnpr.junos.factory 8 | jnpr.junos.facts 9 | jnpr.junos.utils 10 | 11 | 12 | jnpr.junos.device 13 | ------------------------ 14 | 15 | .. automodule:: jnpr.junos.device 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | 20 | jnpr.junos.exception 21 | --------------------------- 22 | 23 | .. automodule:: jnpr.junos.exception 24 | :members: 25 | :undoc-members: 26 | :show-inheritance: 27 | 28 | jnpr.junos.jxml 29 | ---------------------- 30 | 31 | .. automodule:: jnpr.junos.jxml 32 | :members: 33 | :undoc-members: 34 | :show-inheritance: 35 | 36 | jnpr.junos.rpcmeta 37 | ------------------------- 38 | 39 | .. automodule:: jnpr.junos.rpcmeta 40 | 41 | .. autoclass:: jnpr.junos.rpcmeta._RpcMetaExec 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | -------------------------------------------------------------------------------- /docs/jnpr.junos.utils.rst: -------------------------------------------------------------------------------- 1 | jnpr.junos.utils 2 | ======================== 3 | 4 | jnpr.junos.utils.config 5 | ------------------------------ 6 | 7 | .. automodule:: jnpr.junos.utils.config 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | 12 | jnpr.junos.utils.fs 13 | -------------------------- 14 | 15 | .. automodule:: jnpr.junos.utils.fs 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | 20 | jnpr.junos.utils.scp 21 | --------------------------- 22 | 23 | .. automodule:: jnpr.junos.utils.scp 24 | :members: 25 | :undoc-members: 26 | :show-inheritance: 27 | 28 | jnpr.junos.utils.start_shell 29 | ----------------------------------- 30 | 31 | .. automodule:: jnpr.junos.utils.start_shell 32 | :members: 33 | :undoc-members: 34 | :show-inheritance: 35 | 36 | jnpr.junos.utils.sw 37 | -------------------------- 38 | 39 | .. automodule:: jnpr.junos.utils.sw 40 | :members: 41 | :undoc-members: 42 | :show-inheritance: 43 | 44 | jnpr.junos.utils.util 45 | ---------------------------- 46 | 47 | .. automodule:: jnpr.junos.utils.util 48 | :members: 49 | :undoc-members: 50 | :show-inheritance: 51 | 52 | jnpr.junos.utils.ftp 53 | ---------------------------- 54 | 55 | .. automodule:: jnpr.junos.utils.ftp 56 | :members: 57 | :undoc-members: 58 | :show-inheritance: 59 | -------------------------------------------------------------------------------- /docs/juniper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/docs/juniper.png -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set +e 4 | 5 | ## Functions 6 | function apk_add { 7 | echo "Installing additional OS packages" 8 | while IFS= read -r pkg 9 | do 10 | echo "Installing ${pkg}" 11 | apk add --no-cache -q "${pkg}" 12 | done < "$1" 13 | } 14 | 15 | function pip_install { 16 | echo "Installing Python packages" 17 | pip install -r $1 18 | } 19 | 20 | function run_scripts { 21 | if [ "$1" = "python3" ] || [ "$1" = "python" ]; then python3 22 | else 23 | echo "Executing defined script" 24 | $1 ${@:2} 25 | fi 26 | } 27 | 28 | ## Manually defined variables will take precedence 29 | 30 | if [ "$APK" ]; then APK=$APK 31 | elif [ -f "/extras/apk.txt" ]; then APK="/extras/apk.txt" 32 | else APK='' 33 | fi 34 | 35 | if [ "$REQ" ]; then REQ=$REQ 36 | elif [ -f "/extras/requirements.txt" ];then REQ="/extras/requirements.txt" 37 | else REQ='' 38 | fi 39 | 40 | if [ "$#" ]; then SCRIPT=$@ 41 | else SCRIPT='' 42 | fi 43 | 44 | ## Install extras, run scripts, or start a shell session 45 | [[ -z "$APK" ]] || apk_add "$APK" 46 | [[ -z "$REQ" ]] || pip_install "$REQ" 47 | [[ -z "$SCRIPT" ]] && /bin/bash || run_scripts "$SCRIPT" 48 | 49 | -------------------------------------------------------------------------------- /env-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # usage: source env-setup 3 | 4 | # When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE 5 | if [ -n "$BASH_SOURCE" ] ; then 6 | HACKING_DIR=`dirname $BASH_SOURCE` 7 | elif [ $(basename $0) = "env-setup" ]; then 8 | HACKING_DIR=`dirname $0` 9 | else 10 | HACKING_DIR="$PWD" 11 | fi 12 | 13 | # The below is an alternative to readlink -fn which doesn't exist on OS X 14 | # Source: http://stackoverflow.com/a/1678636 15 | FULL_PATH=`python -c "import os; print(os.path.realpath('$HACKING_DIR'))"` 16 | PRJ_LIB="$FULL_PATH/lib" 17 | 18 | [[ $PYTHONPATH != ${PRJ_LIB}* ]] && export PYTHONPATH=$PRJ_LIB:$PYTHONPATH 19 | -------------------------------------------------------------------------------- /lib/jnpr/__init__.py: -------------------------------------------------------------------------------- 1 | __import__("pkg_resources").declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /lib/jnpr/junos/__init__.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.device import Device 2 | from jnpr.junos.console import Console 3 | from jnpr.junos.factory.to_json import PyEzJSONEncoder 4 | from jnpr.junos.facts.swver import version_info 5 | from jnpr.junos.facts.swver import version_yaml_representer 6 | from . import jxml 7 | from . import jxml as JXML 8 | from . import version 9 | from . import exception 10 | 11 | import json 12 | import yaml 13 | import logging 14 | 15 | __date__ = version.DATE 16 | 17 | # import time 18 | # __date__ = time.strftime("%Y-%b-%d") 19 | 20 | # Set default JSON encoder 21 | json._default_encoder = PyEzJSONEncoder() 22 | 23 | # Disable ignore_aliases for YAML dumper 24 | # To support version_info 25 | yaml.dumper.SafeDumper.ignore_aliases = lambda self, data: True 26 | yaml.dumper.Dumper.ignore_aliases = lambda self, data: True 27 | # Add YAML representer for version_info 28 | yaml.Dumper.add_multi_representer(version_info, version_yaml_representer) 29 | yaml.SafeDumper.add_multi_representer(version_info, version_yaml_representer) 30 | 31 | 32 | # Suppress Paramiko logger warnings 33 | plog = logging.getLogger("paramiko") 34 | if not plog.handlers: 35 | 36 | class NullHandler(logging.Handler): 37 | def emit(self, record): 38 | pass 39 | 40 | plog.addHandler(NullHandler()) 41 | 42 | from ._version import get_versions 43 | 44 | __version__ = get_versions()["version"] 45 | del get_versions 46 | 47 | from . import _version 48 | 49 | __version__ = _version.get_versions()["version"] 50 | -------------------------------------------------------------------------------- /lib/jnpr/junos/cfg/__init__.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.cfg.resource import Resource 2 | -------------------------------------------------------------------------------- /lib/jnpr/junos/cfg/phyport/__init__.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.cfg import Resource 2 | from jnpr.junos.cfg.phyport.classic import PhyPortClassic 3 | from jnpr.junos.cfg.phyport.switch import PhyPortSwitch 4 | 5 | __all__ = ["PhyPort"] 6 | 7 | 8 | class PhyPort(object): 9 | def __new__(cls, dev, name=None): 10 | supercls = { 11 | "CLASSIC": PhyPortClassic, 12 | "SWITCH": PhyPortSwitch, 13 | }.get(dev.facts["ifd_style"]) 14 | newcls = type(cls.__name__, (supercls,), {}) 15 | return newcls(dev, name) 16 | -------------------------------------------------------------------------------- /lib/jnpr/junos/cfg/phyport/classic.py: -------------------------------------------------------------------------------- 1 | # 3rd-party 2 | from lxml.builder import E 3 | 4 | # local 5 | from jnpr.junos.cfg.resource import Resource 6 | from jnpr.junos import JXML 7 | from jnpr.junos.cfg.phyport.base import PhyPortBase 8 | 9 | 10 | class PhyPortClassic(PhyPortBase): 11 | # ----------------------------------------------------------------------- 12 | # XML readers 13 | # ----------------------------------------------------------------------- 14 | 15 | def _xml_to_py(self, has_xml, has_py): 16 | PhyPortBase._xml_to_py(self, has_xml, has_py) 17 | 18 | Resource.copyifexists(has_xml, "speed", has_py) 19 | Resource.copyifexists(has_xml, "link-mode", has_py, "duplex") 20 | if has_xml.find("gigether-options/loopback") is not None: 21 | has_py["loopback"] = True 22 | has_py["$unit_count"] = len(has_xml.findall("unit")) 23 | 24 | # normalizers 25 | if "duplex" in has_py: 26 | PhyPortBase._set_invert(has_py, "duplex", self.PORT_DUPLEX) 27 | 28 | # ----------------------------------------------------------------------- 29 | # XML writers 30 | # ----------------------------------------------------------------------- 31 | 32 | def _xml_change_speed(self, xml): 33 | Resource.xml_set_or_delete(xml, "speed", self.speed) 34 | return True 35 | 36 | def _xml_change_duplex(self, xml): 37 | value = self.PORT_DUPLEX.get(self.duplex) 38 | Resource.xml_set_or_delete(xml, "link-mode", value) 39 | return True 40 | 41 | def _xml_change_loopback(self, xml): 42 | opts = E("gigether-options") 43 | opts.append(Resource.xmltag_set_or_del("loopback", self.loopback)) 44 | xml.append(opts) 45 | return True 46 | -------------------------------------------------------------------------------- /lib/jnpr/junos/cfgro/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/lib/jnpr/junos/cfgro/__init__.py -------------------------------------------------------------------------------- /lib/jnpr/junos/command/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | from importlib.abc import Loader, MetaPathFinder 4 | from importlib.util import spec_from_loader 5 | 6 | import yaml 7 | import yamlordereddictloader 8 | from jnpr.junos.factory.factory_loader import FactoryLoader 9 | 10 | __all__ = [] 11 | 12 | 13 | class MetaPathFinder(MetaPathFinder): 14 | def find_spec(self, fullname, path=None, target=None): 15 | mod = fullname.split(".")[-1] 16 | if mod in [ 17 | os.path.splitext(i)[0] for i in os.listdir(os.path.dirname(__file__)) 18 | ]: 19 | return spec_from_loader(fullname, MetaPathLoader(fullname)) 20 | 21 | 22 | class MetaPathLoader(Loader): 23 | def __init__(self, fullname): 24 | self.fullname = fullname 25 | self.modules = {} 26 | 27 | def exec_module(self, module): 28 | if self.fullname in self.modules: 29 | return self.modules[self.fullname] 30 | 31 | mod = self.fullname.split(".")[-1] 32 | with open(os.path.join(os.path.dirname(__file__), mod + ".yml"), "r") as stream: 33 | try: 34 | modules = FactoryLoader().load( 35 | yaml.load(stream, Loader=yamlordereddictloader.Loader) 36 | ) 37 | except yaml.YAMLError as exc: 38 | raise ImportError("%s is not loaded" % mod) 39 | 40 | for k, v in modules.items(): 41 | setattr(module, k, v) 42 | 43 | self.modules[self.fullname] = module 44 | 45 | return module 46 | 47 | 48 | sys.meta_path.insert(0, MetaPathFinder()) 49 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/chassis_fan.yml: -------------------------------------------------------------------------------- 1 | ChassisFanTable: 2 | command: show chassis fan 3 | key: fan-name 4 | view: ChassisFanView 5 | ChassisFanView: 6 | columns: 7 | fan-name: Item 8 | fan-status: Status 9 | fan-rpm: RPM 10 | fan-measurement: Measurement 11 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/cm_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CMErrorTable: 3 | command: show cmerror module brief 4 | target: Null 5 | key: 6 | - module 7 | view: CMErrorView 8 | 9 | CMErrorView: 10 | columns: 11 | module: Module 12 | name: Name 13 | errors: Active Errors 14 | pfe-specific: 15 | - PFE 16 | - Specific 17 | callback: 18 | - Callback 19 | - Function 20 | module-data: ModuleData 21 | filters: 22 | - errors 23 | - name 24 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_drd_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipDRDErrTable: 3 | command: show mqss {{ instance }} drd error-stats 4 | args: 5 | instance: 0 6 | target: Null 7 | key: Interrupt Name 8 | item: '*' 9 | view: CChipDRDErrView 10 | eval: 11 | cchip-drd-wan-errors: > 12 | sum([v['interrupt-count-wan'] for k, v in {{ data }}.items() 13 | if isinstance(v, dict)]) 14 | cchip-drd-fab-errors: > 15 | sum([v['interrupt-count-fab'] for k, v in {{ data }}.items() 16 | if isinstance(v, dict)]) 17 | 18 | CChipDRDErrView: 19 | regex: 20 | cchip-drd-wan-timeouts: 'Total WAN reorder ID timeout errors:\s+(\d+)' 21 | cchip-drd-fab-timeouts: 'Total fabric reorder ID timeout errors:\s+(\d+)' 22 | columns: 23 | interrupt-name: Interrupt Name 24 | interrupt-count-wan: 25 | - Number of 26 | - Reorder Engine 0 27 | interrupt-count-fab: 28 | - Interrupts 29 | - Reorder Engine 1 30 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_fi_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipFiErrTable: 3 | command: show mqss {{ instance }} fi interrupt-stats 4 | target: Null 5 | args: 6 | instance: 0 7 | key: Stream 8 | view: CChipFiErrView 9 | 10 | CChipFiErrView: 11 | fields: 12 | _counter_group_0: _table_0 13 | _counter_group_1: _table_1 14 | 15 | _table_0: 16 | item: '*' 17 | key: stream 18 | view: _table_0_view 19 | 20 | _table_0_view: 21 | columns: 22 | stream: Stream 23 | req-sat: 24 | - Total RLIM 25 | - request 26 | - counter 27 | - saturation 28 | cchip-fi-malloc-drops: 29 | - Total 30 | - PT/MALLOC 31 | - Usemeter 32 | - Drops 33 | cell-timeout-ignored: 34 | - Cell timeout 35 | - Ignored 36 | cchip-fi-cell-timeout: 37 | - Total Reorder 38 | - cell timeout 39 | - errors 40 | drops-in-secure: 41 | - Total cell 42 | - drops in 43 | - secure mode 44 | times-in-secure: 45 | - Total number 46 | - of times 47 | - entered into 48 | - secure mode 49 | 50 | _table_1: 51 | item: '*' 52 | key: stream 53 | view: _table_1_view 54 | 55 | _table_1_view: 56 | columns: 57 | stream: Stream 58 | stalled: 59 | - Stream reconfiguration 60 | - count due to pointers 61 | - stalled in secure mode 62 | cchip-fi-error-cells: 63 | - Total Error 64 | - Cells 65 | cchip-fi-late-cells: 66 | - Total Late 67 | - Cells 68 | cchip-fi-crc-error-packets: 69 | - Total CRC Errored 70 | - Packets 71 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_fi_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipFiStatsTable: 3 | command: show mqss {{ instance }} fi stats 4 | args: 5 | instance: 0 6 | target: Null 7 | item: '*' 8 | view: CenterChipFabricInStatsView 9 | 10 | CenterChipFabricInStatsView: 11 | regex: 12 | cchip-fi-packets-received: 'Received packets in input block for enabled streams\s+(\d+)' 13 | cchip-fi-packets-dropped: 'Packets dropped in FI memory interface\s+(\d+)' 14 | cchip-fi-packets-sent-ok: 'Packets sent out of PSV\s+(\d+)' 15 | cchip-fi-packets-with-error: 'Error packets sent out of PSV\s+(\d+)' 16 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_fo_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipFOStatsTable: 3 | command: show mqss {{ chip_instance }} fo stats 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | title: Counter group 0 8 | key: set 9 | view: MQSSFOStatsView 10 | 11 | MQSSFOStatsView: 12 | regex: 13 | set: (\d+)\s+Stream\s+\d+x\d+\s+\d+x\d+ 14 | total-packets-sent: (\d+).* 15 | filters: 16 | - total-packets-sent 17 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_host_drop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipHostDropTable: 3 | command: show xqss {{ instance }} sched queue 1008 local-stats 4 | target: Null 5 | args: 6 | instance: 0 7 | view: CChipHostDropView 8 | CChipHostDropView: 9 | regex: 10 | cchip-host-path-drops: Dropped pkts\s+:\s+(\d+) 11 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_li_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipLiInterruptStatsTable: 3 | command: show mqss {{ chip_instance }} li interrupt-stats 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | title: 'LI Block Interrupt Name Number of Interrupts' 8 | key: 9 | - li-block 10 | - name 11 | view: CChipLiInterruptStatsView 12 | eval: 13 | cchip-errors-from-lookup-chip: > 14 | sum([v['interrupts'] for k,v in {{ data }}.items()]) 15 | 16 | CChipLiInterruptStatsView: 17 | columns: 18 | li-block: LI Block 19 | name: Interrupt Name 20 | interrupts: Number of Interrupts 21 | last-occurance: Last Occurrence 22 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_lo_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipLoStatsTable: 3 | command: show mqss {{ chip_instance }} lo stats 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | title: 'LO Block Parcel Name Counter Name' 8 | key: block 9 | eval: 10 | cchip-lookup-out-errors: > 11 | sum([v['total'] for k,v in {{ data }}.items()]) 12 | view: CChipLoStatsView 13 | 14 | CChipLoStatsView: 15 | regex: 16 | block: \d+ 17 | parcel: Error Parcels 18 | counter: Error parcels sent to LUSS 19 | total: \d+ 20 | rate: \d+ pps 21 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_pt_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipPTStatTable: 3 | command: show mqss {{ instance }} drd stats 4 | args: 5 | instance: 0 6 | target: Null 7 | item: '*' 8 | view: CChipPTStatView 9 | 10 | 11 | CChipPTStatView: 12 | fields: 13 | cchip-free-internal-packet-table-wan: _wan_view 14 | cchip-free-internal-packet-table-fabric: _fab_view 15 | 16 | _wan_view: 17 | title: free_rid[0] 18 | 19 | _fab_view: 20 | title: free_rid[1] 21 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_wi_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipWiStatsTable: 3 | command: show mqss {{ chip_instance }} wi stats 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | key: mac 8 | view: CChipWiStatsView 9 | eval: 10 | total-drop: > 11 | sum([v['total_drop_packet'] for k, v in {{ data }}.items() 12 | if isinstance(v, dict) and 'total_drop_packet' in v]) 13 | 14 | CChipWiStatsView: 15 | fields: 16 | cchip-wi-stall: _CchipWiStallTable 17 | columns: 18 | mac: 19 | - MAC 20 | - Port 21 | total_drop_packet: Total Dropped Packets 22 | drop_packet: 23 | - Dropped Packets 24 | - Rate (pps) 25 | total_drop_byte: Total Dropped Bytes 26 | drop_byte: 27 | - Dropped Bytes Rate 28 | - (bps) 29 | 30 | _CchipWiStallTable: 31 | title: WI debug statistics 32 | item: '*' 33 | view: _CchipWiStallView 34 | 35 | _CchipWiStallView: 36 | regex: 37 | cchip-wi-stall-0: wsch_stall_hi\s+:\s+(\d+) 38 | cchip-wi-stall-1: wsch_stall_lo\s+:\s+(\d+) 39 | cchip-wi-received-packets: Received Packets\s+(\d+) 40 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ea_wo_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipWoStatsTable: 3 | command: show mqss {{ chip_instance }} wo stats 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | eval: 8 | cchip-wo-packets-sent: > 9 | {{ data }}['counter_0']['total_packets_0'] + 10 | {{ data }}['counter_1']['total_packets_1'] 11 | view: CChipWoStatsView 12 | 13 | CChipWoStatsView: 14 | fields: 15 | counter_0: _counter0_table 16 | counter_1: _counter1_table 17 | 18 | _counter0_table: 19 | title: Counter set 0 20 | item: "*" 21 | view: _counter_0_view 22 | 23 | _counter_0_view: 24 | regex: 25 | total_packets_0: 'Transmitted packets\s+:\s+(\d+)' 26 | 27 | _counter1_table: 28 | title: Counter set 1 29 | item: "*" 30 | view: _counter_1_view 31 | 32 | _counter_1_view: 33 | regex: 34 | total_packets_1: 'Transmitted packets\s+:\s+(\d+)' 35 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/fpc_link_stats.yml: -------------------------------------------------------------------------------- 1 | --- 2 | FPCLinkStats: 3 | command: show link stats 4 | target: Null 5 | delimiter: ":" 6 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/fpc_memory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | FpcMemory: 3 | command: show memory 4 | target: Null 5 | key: ID 6 | key_items: 7 | - 0 8 | - 1 9 | view: FPCMemoryView 10 | 11 | FPCMemoryView: 12 | columns: 13 | id: ID 14 | base: Base 15 | total: Total(b) 16 | free: Free(b) 17 | used: Used(b) 18 | perc: "%" 19 | name: Name 20 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/fpc_threads.yml: -------------------------------------------------------------------------------- 1 | --- 2 | FPCThread: 3 | command: show threads 4 | target: Null 5 | key: Name 6 | view: FPCThreadView 7 | 8 | FPCThreadView: 9 | columns: 10 | pid-pr: PID PR 11 | state: State 12 | name: Name 13 | stack: Stack Use 14 | time: Time (Last/Max/Total) 15 | cpu: cpu 16 | eval: 17 | cpu: "'{{ cpu }}'[:-1]" 18 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/host_loopback_status.yml: -------------------------------------------------------------------------------- 1 | --- 2 | HostlbStatusSummaryTable: 3 | command: show host_loopback status-summary 4 | target: Null 5 | view: HostlbStatusSummaryView 6 | 7 | HostlbStatusSummaryView: 8 | exists: 9 | no-detected-wedges: No detected wedges 10 | no-toolkit-errors: No toolkit errors 11 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ithrottle.yml: -------------------------------------------------------------------------------- 1 | --- 2 | IthrottleTable: 3 | command: show ithrottle 4 | target: Null 5 | key: 6 | - Name 7 | view: IthrottleView 8 | 9 | IthrottleView: 10 | columns: 11 | id: ID 12 | usage: "Usage %" 13 | configuration-state: "Cfg State" 14 | operating-state: "Oper State" 15 | name: Name 16 | 17 | IthrottleIDTable: 18 | command: show ithrottle id {{ id }} 19 | args: 20 | id: 0 21 | item: '*' 22 | target: Null 23 | view: IthrottleIDView 24 | 25 | IthrottleIDView: 26 | regex: 27 | min-usage: 'Min Usage Perc: (\d+\.\d+)' 28 | max-usage: 'Max Usage Perc: (\d+\.\d+)' 29 | usage-enable: 'AdjustUsageEnable: (\d)' 30 | fields: 31 | throttle-stats: _ThrottleStatsTable 32 | 33 | _ThrottleStatsTable: 34 | title: Throttle Stats 35 | delimiter: ":" 36 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/jnh_exceptions.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ShowJnhExceptions: 3 | command: show jnh {{ jnh_instance }} exceptions terse 4 | args: 5 | jnh_instance: 0 6 | target: Null 7 | key: reason 8 | view: ShowJnhExceptionsView 9 | 10 | ShowJnhExceptionsView: 11 | regex: 12 | reason: '(\w+(\s\w+)*)' 13 | type: '((DISC|PUNT)\(\s*\d+\)|M2L ERROR|TRAP\(\))' 14 | packets: '\d+' 15 | bytes: '\d*' 16 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/jnh_ifd_stream.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ShowJnhIfdStream: 3 | command: show jnh ifd {{ ifd }} stream 4 | args: 5 | ifd: 343 6 | target: Null 7 | title: Detail Statistics 8 | key: counter 9 | view: ShowJnhIfdStreamView 10 | 11 | ShowJnhIfdStreamView: 12 | regex: 13 | counter: '([a-zA-Z0-9-]+):' 14 | packets: '(\d+) pkts,' 15 | bytes: '(\d+) bytes' 16 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/jnhexceptionpkt.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ShowJnhExceptions: 3 | command: show jnh exceptions-trace 4 | target: Null 5 | item: '\[(\d+)\].*###############' 6 | key: name 7 | view: ShowJnhExceptionsPacketView 8 | 9 | ShowJnhExceptionsPacketView: 10 | fields: 11 | packets: _PacketTable 12 | 13 | _PacketTable: 14 | item: '*' 15 | title: 'token' 16 | view: _PacketView 17 | 18 | _PacketView: 19 | regex: 20 | reason: '.*token=\d+ \]' 21 | packets_00: '0x00: (.*)' 22 | packets_10: '0x10: (.*)' 23 | packets_20: '0x20: (.*)' 24 | packets_30: '0x30: (.*)' 25 | packets_40: '0x40: (.*)' 26 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/ospf_neighbor.yml: -------------------------------------------------------------------------------- 1 | --- 2 | OspfNeighborTable: 3 | command: show ospf neighbor 4 | key: Address 5 | view: OspfNeighborView 6 | OspfNeighborView: 7 | columns: 8 | neighbor_address: Address 9 | interface: Interface 10 | neighbor_state: State 11 | neighbor_id: ID 12 | neighbor_priority: Pri 13 | activity_timer: Dead 14 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/pci_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ShowPciErrorsTable: 3 | command: show pci errors {{ pci_controller_number }} 4 | target: Null 5 | args: 6 | pci_controller_number: 0 7 | key: 8 | - pci-address 9 | - status-type 10 | view: ShowPciErrorsView 11 | 12 | ShowPciErrorsView: 13 | regex: 14 | pci-address: 'PCI ERROR: (\d+:\d+:\d+:\d+) \(0x[a-f0-9]+\)' 15 | status-type: '(Slot|Link) status :' 16 | status: '0x[a-f0-9]+' 17 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/pfe_ddos_policer.yml: -------------------------------------------------------------------------------- 1 | --- 2 | DdosPolicerStatsTable: 3 | command: show ddos policer stats {{ protocol }} 4 | args: 5 | protocol: ospf 6 | target: Null 7 | title: "DDOS Policer Statistics:" 8 | key: location 9 | view: DdosPolicerStatsView 10 | 11 | DdosPolicerStatsView: 12 | regex: 13 | location: '(UKERN|PFE-[0-9]:[0-9])' 14 | pass: \d+ 15 | drop: \d+ 16 | arrival_rate: \d+ 17 | pass_rate: \d+ 18 | flows: \d+ 19 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/pre_classifier.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PreClStatsTable: 3 | command: show precl-eng {{ precl_index }} statistics 4 | target: Null 5 | args: 6 | precl_index: 2 7 | key: 8 | - port 9 | - id 10 | view: PreClStatsView 11 | 12 | PreClStatsView: 13 | columns: 14 | port: port 15 | id: ID 16 | class: Class 17 | transmitted-packets: TX pkts 18 | recieved-packets: RX pkts 19 | dropped-packets: Dropped pkts 20 | 21 | PreclSummTable: 22 | command: show precl-eng summary 23 | target: Null 24 | key: id 25 | view: PreclSummView 26 | 27 | PreclSummView: 28 | regex: 29 | id: "[0-9]+" 30 | engine_name: "[A-Za-z_.0-9]+" 31 | fpc: "[0-9]+" 32 | pic: "[0-9]+" 33 | ptr: "[0-9a-f]+" 34 | filters: 35 | - id 36 | - fpc 37 | - pic 38 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/scheduler_info.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SchedulerTable: 3 | command: show sched 4 | target: Null 5 | key: name 6 | view: SchedulerView 7 | 8 | SchedulerView: 9 | fields: 10 | thread: _TopThreadTable 11 | columns: 12 | cpu: CPU 13 | name: Name 14 | time-ms: Time(ms) 15 | regex: 16 | interrupt-time: 'Total interrupt time (\d+)' 17 | 18 | _TopThreadTable: 19 | title: Top Thread 20 | delimiter: "=" 21 | 22 | SchedulerCpuTable: 23 | command: show sched 24 | target: Null 25 | item: '*' 26 | view: SchedulerCpuView 27 | 28 | SchedulerCpuView: 29 | regex: 30 | cpu-1-second: 'CPU load is (\d+)% \(1 second\),\s+' 31 | cpu-5-seconds: '(\d+)% \(5 second\)' 32 | cpu-10-seconds: '\s+(\d+)% \(10 second\),\s+' 33 | cpu-1-minute: '(\d+)% \(1 minute\)' 34 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/system_proc_ext.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SystemProcExtTable: 3 | command: show system processes extensive 4 | key: cmd 5 | title: ' PID' 6 | view: SystemProcExtView 7 | 8 | SystemProcExtView: 9 | regex: 10 | size: '.* \S +(\d+(K|M))\s+' 11 | res: '(\d+(K|M))' 12 | wcpu: '.* (\d+\.\d+)%' 13 | cmd: '\w+' 14 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/system_queues.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SystemQueuesOutTable: 3 | command: show system queues 4 | key: output interface 5 | view: SystemQueuesOutView 6 | 7 | SystemQueuesOutView: 8 | columns: 9 | interface: output interface 10 | bytes: bytes 11 | max-bytes: max 12 | packets: packets 13 | max-packets: max 14 | drops: drops 15 | 16 | SystemQueuesINTable: 17 | command: show system queues 18 | key: input protocol 19 | view: SystemQueuesINView 20 | 21 | SystemQueuesINView: 22 | columns: 23 | interface: input protocol 24 | bytes: bytes 25 | max-bytes: max 26 | packets: packets 27 | max-packets: max 28 | drops: drops 29 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/task_io.yml: -------------------------------------------------------------------------------- 1 | --- 2 | TaskIOTable: 3 | command: show task io 4 | key: task-name 5 | view: TaskIOView 6 | 7 | TaskIOView: 8 | columns: 9 | task-name: Task Name 10 | reads: Reads 11 | writes: Writes 12 | received: Rcvd 13 | sent: Sent 14 | dropped: Dropped 15 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/toe_pfe.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ShowToePfeTable: 3 | command: > 4 | show toe pfe {{ pfe_instance }} {{ asic_type }} 5 | {{ asic_instance }} toe-inst {{ toe_instance }} 6 | wedge-stats stream {{ stream_id }} 7 | args: 8 | pfe_instance: 0 9 | asic_type: xm 10 | asic_instance: 0 11 | toe_instance: 0 12 | stream_id: 0 13 | target: Null 14 | view: ShowToePfeView 15 | 16 | ShowToePfeView: 17 | exists: 18 | wedge-not-declared: 'Declared Wedge: NO' 19 | wedge-window-size-0: 'Wedge window size: 0' 20 | toe-ucode-not-halted: 'TOE ucode halted..................NO' 21 | to-asic-not-blocked: 'Suspected to-asic blockage........NO' 22 | toe-driver-host-path-app-running: 'TOE driver host path app halted...NO' 23 | toe-packets-received: 'RX packets received...YES' 24 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/veriexec.yml: -------------------------------------------------------------------------------- 1 | veriexecTable: 2 | command: request routing-engine execute command "sysctl security.mac.veriexec.state" 3 | key: veriexec-name 4 | view: veriexecView 5 | 6 | veriexecView: 7 | regex: 8 | veriexec-name: '(.*):' 9 | veriexec-state: '(.*)' 10 | 11 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/vmcores.yml: -------------------------------------------------------------------------------- 1 | vmcoreTable: 2 | command: request routing-engine execute command "ls /var/crash/ | grep vmcore | wc -l" 3 | key: . 4 | view: vmcoreView 5 | 6 | vmcoreView: 7 | regex: 8 | num_cores: '(\d+)' 9 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_drd_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipDRDErrTable: 3 | command: show xmchip {{ instance }} drd error-stats 4 | args: 5 | instance: 0 6 | target: Null 7 | key: Interrupt Name 8 | item: '*' 9 | view: CChipDRDErrView 10 | eval: 11 | cchip-drd-wan-errors: > 12 | sum([v['interrupt-count'] for k, v in {{ data }}.items() 13 | if k.endswith('_0')]) 14 | cchip-drd-fab-errors: > 15 | sum([v['interrupt-count'] for k, v in {{ data }}.items() 16 | if k.endswith('_1')]) 17 | 18 | CChipDRDErrView: 19 | regex: 20 | cchip-drd-wan-timeouts: 'Total WAN reorder ID timeout errors:\s+(\d+)' 21 | cchip-drd-fab-timeouts: 'Total fabric reorder ID timeout errors:\s+(\d+)' 22 | columns: 23 | interrupt-name: Interrupt Name 24 | interrupt-count: Number of Interrupts 25 | filters: 26 | - interrupt-count 27 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_fi_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipFiErrTable: 3 | command: show xmchip {{ instance }} fi error-stats 4 | args: 5 | instance: 0 6 | target: Null 7 | item: '*' 8 | view: CChipFiErrView 9 | 10 | CChipFiErrView: 11 | regex: 12 | cchip-fi-cell-timeout: 'cell_timeout\s+:\s?(\d+)' 13 | cchip-fi-error-cells: 'err_cell\s+:\s?(\d+)' 14 | cchip-fi-late-cells: 'late_cell\s+:\s?(\d+)' 15 | cchip-fi-crc-error-packets: 'pkt_crc_err\s+:\s?(\d+)' 16 | cchip-fi-malloc-drops: 'ptuse_drops\s+:\s?(\d+)' 17 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_fi_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipFiStatsTable: 3 | command: show xmchip {{ instance }} fi stats 4 | args: 5 | instance: 0 6 | target: Null 7 | item: '*' 8 | view: CenterChipFabricInStatsView 9 | 10 | CenterChipFabricInStatsView: 11 | regex: 12 | cchip-fi-packets-received: 'MIF packet received\s+(\d+)' 13 | cchip-fi-packets-dropped: 'MIF packet drops \s+(\d+)' 14 | cchip-fi-packets-sent-ok: 'Packets sent to PT\s+(\d+)' 15 | cchip-fi-packets-with-error: 'Packets with errors sent to PT\s+(\d+)' 16 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_fo_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipFOStatsTable: 3 | command: show xmchip {{ instance }} fo stats 4 | args: 5 | instance: 0 6 | target: Null 7 | item: '*' 8 | view: XMChipFoStatsView 9 | 10 | XMChipFoStatsView: 11 | regex: 12 | cchip-fo-packets-sent: 'Transmitted packets\s+:\s(\d+)' 13 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_host_drop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipHostDropTable: 3 | command: show xmchip {{ instance }} phy-stream q-node-stats 1151 0 4 | target: Null 5 | args: 6 | instance: 0 7 | key: 8 | - color 9 | - counter-id 10 | - counter-name 11 | eval: 12 | cchip-host-path-drops: sum([i['total_error'] for i in {{ data }}.values()]) 13 | view: CChipHostDropView 14 | 15 | CChipHostDropView: 16 | regex: 17 | color: word 18 | outcome: \w+ drops 19 | counter-id: numbers 20 | counter-name: Packets 21 | total_error: numbers 22 | rate: (\d+) pps 23 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_li_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipLiInterruptStatsTable: 3 | command: show xmchip {{ chip_instance }} li interrupt-stats 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | title: 'LI Block Interrupt Name Number of Interrupts' 8 | key: 9 | - li-block 10 | - name 11 | view: CChipLiInterruptStatsView 12 | eval: 13 | cchip-errors-from-lookup-chip: > 14 | sum([v['interrupts'] for k,v in {{ data }}.items()]) 15 | 16 | CChipLiInterruptStatsView: 17 | columns: 18 | li-block: LI Block 19 | name: Interrupt Name 20 | interrupts: Number of Interrupts 21 | last-occurance: Last Occurrence 22 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_lo_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipLoStatsTable: 3 | command: show xmchip {{ chip_instance }} lo stats 0 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | title: 'LU Parcel Name Counter Name' 8 | key: block 9 | eval: 10 | cchip-lookup-out-errors: > 11 | sum([v['total'] for k,v in {{ data }}.items()]) 12 | view: CChipLoStatsView 13 | CChipLoStatsView: 14 | regex: 15 | # data: '.*' 16 | block: '\d+' 17 | counter: 'Error parcels sent to LU' 18 | total: '\d+' 19 | rate: '\d+ pps' 20 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_pt_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipPTStatTable: 3 | command: show xmchip {{ instance }} pt stats 4 | args: 5 | instance: 0 6 | target: Null 7 | item: '*' 8 | view: CChipPTStatView 9 | 10 | CChipPTStatView: 11 | regex: 12 | pct_wi_1: 'PCT entries used by all WI-1 streams\s+:\s?(\d+)' 13 | pct_wi_0: 'PCT entries used by all WI-0 streams\s+:\s?(\d+)' 14 | pct_fab: 'PCT entries used by all FI streams\s+:\s?(\d+)' 15 | eval: 16 | cchip-free-internal-packet-table-wan: '4096 - {{ pct_wi_1 }} + {{ pct_wi_0 }}' 17 | cchip-free-internal-packet-table-fabric: '4096 - {{pct_fab}}' 18 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_wi_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipWiStatsTable: 3 | command: show xmchip {{ chip_instance }} wi stats 0 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | key: mac 8 | view: CChipWiStatsView 9 | eval: 10 | cchip-total-oversubscription-drop: > 11 | sum([v['total_drop_packet'] for k, v in {{ data }}.items() if 12 | isinstance(v, dict) and 'total_drop_packet' in v]) 13 | 14 | CChipWiStatsView: 15 | exists: 16 | cchip_wi_stall_0: WIOCM STALL 0x0000000000000000_0000000000000000 17 | cchip_wi_stall_1: WICPQ STALL 0x0000000000000000_0000000000000000 18 | regex: 19 | cchip-wi-received-packets: Received Packets\s+(\d+) 20 | columns: 21 | mac: 22 | - MAC 23 | - Port 24 | total_drop_packet: Total Dropped Packets 25 | drop_packet: 26 | - Dropped Packets 27 | - Rate (pps) 28 | total_drop_byte: Total Dropped Bytes 29 | drop_byte: 30 | - Dropped Bytes Rate 31 | - (bps) 32 | total_preclassifier: 33 | - Total Preclassifier 34 | - Discards 35 | preclassifier: 36 | - Preclassifier 37 | - Discards Rate (pps) 38 | -------------------------------------------------------------------------------- /lib/jnpr/junos/command/xm_wo_statistics.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CChipWoStatsTable: 3 | command: show xmchip {{ chip_instance }} wo stats 0 4 | target: Null 5 | args: 6 | chip_instance: 0 7 | eval: 8 | cchip-wo-packets-sent: > 9 | {{ data }}['counter_0']['total_packets_0'] + 10 | {{ data }}['counter_1']['total_packets_1'] 11 | view: CChipWoStatsView 12 | 13 | CChipWoStatsView: 14 | fields: 15 | counter_0: _counter0_table 16 | counter_1: _counter1_table 17 | 18 | _counter0_table: 19 | title: Counter set 0 20 | item: "*" 21 | view: _counter_0_view 22 | 23 | _counter_0_view: 24 | regex: 25 | total_packets_0: 'Transmitted packets\s+:\s+(\d+)' 26 | 27 | _counter1_table: 28 | title: Counter set 1 29 | item: "*" 30 | view: _counter_1_view 31 | 32 | _counter_1_view: 33 | regex: 34 | total_packets_1: 'Transmitted packets\s+:\s+(\d+)' 35 | -------------------------------------------------------------------------------- /lib/jnpr/junos/factory/__init__.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | import os.path 3 | 4 | from jnpr.junos.factory.factory_loader import FactoryLoader 5 | 6 | __all__ = ["loadyaml", "FactoryLoader"] 7 | 8 | 9 | def loadyaml(path): 10 | """ 11 | Load a YAML file at :path: that contains Table and View definitions. 12 | Returns a of item-name anditem-class definition. 13 | 14 | If you want to import these definitions directly into your namespace, 15 | (like a module) you would do the following: 16 | 17 | globals().update( loadyaml( )) 18 | 19 | If you did not want to do this, you can access the items as the . 20 | For example, if your YAML file contained a Table called MyTable, then 21 | you could do something like: 22 | 23 | catalog = loadyaml( ) 24 | MyTable = catalog['MyTable'] 25 | 26 | table = MyTable(dev) 27 | table.get() 28 | ... 29 | """ 30 | # if no extension is given, default to '.yml' 31 | if os.path.splitext(path)[1] == "": 32 | path += ".yml" 33 | return FactoryLoader().load(yaml.load(open(path, "r"), Loader=yaml.FullLoader)) 34 | -------------------------------------------------------------------------------- /lib/jnpr/junos/facts/file_list.py: -------------------------------------------------------------------------------- 1 | def provides_facts(): 2 | """ 3 | Returns a dictionary keyed on the facts provided by this module. The value 4 | of each key is the doc string describing the fact. 5 | """ 6 | return { 7 | "HOME": "A string indicating the home directory of the current " "user.", 8 | } 9 | 10 | 11 | def get_facts(device): 12 | """ 13 | Gathers facts from the RPC. 14 | """ 15 | home = None 16 | rsp = device.rpc.file_list(normalize=True, path="~") 17 | if rsp.tag == "directory-list": 18 | dir_list_element = rsp 19 | else: 20 | dir_list_element = rsp.find(".//directory-list") 21 | if dir_list_element is not None: 22 | home = dir_list_element.get("root-path") 23 | if home is not None: 24 | home = home.rstrip("/") 25 | return { 26 | "HOME": home, 27 | } 28 | -------------------------------------------------------------------------------- /lib/jnpr/junos/facts/get_chassis_inventory.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.exception import ConnectNotMasterError 2 | from jnpr.junos.exception import RpcError 3 | 4 | 5 | def provides_facts(): 6 | """ 7 | Returns a dictionary keyed on the facts provided by this module. The value 8 | of each key is the doc string describing the fact. 9 | """ 10 | return { 11 | "RE_hw_mi": "(Routing Engine hardware multi-instance) A boolean " 12 | "indicating if this is a multi-chassis system.", 13 | "serialnumber": "A string containing the serial number of the " 14 | "device's chassis. If there is no chassis serial " 15 | "number, the serial number of the backplane or " 16 | "midplane is returned.", 17 | } 18 | 19 | 20 | def get_facts(device): 21 | """ 22 | Gathers facts from the RPC. 23 | """ 24 | rsp = device.rpc.get_chassis_inventory(normalize=True) 25 | if rsp.tag == "error": 26 | raise RpcError() 27 | 28 | if ( 29 | rsp.tag == "output" 30 | and rsp.text.find("can only be used on the master routing engine") != -1 31 | ): 32 | # An error; due to the fact that this RPC can only be executed on the 33 | # master Routing Engine 34 | raise ConnectNotMasterError() 35 | 36 | RE_hw_mi = False 37 | if rsp.tag == "multi-routing-engine-results": 38 | RE_hw_mi = True 39 | 40 | serialnumber = ( 41 | rsp.findtext(".//chassis[1]/serial-number") 42 | or rsp.findtext('.//chassis-module[name="Backplane"]/serial-number') 43 | or rsp.findtext('.//chassis-module[name="Midplane"]/serial-number') 44 | ) 45 | 46 | return { 47 | "RE_hw_mi": RE_hw_mi, 48 | "serialnumber": serialnumber, 49 | } 50 | -------------------------------------------------------------------------------- /lib/jnpr/junos/facts/ifd_style.py: -------------------------------------------------------------------------------- 1 | def provides_facts(): 2 | """ 3 | Returns a dictionary keyed on the facts provided by this module. The value 4 | of each key is the doc string describing the fact. 5 | """ 6 | return { 7 | "ifd_style": "The type of physical interface (ifd) supported by " 8 | "the device. Choices are 'CLASSIC' or 'SWITCH'.", 9 | } 10 | 11 | 12 | def get_facts(device): 13 | """ 14 | Determines ifd_style fact based on the personality. 15 | """ 16 | ifd_style = "CLASSIC" 17 | 18 | if device.facts["personality"] == "SWITCH": 19 | ifd_style = "SWITCH" 20 | elif device.facts["personality"] == "JDM": 21 | ifd_style = None 22 | 23 | return { 24 | "ifd_style": ifd_style, 25 | } 26 | -------------------------------------------------------------------------------- /lib/jnpr/junos/facts/is_linux.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.exception import RpcError 2 | 3 | 4 | def provides_facts(): 5 | """ 6 | Returns a dictionary keyed on the facts provided by this module. The value 7 | of each key is the doc string describing the fact. 8 | """ 9 | return { 10 | "_is_linux": "A boolean indicating if the device is running linux" "kernel.", 11 | } 12 | 13 | 14 | def get_facts(device): 15 | """ 16 | Gathers the _is_linux fact using the RPC on the EVO version file. 17 | """ 18 | 19 | # Temporary implementation until PR 1245634 is implemented. 20 | LINUX_VERSION_PATH = "/usr/share/cevo/cevo_version" 21 | 22 | is_linux = None 23 | 24 | try: 25 | rsp = device.rpc.file_show(normalize=True, filename=LINUX_VERSION_PATH) 26 | if rsp.tag == "file-content": 27 | is_linux = True 28 | else: 29 | is_linux = False 30 | except RpcError: 31 | is_linux = False 32 | return { 33 | "_is_linux": is_linux, 34 | } 35 | -------------------------------------------------------------------------------- /lib/jnpr/junos/ofacts/__init__.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.ofacts.chassis import facts_chassis 2 | from jnpr.junos.ofacts.routing_engines import facts_routing_engines 3 | from jnpr.junos.ofacts.personality import facts_personality 4 | from jnpr.junos.ofacts.swver import facts_software_version 5 | from jnpr.junos.ofacts.ifd_style import facts_ifd_style 6 | from jnpr.junos.ofacts.switch_style import facts_switch_style 7 | from jnpr.junos.ofacts.session import facts_session 8 | from jnpr.junos.ofacts.srx_cluster import facts_srx_cluster 9 | from jnpr.junos.ofacts.domain import facts_domain 10 | 11 | FACT_LIST = [ 12 | facts_chassis, # first 13 | facts_routing_engines, # second 14 | facts_personality, # third 15 | facts_srx_cluster, # four 16 | facts_software_version, # fifth 17 | facts_domain, 18 | facts_ifd_style, 19 | facts_switch_style, 20 | facts_session, 21 | ] 22 | 23 | __all__ = ["FACT_LIST"] 24 | -------------------------------------------------------------------------------- /lib/jnpr/junos/ofacts/domain.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.utils.fs import FS 2 | from jnpr.junos.exception import RpcError 3 | from jnpr.junos.jxml import INHERIT 4 | from lxml.builder import E 5 | 6 | 7 | def facts_domain(junos, facts): 8 | """ 9 | The following facts are required: 10 | facts['hostname'] 11 | 12 | The following facts are assigned: 13 | facts['domain'] 14 | facts['fqdn'] 15 | """ 16 | 17 | try: 18 | domain_filter_xml = E("configuration", E("system", E("domain-name"))) 19 | domain = junos.rpc.get_config(filter_xml=domain_filter_xml, options=INHERIT) 20 | domain_name = domain.xpath(".//domain-name") 21 | if len(domain_name) > 0: 22 | facts["domain"] = domain_name[0].text 23 | facts["fqdn"] = facts["hostname"] + "." + facts["domain"] 24 | return 25 | except RpcError: 26 | pass 27 | 28 | fs = FS(junos) 29 | file_content = fs.cat("/etc/resolv.conf") or fs.cat("/var/etc/resolv.conf") 30 | words = file_content.split() if file_content is not None else "" 31 | if "domain" not in words: 32 | facts["domain"] = None 33 | facts["fqdn"] = facts["hostname"] 34 | else: 35 | idx = words.index("domain") + 1 36 | facts["domain"] = words[idx] 37 | facts["fqdn"] = facts["hostname"] + "." + facts["domain"] 38 | -------------------------------------------------------------------------------- /lib/jnpr/junos/ofacts/ifd_style.py: -------------------------------------------------------------------------------- 1 | def facts_ifd_style(junos, facts): 2 | persona = facts["personality"] 3 | if persona == "SWITCH": 4 | facts["ifd_style"] = "SWITCH" 5 | else: 6 | facts["ifd_style"] = "CLASSIC" 7 | -------------------------------------------------------------------------------- /lib/jnpr/junos/ofacts/personality.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | def facts_personality(junos, facts): 5 | model = facts["model"] 6 | 7 | if model != "Virtual Chassis": 8 | examine = model 9 | else: 10 | for fact in facts: 11 | if re.match(r"^RE\d", fact): 12 | examine = facts[fact]["model"] 13 | break 14 | 15 | examine = examine.upper() 16 | 17 | if re.match("^(EX)|(QFX)", examine): 18 | persona = "SWITCH" 19 | elif examine.startswith("MX"): 20 | persona = "MX" 21 | elif examine.startswith("VMX"): 22 | facts["virtual"] = True 23 | persona = "MX" 24 | elif examine.startswith("VJX"): 25 | facts["virtual"] = True 26 | persona = "SRX_BRANCH" 27 | elif "VRR" == examine: 28 | persona = "MX" 29 | facts["virtual"] = True 30 | elif examine.startswith("M"): 31 | persona = "M" 32 | elif examine.startswith("T"): 33 | persona = "T" 34 | elif examine.startswith("PTX"): 35 | persona = "PTX" 36 | elif re.match(r"SRX\s?(\d){4}", examine): 37 | persona = "SRX_HIGHEND" 38 | elif re.match(r"SRX\s?(\d){3}", examine): 39 | persona = "SRX_BRANCH" 40 | elif re.search("firefly", examine, re.IGNORECASE): 41 | facts["virtual"] = True 42 | persona = "SRX_BRANCH" 43 | elif "OLIVE" == examine: 44 | facts["virtual"] = True 45 | persona = "OLIVE" 46 | else: 47 | persona = "UNKNOWN" 48 | 49 | facts["personality"] = persona 50 | -------------------------------------------------------------------------------- /lib/jnpr/junos/ofacts/session.py: -------------------------------------------------------------------------------- 1 | """ 2 | facts['HOME'] = login home directory 3 | """ 4 | 5 | from lxml.builder import E 6 | 7 | 8 | def facts_session(dev, facts): 9 | facts["HOME"] = dev.rpc(E.command("show cli directory")).findtext( 10 | "./working-directory" 11 | ) 12 | -------------------------------------------------------------------------------- /lib/jnpr/junos/ofacts/srx_cluster.py: -------------------------------------------------------------------------------- 1 | def facts_srx_cluster(junos, facts): 2 | # we should check the 'cluster status' on redundancy group 0 to see who is 3 | # master. we use a try/except block for cases when SRX is not clustered 4 | 5 | try: 6 | cluster_st = junos.rpc.get_chassis_cluster_status(redundancy_group="0") 7 | if "error" == cluster_st.tag: 8 | facts["srx_cluster"] = False 9 | return 10 | 11 | primary = cluster_st.xpath('.//redundancy-group-status[.="primary"]')[0] 12 | 13 | node = primary.xpath("preceding-sibling::device-name[1]")[0].text.replace( 14 | "node", "RE" 15 | ) 16 | 17 | if not facts.get("master"): 18 | facts["master"] = node 19 | elif node not in facts["master"]: 20 | facts["master"].append(node) 21 | 22 | facts["srx_cluster"] = True 23 | 24 | except: 25 | # this device doesn't support SRX chassis clustering; i.e. 26 | # since we arbitrarily execute the RPC on all devices, if we 27 | # hit this exception we just ignore, A-OK, yo! 28 | pass 29 | -------------------------------------------------------------------------------- /lib/jnpr/junos/ofacts/switch_style.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | def facts_switch_style(junos, facts): 5 | persona = facts["personality"] 6 | 7 | if persona in ["MX", "SRX_HIGHEND"]: 8 | style = "BRIDGE_DOMAIN" 9 | elif persona in ["SWITCH", "SRX_BRANCH"]: 10 | model = facts["model"] 11 | if re.match("firefly", model, re.IGNORECASE): 12 | style = "NONE" 13 | elif re.match("^(EX9)|(EX43)", model): 14 | style = "VLAN_L2NG" 15 | else: 16 | style = "VLAN" 17 | else: 18 | style = "NONE" 19 | 20 | facts["switch_style"] = style 21 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/__init__.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import yaml 4 | 5 | from importlib.abc import Loader, MetaPathFinder 6 | from importlib.util import spec_from_loader 7 | from jnpr.junos.factory.factory_loader import FactoryLoader 8 | 9 | __all__ = [] 10 | 11 | 12 | class OPMetaPathFinder(MetaPathFinder): 13 | def find_spec(self, fullname, path=None, target=None): 14 | if fullname.startswith("jnpr.junos"): 15 | mod = fullname.split(".")[-1] 16 | if mod in [ 17 | os.path.splitext(i)[0] for i in os.listdir(os.path.dirname(__file__)) 18 | ]: 19 | return spec_from_loader(fullname, OPMetaPathLoader(fullname)) 20 | 21 | 22 | class OPMetaPathLoader(Loader): 23 | def __init__(self, fullname): 24 | self.fullname = fullname 25 | self.modules = {} 26 | 27 | def exec_module(self, module): 28 | if self.fullname in self.modules: 29 | return self.modules[self.fullname] 30 | 31 | mod = self.fullname.split(".")[-1] 32 | 33 | with open(os.path.join(os.path.dirname(__file__), mod + ".yml"), "r") as stream: 34 | try: 35 | modules = FactoryLoader().load( 36 | yaml.load(stream, Loader=yaml.FullLoader) 37 | ) 38 | except yaml.YAMLError as exc: 39 | raise ImportError("%s is not loaded" % mod) 40 | for k, v in modules.items(): 41 | setattr(module, k, v) 42 | 43 | self.modules[self.fullname] = module 44 | 45 | return module 46 | 47 | 48 | sys.meta_path.insert(0, OPMetaPathFinder()) 49 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/arp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ArpTable: 3 | rpc: get-arp-table-information 4 | args: 5 | no-resolve: True 6 | item: arp-table-entry 7 | key: mac-address 8 | view: ArpView 9 | 10 | ArpView: 11 | fields: 12 | mac_address: mac-address 13 | ip_address: ip-address 14 | interface_name: interface-name 15 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/bgp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | bgpTable: 3 | rpc: get-bgp-neighbor-information 4 | item: bgp-peer 5 | view: bgpView 6 | key: peer-id 7 | 8 | bgpView: 9 | fields: 10 | local_as: local-as 11 | peer_as: peer-as 12 | local_address: local-address 13 | peer_id: peer-id 14 | local_id: local-id 15 | route_received: bgp-rib/received-prefix-count 16 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/ccc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | CCCTable: 3 | rpc: get-ccc-information 4 | args: 5 | status: True 6 | interface-switch: True 7 | item: ccc-connection 8 | key: ccc-connection-name 9 | view: CCCView 10 | 11 | CCCView: 12 | fields: 13 | status: ccc-connection-status 14 | ports: _CCCPorts 15 | 16 | _CCCPorts: 17 | item: ccc-connection-circuit 18 | key: 19 | - ccc-circuit-name 20 | view: _CCCPortsView 21 | 22 | _CCCPortsView: 23 | fields: 24 | type: ccc-circuit-type 25 | status: ccc-circuit-status 26 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/ddos.yml: -------------------------------------------------------------------------------- 1 | --- 2 | DDOSTable: 3 | rpc: get-ddos-statistics-information 4 | item: . 5 | key: ddos-policing-re-enabled 6 | view: DDOSView 7 | 8 | DDOSView: 9 | fields: 10 | policing_on_re: ddos-policing-re-enabled 11 | policing_on_fpc: ddos-policing-fpc-enabled 12 | flow_detection: ddos-flow-detection-enabled 13 | logging: ddos-logging-enabled 14 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/elsethernetswitchingtable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ElsEthernetSwitchingTable: 3 | rpc: get-ethernet-switching-table-information 4 | args: 5 | detail: True 6 | item: l2ng-l2ald-mac-entry-vlan 7 | key: l2ng-l2-mac-address 8 | view: ElsEthernetSwitchingView 9 | 10 | ElsEthernetSwitchingView: 11 | fields: 12 | mac_address: l2ng-l2-mac-address 13 | count: mac-count-global 14 | learnt: learnt-mac-count 15 | routing_instance: l2ng-l2-mac-routing-instance 16 | vlan_id: l2ng-l2-vlan-id 17 | vlan_name: l2ng-l2-mac-vlan-name 18 | logical_interface: l2ng-l2-mac-logical-interface 19 | active_source: l2ng-l2-active-source 20 | ifl_generation: l2ng-l2-mac-ifl-generation 21 | flags: l2ng-l2-mac-entry-flags 22 | epoch: l2ng-l2-mac-epoch 23 | sequence_number: l2ng-l2-mac-sequence-number 24 | learn_mask: l2ng-l2-mac-learn-mask 25 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/ethernetswitchingtable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | EthernetSwitchingTable: 3 | rpc: get-ethernet-switching-table-information 4 | args: 5 | detail: True 6 | key: mac-table-count 7 | item: ethernet-switching-table 8 | view: EthernetSwitchingView 9 | 10 | EthernetSwitchingView: 11 | fields: 12 | count: mac-table-count 13 | learned: mac-table-learned 14 | persistent: mac-table-persistent 15 | entries: _MacTableEntriesTable 16 | 17 | _MacTableEntriesTable: 18 | item: mac-table-entry 19 | key: mac-vlan 20 | view: _MacTableEntriesView 21 | 22 | _MacTableEntriesView: 23 | fields: 24 | vlan: mac-vlan 25 | vlan_tag: mac-vlan-tag 26 | mac_address: mac-address 27 | type: mac-type 28 | age: mac-age 29 | learned_time: mac-learned-time 30 | action: mac-action 31 | next_hop: mac-nexthop 32 | interface: mac-interface 33 | interface-list: _MacTableInterfacesTable 34 | 35 | _MacTableInterfacesTable: 36 | item: mac-interfaces-list 37 | key: mac-interfaces 38 | view: _MacTableInterfacesView 39 | 40 | _MacTableInterfacesView: 41 | fields: 42 | interfaces: mac-interfaces 43 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/ethport.yml: -------------------------------------------------------------------------------- 1 | --- 2 | EthPortTable: 3 | rpc: get-interface-information 4 | args: 5 | media: True 6 | interface_name: '[afgxe][et]-*' 7 | args_key: interface_name 8 | item: physical-interface 9 | view: EthPortView 10 | 11 | EthPortView: 12 | groups: 13 | mac_stats: ethernet-mac-statistics 14 | flags: if-device-flags 15 | fields: 16 | oper: oper-status 17 | admin: admin-status 18 | description: description 19 | mtu: { mtu : int } 20 | link_mode: link-mode 21 | macaddr: current-physical-address 22 | fields_mac_stats: 23 | rx_bytes: input-bytes 24 | rx_packets: input-packets 25 | tx_bytes: output-bytes 26 | tx_packets: output-packets 27 | fields_flags: 28 | running: { ifdf-running: flag } 29 | present: { ifdf-present: flag } 30 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/idpattacks.yml: -------------------------------------------------------------------------------- 1 | --- 2 | IDPAttackTable: 3 | rpc: get-idp-attack-table-information 4 | item: idp-attack-statistics 5 | key: name 6 | view: IDPAttackView 7 | 8 | IDPAttackView: 9 | fields: 10 | attack_name: name 11 | count: value 12 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/intopticdiag.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PhyPortDiagTable: 3 | rpc: get-interface-optics-diagnostics-information 4 | args: 5 | interface_name: '[efgx][et]-*' 6 | args_key: interface_name 7 | item: physical-interface 8 | view: PhyPortDiagView 9 | 10 | PhyPortDiagView: 11 | groups: 12 | diag: optics-diagnostics 13 | 14 | # fields that are part of groups are called 15 | # "fields_" 16 | 17 | fields_diag: 18 | rx_optic_power : rx-signal-avg-optical-power-dbm 19 | tx_optic_power : laser-output-power-dbm 20 | module_temperature : module-temperature 21 | module_voltage : module-voltage 22 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ModuleTable: 4 | rpc: get-chassis-inventory 5 | item: .//chassis-sub-module|.//chassis-module|.//chassis-sub-sub-module 6 | key: 7 | - name 8 | view: ModuleTableView 9 | 10 | ModuleTableView: 11 | fields: 12 | jname: name 13 | sn: serial-number 14 | pn: part-number 15 | ver: version 16 | type: description 17 | 18 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/isis.yml: -------------------------------------------------------------------------------- 1 | IsisAdjacencyTable: 2 | rpc: get-isis-adjacency-information 3 | args: 4 | extensive: True 5 | item: isis-adjacency 6 | key: 7 | - interface-name 8 | - system-name 9 | view: IsisAdjacencyView 10 | 11 | IsisAdjacencyView: 12 | fields: 13 | interface_name: interface-name 14 | system_name: system-name 15 | level: level 16 | adjacency_state: adjacency-state 17 | holdtime: holdtime 18 | circuit_type: circuit-type 19 | ip_address: ip-address 20 | interface_priority: interface-priority 21 | adjacency_flag: adjacency-flag 22 | adjacency_topologies: adjacency-topologies 23 | adjacency_restart_capable: adjacency-restart-capable 24 | adjacency_advertisement: adjacency-advertisement 25 | adjacency_log: _IsisAdjacencyLogTable 26 | 27 | _IsisAdjacencyLogTable: 28 | item: isis-adjacency-log 29 | key: 30 | - adjacency-when 31 | - adjacency-state 32 | view: _IsisAdjacencyLogView 33 | 34 | _IsisAdjacencyLogView: 35 | fields: 36 | when: adjacency-when 37 | state: adjacency-state 38 | event: adjacency-event 39 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/l2circuit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ### ------------------------------------------------------ 4 | ### show l2circuit connections 5 | ### ------------------------------------------------------ 6 | 7 | L2CircuitConnectionTable: 8 | rpc: get-l2ckt-connection-information 9 | item: l2circuit-neighbor/connection 10 | key: 11 | - ancestor::l2circuit-neighbor/neighbor-address 12 | - connection-id 13 | view: L2CircuitConnectionView 14 | 15 | L2CircuitConnectionView: 16 | fields: 17 | connection_id: connection-id 18 | connection_type: connection-type 19 | connection_status: connection-status 20 | remote_pe: remote-pe 21 | control_word: control-word 22 | inboud_label: inbound-label 23 | outbound_label: outbound-label 24 | pw_status_tlv: pw-status-tlv 25 | local_interface: local-interface/interface-name 26 | interface_status: local-interface/interface-status 27 | interface_encapsulation: local-interface/interface-encapsulation 28 | interface_description: local-interface/interface-description 29 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/ldp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | LdpNeighborTable: 3 | rpc: get-ldp-neighbor-information 4 | args: 5 | extensive: True 6 | item: ldp-neighbor 7 | key: 8 | - interface-name 9 | - ldp-neighbor-address 10 | view: LdpNeighborView 11 | 12 | LdpNeighborView: 13 | fields: 14 | interface_name: interface-name 15 | neighbor_address: ldp-neighbor-address 16 | label_space_id: ldp-label-space-id 17 | remaining_time: ldp-remaining-time 18 | transport_address: ldp-transport-address 19 | config_sequence: ldp-config-sequence 20 | up_time: ldp-up-time 21 | reference_count: ldp-reference-count 22 | holdtime: ldp-holdtime 23 | proposed_local_holdtime: ldp-proposed-local-holdtime 24 | proposed_peer_holdtime: ldp-proposed-peer-holdtime 25 | hello_interval: ldp-hello-interval 26 | hello_flags: _LdpNeighborHelloFlagsTable 27 | types: _LdpNeighborTypesTable 28 | 29 | _LdpNeighborHelloFlagsTable: 30 | item: ldp-neighbor-hello-flags 31 | key: ldp-neighbor-hello-flag 32 | view: _LdpNeighborHelloFlagsView 33 | 34 | _LdpNeighborHelloFlagsView: 35 | fields: 36 | flag: ldp-neighbor-hello-flag 37 | 38 | _LdpNeighborTypesTable: 39 | item: ldp-neighbor-types 40 | key: ldp-neighbor-type 41 | view: _LdpNeighborTypesView 42 | 43 | _LdpNeighborTypesView: 44 | fields: 45 | type: ldp-neighbor-type 46 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/lldp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | LLDPNeighborTable: 3 | rpc: get-lldp-neighbors-information 4 | item: lldp-neighbor-information 5 | key: lldp-local-interface | lldp-local-port-id 6 | view: LLDPNeighborView 7 | 8 | LLDPNeighborView: 9 | fields: 10 | local_int: lldp-local-interface | lldp-local-port-id 11 | local_parent: lldp-local-parent-interface-name 12 | remote_type: lldp-remote-chassis-id-subtype 13 | remote_chassis_id: lldp-remote-chassis-id 14 | remote_port_desc: lldp-remote-port-description 15 | remote_port_id: lldp-remote-port-id 16 | remote_sysname: lldp-remote-system-name 17 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/nd.yml: -------------------------------------------------------------------------------- 1 | --- 2 | NdTable: 3 | rpc: get-ipv6-nd-information 4 | item: ipv6-nd-entry 5 | key: ipv6-nd-neighbor-l2-address 6 | view: NdView 7 | 8 | NdView: 9 | fields: 10 | mac_address: ipv6-nd-neighbor-l2-address 11 | ip_address: ipv6-nd-neighbor-address 12 | interface_name: ipv6-nd-interface-name 13 | router: ipv6-nd-isrouter 14 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/pfestats.yml: -------------------------------------------------------------------------------- 1 | PFEStatsTrafficTable: 2 | rpc: get-pfe-statistics 3 | item: pfe-traffic-statistics 4 | key: pfe-input-packets 5 | view: PFEStatsTrafficView 6 | 7 | PFEStatsTrafficView: 8 | fields: 9 | input_packets: pfe-input-packets 10 | output_packets: pfe-output-packets 11 | local_traffic: _PFEStatsLocalTrafficTable 12 | local_protocol: _PFEStatsLocalProtocolTable 13 | 14 | _PFEStatsLocalTrafficTable: 15 | item: ../pfe-local-traffic-statistics 16 | key: pfe-input-packets 17 | view: _PFEStatsLocalTrafficView 18 | 19 | _PFEStatsLocalTrafficView: 20 | fields: 21 | input_packets: pfe-input-packets 22 | output_packets: pfe-output-packets 23 | 24 | _PFEStatsLocalProtocolTable: 25 | item: ../pfe-local-protocol-statistics 26 | key: ospf-hello-count 27 | view: _PFEStatsLocalProtocolView 28 | 29 | _PFEStatsLocalProtocolView: 30 | fields: 31 | hello_count: ospf-hello-count 32 | arp_count: arp-count 33 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/ppm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PPMTable: 3 | rpc: get-ppm-adjacencies 4 | args: 5 | level: detail 6 | item: adjacency-data 7 | key: protocol 8 | view: PPMView 9 | 10 | PPMView: 11 | fields: 12 | protocol: protocol 13 | holdtime: adjacency-holdtime 14 | interface_index: adjacency-interface-index 15 | distributed: adjacency-distributed 16 | ospf_src_key: adjacency-ospf-src-key 17 | ospf_area_id: adjacency-ospf-area-id 18 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/routes.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ### ------------------------------------------------------ 4 | ### show route 5 | ### ------------------------------------------------------ 6 | 7 | RouteTable: 8 | rpc: get-route-information 9 | args_key: destination 10 | item: route-table/rt 11 | key: rt-destination 12 | view: RouteTableView 13 | 14 | RouteTableView: 15 | groups: 16 | entry: rt-entry 17 | fields_entry: 18 | # fields taken from the group 'entry' 19 | protocol: protocol-name 20 | via: nh/via | nh/nh-local-interface 21 | age: { age/@seconds : int } 22 | nexthop: nh/to 23 | 24 | ### ------------------------------------------------------ 25 | ### show route summary 26 | ### ------------------------------------------------------ 27 | 28 | RouteSummaryTable: 29 | rpc: get-route-summary-information 30 | item: route-table 31 | key: table-name 32 | view: RouteSummaryView 33 | 34 | RouteSummaryView: 35 | fields: 36 | dests: { destination-count : int } 37 | total: { total-route-count : int } 38 | active: { active-route-count : int } 39 | holddown: { holddown-route-count : int } 40 | hidden: { hidden-route-count : int } 41 | proto: _rspTable 42 | 43 | _rspTable: 44 | item: protocols 45 | key: protocol-name 46 | view: _rspView 47 | 48 | _rspView: 49 | fields: 50 | count: { protocol-route-count: int } 51 | active: { active-route-count : int } 52 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/securityzone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SecurityZoneTable: 3 | rpc: get-zones-information 4 | item: //zones-security 5 | key: zones-security-zonename 6 | view: SecurityZoneView 7 | 8 | SecurityZoneView: 9 | fields: 10 | tcp_rst: { zones-security-send-reset : True=On } 11 | policy_configurable: { zones-security-policy-configurable : True=Yes } 12 | interface_count: { zones-security-interfaces-bound : int } 13 | interfaces: _szInterfaceTable 14 | 15 | _szInterfaceTable: 16 | item: zones-security-interfaces 17 | view: _szInterfaceView 18 | 19 | _szInterfaceView: 20 | fields: 21 | name: zones-security-interface-name 22 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/systemstorage.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SystemStorageTable: 3 | rpc: get-system-storage 4 | key: re-name | Null 5 | item: //multi-routing-engine-item | //rpc-reply/system-storage-information 6 | view: SystemStorageView 7 | 8 | SystemStorageView: 9 | fields: 10 | re-name: re-name 11 | filesystems: _FsTable 12 | 13 | _FsTable: 14 | item: system-storage-information/filesystem | //rpc-reply/system-storage-information/filesystem 15 | key: filesystem-name 16 | view: _FsView 17 | 18 | _FsView: 19 | fields: 20 | name: filesystem-name 21 | total_blocks: total-blocks 22 | used_blocks: used-blocks 23 | available_blocks: available-blocks 24 | used_percent: used-percent 25 | mounted_on: mounted-on 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/taskmemory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | TaskMemoryTable: 3 | rpc: get-task-memory-information 4 | args: 5 | level: detail 6 | item: task-memory-overall-report/task-size-block-list/task-size-block 7 | key: tsb-size 8 | view: TaskMemoryView 9 | 10 | TaskMemoryView: 11 | fields: 12 | size: {tsb-size: int} 13 | alloc_bytes: {tsb-alloc-bytes: int} 14 | allocs: {tsb-allocs: int} 15 | max_allocs: {tsb-max-allocs: int} 16 | max_bytes: {tsb-max-bytes: int} 17 | free_bytes: {tsb-free-bytes: int} 18 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/teddb.yml: -------------------------------------------------------------------------------- 1 | ### ------------------------------------------------------ 2 | #### show ted database 3 | #### ------------------------------------------------------ 4 | 5 | TedTable: 6 | rpc: get-ted-database-information 7 | args: 8 | extensive: True 9 | item: ted-database 10 | key: ted-database-id 11 | view: TedView 12 | 13 | TedView: 14 | fields: 15 | type: ted-database-type 16 | age: { ted-database-age : int } 17 | link-in: { ted-database-link-in : int } 18 | link-out: { ted-database-link-out : int } 19 | protocol: ted-database-protocol 20 | srgb-base: { ted-spring-capability/ted-spring-srgb-block/ted-spring-srgb-block-start : int } 21 | srgb-range: { ted-spring-capability/ted-spring-srgb-block/ted-spring-srgb-block-range : int } 22 | srgb-flag: ted-spring-capability/ted-spring-srgb-block/ted-spring-srgb-block-flags 23 | link: _linkTable 24 | 25 | _linkTable: 26 | item: ted-link 27 | key: ted-link-local-ifindex 28 | view: _linkView 29 | 30 | _linkView: 31 | fields: 32 | remoteRTR: ted-link-to 33 | remoteIfI: { ted-link-remote-ifindex : int } 34 | remoteADD: ted-link-remote-address 35 | localIfI: { ted-link-local-ifindex : int } 36 | localADD: ted-link-local-address 37 | metric: { ted-link-metric : int } 38 | color: admin-groups/color 39 | sr-adj-sid-label: {ted-adj-sids/ted-link-p2p-adj-sid/ted-link-p2p-adj-sid-label : int} 40 | sr-adj-sid-weight: {ted-adj-sids/ted-link-p2p-adj-sid/ted-link-p2p-adj-sid-weight : int} 41 | sr-adj-sid-afi: ted-adj-sids/ted-link-p2p-adj-sid/ted-link-p2p-adj-sid-af 42 | sr-adj-sid-flags: ted-adj-sids/ted-link-p2p-adj-sid/ted-link-p2p-adj-sid-flags 43 | 44 | 45 | TedSummaryTable: 46 | rpc: get-ted-database-information 47 | item: ted-database-summary 48 | view: TedSummaryView 49 | 50 | TedSummaryView: 51 | fields: 52 | iso-count: { ted-database-iso-count : int } 53 | inet-count: { ted-database-inet-count : int } 54 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/vlan.yml: -------------------------------------------------------------------------------- 1 | --- 2 | VlanTable: 3 | rpc: get-vlan-information 4 | item: vlan 5 | key: vlan-name 6 | view: VlanView 7 | 8 | VlanView: 9 | fields: 10 | instance: vlan-instance 11 | vlan_name: vlan-name 12 | created: vlan-create-time 13 | status: vlan-status 14 | owner: vlan-owner 15 | tag: vlan-tag 16 | members: .//vlan-member-interface 17 | 18 | -------------------------------------------------------------------------------- /lib/jnpr/junos/op/xcvr.yml: -------------------------------------------------------------------------------- 1 | --- 2 | XcvrTable: 3 | rpc: get-chassis-inventory 4 | item: //*[starts-with(name,"Xcvr")] 5 | key: 6 | - ancestor::*[starts-with(name,'FPC')]/name 7 | - ancestor::*[starts-with(name,'PIC')]/name 8 | - name 9 | view: XcvrTableView 10 | 11 | XcvrTableView: 12 | fields: 13 | sn: serial-number 14 | pn: part-number 15 | ver: version 16 | type: description 17 | -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/lib/jnpr/junos/resources/__init__.py -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/autosys.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pythonifier for AutoSys Table/View 3 | """ 4 | 5 | from jnpr.junos.factory import loadyaml 6 | from os.path import splitext 7 | 8 | _YAML_ = splitext(__file__)[0] + ".yml" 9 | globals().update(loadyaml(_YAML_)) 10 | -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/autosys.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### ------------------------------------------------------ 3 | ### Table-view to configure Autonomous system. 4 | ### ------------------------------------------------------ 5 | AutoSysTable: 6 | set: routing-options/autonomous-system 7 | key-field: 8 | - as_num 9 | view: AutoSysView 10 | AutoSysView: 11 | fields: 12 | as_num: as-number -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/bgp.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pythonifier for BGP Table/View 3 | """ 4 | 5 | from jnpr.junos.factory import loadyaml 6 | from os.path import splitext 7 | 8 | _YAML_ = splitext(__file__)[0] + ".yml" 9 | globals().update(loadyaml(_YAML_)) 10 | -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/bgp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### ------------------------------------------------------ 3 | ### Table-view to configure BGP. 4 | ### ------------------------------------------------------ 5 | BgpTable: 6 | set: protocols/bgp/group 7 | key-field: 8 | - bgp_name 9 | view: BgpView 10 | BgpView: 11 | groups: 12 | neigh : neighbor 13 | fields: 14 | bgp_name : { 'name' : { 'type' : 'str', 'minValue' : 1, 'maxValue' : 255} } 15 | bgp_type : {'type' : {'type': { 'enum': ['external', 'internal'] } } } 16 | local_addr : local-address 17 | peer : { 'peer-as' : { 'type' : 'int' } } 18 | fields_neigh: 19 | neigh_addr : name -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/interface.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pythonifier for interface table/view 3 | """ 4 | 5 | from jnpr.junos.factory import loadyaml 6 | from os.path import splitext 7 | 8 | _YAML_ = splitext(__file__)[0] + ".yml" 9 | globals().update(loadyaml(_YAML_)) 10 | -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/interface.yml: -------------------------------------------------------------------------------- 1 | InterfaceTable: 2 | set: interfaces/interface 3 | key-field: 4 | - name 5 | - unit_name 6 | view: InterfaceView 7 | 8 | InterfaceView: 9 | groups: 10 | unit: unit 11 | bridge: unit/family/bridge 12 | fields: 13 | name: name 14 | disable: { 'disable' : { 'type': 'bool' } } 15 | enc : encapsulation 16 | native_vlan: native-vlan-id 17 | fields_unit: 18 | unit_name : name 19 | desc : description 20 | fields_bridge: 21 | mode: interface-mode 22 | vlan_list: vlan-id-list -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/staticroutes.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pythonifier for Static route Table/View 3 | """ 4 | 5 | from jnpr.junos.factory import loadyaml 6 | from os.path import splitext 7 | 8 | _YAML_ = splitext(__file__)[0] + ".yml" 9 | globals().update(loadyaml(_YAML_)) 10 | -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/staticroutes.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### ------------------------------------------------------ 3 | ### Table-view to configure Static routes. 4 | ### ------------------------------------------------------ 5 | StaticRouteTable: 6 | set: routing-options/static/route 7 | key-field: 8 | - route_name 9 | view: StaticRouteView 10 | 11 | StaticRouteView: 12 | fields: 13 | route_name: name 14 | hop: next-hop -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/syslog.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pythonifier for Syslog Table/View 3 | """ 4 | 5 | from jnpr.junos.factory import loadyaml 6 | from os.path import splitext 7 | 8 | _YAML_ = splitext(__file__)[0] + ".yml" 9 | globals().update(loadyaml(_YAML_)) 10 | -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/syslog.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### ------------------------------------------------------ 3 | ### Table-view to configure Syslog. 4 | ### ------------------------------------------------------ 5 | SyslogTable: 6 | set: system/syslog/file 7 | key-field: 8 | - name 9 | - contents_name 10 | view: SyslogView 11 | SyslogView: 12 | groups: 13 | contents: contents 14 | fields: 15 | name : { 'name' : { 'default' : 'messages' } } 16 | fields_contents: 17 | info : info 18 | contents_name : name 19 | error : error -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/user.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pythonifier for User Table/View 3 | """ 4 | 5 | from jnpr.junos.factory import loadyaml 6 | from os.path import splitext 7 | 8 | _YAML_ = splitext(__file__)[0] + ".yml" 9 | globals().update(loadyaml(_YAML_)) 10 | -------------------------------------------------------------------------------- /lib/jnpr/junos/resources/user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### ------------------------------------------------------ 3 | ### Table-view to configure login user. 4 | ### ------------------------------------------------------ 5 | UserTable: 6 | set: system/login/user 7 | key-field: user 8 | view: userView 9 | 10 | userView: 11 | groups: 12 | auth: authentication 13 | fields: 14 | user: name 15 | uid: { uid : { 'type' : 'int', 'minValue' : 100, 'maxValue' : 64000 } } 16 | class_name: { class : { 'type' : { 'enum' : ['operator', 'read-only', 'super-user'] } } } 17 | fields_auth: 18 | password: encrypted-password -------------------------------------------------------------------------------- /lib/jnpr/junos/transport/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/lib/jnpr/junos/transport/__init__.py -------------------------------------------------------------------------------- /lib/jnpr/junos/transport/_telnetlib/README.md: -------------------------------------------------------------------------------- 1 | 2 | From https://github.com/python/cpython/blob/v3.12.4/Lib/telnetlib.py 3 | Tag: v3.12.4 4 | 5 | Licensed as per the included LICENSE file in this directory. 6 | 7 | All contributions were made by the original contributor as documented 8 | in the referenced github.com repository or as documented otherwise 9 | by telnetlib's history. 10 | 11 | jnpr-community-netdev@juniper.net has made no code contributions to this library. 12 | Note: It is temporary fix till junos-eznc support exscript or telnetlib3 13 | library. 14 | -------------------------------------------------------------------------------- /lib/jnpr/junos/transport/_telnetlib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/lib/jnpr/junos/transport/_telnetlib/__init__.py -------------------------------------------------------------------------------- /lib/jnpr/junos/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from jnpr.junos.utils.util import Util 2 | -------------------------------------------------------------------------------- /lib/jnpr/junos/utils/util.py: -------------------------------------------------------------------------------- 1 | """ 2 | Junos PyEZ Utility Base Class 3 | """ 4 | 5 | 6 | class Util(object): 7 | """ 8 | Base class for all utility classes 9 | """ 10 | 11 | def __init__(self, dev): 12 | self._dev = dev 13 | 14 | def __repr__(self): 15 | return "jnpr.junos.utils.%s(%s)" % (self.__class__.__name__, self._dev.hostname) 16 | 17 | # ------------------------------------------------------------------------- 18 | # property: dev 19 | # ------------------------------------------------------------------------- 20 | 21 | @property 22 | def dev(self): 23 | """ 24 | :returns: the Device object 25 | """ 26 | return self._dev 27 | 28 | @dev.setter 29 | def dev(self, value): 30 | """read-only property""" 31 | raise RuntimeError("read-only: dev") 32 | 33 | # ------------------------------------------------------------------------- 34 | # property: rpc 35 | # ------------------------------------------------------------------------- 36 | 37 | @property 38 | def rpc(self): 39 | """ 40 | :returns: Device RPC meta object 41 | """ 42 | return self._dev.rpc 43 | 44 | @rpc.setter 45 | def rpc(self, value): 46 | """read-only property""" 47 | raise RuntimeError("read-only: rpc") 48 | -------------------------------------------------------------------------------- /lib/jnpr/junos/version.py: -------------------------------------------------------------------------------- 1 | VERSION = "2.7.5.dev0" 2 | DATE = "2025-Apr-30" 3 | 4 | # Augment with the internal version if present 5 | try: 6 | from ._version import get_versions 7 | 8 | VERSION = get_versions()["version"] 9 | del get_versions 10 | except ImportError: 11 | # No internal version 12 | pass 13 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | lxml>=3.2.4 2 | # ncclient version 0.6.10 and 0.6.16 has issues with PyEZ(junos-eznc) and needs to be avoided 3 | ncclient==0.6.15 4 | scp>=0.7.0 5 | jinja2>=2.7.1 6 | PyYAML>=5.1 7 | paramiko>=3.5.0 8 | six 9 | pyserial 10 | yamlordereddictloader 11 | pyparsing 12 | transitions 13 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | 2 | # See the docstring in versioneer.py for instructions. Note that you must 3 | # re-run 'versioneer.py setup' after changing this section, and commit the 4 | # resulting files. 5 | 6 | [versioneer] 7 | VCS = git 8 | style = pep440 9 | versionfile_source = lib/jnpr/junos/_version.py 10 | versionfile_build = jnpr/junos/_version.py 11 | tag_prefix = 12 | #parentdir_prefix = 13 | 14 | [metadata] 15 | license_files = LICENSE 16 | 17 | 18 | -------------------------------------------------------------------------------- /static/PyEZ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/static/PyEZ.png -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Created on Feb 10, 2014 3 | 4 | @author: rsherman 5 | """ 6 | -------------------------------------------------------------------------------- /tests/functional/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/functional/__init__.py -------------------------------------------------------------------------------- /tests/functional/test_device_ssh.py: -------------------------------------------------------------------------------- 1 | __author__ = "rsherman, vnitinv" 2 | 3 | import unittest 4 | 5 | from jnpr.junos import Device 6 | 7 | 8 | class TestDeviceSsh(unittest.TestCase): 9 | def tearDown(self): 10 | self.dev.close() 11 | 12 | def test_device_open_key_pass(self): 13 | self.dev = Device( 14 | host="xxxx", 15 | user="jenkins", 16 | ssh_private_key_file="/var/lib/jenkins/.ssh/passkey", 17 | passwd="password", 18 | ) 19 | self.dev.open() 20 | self.assertEqual(self.dev.connected, True) 21 | -------------------------------------------------------------------------------- /tests/functional/test_shell.py: -------------------------------------------------------------------------------- 1 | __author__ = "jnpr-community-netdev" 2 | 3 | try: 4 | import unittest2 as unittest 5 | except ImportError: 6 | import unittest 7 | 8 | import yaml 9 | 10 | 11 | class test(unittest.TestCase): 12 | @classmethod 13 | def setUpClass(self): 14 | from jnpr.junos import Device 15 | 16 | with open("config.yaml", "r") as fyaml: 17 | cfg = yaml.safe_load(fyaml) 18 | self.dev = Device(**cfg) 19 | self.dev.open() 20 | 21 | @classmethod 22 | def tearDownClass(self): 23 | self.dev.close() 24 | 25 | def test_shell_run(self): 26 | from jnpr.junos.utils.start_shell import StartShell 27 | 28 | with StartShell(self.dev) as sh: 29 | output = sh.run("pwd") 30 | self.assertTrue(output[0]) 31 | 32 | def test_shell_run_with_sleep(self): 33 | from jnpr.junos.utils.start_shell import StartShell 34 | 35 | with StartShell(self.dev) as sh: 36 | output = sh.run("hostname", sleep=2) 37 | self.assertTrue(output[0]) 38 | 39 | def test_shell_run_shell_type_ssh(self): 40 | from jnpr.junos.utils.start_shell import StartShell 41 | 42 | with StartShell(self.dev, shell_type="ssh") as sh: 43 | output = sh.run("hostname", sleep=2) 44 | self.assertTrue(output[0]) 45 | 46 | def test_shell_run_shell_type_csh(self): 47 | from jnpr.junos.utils.start_shell import StartShell 48 | 49 | with StartShell(self.dev, shell_type="csh") as sh: 50 | output = sh.run("hostname", sleep=2) 51 | self.assertTrue(output[0]) 52 | -------------------------------------------------------------------------------- /tests/functional/test_table.py: -------------------------------------------------------------------------------- 1 | __author__ = "rsherman, vnitinv" 2 | 3 | try: 4 | import unittest2 as unittest 5 | except ImportError: 6 | import unittest 7 | 8 | from jnpr.junos.op.routes import RouteTable 9 | import json 10 | 11 | 12 | class TestTable(unittest.TestCase): 13 | @classmethod 14 | def setUpClass(self): 15 | from jnpr.junos import Device 16 | 17 | self.dev = Device(host="xxxx", user="jenkins", password="password") 18 | self.dev.open() 19 | 20 | @classmethod 21 | def tearDownClass(self): 22 | self.dev.close() 23 | 24 | def test_table_union(self): 25 | tbl = RouteTable(self.dev) 26 | tbl.get() 27 | self.assertEqual(tbl[0].via, "em0.0") 28 | 29 | def test_table_json(self): 30 | tbl = RouteTable(self.dev) 31 | tbl.get("10.48.21.71") 32 | self.assertEqual( 33 | json.loads(tbl.to_json())["10.48.21.71/32"]["protocol"], "Local" 34 | ) 35 | -------------------------------------------------------------------------------- /tests/unit/__init__.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import sys 3 | 4 | import nose2 5 | from unittest.mock import patch 6 | 7 | __author__ = "Nitin Kumar" 8 | __credits__ = "Jeremy Schulman" 9 | 10 | 11 | class TestJunosInit(unittest.TestCase): 12 | def test_warning(self): 13 | with patch.object(sys.modules["sys"], "version_info", (3, 8, 0)) as mock_sys: 14 | from jnpr import junos 15 | 16 | self.assertEqual(mock_sys, (3, 8, 0)) 17 | -------------------------------------------------------------------------------- /tests/unit/factory/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/unit/factory/__init__.py -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/get-configuration-user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | test 7 | Test User 8 | 928 9 | superuser 10 | csh 11 | 12 | $encryptedpass. 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/get-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | untrust 7 | untrust-screen 8 | 9 | ge-0/0/0.0 10 | 11 | 12 | http 13 | 14 | 15 | https 16 | 17 | 18 | ssh 19 | 20 | 21 | telnet 22 | 23 | 24 | dhcp 25 | 26 | 27 | netconf 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/get-lldp-neighbors-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | et-0/0/48 5 | - 6 | Mac address 7 | 10:0e:7e:ad:ae:00 8 | et-0/0/2 9 | spine-01 10 | 11 | 12 | et-0/0/49 13 | - 14 | Mac address 15 | 10:0e:7e:ad:De:c0 16 | et-0/0/2 17 | spine-02 18 | 19 | 20 | xe-0/0/13 21 | - 22 | Mac address 23 | 10:0e:7e:b1:D3:80 24 | xe-0/0/13 25 | leaf-02 26 | 27 | 28 | 29 | {master:0} 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/get-software-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | firefly 5 | firefly-perimeter 6 | firefly-perimeter 7 | 8 | junos 9 | JUNOS Software Release [12.1X46-D15.3] 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/request_routing-engine_execute_command_sysctl_dummy.xml: -------------------------------------------------------------------------------- 1 | security.mac.veriexec.state: loaded active enforce 2 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show-utmd-status-use-Null.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show-utmd-status.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | node0 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | node1 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_cmerror_module_brief.xml: -------------------------------------------------------------------------------- 1 | 2 | command: show cmerror module brief 3 | 4 | Output for given command: 5 | 6 | --------------------------------------- 7 | Module Name Active Errors 8 | --------------------------------------- 9 | 1 PQ3 Chip 0 10 | 2 Host Loopback 0 11 | 3 CM[0] 0 12 | 4 CM[1] 0 13 | 5 LUCHIP(0) 0 14 | 6 TOE-LU-0:0:0 0 15 | 16 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_cmerror_module_brief_dummy_multiline.xml: -------------------------------------------------------------------------------- 1 | 2 | ------------------------------------------------------------------------- 3 | Module Name Active Errors PFE Callback ModuleData 4 | Specific Function 5 | ------------------------------------------------------------------------- 6 | 1 PQ3 Chip 0 Yes 0x00000000 0x00000000 7 | 2 Host Loopback 0 No 0x00000000 0x464295b0 8 | 3 CM[0] 0 No 0x41f550f0 0x462f767c 9 | 4 LUCHIP(0) 0 No 0x00000000 0x481b84d8 10 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_host_loopback_status-summary.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show host_loopback status-summary 3 | 4 | Host Loopback Toolkit Status Summary: 5 | 6 | No detected wedges 7 | 8 | No toolkit errors 9 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_icmp_statistics.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show icmp statistics 3 | 4 | ICMP Statistics: 5 | 0 requests 6 | 0 throttled 7 | 0 network unreachables 8 | 0 ttl expired 9 | 0 redirects 10 | 0 mtu exceeded 11 | 0 source route denials 12 | 0 filter prohibited 13 | 0 other unreachables 14 | 0 parameter problems 15 | 0 ttl captured 16 | 0 icmp/option handoffs 17 | 0 igmp v1 handoffs 18 | 0 tag te requests 19 | 0 tag te to RE 20 | 21 | ICMP Errors: 22 | 0 unknown unreachables 23 | 0 unsupported ICMP type 24 | 0 unprocessed redirects 25 | 0 invalid ICMP type 26 | 0 invalid protocol 27 | 0 bad input interface 28 | 0 bad route lookup 29 | 0 bad nh lookup 30 | 0 bad cf mtu 31 | 0 runts 32 | 33 | ICMP Discards: 34 | 0 multicasts 35 | 0 bad source addresses 36 | 0 bad dest addresses 37 | 0 IP fragments 38 | 0 ICMP errors 39 | 0 unknown originators 40 | 41 | ICMP Debug Messages: 42 | 0 throttled 43 | 44 | ICMP Rate Limit Settings: 45 | 500 pps per iff 46 | 1000 pps total 47 | 48 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_ithrottle_id_0.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show ithrottle id 0 3 | 4 | ID Usage % Cfg State Oper State Name 5 | -- ------- --------- ---------- -------- 6 | 0 50.0 1 1 TOE ithrottle 7 | 8 | Throttle Times: In hptime ticks In ms 9 | --------------- ------ 10 | Timer Interval 333333 5.000 11 | Allowed time 166666 2.500 12 | Allowed excess 8333 0.125 13 | Start time 488655082 n/a 14 | Run time this interval 0 0.000 15 | Deficit 0 0.000 16 | Run time max 17712 0.266 17 | Run time total 144154525761 2162317 18 | 19 | Min Usage Perc: 25.0 20 | Max Usage Perc: 50.0 21 | AdjustUsageEnable: 1 22 | 23 | Throttle Stats: 24 | Starts : 65708652 25 | Stops : 65708652 26 | Checks : 124149442 27 | Enables : 0 28 | Disables : 0 29 | AdjUp : 6 30 | AdjDown : 4 31 | 32 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_link_stats.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show link stats 3 | 4 | PPP LCP/NCP: 0 5 | HDLC keepalives: 0 6 | RSVP: 0 7 | ISIS: 0 8 | OSPF Hello: 539156 9 | OAM: 0 10 | BFD: 15 11 | UBFD: 0 12 | LMI: 0 13 | LACP: 0 14 | ETHOAM: 0 15 | 16 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_memory.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show memory 3 | 4 | ID Base Total(b) Free(b) Used(b) % Name 5 | -- ---------- ----------- ----------- ----------- --- ----------- 6 | 0 4d9ad8e8 1726292636 1514622708 211669928 12 Kernel 7 | 1 b47ffb88 67108860 53057404 14051456 20 LAN buffer 8 | 2 bcdfffe0 52428784 52428784 0 0 Blob 9 | 3 b87ffb88 73400316 73400316 0 0 ISSU scratch 10 | 11 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_mtip-cge_summary.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show mtip-cge summary 3 | 4 | ID mtip_cge name FPC PIC ifd (ptr) 5 | --- -------------------- --- --- -------------------- -------- 6 | 1 mtip_cge.1.0.8192 1 0 4f11a058 7 | 2 mtip_cge.1.0.0 1 0 et-1/0/0 4f119fb8 8 | 3 mtip_cge.1.257.8192 1 257 4f119d38 9 | 4 mtip_cge.1.2.0 1 2 et-1/2/0 4f119c98 10 | 5 mtip_cge.1.2.1 1 2 et-1/2/1 4f119bf8 11 | 12 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_pci_errors_2.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show pci errors 2 3 | 4 | PCI ERROR: 2:2:9:0 (0x0082) Slot status : 0x0000004c 5 | PCI ERROR: 2:2:9:0 (0x007a) Link status : 0x00000001 6 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_pq3_pci.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show pq3 pci 3 | 4 | PQ3 PEX EXC Count 1288, PCIX EXC Count 0. 5 | PQ3 PCI Error Status Indexes, head 0 tail 0. 6 | PCI 0:0:0:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 7 | PCI 2:0:0:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 8 | PCI 2:1:0:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 9 | PCI 2:2:1:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 10 | PCI 2:2:2:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 11 | PCI 2:2:4:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 12 | PCI 2:2:5:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 13 | PCI 2:2:6:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 14 | PCI 2:2:7:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 15 | PCI 2:2:8:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 16 | PCI 2:2:9:0 Correctable Counts: rxe 0, btlp 0, bdllp 0, rnr 0, rto 0 17 | 18 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_sched.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show sched 3 | 4 | Total system uptime 99+18:17:23, (8619400175 ms), 4871292458 thread dispatches 5 | CPU load is 16% (1 second), 14% (5 second) 6 | 14% (10 second), 14% (1 minute) 7 | Total interrupt time 16786614 (ms) 8 | 9 | CPU Name Time(ms) 10 | 85% Idle 7397672498 11 | 0% Level 3 1 12 | 13 | Last Long Running Thread Event time 200 ms 14 | 15 | CPU Name Time(ms) Count 16 | 17 | Top Thread: 18 | pid = 99 19 | name = LU Background Service 20 | time = 410844018 ms 21 | cpu = 4% 22 | 23 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_ttp_statistics.xml: -------------------------------------------------------------------------------- 1 | 2 | SENT: Ukern command: show ttp statistics 3 | 4 | TTP Statistics: 5 | Receive Transmit 6 | ---------- ---------- 7 | L2 Packets 4292 1093544 8 | L3 Packets 542638 0 9 | Drops 0 0 10 | Netwk Fail 0 0 11 | Queue Drops 0 0 12 | Unknown 0 0 13 | Coalesce 0 0 14 | Coalesce Fail 0 0 15 | 16 | TTP Transmit Statistics: 17 | Queue 0 Queue 1 Queue 2 Queue 3 18 | ---------- ---------- ---------- ---------- 19 | L2 Packets 1093544 0 0 0 20 | L3 Packets 0 0 0 0 21 | 22 | TTP Receive Statistics: 23 | Control High Medium Low Discard 24 | ---------- ---------- ---------- ---------- ---------- 25 | L2 Packets 0 0 4292 0 0 26 | L3 Packets 0 539172 3466 0 0 27 | Drops 0 0 0 0 0 28 | Queue Drops 0 0 0 0 0 29 | Unknown 0 0 0 0 0 30 | Coalesce 0 0 0 0 0 31 | Coalesce Fail 0 0 0 0 0 32 | 33 | TTP Receive Queue Sizes: 34 | Control Plane : 0 (max is 4473) 35 | High : 0 (max is 4473) 36 | Medium : 0 (max is 4473) 37 | Low : 0 (max is 2236) 38 | 39 | TTP Transmit Queue Size: 0 (max is 6710) 40 | 41 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_xmchip_0_li_interrupt-stats.xml: -------------------------------------------------------------------------------- 1 | 2 | LI interrupt statistics 3 | ----------------------- 4 | 5 | --------------------------------------------------------------- 6 | LI Block Interrupt Name Number of Interrupts Last Occurrence 7 | --------------------------------------------------------------- 8 | 0 pb_overflow 0 - 9 | 0 parser_drop 0 - 10 | 0 max_len_err 0 - 11 | 0 eope_err 23 - 12 | 0 bp_nodata_err 0 - 13 | 0 dwr_nodata_err 0 - 14 | 0 drr_nodata_err 13 - 15 | 0 pkt_nodata_err 0 - 16 | 0 cookie_sz_err 22 - 17 | 18 | 1 pb_overflow 0 - 19 | 1 parser_drop 0 - 20 | 1 max_len_err 11 - 21 | 1 eope_err 0 - 22 | 1 bp_nodata_err 0 - 23 | 1 dwr_nodata_err 0 - 24 | 1 drr_nodata_err 0 - 25 | 1 pkt_nodata_err 0 - 26 | 1 cookie_sz_err 12 - 27 | --------------------------------------------------------------- 28 | 29 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/show_xmchip_0_pt_stats.xml: -------------------------------------------------------------------------------- 1 | 2 | WAN PT statistics (Index 0) 3 | --------------------------- 4 | 5 | PCT entries used by all WI-1 streams : 0 6 | PCT entries used by all WI-0 streams : 0 7 | PCT entries used by all LI streams : 0 8 | CPT entries used by all multicast packets : 0 9 | CPT entries used by all WI-1 streams : 0 10 | CPT entries used by all WI-0 streams : 0 11 | CPT entries used by all LI streams : 0 12 | 13 | Fabric PT statistics (Index 1) 14 | ------------------------------ 15 | 16 | PCT entries used by all FI streams : 0 17 | PCT entries used by all WI (Unused) streams : 0 18 | PCT entries used by all LI streams : 0 19 | CPT entries used by all multicast packets : 0 20 | CPT entries used by all FI streams : 0 21 | CPT entries used by all WI (Unused) streams : 0 22 | CPT entries used by all LI streams : 0 23 | -------------------------------------------------------------------------------- /tests/unit/factory/rpc-reply/user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | test 6 | 2000 7 | super-user 8 | 9 | $$$$$$ 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/unit/factory/test_factory_cls.py: -------------------------------------------------------------------------------- 1 | __author__ = "Rick Sherman" 2 | __credits__ = "Jeremy Schulman" 3 | 4 | import unittest 5 | import nose2 6 | 7 | from jnpr.junos.factory.factory_cls import FactoryCfgTable, FactoryOpTable 8 | from jnpr.junos.factory.factory_cls import FactoryTable, FactoryView 9 | 10 | 11 | class TestFactoryCls(unittest.TestCase): 12 | def test_factory_cls_cfgtable(self): 13 | t = FactoryCfgTable() 14 | self.assertEqual(t.__module__, "jnpr.junos.factory.CfgTable") 15 | 16 | def test_factory_cls_optable(self): 17 | t = FactoryOpTable("test") 18 | self.assertEqual(t.__module__, "jnpr.junos.factory.OpTable") 19 | 20 | def test_factory_cls_factorytable(self): 21 | t = FactoryTable("test") 22 | self.assertEqual(t.__module__, "jnpr.junos.factory.Table") 23 | 24 | def test_factory_cls_factoryview(self): 25 | x = FactoryCfgTable() 26 | x.FIELDS = {"test": "test"} 27 | x.GROUPS = x.FIELDS 28 | t = FactoryView(x.FIELDS, extends=x, groups=x.FIELDS) 29 | self.assertEqual(t.__module__, "jnpr.junos.factory.View") 30 | -------------------------------------------------------------------------------- /tests/unit/factory/test_view_fields.py: -------------------------------------------------------------------------------- 1 | __author__ = "Rick Sherman" 2 | __credits__ = "Jeremy Schulman" 3 | 4 | import unittest 5 | import nose2 6 | 7 | from jnpr.junos.factory.viewfields import ViewFields 8 | 9 | 10 | class TestFactoryViewFields(unittest.TestCase): 11 | def setUp(self): 12 | self.vf = ViewFields() 13 | 14 | def test_viewfields_string(self): 15 | self.vf.str("test", key="123") 16 | self.assertEqual(self.vf.end["test"]["key"], "123") 17 | 18 | def test_viewfields_astype(self): 19 | self.vf.astype("test", astype=1) 20 | self.assertEqual(self.vf.end["test"]["astype"], 1) 21 | 22 | def test_viewfields_int(self): 23 | self.vf.int("test") 24 | self.assertEqual(self.vf.end["test"]["astype"], int) 25 | 26 | def test_viewfields_flag(self): 27 | self.vf.flag("test") 28 | self.assertEqual(self.vf.end["test"]["astype"], bool) 29 | 30 | def test_viewfields_table(self): 31 | self.vf.table("test", []) 32 | self.assertEqual(self.vf.end["test"]["table"], []) 33 | -------------------------------------------------------------------------------- /tests/unit/facts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/unit/facts/__init__.py -------------------------------------------------------------------------------- /tests/unit/facts/dupe_foo1.py: -------------------------------------------------------------------------------- 1 | def provides_facts(): 2 | """ 3 | Returns a dictionary keyed on the facts provided by this module. The value 4 | of each key is the doc string describing the fact. 5 | """ 6 | return {"foo": "The foo information."} 7 | 8 | 9 | def get_facts(device): 10 | return {"foo": None} 11 | -------------------------------------------------------------------------------- /tests/unit/facts/dupe_foo2.py: -------------------------------------------------------------------------------- 1 | def provides_facts(): 2 | """ 3 | Returns a dictionary keyed on the facts provided by this module. The value 4 | of each key is the doc string describing the fact. 5 | """ 6 | return {"foo": "The foo information."} 7 | 8 | 9 | def get_facts(device): 10 | return {"foo": None} 11 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/bd_command.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/chassis_backplane_serialnumber_get-chassis-inventory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | node0 5 | 6 | 7 | node1 8 | 9 | 10 | 11 | 12 | Chassis 13 | FIREFLY-PERIMETER 14 | 15 | Midplane 16 | 17 | 18 | System IO 19 | 20 | 21 | Backplane 22 | 123456789 23 | 24 | 25 | Routing Engine 26 | FIREFLY-PERIMETER RE 27 | 28 | 29 | FPC 0 30 | Virtual FPC 31 | 32 | PIC 0 33 | Virtual GE 34 | 35 | 36 | 37 | Power Supply 0 38 | 39 | 40 | 41 | 42 | 43 | 44 | {disabled:node0} 45 | 46 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/chassis_connect_not_master_get-chassis-inventory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Aborted! This command can only be used on the master routing engine. 4 | 5 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/chassis_error_xml_get-chassis-inventory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Some error message. 4 | 5 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/cluster_false_get-chassis-cluster-status.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsrpd 5 | error: Chassis cluster is not enabled 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/cluster_true_get-chassis-cluster-status.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 1 6 | 0 7 | 1 8 | 9 | node0 10 | 100 11 | primary 12 | no 13 | no 14 | node1 15 | 0 16 | lost 17 | n/a 18 | n/a 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/current_re_empty_file-show.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # End of internal names 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/current_re_empty_get-interface-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/current_re_jdm_get-software-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | jdm 4 | junos_node_slicing 5 | pvi-model 6 | 7 | Server slot 8 | Server slot : 0 9 | 10 | 11 | JDM package version 12 | JDM package version : 1.0 13 | 14 | 15 | JUNOS version 16 | JUNOS version : 17.4-20170718_dev_common.1-secure 17 | 18 | 19 | Host Software 20 | Host Software [Red Hat Enterprise Linux] 21 | 22 | 23 | JDM container Software 24 | JDM container Software [Ubuntu 14.04.1 LTS] 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/domain_config_get-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | juniper.net 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/domain_file_file-show.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | search juniper.net jnpr.net 4 | nameserver 10.0.0.1 5 | nameserver 10.0.0.2 6 | # domain juniper.net 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/domain_file_get-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | protocol 4 | operation-failed 5 | error 6 | permission denied 7 | 8 | system 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/els_get-ethernet-switching-table-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | 0 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/file_list2_file-list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | /var/home/user/ 6 | 28 7 | 8 | .ssh 9 | 10 | 11 | 12 | baseline.config 13 | 14 | 15 | change.config 16 | 17 | 18 | junos_comment_config.xml 19 | 20 | 3 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/file_list_file-list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /var/home/user/ 5 | 28 6 | 7 | .ssh 8 | 9 | 10 | 11 | baseline.config 12 | 13 | 14 | change.config 15 | 16 | 17 | junos_comment_config.xml 18 | 19 | 3 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/iri_mapping2_file-show.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #JCS 4 | 190.0.0.1 gnf%d-master 5 | 190.0.0.4 gnf%d-re0 6 | 190.0.0.5 gnf%d-re1 7 | 190.0.0.6 gnf%d-backup 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_ex_command.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | fpc0 7 | 8 | 9 | rppdt-ex4200a 10 | ex4200-48t 11 | ex4200-48t 12 | 13.3R2.2 13 | 14 | junos 15 | JUNOS EX Software Suite [13.3R2.2] 16 | 17 | 18 | fips-mode-powerpc 19 | JUNOS FIPS mode utilities [13.3R2.2] 20 | 21 | 22 | jdocs-ex 23 | JUNOS Online Documentation [13.3R2.2] 24 | 25 | 26 | junos-ex-4200 27 | JUNOS EX 4200 Software Suite [13.3R2.2] 28 | 29 | 30 | jweb-ex 31 | JUNOS Web Management [13.3R2.2] 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_ex_get-route-engine-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | master 6 | OK 7 | 38 degrees C / 100 degrees F 8 | 38 degrees C / 100 degrees F 9 | 1024 10 | 66 11 | 68 12 | 0 13 | 32 14 | 0 15 | 0 16 | EX4200-48T, 8 POE 17 | BP0212121453 18 | 2016-07-01 18:04:17 PDT 19 | 183 days, 20 hours, 27 minutes, 41 seconds 20 | 0x1:power cycle/failure 21 | 1.98 22 | 2.16 23 | 2.20 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_ex_get-virtual-chassis-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 33c1.0dbd.447f 5 | Enabled 6 | 7 | 8 | 9 | Prsnt 10 | 0 11 | (FPC 0) 12 | BP0212121453 13 | ex4200-48t 14 | 128 15 | N 16 | Master* 17 | 18 | 19 | 20 | 21 | 22 | 1 23 | 1 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_olive_get-route-engine-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chassis-control 4 | Unrecognized command (chassis-control) 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_srx_branch_command.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | usability-he2 4 | srx210he2 5 | srx210he2 6 | 7 | 8 | junos 9 | JUNOS Software Release [12.1X46-D65] 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_srx_branch_get-route-engine-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OK 5 | 56 degrees C / 132 degrees F 6 | 2048 7 | 1044 8 | 51 9 | 1088 10 | 511 11 | 47 12 | 960 13 | 528 14 | 55 15 | 13 16 | 0 17 | 15 18 | 0 19 | 72 20 | RE-SRX210HE2 21 | ACKD0351 22 | 2016-12-28 17:05:44 PST 23 | 3 days, 21 hours, 24 minutes, 38 seconds 24 | 0x200:normal shutdown 25 | 0.60 26 | 0.33 27 | 0.27 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_srx_high_end_command.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | lsys500 4 | srx5400 5 | srx5400 6 | 7 | 8 | junos 9 | JUNOS Software Release [12.3X48-D40.5] 10 | 11 | 12 | jais 13 | AI-Scripts [6.0R2-THIN.0] 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_srx_high_end_get-route-engine-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | master 6 | master (default) 7 | 1023 8 | 1023 9 | 43 10 | 0 11 | 0 12 | 4 13 | 0 14 | 96 15 | RE-PPC-1200-A 16 | 2016-10-31 14:00:22 PDT 17 | 62 days, 43 minutes, 18 seconds 18 | Router rebooted after a normal shutdown. 19 | 0.01 20 | 0.02 21 | 0.00 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_srx_mid_range_command.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | lsys500 4 | srx3600 5 | srx3600 6 | 7 | 8 | junos 9 | JUNOS Software Release [12.3X48-D40.5] 10 | 11 | 12 | jais 13 | AI-Scripts [6.0R2-THIN.0] 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/personality_srx_mid_range_get-route-engine-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | master 6 | master (default) 7 | 1023 8 | 1023 9 | 43 10 | 0 11 | 0 12 | 4 13 | 0 14 | 96 15 | RE-PPC-1200-A 16 | 2016-10-31 14:00:22 PDT 17 | 62 days, 43 minutes, 18 seconds 18 | Router rebooted after a normal shutdown. 19 | 0.01 20 | 0.02 21 | 0.00 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/sw_info_no_version_get-software-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | lsys500 4 | srx3600 5 | srx3600 6 | 7 | 8 | junos 9 | 10 | 11 | jais 12 | AI-Scripts [6.0R2-THIN.0] 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/sw_info_simple_get-software-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | lsys500 4 | srx3600 5 | srx3600 6 | 7 | 8 | junos 9 | JUNOS Software Release [12.3X48-D40.5] 10 | 11 | 12 | jais 13 | AI-Scripts [6.0R2-THIN.0] 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/switch_style_none_command.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/touch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/unit/facts/rpc-reply/touch -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/vc_dual_master_get-virtual-chassis-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 70b7.3d82.d346 5 | Enabled 6 | 7 | 8 | 9 | Prsnt 10 | 0 11 | (FPC 0) 12 | PD3714050496 13 | ex4300-48p 14 | 129 15 | N 16 | VC 17 | Master* 18 | 19 | 20 | 21 | 22 | Prsnt 23 | 1 24 | (FPC 1) 25 | PD3714170265 26 | ex4300-48p 27 | 129 28 | N 29 | VC 30 | Master 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/vc_get-virtual-chassis-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 70b7.3d82.d346 5 | Enabled 6 | 7 | 8 | 9 | Prsnt 10 | 0 11 | (FPC 0) 12 | PD3714050496 13 | ex4300-48p 14 | 129 15 | N 16 | VC 17 | Master* 18 | 19 | 20 | 21 | 22 | NotPrsnt 23 | 1 24 | (FPC 1) 25 | PD3714170265 26 | ex4300-48p 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/vlan_get-ethernet-switching-table-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/vmhost_error_request-shell-execute.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | protocol 4 | operation-failed 5 | error 6 | permission denied 7 | 8 | system 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/vmhost_false_request-shell-execute.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/unit/facts/rpc-reply/vmhost_true_request-shell-execute.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/unit/facts/test__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Stacy Smith" 2 | __credits__ = "Jeremy Schulman, Nitin Kumar" 3 | 4 | try: 5 | import unittest2 as unittest 6 | except ImportError: 7 | import unittest 8 | import nose2 9 | import importlib 10 | import sys 11 | 12 | import jnpr.junos.facts 13 | 14 | 15 | class TestFactInitialization(unittest.TestCase): 16 | def test_duplicate_facts(self): 17 | module = importlib.import_module("tests.unit.facts.dupe_foo1") 18 | sys.modules["jnpr.junos.facts.dupe_foo1"] = module 19 | module = importlib.import_module("tests.unit.facts.dupe_foo2") 20 | sys.modules["jnpr.junos.facts.dupe_foo2"] = module 21 | with self.assertRaises(RuntimeError): 22 | jnpr.junos.facts._build_fact_callbacks_and_doc_strings() 23 | -------------------------------------------------------------------------------- /tests/unit/ofacts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/unit/ofacts/__init__.py -------------------------------------------------------------------------------- /tests/unit/ofacts/rpc-reply/chassis_get-chassis-inventory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | node0 5 | 6 | 7 | node1 8 | 9 | 10 | 11 | 12 | Chassis 13 | FIREFLY-PERIMETER 14 | 15 | Midplane 16 | 17 | 18 | System IO 19 | 20 | 21 | Backplane 22 | 123456789 23 | 24 | 25 | Routing Engine 26 | FIREFLY-PERIMETER RE 27 | 28 | 29 | FPC 0 30 | Virtual FPC 31 | 32 | PIC 0 33 | Virtual GE 34 | 35 | 36 | 37 | Power Supply 0 38 | 39 | 40 | 41 | 42 | 43 | 44 | {disabled:node0} 45 | 46 | -------------------------------------------------------------------------------- /tests/unit/ofacts/rpc-reply/get-chassis-cluster-status.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 1 6 | 0 7 | 1 8 | 9 | node0 10 | 100 11 | primary 12 | no 13 | no 14 | node1 15 | 0 16 | lost 17 | n/a 18 | n/a 19 | 20 | 21 | 22 | 23 | {primary:node0} 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/unit/ofacts/rpc-reply/get-software-information_RE0-RE0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | abc-re0 7 | 8 | 9 | pyez 10 | txp 11 | txp 12 | 13 | junos-version 14 | Junos: 14.2R4 15 | 16 | 17 | junos 18 | JUNOS Base OS boot [14.2R4] 19 | 20 | 21 | 22 | 23 | 24 | 25 | lcc0-re0 26 | 27 | 28 | pyez-ddd0-re0 29 | t100 30 | t1600 31 | 32 | junos-version 33 | Junos: 14.2R4 34 | 35 | 36 | junos 37 | JUNOS Base OS boot [14.2R4] 38 | 39 | 40 | 41 | 42 | 43 | lcc2-re0 44 | 45 | 46 | pyez-ldd2-re0 47 | t100 48 | t1600 49 | 50 | junos-version 51 | Junos: 14.2R4 52 | 53 | 54 | junos 55 | JUNOS Base OS boot [14.2R4] 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /tests/unit/ofacts/test_ifd_style.py: -------------------------------------------------------------------------------- 1 | __author__ = "Nitin Kumar, Rick Sherman" 2 | __credits__ = "Jeremy Schulman" 3 | 4 | import unittest 5 | from unittest.mock import patch 6 | import nose2 7 | 8 | from jnpr.junos import Device 9 | from jnpr.junos.ofacts.ifd_style import facts_ifd_style as ifd_style 10 | 11 | 12 | class TestIFDStyle(unittest.TestCase): 13 | @patch("jnpr.junos.device.warnings") 14 | def setUp(self, mock_warnings): 15 | self.facts = {} 16 | self.dev = Device( 17 | host="1.1.1.1", 18 | user="rick", 19 | password="password123", 20 | gather_facts=False, 21 | fact_style="old", 22 | ) 23 | 24 | def test_ifd_style_if_condition(self): 25 | self.facts["personality"] = "SWITCH" 26 | ifd_style(self.dev, self.facts) 27 | self.assertEqual(self.facts["ifd_style"], "SWITCH") 28 | 29 | def test_ifd_style_else_condition(self): 30 | self.facts["personality"] = "TEXT" 31 | ifd_style(self.dev, self.facts) 32 | self.assertEqual(self.facts["ifd_style"], "CLASSIC") 33 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-chassis-inventory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chassis 5 | aaf5fe5f9b88 6 | FIREFLY-PERIMETER 7 | 8 | Midplane 9 | 10 | 11 | System IO 12 | 13 | 14 | Routing Engine 15 | FIREFLY-PERIMETER RE 16 | 17 | 18 | FPC 0 19 | Virtual FPC 20 | 21 | PIC 0 22 | Virtual GE 23 | 24 | 25 | 26 | Power Supply 0 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-configuration.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "configuration" : { 4 | "@" : { 5 | "junos:changed-seconds" : "1492754952", 6 | "junos:changed-localtime" : "2017-04-21 11:39:12 IST" 7 | }, 8 | "system" : { 9 | "services" : { 10 | "netconf" : { 11 | "ssh" : { 12 | "port" : 830 13 | }, 14 | "traceoptions" : { 15 | "file" : { 16 | "filename" : "netconf-ops.log", 17 | "size" : 3m, 18 | "files" : 20, 19 | "world-readable" : [null] 20 | }, 21 | "flag" : [ 22 | { 23 | "name" : "all" 24 | } 25 | ] 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-configuration_bgp_openconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10.10.0.1 6 | 7 | OC 8 | 110 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-index-error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-permission-denied.xml: -------------------------------------------------------------------------------- 1 | 2 | error 3 | 4 | get-permission-denied 5 | 6 | permission denied 7 | 8 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-route-engine-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Testing 5 | 2048 6 | 819 7 | 40 8 | 1150 9 | 460 10 | 40 11 | 898 12 | 350 13 | 39 14 | 0 15 | 0 16 | 0 17 | 0 18 | 100 19 | FIREFLY-PERIMETER RE 20 | 2014-03-26 13:15:20 UTC 21 | 6 hours, 29 minutes, 30 seconds 22 | Router rebooted after a normal shutdown. 23 | 0.00 24 | 0.00 25 | 0.00 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-rpc-error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | dcd 5 | [edit interfaces ge-0/0/1] 6 | unit 2 7 | Only unit 0 is valid for this encapsulation 8 | 9 | 10 | 11 | configuration check-out failed 12 | 13 | 14 | 15 | 16 | [edit] 17 | 18 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-software-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | firefly 4 | firefly-perimeter 5 | firefly-perimeter 6 | 7 | junos 8 | JUNOS Software Release [12.1X46-D15.3] 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-system-core-dumps.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /var/crash/*core*: No such file or directory 5 | 6 | 7 | /var/tmp/*core*: No such file or directory 8 | 9 | 10 | /var/tmp/pics/*core*: No such file or directory 11 | 12 | 13 | /var/crash/kernel.*: No such file or directory 14 | 15 | 16 | /tftpboot/corefiles/*core*: No such file or directory 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/get-system-uptime-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2017-06-29 16:59:47 PDT 5 | 6 | NTP CLOCK 7 | 8 | 2017-06-29 13:02:33 PDT 9 | 03:57:14 10 | 11 | 12 | 2017-06-29 13:04:52 PDT 13 | 03:54:55 14 | 15 | 16 | 2017-06-29 13:04:11 PDT 17 | 03:55:36 18 | root 19 | 20 | 21 | 4:59PM 22 | 3:57 23 | 1 24 | 4.29 25 | 3.81 26 | 3.72 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/load-configuration-error.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | error 5 | 6 | system1 7 | 8 | syntax error 9 | 10 | 11 | error 12 | 13 | } 14 | 15 | error recovery ignores input until this point 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/show-cli-directory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /cf/var/home/rick 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/show-configuration-interfaces.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/show-interfaces-routing-instance-media-rpc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | all 5 | 6 | ge-0/0/0.0 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/show-interfaces-terse-asdf.xml: -------------------------------------------------------------------------------- 1 | 2 | protocol: operation-failed 3 | error: device asdf not found 4 | 5 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/show-system-alarms.xml: -------------------------------------------------------------------------------- 1 | 2 | 1 alarms currently active 3 | Alarm time Class Description 4 | 2014-04-17 09:09:21 UTC Minor Rescue configuration is not set 5 | -------------------------------------------------------------------------------- /tests/unit/rpc-reply/show-system-uptime-rpc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/templates/config-example.xml: -------------------------------------------------------------------------------- 1 | system { 2 | host-name {{ host_name }}; 3 | domain-name {{ domain_name }}; 4 | } 5 | -------------------------------------------------------------------------------- /tests/unit/test_junos.py: -------------------------------------------------------------------------------- 1 | # Tests in this file corresponds to /jnpr/junos/__init__.py 2 | 3 | import unittest 4 | import sys 5 | 6 | import nose2 7 | from unittest.mock import patch 8 | 9 | __author__ = "Nitin Kumar" 10 | __credits__ = "Jeremy Schulman" 11 | 12 | 13 | class TestJunosInit(unittest.TestCase): 14 | def test_warning(self): 15 | print(sys.modules["sys"].version_info) 16 | with patch.object(sys.modules["sys"], "version_info", (3, 8, 0)) as mock_sys: 17 | from jnpr import junos 18 | 19 | self.assertEqual(mock_sys, (3, 8, 0)) 20 | -------------------------------------------------------------------------------- /tests/unit/testfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/unit/testfile -------------------------------------------------------------------------------- /tests/unit/transport/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/unit/transport/__init__.py -------------------------------------------------------------------------------- /tests/unit/transport/rpc-reply/commit-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | protocol 4 | operation-failed 5 | error 6 | 7 | interface-range 'axp' is not defined 8 | 9 | 10 | 11 | protocol 12 | operation-failed 13 | error 14 | 15 | interface-ranges expansion failed 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/unit/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/py-junos-eznc/b506a95500bd49dce8387a3ed1daabe04a641329/tests/unit/utils/__init__.py -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/check-in-service-upgrade.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | hup 8 | 9 | 10 | 11 | Verified junos-install-mx-x86-64-16.1-20160925.0 signed by PackageDevelopmentEc_2016 12 | Verified manifest signed by PackageDevelopmentEc_2016 13 | Checking PIC combinations 14 | Verified fips-mode signed by PackageDevelopmentEc_2016 15 | Verified jail-runtime signed by PackageDevelopmentEc_2016 16 | Verified jdocs signed by PackageDevelopmentEc_2016 17 | Verified jpfe-X960 signed by PackageDevelopmentEc_2016 18 | Verified jpfe-common signed by PackageDevelopmentEc_2016 19 | Verified jpfe-wrlinux signed by PackageDevelopmentEc_2016 20 | Verified jsd signed by PackageDevelopmentEc_2016 21 | Verified vrr-mx signed by PackageDevelopmentEc_2016 22 | 23 | 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/checksum.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | xxxx 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/commit-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | protocol 4 | operation-failed 5 | error 6 | 7 | interface-range 'axp' is not defined 8 | 9 | 10 | 11 | protocol 12 | operation-failed 13 | error 14 | 15 | interface-ranges expansion failed 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/file-archive.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | testing tgz 4 | 5 | 6 | 7 | 8 | /var/tmp//abckLjq 9 | 10 | 11 | 12 | 13 | 14 | 15 | /var/tmp//abckLjq 16 | abc.tar 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/file-list_dir.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /var 5 | 123 6 | 7 | abc 8 | 9 | 555 10 | root 11 | xyz 12 | 1 13 | 2 14 | 1392651039 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/file-list_file.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | /var/abc.sh 6 | 7 | 755 8 | pqr 9 | abc 10 | 1 11 | 2 12 | 1394693680 13 | 14 | 1 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/file-list_symlink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /var 5 | 123 6 | 7 | abc 8 | symlink test 9 | 555 10 | root 11 | xyz 12 | 1 13 | 2 14 | 1392651039 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/file-show.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | testing cat functionality 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-chassis-inventory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chassis 5 | aaf5fe5f9b88 6 | FIREFLY-PERIMETER 7 | 8 | Midplane 9 | 10 | 11 | System IO 12 | 13 | 14 | Routing Engine 15 | FIREFLY-PERIMETER RE 16 | 17 | 18 | FPC 0 19 | Virtual FPC 20 | 21 | PIC 0 22 | Virtual GE 23 | 24 | 25 | 26 | Power Supply 0 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-checksum-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MD5 5 | safecopy.tgz 6 | 96a35ab371e1ca10408c3caecdbd8a67 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-directory-usage-information_error1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-directory-usage-information_error2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /var/tmp 5 | 6 | /var/tmp/install 7 | 8 | 2.0K 9 | 10 | 11 | 12 | /var/tmp/vi.recover 13 | 14 | 2.0K 15 | 16 | 17 | 18 | /var/tmp/pics 19 | 20 | 2.0K 21 | 22 | 23 | 24 | /var/tmp/gres-tp 25 | 26 | 34K 27 | 28 | 29 | 30 | /var/tmp/rtsdb 31 | 32 | 2.0K 33 | 34 | 35 | 36 | 37 | 4.0K 38 | 39 | 40 | 41 | 223M 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-route-engine-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Testing 5 | 2048 6 | 819 7 | 40 8 | 1150 9 | 460 10 | 40 11 | 898 12 | 350 13 | 39 14 | 0 15 | 0 16 | 0 17 | 0 18 | 100 19 | FIREFLY-PERIMETER RE 20 | 2014-03-26 13:15:20 UTC 21 | 6 hours, 29 minutes, 30 seconds 22 | Router rebooted after a normal shutdown. 23 | 0.00 24 | 0.00 25 | 0.00 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-routing-task-replication-state.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enabled 4 | Master 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-software-information.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | firefly 4 | firefly-perimeter 5 | firefly-perimeter 6 | 7 | junos 8 | JUNOS Software Release [12.1X46-D15.3] 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-storage-usage-linux.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | re0 5 | 6 | 7 | /dev/sda6 8 | 2015024 9 | 2688 10 | 1874712 11 | 1 12 | /data/config 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/get-system-storage.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /dev/abc 5 | 567431 6 | 2346455 7 | 234234 8 | 1 9 | / 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-halt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This command will not halt the other routing-engine. 5 | If planning to switch off power, use the both-routing-engines option. 6 | 7 | 8 | 9 | 10 | 11 | yes 12 | Perform the operation 13 | 14 | 15 | 16 | no 17 | Don't perform the operation 18 | 19 | 20 | no 21 | Halt the system ? [yes,no] (no) 22 | 23 | 24 | 25 | 26 | Shutdown NOW! 27 | [pid 13517] 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-add.no_mx80_packages.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | hup 5 | 6 | 7 | 8 | ERROR: package: /var/tmp/nonexistent.tgz is not found or empty 9 | 10 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-add.no_result.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | hup 8 | 9 | 10 | 11 | /var/tmp/incoming-package.31020 1742 kB 1742 kBps 12 | Package contains junos-11.1R3.5.tgz ; renaming ... 13 | Formatting alternate root (/dev/ad0s1a)... 14 | /dev/ad0s1a: 299.7MB (613792 sectors) block size 16384, fragment size 2048 15 | using 4 cylinder groups of 74.94MB, 4796 blks, 9600 inodes. 16 | super-block backups (for fsck -b #) at: 17 | 32, 153504, 306976, 460448 18 | Removing /var/tmp/junos-11.1R3.5.tgz 19 | Installing package '/altroot/cf/packages/install-tmp/junos-11.1R3.5-domestic' ... 20 | Verified junos-boot-srxsme-11.1R3.5.tgz signed by PackageProduction_11_1_0 21 | Verified junos-srxsme-11.1R3.5-domestic signed by PackageProduction_11_1_0 22 | Saving boot file package in /var/sw/pkg/junos-boot-srxsme-11.1R3.5.tgz 23 | JUNOS 11.1R3.5 will become active at next reboot 24 | WARNING: A reboot is required to load this software correctly 25 | WARNING: Use the 'request system reboot' command 26 | WARNING: when software installation is complete 27 | Saving state for rollback ... 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-add.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | hup 8 | 9 | 10 | 11 | /var/tmp/incoming-package.31020 1742 kB 1742 kBps 12 | Package contains junos-11.1R3.5.tgz ; renaming ... 13 | Formatting alternate root (/dev/ad0s1a)... 14 | /dev/ad0s1a: 299.7MB (613792 sectors) block size 16384, fragment size 2048 15 | using 4 cylinder groups of 74.94MB, 4796 blks, 9600 inodes. 16 | super-block backups (for fsck -b #) at: 17 | 32, 153504, 306976, 460448 18 | Removing /var/tmp/junos-11.1R3.5.tgz 19 | Installing package '/altroot/cf/packages/install-tmp/junos-11.1R3.5-domestic' ... 20 | Verified junos-boot-srxsme-11.1R3.5.tgz signed by PackageProduction_11_1_0 21 | Verified junos-srxsme-11.1R3.5-domestic signed by PackageProduction_11_1_0 22 | Saving boot file package in /var/sw/pkg/junos-boot-srxsme-11.1R3.5.tgz 23 | JUNOS 11.1R3.5 will become active at next reboot 24 | WARNING: A reboot is required to load this software correctly 25 | WARNING: Use the 'request system reboot' command 26 | WARNING: when software installation is complete 27 | Saving state for rollback ... 28 | 29 | 30 | 0 31 | 32 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-check-pending-install-error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | There is already an install pending. 4 | Use the 'request system reboot' command to complete the install, 5 | or the 'request system software rollback' command to back it out. 6 | 7 | 8 | 1 9 | 10 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-check-pending-install.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 7 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-in-service-upgrade.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | hup 8 | 9 | 10 | 11 | Verified junos-install-mx-x86-64-16.1-20160925.0 signed by PackageDevelopmentEc_2016 12 | Verified manifest signed by PackageDevelopmentEc_2016 13 | Checking PIC combinations 14 | Verified fips-mode signed by PackageDevelopmentEc_2016 15 | Verified jail-runtime signed by PackageDevelopmentEc_2016 16 | Verified jdocs signed by PackageDevelopmentEc_2016 17 | Verified jpfe-X960 signed by PackageDevelopmentEc_2016 18 | Verified jpfe-common signed by PackageDevelopmentEc_2016 19 | Verified jpfe-wrlinux signed by PackageDevelopmentEc_2016 20 | Verified jsd signed by PackageDevelopmentEc_2016 21 | Verified vrr-mx signed by PackageDevelopmentEc_2016 22 | 23 | 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-nonstop-upgrade.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | hup 8 | 9 | 10 | 11 | Verified junos-install-mx-x86-64-16.1-20160925.0 signed by PackageDevelopmentEc_2016 12 | Verified manifest signed by PackageDevelopmentEc_2016 13 | Checking PIC combinations 14 | Verified fips-mode signed by PackageDevelopmentEc_2016 15 | Verified jail-runtime signed by PackageDevelopmentEc_2016 16 | Verified jdocs signed by PackageDevelopmentEc_2016 17 | Verified jpfe-X960 signed by PackageDevelopmentEc_2016 18 | Verified jpfe-common signed by PackageDevelopmentEc_2016 19 | Verified jpfe-wrlinux signed by PackageDevelopmentEc_2016 20 | Verified jsd signed by PackageDevelopmentEc_2016 21 | Verified vrr-mx signed by PackageDevelopmentEc_2016 22 | 23 | 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-rollback-multi-error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | fpc0 7 | 8 | JUNOS version "D10.2" will become active at next reboot 9 | 0 10 | 11 | 12 | 13 | 14 | member1 15 | 16 | ERROR: cannot locate jroute-14.2I20140424_0657_ramas: rollback aborted 17 | 1 18 | 19 | 20 | 21 | 22 | {master:member1-re0} 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-package-rollback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | fpc0 7 | 8 | JUNOS version "D10.2" will become active at next reboot 9 | 0 10 | 11 | 12 | 13 | 14 | fpc1 15 | 16 | Junos version 'D10.2' will become active at next reboot 17 | 0 18 | 19 | 20 | 21 | 22 | {master:member1-re0} 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-power-off.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This command will not halt the other routing-engine. 5 | If planning to switch off power, use the both-routing-engines option. 6 | 7 | 8 | 9 | 10 | 11 | yes 12 | Perform the operation 13 | 14 | 15 | 16 | no 17 | Don't perform the operation 18 | 19 | 20 | no 21 | Power Off the system ? [yes,no] (no) 22 | 23 | 24 | 25 | 26 | Shutdown NOW! 27 | [pid 17221] 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-reboot-at.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | yes 6 | Perform the operation 7 | 8 | 9 | 10 | no 11 | Don't perform the operation 12 | 13 | 14 | no 15 | Reboot the system ? [yes,no] (no) 16 | 17 | 18 | 19 | 20 | Shutdown at Wed Jul 9 18:15:00 2014 21 | [pid 4446] 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-reboot-output.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Initiating vmhost reboot... 4 | 5 | 6 | warning 7 | 8 | Rebooting re0 in 1 min 9 | 10 | 11 | 12 | warning 13 | 14 | Initiating Junos shutdown... 15 | 16 | 17 | 18 | shutdown: [pid 13192] 19 | Shutdown at Thu Aug 6 09:27:13 2020. 20 | 21 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-reboot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | yes 6 | Perform the operation 7 | 8 | 9 | 10 | no 11 | Don't perform the operation 12 | 13 | 14 | no 15 | Reboot the system ? [yes,no] (no) 16 | 17 | 18 | 19 | 20 | Shutdown NOW! 21 | [pid 17221] 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-shell-execute.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | On 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Not Ready 17 | 18 | 19 | {backup} 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-system-storage-cleanup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | /var/abc.txt 6 | 11 7 | Apr 25 10:38 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/request-zeroize.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | warning 4 | 5 | ipsec-key-management subsystem not running - not needed by configuration. 6 | 7 | 8 | 9 | 10 | ipsec-key-management subsystem not running - not needed by configuration. 11 | 12 | 13 | 14 | ipsec-key-management 15 | 16 | 17 | 18 | 19 | 20 | 21 | zeroizing re1 22 | 23 | 24 | 25 | warning 26 | 27 | zeroizing re0 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/set-cli-working-directory.xml: -------------------------------------------------------------------------------- 1 | 2 | change/directory 3 | 4 | -------------------------------------------------------------------------------- /tests/unit/utils/rpc-reply/show-cli-directory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /cf/var/home/rick 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/utils/test_util.py: -------------------------------------------------------------------------------- 1 | __author__ = "Nitin Kumar, Rick Sherman" 2 | __credits__ = "Jeremy Schulman" 3 | 4 | import unittest 5 | import nose2 6 | 7 | from jnpr.junos import Device 8 | from jnpr.junos.utils.util import Util 9 | 10 | from unittest.mock import patch 11 | 12 | 13 | class TestUtil(unittest.TestCase): 14 | @patch("ncclient.manager.connect") 15 | def setUp(self, mock_connect): 16 | self.dev = Device( 17 | host="1.1.1.1", user="nitin", password="password123", gather_facts=False 18 | ) 19 | self.dev.open() 20 | self.util = Util(self.dev) 21 | 22 | def test_repr(self): 23 | self.assertEqual(repr(self.util), "jnpr.junos.utils.Util(1.1.1.1)") 24 | 25 | def test_dev_setter_exception(self): 26 | def mod_dev(): 27 | self.util.dev = "abc" 28 | 29 | self.assertRaises(RuntimeError, mod_dev) 30 | 31 | def test_rpc_setter_exception(self): 32 | def mod_rpc(): 33 | self.util.rpc = "abc" 34 | 35 | self.assertRaises(RuntimeError, mod_rpc) 36 | -------------------------------------------------------------------------------- /vagrant/ansible/group_vars/all: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ubuntu_package: 4 | - libxml2 5 | - libxml2-dev 6 | - libxslt1.1 7 | - libxslt1-dev 8 | - libgmp10 9 | - libgmp-dev 10 | - python-dev 11 | - python-setuptools 12 | - python-lxml 13 | - python-yaml 14 | - python-jinja2 15 | - python-paramiko 16 | - git 17 | 18 | debian_package: 19 | - libxml2 20 | - libxml2-dev 21 | - libxslt1.1 22 | - libxslt1-dev 23 | - libgmp10 24 | - libgmp-dev 25 | - python-dev 26 | - python-setuptools 27 | 28 | centos_package: 29 | - libxml2 30 | - libxml2-devel 31 | - libxslt 32 | - libxslt-devel 33 | - gmp 34 | - gmp-devel 35 | 36 | pip_package: 37 | - lxml 38 | - paramiko 39 | - PyYAML 40 | - jinja2 41 | - scp 42 | 43 | ncclient: 44 | url: https://github.com/Juniper/ncclient.git 45 | installdir: /usr/local/lib/python2.7/dist-packages/ncclient-0.1a-py2.7.egg 46 | 47 | py-junos-eznc: 48 | url: https://github.com/jeremyschulman/py-junos-eznc 49 | installdir: /usr/local/lib/python2.7/dist-packages/junos_eznc-0.0.1-py2.7.egg 50 | 51 | -------------------------------------------------------------------------------- /vagrant/puppet/manifests/default.pp: -------------------------------------------------------------------------------- 1 | class{'pyez': 2 | mode => 'pypi', 3 | version => 'present', 4 | } -------------------------------------------------------------------------------- /vagrant/puppet/modules/pyez/Modulefile: -------------------------------------------------------------------------------- 1 | name 'juniper-pyez' 2 | version '0.1.0' 3 | source '' 4 | author 'Rick Sherman, Juniper Networks' 5 | license 'Apache 2.0' 6 | summary '' 7 | description '' 8 | project_page '' 9 | 10 | ## Add dependencies, if any: 11 | # dependency 'username/name', '>= 1.2.0' 12 | -------------------------------------------------------------------------------- /vagrant/puppet/modules/pyez/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'puppetlabs_spec_helper/rake_tasks' 3 | -------------------------------------------------------------------------------- /vagrant/puppet/modules/pyez/manifests/params.pp: -------------------------------------------------------------------------------- 1 | class pyez::params { 2 | $packages = $operatingsystem ? { 3 | /(?i-mx:ubuntu|debian)/ => ['python-pip', 'python-dev', 'libxml2-dev', 'libxslt-dev'], 4 | /(?i-mx:centos|fedora|redhat)/ => ['python-pip', 'python-devel', 'libxml2-devel', 'libxslt-devel', 'gcc'], 5 | /(?i-mx:freebsd)/ => ['devel/py27-pip', 'textproc/libxml2', 'textproc/libxslt'], 6 | } 7 | $version = 'present' 8 | $mode = 'pypi' 9 | } -------------------------------------------------------------------------------- /vagrant/puppet/modules/pyez/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Rick Sherman, Juniper Networks", 3 | "checksums": { 4 | "manifests\\init.pp": "1e6680acb92445e71521c777a5a7f8f4", 5 | "Rakefile": "f37e6131fe7de9a49b09d31596f5fbf1", 6 | "spec\\spec_helper.rb": "3ea886dd135e120afa31e0aab12e85b0", 7 | "tests\\init.pp": "0d9ec1e464c5abf75c385f087294680d", 8 | "manifests\\params.pp": "d9cf5d5f8d01a35f01c391ebb787345c", 9 | "spec\\spec.opts": "a600ded995d948e393fbe2320ba8e51c", 10 | "Modulefile": "cccc2dde1144f9fd5f1beea464358281", 11 | "README.markdown": "99dd9fd290347d0e074a4d6fb9c9e652" 12 | }, 13 | "dependencies": [], 14 | "description": "", 15 | "license": "Apache 2.0", 16 | "name": "juniper-pyez", 17 | "project_page": "", 18 | "source": "", 19 | "summary": "", 20 | "types": [], 21 | "version": "0.1.0" 22 | } -------------------------------------------------------------------------------- /vagrant/puppet/modules/pyez/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format 2 | s 3 | --colour 4 | --loadby 5 | mtime 6 | --backtrace 7 | -------------------------------------------------------------------------------- /vagrant/puppet/modules/pyez/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'puppetlabs_spec_helper/module_spec_helper' 3 | -------------------------------------------------------------------------------- /vagrant/puppet/modules/pyez/tests/init.pp: -------------------------------------------------------------------------------- 1 | include pyez 2 | --------------------------------------------------------------------------------