hyperglass
repository·main·Indexed 20 days ago
https://github.com/thatmattlove/hyperglassA modern network looking glass platform (version 2.0.4) that enables network operators to provide diagnostic tools such as BGP queries, Ping, and Traceroute to users. It features a React-based web UI built with Next.js and Chakra UI, a REST API with OpenAPI documentation, and support for major network operating systems including Arista EOS, BIRD, Cisco, FRRouting, Huawei VRP, Juniper Junos, Mikrotik, Nokia SR OS, OpenBGPD, TNSR, and VyOS.
What's inside hyperglass
- hyperglass is an open source network looking glass designed for network engineers. It provides unattended visibility into an operator's network for customers, peers, and other network operators. It is designed to be a faster, easier, and more secure way to provide looking glass services.
Overview of Hyperglass features
mainHyperglass is a network looking glass platform designed to allow network operators to provide customers, peers, or the public with tools to view network elements or run tests from their network.
Key capabilities include:
- Network Tests: BGP Route, BGP Community, BGP AS Path, Ping, and Traceroute. You can also add custom commands via configuration directives.
- Protocol Support: Full IPv6 support.
- Multi-Device Queries: Ability to query multiple devices simultaneously.
- Platform Support: Built-in support for major network operating systems including Arista EOS, BIRD, Cisco (IOS, NX-OS, IOS-XR), FRRouting, Huawei VRP, Juniper Junos, Mikrotik, Nokia SR OS, OpenBGPD, TNSR, and VyOS.
- Security & Control: Access-list/prefix-list style query control to whitelist or blacklist query targets, and optional access via an SSH proxy/jump server.
- Extensibility: Highly customizable features, themes, UI/API text, error messages, and commands.
- API & UI: Provides a REST API with automatic OpenAPI documentation and a modern, responsive React-based UI (using NextJS and Chakra UI).
Overview of hyperglass-ui
mainThe
hyperglass-uipackage provides the user interface for Hyperglass. It is built using the following technology stack:- React: For building the component-based UI.
- Next.js: As the underlying framework for routing and rendering.
- Chakra UI: For the design system and component styling.
Key features of hyperglass
mainhyperglass provides a wide range of network diagnostic and management features, including:
- Network Diagnostics: BGP Route, BGP Community, BGP AS Path, Ping, and Traceroute.
- Protocol Support: Full IPv6 support.
- Customization: Highly customizable features, themes, UI/API text, error messages, and commands.
- Platform Support: Built-in support for various network platforms and configurable support for others.
- Connectivity: Optional access to devices via an SSH proxy/jump server.
- Network Isolation: VRF support and Access List/prefix-list style query control to whitelist or blacklist query targets on a per-VRF basis.
- API & UI: REST API with automatic, configurable OpenAPI documentation and a modern, responsive UI.
- Advanced Querying: Ability to query multiple devices simultaneously and browser-based DNS-over-HTTPS resolution of FQDN queries.
What is a directive in Hyperglass?
mainA directive is a configuration that defines how one or more commands should be executed on a device in response to a query. It acts as a bridge between a user's query and the actual device commands.
A directive defines:
- The specific command(s) to run on the device.
- The type of UI fields (text input or select) required for the query.
- Whether the command supports multiple values.
- Help information and validation rules for the input.
- How the directive is grouped in the UI.
What are hyperglass Plugins and how do they work
mainStarting in version 2.0, hyperglass supports custom plugins that are associated with a directive. Plugins allow you to intercept and modify the lifecycle of a query at two specific stages:
- Input Plugins: These run before the query is sent to a device. They can be used to apply custom validation logic to the user input or to transform the input (e.g., converting a CIDR prefix into a network and mask).
- Output Plugins: These run after the device returns data but before it is displayed to the user. They are useful for tasks like redacting sensitive information from the output text.
To use a plugin, you must define a class that inherits from either
InputPluginorOutputPluginand then reference the file path of that plugin within yourdirectives.yamlconfiguration under thepluginskey for a specific directive.Configure structured output for supported devices
mainDevices that support structured or easily parsable data (currently Arista EOS and Juniper Junos) can have their response data rendered in tables within the UI or as JSON via the REST API. Structured output allows Hyperglass to perform additional logic, such as RPKI state checking and BGP community filtering.Use HTTP endpoints as platforms
mainIn addition to Netmiko-based SSH/telnet platforms, hyperglass supports any HTTP endpoint as a platform. To use this, set the platform
Keytohttpin your device configuration. Refer to the HTTP Device Docs for specific configuration details.{ "key": "http" }Define directive rules and actions
mainA rule determines if a query target matches specific conditions to trigger a command. If a rule matches, the specified
action(permitordeny) is applied.Rule Parameters
Parameter Type Default Description conditionString A regex pattern or an IP prefix to match against. actionString permitEither permitordenythe directive target.commandsList of Strings Commands to run. {target}is replaced by the query target.Validation Types
IP Rule Validation
When the
conditionis an IP prefix, you can use these parameters to control prefix length matching:ge: Minimum prefix length (e.g.,8).le: Maximum prefix length (e.g.,24).allow_reserved: Allow RFC1918, etc. (defaultfalse).allow_unspecified: Allow0.0.0.0or::(defaultfalse).allow_loopback: Allow127.0.0.0/8or::1(defaultfalse).
Regex Validation
To validate input using a regular expression, provide the pattern as the
conditionstring.No Validation
To allow any input to pass through to the command, set the
conditiontonull.your-directive: name: BGP Route rules: - condition: "192.0.2.0/24" action: deny - condition: "0.0.0.0/0" command: "show ip bgp {target}"Understand Hyperglass configuration files
mainHyperglass uses three primary configuration files to manage application behavior, device data, and custom commands:
config: Manages application-wide settings such as logging, web UI customization (logos, colors), and other global parameters.devices: Contains the list of your devices and their specific associated configurations.directives: Defines custom directives (commands) used to interact with devices.
While documentation examples typically use YAML, Hyperglass also supports TOML, JSON, and Python files.
Understand platform support in hyperglass
mainhyperglass uses Netmiko for SSH/telnet device interaction. While any platform supported by Netmiko can technically be used, hyperglass only provides built-in directives for a specific subset of platforms.
If you use a Netmiko-supported platform that is not explicitly listed in the hyperglass built-in directives, you must add a custom directive for every command you want to expose to the system.
Quickstart hyperglass with sample devices
mainIf you want to quickly preview the hyperglass interface using fake device data, use the provided sample configuration and run Docker Compose.
- Copy the sample devices configuration to
/etc/hyperglass/devices.yaml. - Run
docker compose upfrom the/opt/hyperglassdirectory. - Access the interface at
http://localhost:8001.
cp /opt/hyperglass/.samples/sample_devices.yaml /etc/hyperglass/devices.yaml cd /opt/hyperglass docker compose up- Copy the sample devices configuration to