diff --git a/docs/pages/_meta.json b/docs/pages/_meta.json index e80c0f4..b3b34cb 100644 --- a/docs/pages/_meta.json +++ b/docs/pages/_meta.json @@ -5,6 +5,7 @@ }, "installation": "Installation", "configuration": "Configuration", + "platforms": "Platforms", "plugins": "Plugins", "documentation": { "title": "Documentation", diff --git a/docs/pages/installation.mdx b/docs/pages/installation.mdx index bb5c51e..c288863 100644 --- a/docs/pages/installation.mdx +++ b/docs/pages/installation.mdx @@ -18,7 +18,7 @@ You should be able to proceed with the automatic installation: curl https://install.hyperglass.dev | sudo bash ``` - + **Piping to bash**
You should be _very_ worried when someone asks you to do what I just did. Downloading a bash script from the internet and piping it to `bash` with root privileges is a terrible idea, unless you diff --git a/docs/pages/platforms.mdx b/docs/pages/platforms.mdx new file mode 100644 index 0000000..5f4a788 --- /dev/null +++ b/docs/pages/platforms.mdx @@ -0,0 +1,63 @@ +--- +description: Platforms supported by hyperglass +--- + +import { Code, Table, Td, Th, Tr } from 'nextra/components'; +import { Callout } from 'nextra-theme-docs'; +import platforms from '~/platforms.json'; + +export const NotSupported = () => ( + + + + +); + +export const Supported = () => ( + + + +); + +export const Platforms = () => ( + + + + + + + {platforms.map(([platform, native]) => ( + + + + + ))} + +
Platform KeysNatively Supported
+ {platform} + {native ? : }
+); + +hyperglass uses [Netmiko](https://github.com/ktbyers/netmiko) to interact with devices via SSH/telnet. [All platforms supported by Netmiko](https://github.com/ktbyers/netmiko/blob/develop/PLATFORMS.md) are supported by hyperglass. + +## Netmiko Platforms + + + Just because Netmiko supports a given platform doesn't mean it will automatically work with + hyperglass. hyperglass has a limited number of built in directives (listed below). Any platforms + other than the ones listed below will require you to [add a custom + directive](/configuration/examples/add-your-own-command) for each command you wish to make + available. + + +
+ + + +## Other Platforms + +| Platform | Key | Natively Supported | +| :---------------- | :----- | :-------------------------------------------------------------------------: | +| FRRouting | `frr` | | +| BIRD | `bird` | | +| Any HTTP Endpoint | `http` | [See HTTP Device Docs](/configuration/reference/devices#http-configuration) | diff --git a/docs/platforms.json b/docs/platforms.json new file mode 100644 index 0000000..deafced --- /dev/null +++ b/docs/platforms.json @@ -0,0 +1 @@ +[["a10", false], ["a10_ssh", false], ["accedian", false], ["accedian_ssh", false], ["adtran_os", false], ["adtran_os_ssh", false], ["alcatel_aos", false], ["alcatel_aos_ssh", false], ["alcatel_sros", false], ["alcatel_sros_ssh", false], ["allied_telesis_awplus", false], ["allied_telesis_awplus_ssh", false], ["apresia_aeos", false], ["apresia_aeos_ssh", false], ["arista_eos", true], ["arista_eos_ssh", false], ["aruba_os", false], ["aruba_os_ssh", false], ["aruba_osswitch", false], ["aruba_osswitch_ssh", false], ["aruba_procurve", false], ["aruba_procurve_ssh", false], ["avaya_ers", false], ["avaya_ers_ssh", false], ["avaya_vsp", false], ["avaya_vsp_ssh", false], ["broadcom_icos", false], ["broadcom_icos_ssh", false], ["brocade_fos", false], ["brocade_fos_ssh", false], ["brocade_fastiron", false], ["brocade_fastiron_ssh", false], ["brocade_netiron", false], ["brocade_netiron_ssh", false], ["brocade_nos", false], ["brocade_nos_ssh", false], ["brocade_vdx", false], ["brocade_vdx_ssh", false], ["brocade_vyos", false], ["brocade_vyos_ssh", false], ["checkpoint_gaia", false], ["checkpoint_gaia_ssh", false], ["calix_b6", false], ["calix_b6_ssh", false], ["cdot_cros", false], ["cdot_cros_ssh", false], ["centec_os", false], ["centec_os_ssh", false], ["ciena_saos", false], ["ciena_saos_ssh", false], ["cisco_asa", false], ["cisco_asa_ssh", false], ["cisco_ftd", false], ["cisco_ftd_ssh", false], ["cisco_ios", true], ["cisco_ios_ssh", false], ["cisco_nxos", true], ["cisco_nxos_ssh", false], ["cisco_s300", false], ["cisco_s300_ssh", false], ["cisco_tp", false], ["cisco_tp_ssh", false], ["cisco_wlc", false], ["cisco_wlc_ssh", false], ["cisco_xe", false], ["cisco_xe_ssh", false], ["cisco_xr", true], ["cisco_xr_ssh", false], ["cloudgenix_ion", false], ["cloudgenix_ion_ssh", false], ["coriant", false], ["coriant_ssh", false], ["dell_dnos9", false], ["dell_dnos9_ssh", false], ["dell_force10", false], ["dell_force10_ssh", false], ["dell_os6", false], ["dell_os6_ssh", false], ["dell_os9", false], ["dell_os9_ssh", false], ["dell_os10", false], ["dell_os10_ssh", false], ["dell_powerconnect", false], ["dell_powerconnect_ssh", false], ["dell_isilon", false], ["dell_isilon_ssh", false], ["dlink_ds", false], ["dlink_ds_ssh", false], ["endace", false], ["endace_ssh", false], ["eltex", false], ["eltex_ssh", false], ["eltex_esr", false], ["eltex_esr_ssh", false], ["enterasys", false], ["enterasys_ssh", false], ["ericsson_ipos", false], ["ericsson_ipos_ssh", false], ["extreme", false], ["extreme_ssh", false], ["extreme_ers", false], ["extreme_ers_ssh", false], ["extreme_exos", false], ["extreme_exos_ssh", false], ["extreme_netiron", false], ["extreme_netiron_ssh", false], ["extreme_nos", false], ["extreme_nos_ssh", false], ["extreme_slx", false], ["extreme_slx_ssh", false], ["extreme_vdx", false], ["extreme_vdx_ssh", false], ["extreme_vsp", false], ["extreme_vsp_ssh", false], ["extreme_wing", false], ["extreme_wing_ssh", false], ["f5_ltm", false], ["f5_ltm_ssh", false], ["f5_tmsh", false], ["f5_tmsh_ssh", false], ["f5_linux", false], ["f5_linux_ssh", false], ["flexvnf", false], ["flexvnf_ssh", false], ["fortinet", false], ["fortinet_ssh", false], ["generic", false], ["generic_ssh", false], ["generic_termserver", false], ["generic_termserver_ssh", false], ["hp_comware", false], ["hp_comware_ssh", false], ["hp_procurve", false], ["hp_procurve_ssh", false], ["huawei", true], ["huawei_ssh", false], ["huawei_smartax", false], ["huawei_smartax_ssh", false], ["huawei_olt", false], ["huawei_olt_ssh", false], ["huawei_vrpv8", false], ["huawei_vrpv8_ssh", false], ["ipinfusion_ocnos", false], ["ipinfusion_ocnos_ssh", false], ["juniper", true], ["juniper_ssh", false], ["juniper_junos", false], ["juniper_junos_ssh", false], ["juniper_screenos", false], ["juniper_screenos_ssh", false], ["keymile", false], ["keymile_ssh", false], ["keymile_nos", false], ["keymile_nos_ssh", false], ["linux", false], ["linux_ssh", false], ["mikrotik_routeros", false], ["mikrotik_routeros_ssh", false], ["mikrotik_switchos", false], ["mikrotik_switchos_ssh", false], ["mellanox", false], ["mellanox_ssh", false], ["mellanox_mlnxos", false], ["mellanox_mlnxos_ssh", false], ["mrv_lx", false], ["mrv_lx_ssh", false], ["mrv_optiswitch", false], ["mrv_optiswitch_ssh", false], ["netapp_cdot", false], ["netapp_cdot_ssh", false], ["netgear_prosafe", false], ["netgear_prosafe_ssh", false], ["netscaler", false], ["netscaler_ssh", false], ["nokia_sros", true], ["nokia_sros_ssh", false], ["oneaccess_oneos", false], ["oneaccess_oneos_ssh", false], ["ovs_linux", false], ["ovs_linux_ssh", false], ["paloalto_panos", false], ["paloalto_panos_ssh", false], ["pluribus", false], ["pluribus_ssh", false], ["quanta_mesh", false], ["quanta_mesh_ssh", false], ["rad_etx", false], ["rad_etx_ssh", false], ["raisecom_roap", false], ["raisecom_roap_ssh", false], ["ruckus_fastiron", false], ["ruckus_fastiron_ssh", false], ["ruijie_os", false], ["ruijie_os_ssh", false], ["sixwind_os", false], ["sixwind_os_ssh", false], ["sophos_sfos", false], ["sophos_sfos_ssh", false], ["supermicro_smis", false], ["supermicro_smis_ssh", false], ["tplink_jetstream", false], ["tplink_jetstream_ssh", false], ["ubiquiti_edge", false], ["ubiquiti_edge_ssh", false], ["ubiquiti_edgerouter", false], ["ubiquiti_edgerouter_ssh", false], ["ubiquiti_edgeswitch", false], ["ubiquiti_edgeswitch_ssh", false], ["ubiquiti_unifiswitch", false], ["ubiquiti_unifiswitch_ssh", false], ["vyatta_vyos", false], ["vyatta_vyos_ssh", false], ["vyos", true], ["vyos_ssh", false], ["watchguard_fireware", false], ["watchguard_fireware_ssh", false], ["zte_zxros", false], ["zte_zxros_ssh", false], ["yamaha", false], ["yamaha_ssh", false], ["adtran_os_telnet", false], ["apresia_aeos_telnet", false], ["arista_eos_telnet", false], ["aruba_procurve_telnet", false], ["brocade_fastiron_telnet", false], ["brocade_netiron_telnet", false], ["calix_b6_telnet", false], ["centec_os_telnet", false], ["ciena_saos_telnet", false], ["cisco_ios_telnet", false], ["cisco_xr_telnet", false], ["dell_dnos6_telnet", false], ["dell_powerconnect_telnet", false], ["dlink_ds_telnet", false], ["extreme_telnet", false], ["extreme_exos_telnet", false], ["extreme_netiron_telnet", false], ["generic_telnet", false], ["generic_termserver_telnet", false], ["hp_procurve_telnet", false], ["hp_comware_telnet", false], ["huawei_telnet", false], ["huawei_olt_telnet", false], ["ipinfusion_ocnos_telnet", false], ["juniper_junos_telnet", false], ["nokia_sros_telnet", false], ["oneaccess_oneos_telnet", false], ["paloalto_panos_telnet", false], ["rad_etx_telnet", false], ["raisecom_telnet", false], ["ruckus_fastiron_telnet", false], ["ruijie_os_telnet", false], ["supermicro_smis_telnet", false], ["tplink_jetstream_telnet", false], ["yamaha_telnet", false], ["zte_zxros_telnet", false], ["cisco_ios_serial", false], ["terminal_server", false], ["autodetect", false]] \ No newline at end of file diff --git a/hyperglass/util/docs.py b/hyperglass/util/docs.py new file mode 100644 index 0000000..d243243 --- /dev/null +++ b/hyperglass/util/docs.py @@ -0,0 +1,27 @@ +"""Helpers for hyperglass docs.""" + +# Standard Library +import json +from pathlib import Path + + +def create_platform_list() -> str: + """Create a list of platforms as a typescript file for use by the docs.""" + # Third Party + from netmiko.ssh_dispatcher import CLASS_MAPPER # type: ignore + + project_root = Path(__file__).parent.parent.parent + + dir_ = project_root / "docs" + file_ = dir_ / "platforms.json" + + builtin_directives = project_root / "hyperglass" / "defaults" / "directives" + + names = [f.stem for f in builtin_directives.iterdir() if not f.name.startswith("_")] + + platforms = [[p, p in names] for p in CLASS_MAPPER.keys()] + + with file_.open("w+") as opened_file: + json.dump(platforms, opened_file) + + return f"Wrote platforms to {file_!s}" diff --git a/pyproject.toml b/pyproject.toml index df1ffe6..c7a93c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,11 +61,11 @@ isort = "^5.10.1" pep8-naming = "^0.13.2" pre-commit = "^2.20.0" pytest = "^7.2.0" +pytest-asyncio = "^0.20.3" pytest-dependency = "^0.5.1" ruff = "v0.0.194" stackprinter = "^0.2.10" taskipy = "^1.10.3" -pytest-asyncio = "^0.20.3" [tool.black] line-length = 100 @@ -95,6 +95,7 @@ reportMissingTypeStubs = true [tool.taskipy.tasks] check = {cmd = "task lint && task ui-lint", help = "Run all lint checks"} +docs-platforms = {cmd = "python3 -c 'from hyperglass.util.docs import create_platform_list;print(create_platform_list())'"} format = {cmd = "black hyperglass", help = "Run Black"} lint = {cmd = "ruff hyperglass", help = "Run Ruff Linter"} sort = {cmd = "isort hyperglass", help = "Run iSort"}