mirror of
https://github.com/thatmattlove/hyperglass.git
synced 2026-01-17 08:48:05 +00:00
update docs & examples
This commit is contained in:
parent
5d39ff054f
commit
847e55098b
38 changed files with 744 additions and 256 deletions
14
.samples/Caddyfile
Normal file
14
.samples/Caddyfile
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
lg.example.com:443 {
|
||||
tls person@example.com
|
||||
file_server {
|
||||
root /etc/hyperglass/static/ui
|
||||
index /etc/hyperglass/static/ui/index.html
|
||||
}
|
||||
file_server /custom {
|
||||
root /etc/hyperglass/static/custom
|
||||
}
|
||||
file_server /images {
|
||||
root /etc/hyperglass/static/images
|
||||
}
|
||||
reverse_proxy localhost:8001
|
||||
}
|
||||
15
.samples/hyperglass-docker.service
Normal file
15
.samples/hyperglass-docker.service
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=hyperglass
|
||||
PartOf=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=true
|
||||
WorkingDirectory=/opt/hyperglass
|
||||
EnvironmentFile=/etc/hyperglass/hyperglass.env
|
||||
ExecStart=/usr/bin/docker compose up -d --remove-orphans
|
||||
ExecStop=/usr/bin/docker compose down
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
13
.samples/hyperglass-manual.service
Normal file
13
.samples/hyperglass-manual.service
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=hyperglass
|
||||
After=network.target
|
||||
Requires=redis-server
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
EnvironmentFile=/etc/hyperglass/hyperglass.env
|
||||
ExecStart=python3 -m hyperglass.console start
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
49
.samples/hyperglass.nginx
Normal file
49
.samples/hyperglass.nginx
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name lg.example.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
server {
|
||||
listen [::]:443 ssl ipv6only=on;
|
||||
listen 443 ssl;
|
||||
ssl_certificate <path to cert chain>
|
||||
ssl_certificate_key <path to key>
|
||||
|
||||
client_max_body_size 2M;
|
||||
|
||||
server_name lg.example.com;
|
||||
|
||||
root /etc/hyperglass/static;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /ui /ui/$uri =404;
|
||||
index /ui/index.html;
|
||||
}
|
||||
|
||||
location /openapi.json {
|
||||
try_files $uri @proxy_to_app;
|
||||
}
|
||||
|
||||
location /custom/ {
|
||||
try_files $uri $uri/ /custom;
|
||||
}
|
||||
|
||||
location /images/ {
|
||||
try_files $uri $uri/ /images;
|
||||
}
|
||||
|
||||
location /api {
|
||||
try_files $uri @proxy_to_app;
|
||||
}
|
||||
|
||||
location @proxy_to_app {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
proxy_pass http://[::1]:8001;
|
||||
}
|
||||
|
||||
}
|
||||
7
.samples/sample_devices.yaml
Normal file
7
.samples/sample_devices.yaml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
devices:
|
||||
- name: Example Device
|
||||
address: 127.0.0.1
|
||||
credential:
|
||||
username: test
|
||||
password: test
|
||||
platform: juniper
|
||||
|
|
@ -1,4 +1,24 @@
|
|||
import { Callout } from 'nextra-theme-docs';
|
||||
import { Code, Table, Td, Th, Tr } from "nextra/components";
|
||||
import { Callout } from "nextra-theme-docs";
|
||||
import platforms from "~/platforms.json";
|
||||
import { Supported } from "./platforms.mdx";
|
||||
|
||||
export const Platforms = () => (
|
||||
<ul>
|
||||
{platforms.reduce((final, platform) => {
|
||||
if (platform.native) {
|
||||
const element = (
|
||||
<li key={platform.name}>
|
||||
<Supported style={{ display: "inline", marginRight: "0.5rem" }} />
|
||||
{platform.name}
|
||||
</li>
|
||||
);
|
||||
final = [...final, element];
|
||||
}
|
||||
return final;
|
||||
}, [])}
|
||||
</ul>
|
||||
);
|
||||
|
||||
Once you've gotten started with a basic configuration, you'll probably want to customize the look and feel of hyperglass by changing the logo or color scheme. Fortunately, there are _a lot_ ways to customize hyperglass.
|
||||
|
||||
|
|
@ -8,12 +28,12 @@ Once you've gotten started with a basic configuration, you'll probably want to c
|
|||
| :----------- | :------------------------------------------------------------------------- |
|
||||
| `config` | Application-wide configuration such as logging, web UI customization, etc. |
|
||||
| `devices` | Your devices and their associated configurations. |
|
||||
| `directives` | Custom [directives](/configuration/directives-file-reference) (commands). |
|
||||
| `directives` | Custom [directives](configuration/directives.mdx) (commands). |
|
||||
|
||||
<Callout type="info">
|
||||
**File Extensions** <br />
|
||||
All the examples in the docs are provided in [YAML](https://yaml.org/) format, but [TOML](https://toml.io/),
|
||||
JSON, and Python files are also supported.
|
||||
**File Extensions** <br />
|
||||
All the examples in the docs are provided in [YAML](https://yaml.org/) format, but [TOML](https://toml.io/),
|
||||
JSON, and Python files are also supported.
|
||||
</Callout>
|
||||
|
||||
### Using a Python File
|
||||
|
|
@ -55,3 +75,21 @@ main = {
|
|||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Built-in Directives
|
||||
|
||||
hyperglass ships with predefined [directives](configuration/directives.mdx) for the following [platforms](platforms.mdx):
|
||||
|
||||
<Platforms />
|
||||
|
||||
All built in directives require that the following `attrs` be defined on each device using the directive:
|
||||
|
||||
| Attribute | Value |
|
||||
| :-------- | :-------------------------------------------------------- |
|
||||
| `source4` | IPv4 address used to source Ping and Traceroute commands. |
|
||||
| `source6` | IPv6 address used to source Ping and Traceroute commands. |
|
||||
|
||||
<Callout type="warning">
|
||||
If you do not utilize IPv6 in your network, you'll need to create your own directive that only
|
||||
has IPv4 commands.
|
||||
</Callout>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"reference": "Reference",
|
||||
"config": "Config File",
|
||||
"devices": "Devices File",
|
||||
"directives": "Directives File",
|
||||
"examples": "Examples"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ title: Basic Configuration
|
|||
description: Get started with a basic hyperglass configuration
|
||||
---
|
||||
|
||||
import { Callout } from 'nextra-theme-docs';
|
||||
import { Callout } from "nextra-theme-docs";
|
||||
|
||||
To get started, hyperglass only needs to know about your devices.
|
||||
|
||||
<Callout>
|
||||
**Devices** are your routers, switches, or whatever else you want to call the endpoints hyperglass
|
||||
will query for information.
|
||||
**Devices** are your routers, switches, or whatever else you want to call the endpoints
|
||||
hyperglass will query for information.
|
||||
</Callout>
|
||||
|
||||
## Simple Device Configuration
|
||||
|
|
@ -18,12 +18,15 @@ Create a file called `devices.yaml` in the directory `/etc/hyperglass`.
|
|||
|
||||
```yaml filename="devices.yaml"
|
||||
devices:
|
||||
- name: NYC Router 1
|
||||
address: <IP address hyperglass will use to log into the router>
|
||||
credential:
|
||||
username: <Username hyperglass will use to log into the router>
|
||||
password: <Password hyperglass will use to log into the router>
|
||||
platform: cisco_ios
|
||||
- name: NYC Router 1
|
||||
address: <IP address hyperglass will use to log into the router>
|
||||
credential:
|
||||
username: <Username hyperglass will use to log into the router>
|
||||
password: <Password hyperglass will use to log into the router>
|
||||
platform: cisco_ios
|
||||
attrs:
|
||||
source4: <IPv4 address from which to source ping & traceroute commands>
|
||||
source6: <IPv4 address from which to source ping & traceroute commands>
|
||||
```
|
||||
|
||||
That's it!
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"config": "Config File",
|
||||
"devices": "Devices File",
|
||||
"directives": "Directives File"
|
||||
}
|
||||
|
|
@ -5,6 +5,64 @@ description: Installing hyperglass
|
|||
|
||||
import { Callout, Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
## Docker
|
||||
<Callout type="info">
|
||||
**Docker is the recommended method for running hyperglass.**
|
||||
</Callout>
|
||||
|
||||
### 1. [Install Docker](https://docs.docker.com/engine/install/)
|
||||
|
||||
### 2. Download hyperglass
|
||||
|
||||
```shell copy
|
||||
mkdir /etc/hyperglass
|
||||
cd /opt
|
||||
git clone https://github.com/thatmattlove/hyperglass/tree/v2.0.0 --depth=1
|
||||
```
|
||||
|
||||
### Quickstart (optional)
|
||||
|
||||
Do this if you just want to see the hyperglass page working with a fake device.
|
||||
|
||||
```shell copy
|
||||
cp /opt/hyperglass/.samples/sample_devices.yaml /etc/hyperglass/devices.yaml
|
||||
cd /opt/hyperglass
|
||||
docker compose up
|
||||
```
|
||||
|
||||
Navigate to http://localhost:8001
|
||||
|
||||
### 3. Setup Reverse Proxy
|
||||
|
||||
[Caddy](https://caddyserver.com) is recommended, but any reverse proxy ([NGINX](https://www.nginx.com), [Apache2](https://httpd.apache.org)) will work.
|
||||
|
||||
#### Caddy
|
||||
|
||||
[**Install Caddy**](https://caddyserver.com/docs/install)
|
||||
|
||||
```shell copy
|
||||
cp /opt/hyperglass/.samples/Caddyfile /etc/caddy/Caddyfile
|
||||
```
|
||||
|
||||
Change the `lg.example.com` and `person@example.com` values to match your hyperglass FQDN and email address (the email address is for automatic SSL certificate generation via Let's Encrypt).
|
||||
|
||||
<Callout type="info">
|
||||
If you prefer to use other Let's Encrypt validation methods or your own SSL certificate, modify your `/etc/hyperglass/Caddyfile` in accordance with the [Caddy docs](https://caddyserver.com/docs/caddyfile-tutorial).
|
||||
</Callout>
|
||||
|
||||
Restart the Caddy service: `systemctl restart caddy{:shell}`
|
||||
|
||||
#### NGINX
|
||||
|
||||
```shell copy
|
||||
cp /opt/hyperglass/.samples/hyperglass.nginx /etc/nginx/sites-available/hyperglass
|
||||
ln -s /etc/nginx/sites-available/hyperglass /etc/nginx/sites-enabled/hyperglass
|
||||
```
|
||||
|
||||
Change the `lg.example.com` value to match your hyperglass FQDN.
|
||||
|
||||
Change the `<path to cert chain>` and `<path to key>` values to match the path to your certificate and private key files.
|
||||
|
||||
## Automatic installation
|
||||
|
||||
If your system runs on:
|
||||
|
|
|
|||
6
docs/pages/installation/_meta.json
Normal file
6
docs/pages/installation/_meta.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"docker": "Using Docker",
|
||||
"manual": "Manual Installation",
|
||||
"environment-variables": "Environment Variables",
|
||||
"reverse-proxy": "Reverse Proxy"
|
||||
}
|
||||
54
docs/pages/installation/docker.mdx
Normal file
54
docs/pages/installation/docker.mdx
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
title: Using Docker
|
||||
description: Installing hyperglass with Docker
|
||||
---
|
||||
|
||||
import { Button } from "nextra/components";
|
||||
import { Callout } from "nextra-theme-docs";
|
||||
|
||||
## Docker
|
||||
|
||||
<Callout type="info">**Docker is the recommended method for running hyperglass.**</Callout>
|
||||
|
||||
### 1. Install Docker
|
||||
|
||||
<Button className="nx-my-4 nx-py-2 nx-px-4 nx-font-bold">
|
||||
<a target="_blank" href="https://docs.docker.com/engine/install/">
|
||||
Docker Engine Installation Guide
|
||||
</a>
|
||||
</Button>
|
||||
|
||||
### 2. Download hyperglass
|
||||
|
||||
```shell copy
|
||||
mkdir /etc/hyperglass
|
||||
cd /opt
|
||||
git clone https://github.com/thatmattlove/hyperglass/tree/v2.0.0 --depth=1
|
||||
```
|
||||
|
||||
### Optional: Quickstart
|
||||
|
||||
Do this if you just want to see the hyperglass page working with a fake device.
|
||||
|
||||
```shell copy
|
||||
cp /opt/hyperglass/.samples/sample_devices.yaml /etc/hyperglass/devices.yaml
|
||||
cd /opt/hyperglass
|
||||
docker compose up
|
||||
```
|
||||
|
||||
Navigate to http://localhost:8001
|
||||
|
||||
### 3. Create a `systemd` service
|
||||
|
||||
<Callout type="info">
|
||||
Before you create and start the hyperglass service, you may want to verify whether or not you
|
||||
intend to change any [environment variables](environment-variables.mdx) and change them first.
|
||||
</Callout>
|
||||
|
||||
```shell copy
|
||||
cp /opt/hyperglass/.samples/hyperglass-docker.service /etc/hyperglass/hyperglass.service
|
||||
ln -s /etc/hyperglass/hyperglass.service /etc/systemd/system/hyperglass.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable hyperglass
|
||||
systemctl start hyperglass
|
||||
```
|
||||
22
docs/pages/installation/environment-variables.mdx
Normal file
22
docs/pages/installation/environment-variables.mdx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
title: Environment Variables
|
||||
description: hyperglass environment variables
|
||||
---
|
||||
|
||||
There are some configuration variables that must be supplied before hyperglass can start or read its configuration files. Most of the time, you should not need to modify these.
|
||||
|
||||
Environment variables may be overridden at the command line, or by placing them in `${HYPERGLASS_APP_PATH}/hyperglass.env`.
|
||||
|
||||
| Variable Name | Type | Default | Description |
|
||||
| :-------------------------- | :------ | :---------------- | :----------------------------------------------------------------------------------------------------------------- |
|
||||
| `HYPERGLASS_DEBUG` | boolean | `false` | Enable debug logging |
|
||||
| `HYPERGLASS_DEV_MODE` | boolean | `false` | Enable developer mode. This should only be used if you are developing hyperglass under specific circumstances. |
|
||||
| `HYPERGLASS_DISABLE_UI` | boolean | `false` | If set to `true`, the hyperglass UI is not built or served. The only way to access hyperglass is via REST API. |
|
||||
| `HYPERGLASS_APP_PATH` | string | `/etc/hyperglass` | Directory where hyperglass configuration files and static web UI files are contained. |
|
||||
| `HYPERGLASS_REDIS_HOST` | string | `localhost` | Host on which Redis is running. |
|
||||
| `HYPERGLASS_REDIS_PASSWORD` | string | — | Redis password, if any. |
|
||||
| `HYPERGLASS_REDIS_DB` | number | `1` | Redis database number. |
|
||||
| `HYPERGLASS_REDIS_DSN` | string | — | Redis DSN. If supplied, overrides `HYPERGLASS_REDIS_HOST`, `HYPERGLASS_REDIS_DB`, and `HYPERGLASS_REDIS_PASSWORD`. |
|
||||
| `HYPERGLASS_HOST` | string | `[::1]` | Address on which hyperglass listens for requests. |
|
||||
| `HYPERGLASS_PORT` | number | `8001` | TCP port on which hyperglass listens for requests. |
|
||||
| `HYPERGLASS_CA_CERT` | string | — | Path to CA certificate file for validating HTTPS certificates. If not supplied, system CAs are used. |
|
||||
60
docs/pages/installation/manual.mdx
Normal file
60
docs/pages/installation/manual.mdx
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
title: Manual Installation
|
||||
description: Installing hyperglass manually
|
||||
---
|
||||
|
||||
import { Callout } from 'nextra-theme-docs';
|
||||
|
||||
## Install Dependencies
|
||||
To install hyperglass manually, you'll need to install the following dependencies:
|
||||
|
||||
1. [Python 3.9, 3.10, 3.11, or 3.12](https://www.python.org/downloads/)
|
||||
2. [NodeJS 18.17 or later](https://nodejs.org/en/download)
|
||||
3. [PNPM 8 or later](https://pnpm.io/installation)
|
||||
4. [Redis 7.2 or later](https://redis.io/download/)
|
||||
|
||||
<Callout type="default">
|
||||
Make sure the Redis server is started.
|
||||
</Callout>
|
||||
|
||||
## Install hyperglass
|
||||
|
||||
Once these dependencies are installed, install hyperglass via PyPI:
|
||||
|
||||
```shell copy
|
||||
pip3 install hyperglass
|
||||
```
|
||||
|
||||
## Create app directory
|
||||
|
||||
<Callout type="info">
|
||||
If you plan on using a different directory, be sure to set the directory you wish to use in your [environment variables](environment-variables.mdx).
|
||||
</Callout>
|
||||
|
||||
```shell copy
|
||||
mkdir /etc/hyperglass
|
||||
```
|
||||
|
||||
## Optional: Quickstart
|
||||
|
||||
Do this if you just want to see the hyperglass page working with default settings and a fake device.
|
||||
|
||||
```shell copy
|
||||
curl -o /etc/hyperglass/devices.yaml https://github.com/thatmattlove/hyperglass/blob/v2.0.0/.samples/sample_devices.yaml
|
||||
hyperglass start
|
||||
```
|
||||
|
||||
## Create a `systemd` service
|
||||
|
||||
```shell copy
|
||||
curl -o /etc/hyperglass/hyperglass.service https://github.com/thatmattlove/hyperglass/blob/v2.0.0/.samples/hyperglass-manual.service
|
||||
ln -s /etc/hyperglass/hyperglass.service /etc/systemd/system/hyperglass.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable hyperglass
|
||||
systemctl start hyperglass
|
||||
```
|
||||
|
||||
<Callout type="info">
|
||||
If you used a different app directory from the default `/etc/hyperglass`, change the `EnvironmentFile` value in the `hyperglass.service` file.
|
||||
</Callout>
|
||||
|
||||
42
docs/pages/installation/reverse-proxy.mdx
Normal file
42
docs/pages/installation/reverse-proxy.mdx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: Reverse Proxy
|
||||
description: Setting up a reverse proxy for hyperglass
|
||||
---
|
||||
|
||||
import { Button } from "nextra/components";
|
||||
import { Callout } from "nextra-theme-docs";
|
||||
|
||||
[Caddy](https://caddyserver.com) is recommended, but any reverse proxy ([NGINX](https://www.nginx.com), [Apache2](https://httpd.apache.org)) will work.
|
||||
|
||||
## Caddy
|
||||
|
||||
<Button className="nx-my-4 nx-py-2 nx-px-4 nx-font-bold">
|
||||
<a target="_blank" href="https://caddyserver.com/docs/install">
|
||||
Install Caddy
|
||||
</a>
|
||||
</Button>
|
||||
|
||||
```shell copy
|
||||
cp /opt/hyperglass/.samples/Caddyfile /etc/caddy/Caddyfile
|
||||
```
|
||||
|
||||
Change the `lg.example.com` and `person@example.com` values to match your hyperglass FQDN and email address (the email address is for automatic SSL certificate generation via Let's Encrypt).
|
||||
|
||||
<Callout type="info">
|
||||
If you prefer to use other Let's Encrypt validation methods or your own SSL certificate, modify
|
||||
your `/etc/hyperglass/Caddyfile` in accordance with the [Caddy
|
||||
docs](https://caddyserver.com/docs/caddyfile-tutorial).
|
||||
</Callout>
|
||||
|
||||
Restart the Caddy service: `systemctl restart caddy{:shell}`
|
||||
|
||||
## NGINX
|
||||
|
||||
```shell copy
|
||||
cp /opt/hyperglass/.samples/hyperglass.nginx /etc/nginx/sites-available/hyperglass
|
||||
ln -s /etc/nginx/sites-available/hyperglass /etc/nginx/sites-enabled/hyperglass
|
||||
```
|
||||
|
||||
Change the `lg.example.com` value to match your hyperglass FQDN.
|
||||
|
||||
Change the `<path to cert chain>` and `<path to key>` values to match the path to your certificate and private key files.
|
||||
|
|
@ -2,40 +2,57 @@
|
|||
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';
|
||||
import { Code, Table, Td, Th, Tr } from "nextra/components";
|
||||
import { Callout } from "nextra-theme-docs";
|
||||
import platforms from "~/platforms.json";
|
||||
|
||||
export const NotSupported = () => (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#edae49" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />
|
||||
</svg>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
fill="#edae49"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const Supported = () => (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#35b246" viewBox="0 0 16 16">
|
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
|
||||
</svg>
|
||||
export const Supported = (props) => (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
fill="#35b246"
|
||||
viewBox="0 0 16 16"
|
||||
{...props}
|
||||
>
|
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const Platforms = () => (
|
||||
<Table>
|
||||
<tbody>
|
||||
<Tr>
|
||||
<Th>Platform Keys</Th>
|
||||
<Th>Natively Supported</Th>
|
||||
</Tr>
|
||||
{platforms.map(([platform, native]) => (
|
||||
<Tr key={platform}>
|
||||
<Td>
|
||||
<Code>{platform}</Code>
|
||||
</Td>
|
||||
<Td align="center">{native ? <Supported /> : <NotSupported />}</Td>
|
||||
</Tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
<Table>
|
||||
<tbody>
|
||||
<Tr>
|
||||
<Th>Platform Keys</Th>
|
||||
<Th>Natively Supported</Th>
|
||||
</Tr>
|
||||
{platforms.map((spec) => (
|
||||
<Tr key={spec.keys.join("--")}>
|
||||
<Td>
|
||||
{spec.keys.map((key) => (
|
||||
<Code className="nx-mx-2" key={key}>
|
||||
{key}
|
||||
</Code>
|
||||
))}
|
||||
</Td>
|
||||
<Td align="center">{spec.native ? <Supported /> : <NotSupported />}</Td>
|
||||
</Tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
);
|
||||
|
||||
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.
|
||||
|
|
@ -43,11 +60,11 @@ hyperglass uses [Netmiko](https://github.com/ktbyers/netmiko) to interact with d
|
|||
## Netmiko Platforms
|
||||
|
||||
<Callout type="info">
|
||||
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.
|
||||
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.mdx) for each command you wish to make
|
||||
available.
|
||||
</Callout>
|
||||
|
||||
<br />
|
||||
|
|
@ -56,8 +73,6 @@ hyperglass uses [Netmiko](https://github.com/ktbyers/netmiko) to interact with d
|
|||
|
||||
## Other Platforms
|
||||
|
||||
| Platform | Key | Natively Supported |
|
||||
| :---------------- | :----- | :-------------------------------------------------------------------------: |
|
||||
| FRRouting | `frr` | <Supported/> |
|
||||
| BIRD | `bird` | <Supported/> |
|
||||
| Any HTTP Endpoint | `http` | [See HTTP Device Docs](/configuration/reference/devices#http-configuration) |
|
||||
| Platform | Key | Natively Supported |
|
||||
| :---------------- | :----- | :------------------------------------------------------------------: |
|
||||
| Any HTTP Endpoint | `http` | [See HTTP Device Docs](configuration/devices.mdx#http-configuration) |
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,130 +1,137 @@
|
|||
import styles from './global.module.css';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useConfig, type DocsThemeConfig } from 'nextra-theme-docs';
|
||||
import faviconFormats from './favicon-formats';
|
||||
import { useRouter } from "next/router";
|
||||
import { type DocsThemeConfig, useConfig } from "nextra-theme-docs";
|
||||
import faviconFormats from "./favicon-formats";
|
||||
import styles from "./global.module.css";
|
||||
|
||||
const NO_INDEX_FOLLOW = process.env.CF_PAGES_BRANCH !== 'main';
|
||||
const NO_INDEX_FOLLOW = process.env.CF_PAGES_BRANCH !== "main";
|
||||
|
||||
const config: DocsThemeConfig = {
|
||||
logo: (
|
||||
<span className={styles.logo}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2759.9 544.87" width={200}>
|
||||
<g fill="currentColor">
|
||||
<g>
|
||||
<path
|
||||
d="M931.39,683.15q20.28,21.23,20.28,62.74l0,134.13c0,3.35-.85,5.94-2.51,7.76a10.52,10.52,0,0,1-14.15,0c-1.67-1.82-2.51-4.4-2.5-7.75l0-131.86q0-35.58-14.12-51.79t-45.62-16.21q-35.13,0-56.35,21.65t-21.24,57.71l0,120.44q0,5-2.51,7.76a9.12,9.12,0,0,1-7.07,2.74,9,9,0,0,1-6.84-3A10.66,10.66,0,0,1,776,880l.12-305.23q0-5,2.51-7.76a10.52,10.52,0,0,1,14.15,0c1.66,1.83,2.5,4.41,2.5,7.76l0,131.39a71.74,71.74,0,0,1,30.13-32.83q20.07-11.4,46.08-11.39Q911.09,661.93,931.39,683.15Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1201.26,663a9.19,9.19,0,0,1,6.39,2.51,8.56,8.56,0,0,1,2.73,6.62,14.35,14.35,0,0,1-.91,4.1l-131,290.12q-2.75,5.48-8.22,5.47a8.83,8.83,0,0,1-6.16-2.28,7.66,7.66,0,0,1-2.5-5.93l.91-3.65,32.88-72.08L999.6,676.1a14.33,14.33,0,0,1-.91-4.11,8.65,8.65,0,0,1,3.19-6.84,10.93,10.93,0,0,1,7.3-2.73q5,0,7.76,5.48l88,198.49.91-2.28,86.76-194.78C1194.42,665.08,1197.31,662.94,1201.26,663Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1406.57,676.48q22.34,14.38,34.66,40.39t12.29,60.69q0,34.22-12.34,60t-34.69,39.91q-22.37,14.13-51.56,14.12-27.84,0-47.67-12.33t-29.88-35.6l0,118.62c0,3.35-.84,5.93-2.51,7.76a9.15,9.15,0,0,1-7.07,2.73q-9.59,0-9.58-10.5l.11-289.25a10.34,10.34,0,0,1,2.51-7.3,10.49,10.49,0,0,1,14.14,0,10.42,10.42,0,0,1,2.51,7.3v36q10-22.81,29.89-34.9T1355,662.09Q1384.21,662.11,1406.57,676.48ZM1412,848q20.54-24.85,20.55-70.48T1412,706.37q-20.52-25.56-57-25.57-37.41,0-57.5,24.84t-20.1,70.94q0,46.09,20,71.18t57,25.12Q1391.44,872.9,1412,848Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1688.91,847.68a8.28,8.28,0,0,1,2.28,5.71,14.17,14.17,0,0,1-3.43,8.89q-3.42,4.35-12.09,9.81-32.85,19.6-68,19.59-49.73,0-78.23-30.6t-28.49-84q0-34.22,12.8-60.22t36.06-40.36q23.28-14.37,53.39-14.35,42,0,66.14,27.4t24.15,74.83q0,8.21-3.19,11.86t-11.41,3.65l-157-.06q.43,44.71,22.56,68.9t62.27,24.2q21.9,0,36.27-5.91a146.07,146.07,0,0,0,28.07-15.51q9.57-6.37,12.32-6.38A7.16,7.16,0,0,1,1688.91,847.68Zm-141.61-146q-21.22,21.68-24.89,60.44l152.85.06q-.91-39.69-19.6-60.91T1603.2,680Q1568.52,680,1547.3,701.63Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1855.05,663.19c3.65,0,6.16.69,7.52,2.06s2.06,3.42,2.06,6.16q0,7.77-9.59,9.12l-13.69,1.37q-33.3,3.18-50.19,24.61a77.43,77.43,0,0,0-16.9,49.27l0,124.56q0,5-2.51,7.75a10.5,10.5,0,0,1-14.15,0c-1.67-1.83-2.5-4.41-2.5-7.76l.08-206.68q0-10.49,9.58-10.49a9.25,9.25,0,0,1,6.84,2.74c1.83,1.83,2.74,4.41,2.74,7.76v32.85q19.62-39.22,71.19-42.86l6.38-.46Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2078.6,666a9.84,9.84,0,0,1,2.74,7.3l-.08,204.85q0,47.45-22.38,71.62T1992.26,974q-24.65,0-43.34-4.58a127.8,127.8,0,0,1-36-15.07q-8.67-5.47-12.32-9.81a13.79,13.79,0,0,1-3.64-8.9,7.82,7.82,0,0,1,8.21-8.21q2.28,0,11.86,5.48a204.67,204.67,0,0,0,32.85,16q16.86,6.39,43.34,6.4,33.75,0,51.56-18.91t17.81-55.43l0-47.9q-9.59,23.71-29.9,36.26t-49.05,12.53q-29.2,0-51.78-13.71t-35.11-38.8q-12.54-25.08-12.53-57.49t12.57-57.25q12.56-24.85,35.15-38.54t51.79-13.67q28.27,0,48.35,12.34t30.1,35.14l0-36q0-10.5,9.58-10.49A9.25,9.25,0,0,1,2078.6,666Zm-37.25,172.67q20.78-24.39,20.79-66.83t-20.73-66.62q-20.76-24.18-57.71-24.2-36.51,0-57.72,24.16t-21.25,66.6q0,42.88,21.19,67.08t57.71,24.2Q2020.59,863.1,2041.35,838.69Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2161.32,888.24c-1.67-1.83-2.51-4.41-2.5-7.76l.11-305.22q0-5,2.51-7.76a9.09,9.09,0,0,1,7.08-2.73,9,9,0,0,1,6.84,3,10.73,10.73,0,0,1,2.73,7.53L2178,880.49a10.75,10.75,0,0,1-2.74,7.53,9,9,0,0,1-6.85,3A9.09,9.09,0,0,1,2161.32,888.24Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2416.64,744.16l0,136q0,5-2.51,7.76a9.12,9.12,0,0,1-7.08,2.73,9.45,9.45,0,0,1-7.29-3,10.66,10.66,0,0,1-2.74-7.53V848.18q-10,21-29,32.38T2324.88,892a84.41,84.41,0,0,1-38.32-8.68,71.93,71.93,0,0,1-27.6-23.51,59.47,59.47,0,0,1-10.71-33.08q-.43-25.08,12.34-38.78t42.89-19.6q30.12-5.91,84.41-5.9H2397V743.24q0-32.38-13-47.22t-40.83-14.85q-21.9,0-39,5.69t-27.15,13q-1.83,1.38-7.53,5.25c-3.81,2.59-6.93,3.87-9.36,3.87a7.82,7.82,0,0,1-5.7-2.51,8.37,8.37,0,0,1-2.51-6.16q0-8.65,16-18.24a134.23,134.23,0,0,1,34.91-14.59,146.13,146.13,0,0,1,37.64-5Q2416.67,662.5,2416.64,744.16ZM2361.85,863a69.15,69.15,0,0,0,25.78-27.13q9.36-17.34,9.37-39.24V780.2h-8.67q-47.91,0-73,3.85t-35.14,13.21q-10,9.36-10,27.6,0,21,15.49,34.46t39.24,13.47Q2345.41,872.79,2361.85,863Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2526.54,886.78a122.09,122.09,0,0,1-31.93-14.38q-9.14-5.92-12.32-9.82a13.55,13.55,0,0,1-3.19-8.89,8.24,8.24,0,0,1,2.29-5.71,7.17,7.17,0,0,1,5.47-2.5q2.28,0,6.16,2.51c2.58,1.67,4.33,2.82,5.25,3.42a142.87,142.87,0,0,0,27.59,15.75q14.37,6.17,36.27,6.18,29.65,0,45.63-10.94t16-31q0-11.85-5.7-19.62t-18.7-13.46q-13-5.7-37.17-11.19Q2522,778,2504.69,763.82t-17.33-37.42q0-28.29,22.15-46.08t57.26-17.77a114.74,114.74,0,0,1,32.4,4.58,95.21,95.21,0,0,1,27.37,12.78q8.65,6.4,12.54,11.19a15.49,15.49,0,0,1,3.87,9.81,8.24,8.24,0,0,1-2.28,5.7,7.18,7.18,0,0,1-5.48,2.51c-2.44,0-6.38-2.29-11.86-6.85a127.56,127.56,0,0,0-24.86-15.07q-13-5.93-32.62-5.94-25.54,0-41.29,12.07T2508.81,725q0,11.87,5,19.39t17.1,13q12.09,5.47,34.45,10.5,31.47,7.78,48.35,15.76t24,19.18q7.07,11.18,7.06,28.51,0,27.38-22.6,44t-60,16.63A125.17,125.17,0,0,1,2526.54,886.78Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2743.71,886.86a121.76,121.76,0,0,1-31.93-14.38q-9.14-5.93-12.32-9.81a13.6,13.6,0,0,1-3.19-8.9,8.25,8.25,0,0,1,2.29-5.7,7.14,7.14,0,0,1,5.47-2.51q2.28,0,6.16,2.51l5.25,3.42a143.22,143.22,0,0,0,27.6,15.76q14.36,6.16,36.26,6.17,29.65,0,45.63-10.93t16-31q0-11.87-5.69-19.62t-18.7-13.47q-13-5.7-37.18-11.19-40.15-9.13-57.48-23.29t-17.32-37.42q0-28.29,22.14-46.07T2784,662.64a114.31,114.31,0,0,1,32.39,4.57A94.83,94.83,0,0,1,2843.71,680q8.65,6.39,12.54,11.18a15.51,15.51,0,0,1,3.87,9.81,8.24,8.24,0,0,1-2.28,5.7,7.12,7.12,0,0,1-5.47,2.51q-3.66,0-11.86-6.85a128.65,128.65,0,0,0-24.86-15.07q-13-5.92-32.62-5.94-25.56,0-41.3,12.08T2726,725.12q0,11.86,5,19.39t17.1,13q12.09,5.47,34.45,10.51,31.47,7.77,48.35,15.76t24,19.17q7.07,11.19,7.06,28.51,0,27.38-22.6,44t-60,16.62A125.19,125.19,0,0,1,2743.71,886.86Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<path
|
||||
d="M629,748.94A254.5,254.5,0,0,1,177.8,910.5a253.51,253.51,0,0,1-57-141.26A254.75,254.75,0,0,1,269.49,517c48.18-22.05,103.68-28.13,155.56-17.55a253.76,253.76,0,0,1,204,249.5c0,11.58,18,11.6,18,0-.15-56.09-17.45-111.67-50.07-157.4A275.77,275.77,0,0,0,468,492.94c-53.4-19.67-113.16-21.73-167.89-6.22A272.65,272.65,0,0,0,141.23,889.87c28.26,46.62,70.66,84.65,120.38,107.11a275.73,275.73,0,0,0,167.55,18.95,272.71,272.71,0,0,0,142.15-78.52c38.14-39.87,64-91.3,72.33-145.91A287.4,287.4,0,0,0,647,748.94C647,737.36,629,737.34,629,748.94Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M276.33,926.44a203,203,0,0,0,98.67,26c7.72,0,7.73-12,0-12a190.29,190.29,0,0,1-92.62-24.36c-6.74-3.79-12.79,6.58-6.05,10.36Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M233.58,611c-28.56,28.78-48.31,65.84-55.4,105.83a199.79,199.79,0,0,0,55.4,177c5.45,5.49,13.93-3,8.48-8.48C186.68,829.56,171,742.65,205.27,671.45a191.94,191.94,0,0,1,36.79-52c5.45-5.48-3-14-8.48-8.48Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
),
|
||||
|
||||
useNextSeoProps: () => {
|
||||
const { asPath } = useRouter();
|
||||
const { frontMatter, title } = useConfig();
|
||||
return {
|
||||
titleTemplate: '%s | hyperglass',
|
||||
title: frontMatter.title || title,
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
url: `https://hyperglass.dev${asPath}`,
|
||||
title: frontMatter.title || title,
|
||||
description: frontMatter.description || 'hyperglass Documentation',
|
||||
images: [
|
||||
{
|
||||
url: 'https://hyperglass.dev/opengraph.jpg',
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: 'hyperglass',
|
||||
},
|
||||
],
|
||||
},
|
||||
twitter: { handle: '@thatmattlove', site: '@thatmattlove', cardType: 'summary_large_image' },
|
||||
noindex: NO_INDEX_FOLLOW,
|
||||
nofollow: NO_INDEX_FOLLOW,
|
||||
additionalLinkTags: faviconFormats.map(fmt => {
|
||||
const { image_format, dimensions, prefix, rel } = fmt;
|
||||
const [w, h] = dimensions;
|
||||
const href = `/img/${prefix}-${w}x${h}.${image_format}`;
|
||||
return { rel: rel ?? '', href, type: `image/${image_format}` };
|
||||
}),
|
||||
};
|
||||
},
|
||||
banner: {
|
||||
dismissible: true,
|
||||
text: '🎉 hyperglass 2.0 is here!',
|
||||
},
|
||||
feedback: { content: null },
|
||||
footer: { text: `© ${new Date().getFullYear()} hyperglass` },
|
||||
chat: {
|
||||
link: 'https://netdev.chat/',
|
||||
icon: (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 448 512"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M94.12 315.1c0 25.9-21.16 47.06-47.06 47.06S0 341 0 315.1c0-25.9 21.16-47.06 47.06-47.06h47.06v47.06zm23.72 0c0-25.9 21.16-47.06 47.06-47.06s47.06 21.16 47.06 47.06v117.84c0 25.9-21.16 47.06-47.06 47.06s-47.06-21.16-47.06-47.06V315.1zm47.06-188.98c-25.9 0-47.06-21.16-47.06-47.06S139 32 164.9 32s47.06 21.16 47.06 47.06v47.06H164.9zm0 23.72c25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06H47.06C21.16 243.96 0 222.8 0 196.9s21.16-47.06 47.06-47.06H164.9zm188.98 47.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06h-47.06V196.9zm-23.72 0c0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06V79.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06V196.9zM283.1 385.88c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06v-47.06h47.06zm0-23.72c-25.9 0-47.06-21.16-47.06-47.06 0-25.9 21.16-47.06 47.06-47.06h117.84c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06H283.1z" />
|
||||
</svg>
|
||||
logo: (
|
||||
<span className={styles.logo}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2759.9 544.87" width={200}>
|
||||
<title>hyperglass</title>
|
||||
<g fill="currentColor">
|
||||
<g>
|
||||
<path
|
||||
d="M931.39,683.15q20.28,21.23,20.28,62.74l0,134.13c0,3.35-.85,5.94-2.51,7.76a10.52,10.52,0,0,1-14.15,0c-1.67-1.82-2.51-4.4-2.5-7.75l0-131.86q0-35.58-14.12-51.79t-45.62-16.21q-35.13,0-56.35,21.65t-21.24,57.71l0,120.44q0,5-2.51,7.76a9.12,9.12,0,0,1-7.07,2.74,9,9,0,0,1-6.84-3A10.66,10.66,0,0,1,776,880l.12-305.23q0-5,2.51-7.76a10.52,10.52,0,0,1,14.15,0c1.66,1.83,2.5,4.41,2.5,7.76l0,131.39a71.74,71.74,0,0,1,30.13-32.83q20.07-11.4,46.08-11.39Q911.09,661.93,931.39,683.15Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1201.26,663a9.19,9.19,0,0,1,6.39,2.51,8.56,8.56,0,0,1,2.73,6.62,14.35,14.35,0,0,1-.91,4.1l-131,290.12q-2.75,5.48-8.22,5.47a8.83,8.83,0,0,1-6.16-2.28,7.66,7.66,0,0,1-2.5-5.93l.91-3.65,32.88-72.08L999.6,676.1a14.33,14.33,0,0,1-.91-4.11,8.65,8.65,0,0,1,3.19-6.84,10.93,10.93,0,0,1,7.3-2.73q5,0,7.76,5.48l88,198.49.91-2.28,86.76-194.78C1194.42,665.08,1197.31,662.94,1201.26,663Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1406.57,676.48q22.34,14.38,34.66,40.39t12.29,60.69q0,34.22-12.34,60t-34.69,39.91q-22.37,14.13-51.56,14.12-27.84,0-47.67-12.33t-29.88-35.6l0,118.62c0,3.35-.84,5.93-2.51,7.76a9.15,9.15,0,0,1-7.07,2.73q-9.59,0-9.58-10.5l.11-289.25a10.34,10.34,0,0,1,2.51-7.3,10.49,10.49,0,0,1,14.14,0,10.42,10.42,0,0,1,2.51,7.3v36q10-22.81,29.89-34.9T1355,662.09Q1384.21,662.11,1406.57,676.48ZM1412,848q20.54-24.85,20.55-70.48T1412,706.37q-20.52-25.56-57-25.57-37.41,0-57.5,24.84t-20.1,70.94q0,46.09,20,71.18t57,25.12Q1391.44,872.9,1412,848Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1688.91,847.68a8.28,8.28,0,0,1,2.28,5.71,14.17,14.17,0,0,1-3.43,8.89q-3.42,4.35-12.09,9.81-32.85,19.6-68,19.59-49.73,0-78.23-30.6t-28.49-84q0-34.22,12.8-60.22t36.06-40.36q23.28-14.37,53.39-14.35,42,0,66.14,27.4t24.15,74.83q0,8.21-3.19,11.86t-11.41,3.65l-157-.06q.43,44.71,22.56,68.9t62.27,24.2q21.9,0,36.27-5.91a146.07,146.07,0,0,0,28.07-15.51q9.57-6.37,12.32-6.38A7.16,7.16,0,0,1,1688.91,847.68Zm-141.61-146q-21.22,21.68-24.89,60.44l152.85.06q-.91-39.69-19.6-60.91T1603.2,680Q1568.52,680,1547.3,701.63Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M1855.05,663.19c3.65,0,6.16.69,7.52,2.06s2.06,3.42,2.06,6.16q0,7.77-9.59,9.12l-13.69,1.37q-33.3,3.18-50.19,24.61a77.43,77.43,0,0,0-16.9,49.27l0,124.56q0,5-2.51,7.75a10.5,10.5,0,0,1-14.15,0c-1.67-1.83-2.5-4.41-2.5-7.76l.08-206.68q0-10.49,9.58-10.49a9.25,9.25,0,0,1,6.84,2.74c1.83,1.83,2.74,4.41,2.74,7.76v32.85q19.62-39.22,71.19-42.86l6.38-.46Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2078.6,666a9.84,9.84,0,0,1,2.74,7.3l-.08,204.85q0,47.45-22.38,71.62T1992.26,974q-24.65,0-43.34-4.58a127.8,127.8,0,0,1-36-15.07q-8.67-5.47-12.32-9.81a13.79,13.79,0,0,1-3.64-8.9,7.82,7.82,0,0,1,8.21-8.21q2.28,0,11.86,5.48a204.67,204.67,0,0,0,32.85,16q16.86,6.39,43.34,6.4,33.75,0,51.56-18.91t17.81-55.43l0-47.9q-9.59,23.71-29.9,36.26t-49.05,12.53q-29.2,0-51.78-13.71t-35.11-38.8q-12.54-25.08-12.53-57.49t12.57-57.25q12.56-24.85,35.15-38.54t51.79-13.67q28.27,0,48.35,12.34t30.1,35.14l0-36q0-10.5,9.58-10.49A9.25,9.25,0,0,1,2078.6,666Zm-37.25,172.67q20.78-24.39,20.79-66.83t-20.73-66.62q-20.76-24.18-57.71-24.2-36.51,0-57.72,24.16t-21.25,66.6q0,42.88,21.19,67.08t57.71,24.2Q2020.59,863.1,2041.35,838.69Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2161.32,888.24c-1.67-1.83-2.51-4.41-2.5-7.76l.11-305.22q0-5,2.51-7.76a9.09,9.09,0,0,1,7.08-2.73,9,9,0,0,1,6.84,3,10.73,10.73,0,0,1,2.73,7.53L2178,880.49a10.75,10.75,0,0,1-2.74,7.53,9,9,0,0,1-6.85,3A9.09,9.09,0,0,1,2161.32,888.24Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2416.64,744.16l0,136q0,5-2.51,7.76a9.12,9.12,0,0,1-7.08,2.73,9.45,9.45,0,0,1-7.29-3,10.66,10.66,0,0,1-2.74-7.53V848.18q-10,21-29,32.38T2324.88,892a84.41,84.41,0,0,1-38.32-8.68,71.93,71.93,0,0,1-27.6-23.51,59.47,59.47,0,0,1-10.71-33.08q-.43-25.08,12.34-38.78t42.89-19.6q30.12-5.91,84.41-5.9H2397V743.24q0-32.38-13-47.22t-40.83-14.85q-21.9,0-39,5.69t-27.15,13q-1.83,1.38-7.53,5.25c-3.81,2.59-6.93,3.87-9.36,3.87a7.82,7.82,0,0,1-5.7-2.51,8.37,8.37,0,0,1-2.51-6.16q0-8.65,16-18.24a134.23,134.23,0,0,1,34.91-14.59,146.13,146.13,0,0,1,37.64-5Q2416.67,662.5,2416.64,744.16ZM2361.85,863a69.15,69.15,0,0,0,25.78-27.13q9.36-17.34,9.37-39.24V780.2h-8.67q-47.91,0-73,3.85t-35.14,13.21q-10,9.36-10,27.6,0,21,15.49,34.46t39.24,13.47Q2345.41,872.79,2361.85,863Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2526.54,886.78a122.09,122.09,0,0,1-31.93-14.38q-9.14-5.92-12.32-9.82a13.55,13.55,0,0,1-3.19-8.89,8.24,8.24,0,0,1,2.29-5.71,7.17,7.17,0,0,1,5.47-2.5q2.28,0,6.16,2.51c2.58,1.67,4.33,2.82,5.25,3.42a142.87,142.87,0,0,0,27.59,15.75q14.37,6.17,36.27,6.18,29.65,0,45.63-10.94t16-31q0-11.85-5.7-19.62t-18.7-13.46q-13-5.7-37.17-11.19Q2522,778,2504.69,763.82t-17.33-37.42q0-28.29,22.15-46.08t57.26-17.77a114.74,114.74,0,0,1,32.4,4.58,95.21,95.21,0,0,1,27.37,12.78q8.65,6.4,12.54,11.19a15.49,15.49,0,0,1,3.87,9.81,8.24,8.24,0,0,1-2.28,5.7,7.18,7.18,0,0,1-5.48,2.51c-2.44,0-6.38-2.29-11.86-6.85a127.56,127.56,0,0,0-24.86-15.07q-13-5.93-32.62-5.94-25.54,0-41.29,12.07T2508.81,725q0,11.87,5,19.39t17.1,13q12.09,5.47,34.45,10.5,31.47,7.78,48.35,15.76t24,19.18q7.07,11.18,7.06,28.51,0,27.38-22.6,44t-60,16.63A125.17,125.17,0,0,1,2526.54,886.78Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M2743.71,886.86a121.76,121.76,0,0,1-31.93-14.38q-9.14-5.93-12.32-9.81a13.6,13.6,0,0,1-3.19-8.9,8.25,8.25,0,0,1,2.29-5.7,7.14,7.14,0,0,1,5.47-2.51q2.28,0,6.16,2.51l5.25,3.42a143.22,143.22,0,0,0,27.6,15.76q14.36,6.16,36.26,6.17,29.65,0,45.63-10.93t16-31q0-11.87-5.69-19.62t-18.7-13.47q-13-5.7-37.18-11.19-40.15-9.13-57.48-23.29t-17.32-37.42q0-28.29,22.14-46.07T2784,662.64a114.31,114.31,0,0,1,32.39,4.57A94.83,94.83,0,0,1,2843.71,680q8.65,6.39,12.54,11.18a15.51,15.51,0,0,1,3.87,9.81,8.24,8.24,0,0,1-2.28,5.7,7.12,7.12,0,0,1-5.47,2.51q-3.66,0-11.86-6.85a128.65,128.65,0,0,0-24.86-15.07q-13-5.92-32.62-5.94-25.56,0-41.3,12.08T2726,725.12q0,11.86,5,19.39t17.1,13q12.09,5.47,34.45,10.51,31.47,7.77,48.35,15.76t24,19.17q7.07,11.19,7.06,28.51,0,27.38-22.6,44t-60,16.62A125.19,125.19,0,0,1,2743.71,886.86Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<path
|
||||
d="M629,748.94A254.5,254.5,0,0,1,177.8,910.5a253.51,253.51,0,0,1-57-141.26A254.75,254.75,0,0,1,269.49,517c48.18-22.05,103.68-28.13,155.56-17.55a253.76,253.76,0,0,1,204,249.5c0,11.58,18,11.6,18,0-.15-56.09-17.45-111.67-50.07-157.4A275.77,275.77,0,0,0,468,492.94c-53.4-19.67-113.16-21.73-167.89-6.22A272.65,272.65,0,0,0,141.23,889.87c28.26,46.62,70.66,84.65,120.38,107.11a275.73,275.73,0,0,0,167.55,18.95,272.71,272.71,0,0,0,142.15-78.52c38.14-39.87,64-91.3,72.33-145.91A287.4,287.4,0,0,0,647,748.94C647,737.36,629,737.34,629,748.94Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M276.33,926.44a203,203,0,0,0,98.67,26c7.72,0,7.73-12,0-12a190.29,190.29,0,0,1-92.62-24.36c-6.74-3.79-12.79,6.58-6.05,10.36Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
<path
|
||||
d="M233.58,611c-28.56,28.78-48.31,65.84-55.4,105.83a199.79,199.79,0,0,0,55.4,177c5.45,5.49,13.93-3,8.48-8.48C186.68,829.56,171,742.65,205.27,671.45a191.94,191.94,0,0,1,36.79-52c5.45-5.48-3-14-8.48-8.48Z"
|
||||
transform="translate(-102 -476.45)"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
),
|
||||
},
|
||||
project: {
|
||||
link: 'https://github.com/thatmattlove/hyperglass',
|
||||
},
|
||||
|
||||
useNextSeoProps: () => {
|
||||
const { asPath } = useRouter();
|
||||
const { frontMatter, title } = useConfig();
|
||||
return {
|
||||
titleTemplate: "%s | hyperglass",
|
||||
title: frontMatter.title || title,
|
||||
openGraph: {
|
||||
type: "website",
|
||||
url: `https://hyperglass.dev${asPath}`,
|
||||
title: frontMatter.title || title,
|
||||
description: frontMatter.description || "hyperglass Documentation",
|
||||
images: [
|
||||
{
|
||||
url: "https://hyperglass.dev/opengraph.jpg",
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: "hyperglass",
|
||||
},
|
||||
],
|
||||
},
|
||||
twitter: {
|
||||
handle: "@thatmattlove",
|
||||
site: "@thatmattlove",
|
||||
cardType: "summary_large_image",
|
||||
},
|
||||
noindex: NO_INDEX_FOLLOW,
|
||||
nofollow: NO_INDEX_FOLLOW,
|
||||
additionalLinkTags: faviconFormats.map((fmt) => {
|
||||
const { image_format, dimensions, prefix, rel } = fmt;
|
||||
const [w, h] = dimensions;
|
||||
const href = `/img/${prefix}-${w}x${h}.${image_format}`;
|
||||
return { rel: rel ?? "", href, type: `image/${image_format}` };
|
||||
}),
|
||||
};
|
||||
},
|
||||
banner: {
|
||||
dismissible: true,
|
||||
// text: "🎉 hyperglass 2.0 is here!",
|
||||
text: "😬 hyperglass 2.0 and its documentation is still in development!",
|
||||
},
|
||||
feedback: { content: null },
|
||||
footer: { text: `© ${new Date().getFullYear()} hyperglass` },
|
||||
chat: {
|
||||
link: "https://netdev.chat/",
|
||||
icon: (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 448 512"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<title>NetDev Chat</title>
|
||||
<path d="M94.12 315.1c0 25.9-21.16 47.06-47.06 47.06S0 341 0 315.1c0-25.9 21.16-47.06 47.06-47.06h47.06v47.06zm23.72 0c0-25.9 21.16-47.06 47.06-47.06s47.06 21.16 47.06 47.06v117.84c0 25.9-21.16 47.06-47.06 47.06s-47.06-21.16-47.06-47.06V315.1zm47.06-188.98c-25.9 0-47.06-21.16-47.06-47.06S139 32 164.9 32s47.06 21.16 47.06 47.06v47.06H164.9zm0 23.72c25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06H47.06C21.16 243.96 0 222.8 0 196.9s21.16-47.06 47.06-47.06H164.9zm188.98 47.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06h-47.06V196.9zm-23.72 0c0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06V79.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06V196.9zM283.1 385.88c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06v-47.06h47.06zm0-23.72c-25.9 0-47.06-21.16-47.06-47.06 0-25.9 21.16-47.06 47.06-47.06h117.84c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06H283.1z" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
project: {
|
||||
link: "https://github.com/thatmattlove/hyperglass",
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ __all__ = (
|
|||
"AristaBGPCommunityTable",
|
||||
)
|
||||
|
||||
NAME = "Arista EOS"
|
||||
PLATFORMS = ["arista_eos"]
|
||||
|
||||
AristaBGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_arista_eos_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -37,7 +40,7 @@ AristaBGPRoute = BuiltinDirective(
|
|||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
table_output="__hyperglass_arista_eos_bgp_route_table__",
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
AristaBGPASPath = BuiltinDirective(
|
||||
|
|
@ -55,7 +58,7 @@ AristaBGPASPath = BuiltinDirective(
|
|||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
table_output="__hyperglass_arista_eos_bgp_aspath_table__",
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
AristaBGPCommunity = BuiltinDirective(
|
||||
|
|
@ -73,7 +76,7 @@ AristaBGPCommunity = BuiltinDirective(
|
|||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
table_output="__hyperglass_arista_eos_bgp_community_table__",
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -93,7 +96,7 @@ AristaPing = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
AristaTraceroute = BuiltinDirective(
|
||||
|
|
@ -112,7 +115,7 @@ AristaTraceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
# Table Output Directives
|
||||
|
|
@ -133,7 +136,7 @@ AristaBGPRouteTable = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
AristaBGPASPathTable = BuiltinDirective(
|
||||
|
|
@ -150,7 +153,7 @@ AristaBGPASPathTable = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
AristaBGPCommunityTable = BuiltinDirective(
|
||||
|
|
@ -167,5 +170,5 @@ AristaBGPCommunityTable = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["arista_eos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"BIRD_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "BIRD"
|
||||
PLATFORMS = ["bird"]
|
||||
|
||||
BIRD_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_bird_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ BIRD_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["bird"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
BIRD_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -49,7 +52,7 @@ BIRD_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["bird"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
BIRD_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -65,7 +68,7 @@ BIRD_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["bird"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
BIRD_Ping = BuiltinDirective(
|
||||
|
|
@ -84,7 +87,7 @@ BIRD_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["bird"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
BIRD_Traceroute = BuiltinDirective(
|
||||
|
|
@ -103,5 +106,5 @@ BIRD_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["bird"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"CiscoIOS_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "Cisco IOS"
|
||||
PLATFORMS = ["cisco_ios"]
|
||||
|
||||
CiscoIOS_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_cisco_ios_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ CiscoIOS_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_ios"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoIOS_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ CiscoIOS_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["cisco_ios"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoIOS_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ CiscoIOS_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["cisco_ios"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoIOS_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ CiscoIOS_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_ios"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoIOS_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ CiscoIOS_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_ios"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"CiscoNXOS_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "Cisco NX-OS"
|
||||
PLATFORMS = ["cisco_nxos"]
|
||||
|
||||
CiscoNXOS_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_cisco_nxos_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ CiscoNXOS_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_nxos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoNXOS_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ CiscoNXOS_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["cisco_nxos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoNXOS_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ CiscoNXOS_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["cisco_nxos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoNXOS_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ CiscoNXOS_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_nxos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoNXOS_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ CiscoNXOS_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_nxos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"CiscoXR_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "Cisco IOS-XR"
|
||||
PLATFORMS = ["cisco_xr"]
|
||||
|
||||
CiscoXR_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_cisco_xr_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ CiscoXR_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_xr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoXR_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ CiscoXR_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["cisco_xr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoXR_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ CiscoXR_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["cisco_xr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoXR_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ CiscoXR_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_xr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
CiscoXR_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ CiscoXR_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["cisco_xr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"FRRouting_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "FRRouting"
|
||||
PLATFORMS = ["frr"]
|
||||
|
||||
FRRouting_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_frr_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ FRRouting_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["frr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
FRRouting_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ FRRouting_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["frr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
FRRouting_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ FRRouting_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["frr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
FRRouting_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ FRRouting_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["frr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
FRRouting_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ FRRouting_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["frr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"Huawei_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "Huawei VRP"
|
||||
PLATFORMS = ["huawei", "huawei_vrpv8"]
|
||||
|
||||
Huawei_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_huawei_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ Huawei_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["huawei"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Huawei_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ Huawei_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["huawei"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Huawei_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ Huawei_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["huawei"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Huawei_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ Huawei_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["huawei"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Huawei_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ Huawei_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["huawei"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ __all__ = (
|
|||
"JuniperBGPCommunityTable",
|
||||
)
|
||||
|
||||
NAME = "Juniper Junos"
|
||||
PLATFORMS = ["juniper", "juniper_junos"]
|
||||
|
||||
JuniperBGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_juniper_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -37,7 +40,7 @@ JuniperBGPRoute = BuiltinDirective(
|
|||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
table_output="__hyperglass_juniper_bgp_route_table__",
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
JuniperBGPASPath = BuiltinDirective(
|
||||
|
|
@ -55,7 +58,7 @@ JuniperBGPASPath = BuiltinDirective(
|
|||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
table_output="__hyperglass_juniper_bgp_aspath_table__",
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
JuniperBGPCommunity = BuiltinDirective(
|
||||
|
|
@ -73,7 +76,7 @@ JuniperBGPCommunity = BuiltinDirective(
|
|||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
table_output="__hyperglass_juniper_bgp_community_table__",
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -93,7 +96,7 @@ JuniperPing = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
JuniperTraceroute = BuiltinDirective(
|
||||
|
|
@ -112,7 +115,7 @@ JuniperTraceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
# Table Output Directives
|
||||
|
|
@ -133,7 +136,7 @@ JuniperBGPRouteTable = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
JuniperBGPASPathTable = BuiltinDirective(
|
||||
|
|
@ -150,7 +153,7 @@ JuniperBGPASPathTable = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
JuniperBGPCommunityTable = BuiltinDirective(
|
||||
|
|
@ -167,5 +170,5 @@ JuniperBGPCommunityTable = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["juniper"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"Mikrotik_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "Mikrotik"
|
||||
PLATFORMS = ["mikrotik_routeros", "mikrotik_switchos"]
|
||||
|
||||
Mikrotik_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_mikrotik_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ Mikrotik_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["mikrotik_routeros", "mikrotik_switchos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Mikrotik_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ Mikrotik_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["mikrotik_routeros", "mikrotik_switchos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Mikrotik_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ Mikrotik_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["mikrotik_routeros", "mikrotik_switchos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Mikrotik_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ Mikrotik_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["mikrotik_routeros", "mikrotik_switchos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
Mikrotik_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ Mikrotik_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["mikrotik_routeros", "mikrotik_switchos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"NokiaSROS_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "Nokia SR OS"
|
||||
PLATFORMS = ["nokia_sros"]
|
||||
|
||||
NokiaSROS_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_nokia_sros_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ NokiaSROS_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["nokia_sros"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
NokiaSROS_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -49,7 +52,7 @@ NokiaSROS_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["nokia_sros"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
NokiaSROS_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -65,7 +68,7 @@ NokiaSROS_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["nokia_sros"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
NokiaSROS_Ping = BuiltinDirective(
|
||||
|
|
@ -84,7 +87,7 @@ NokiaSROS_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["nokia_sros"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
NokiaSROS_Traceroute = BuiltinDirective(
|
||||
|
|
@ -103,5 +106,5 @@ NokiaSROS_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["nokia_sros"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"OpenBGPD_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "OpenBGPD"
|
||||
PLATFORMS = ["openbgpd"]
|
||||
|
||||
OpenBGPD_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_openbgpd_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ OpenBGPD_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["openbgpd"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
OpenBGPD_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ OpenBGPD_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["openbgpd"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
OpenBGPD_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ OpenBGPD_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["openbgpd"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
OpenBGPD_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ OpenBGPD_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["openbgpd"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
OpenBGPD_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ OpenBGPD_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["openbgpd"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"TNSR_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "TNSR"
|
||||
PLATFORMS = ["tnsr"]
|
||||
|
||||
TNSR_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_tnsr_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ TNSR_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["tnsr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
TNSR_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ TNSR_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["tnsr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
TNSR_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ TNSR_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["tnsr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
TNSR_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ TNSR_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["tnsr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
TNSR_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ TNSR_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["tnsr"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ __all__ = (
|
|||
"VyOS_Traceroute",
|
||||
)
|
||||
|
||||
NAME = "VyOS"
|
||||
PLATFORMS = ["vyos"]
|
||||
|
||||
VyOS_BGPRoute = BuiltinDirective(
|
||||
id="__hyperglass_vyos_bgp_route__",
|
||||
name="BGP Route",
|
||||
|
|
@ -33,7 +36,7 @@ VyOS_BGPRoute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["vyos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
VyOS_BGPASPath = BuiltinDirective(
|
||||
|
|
@ -50,7 +53,7 @@ VyOS_BGPASPath = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="AS Path Regular Expression"),
|
||||
platforms=["vyos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
VyOS_BGPCommunity = BuiltinDirective(
|
||||
|
|
@ -67,7 +70,7 @@ VyOS_BGPCommunity = BuiltinDirective(
|
|||
)
|
||||
],
|
||||
field=Text(description="BGP Community String"),
|
||||
platforms=["vyos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
VyOS_Ping = BuiltinDirective(
|
||||
|
|
@ -86,7 +89,7 @@ VyOS_Ping = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["vyos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
||||
VyOS_Traceroute = BuiltinDirective(
|
||||
|
|
@ -105,5 +108,5 @@ VyOS_Traceroute = BuiltinDirective(
|
|||
),
|
||||
],
|
||||
field=Text(description="IP Address, Prefix, or Hostname"),
|
||||
platforms=["vyos"],
|
||||
platforms=PLATFORMS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,11 +2,37 @@
|
|||
|
||||
# Standard Library
|
||||
import json
|
||||
import typing as t
|
||||
from pathlib import Path
|
||||
from importlib.util import module_from_spec, spec_from_file_location
|
||||
|
||||
|
||||
class PlatformSpec(t.TypedDict):
|
||||
"""Definition for each platform."""
|
||||
|
||||
name: str
|
||||
keys: t.Tuple[str, ...]
|
||||
native: bool
|
||||
|
||||
|
||||
def get_directive_variable(path: Path, variable: str) -> t.Any:
|
||||
"""Read a variable from a directive file."""
|
||||
|
||||
name, _ = path.name.split(".")
|
||||
spec = spec_from_file_location(name, location=path)
|
||||
module = module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
|
||||
exports = tuple(getattr(module, e, None) for e in dir(module) if e == variable)
|
||||
if len(exports) < 1:
|
||||
raise RuntimeError(f"'{path!s} exists', but it is missing a variable named '{variable}'")
|
||||
|
||||
value, *_ = exports
|
||||
return value
|
||||
|
||||
|
||||
def create_platform_list() -> str:
|
||||
"""Create a list of platforms as a typescript file for use by the docs."""
|
||||
"""Create a list of platforms as a JSON file for use by the docs."""
|
||||
# Third Party
|
||||
from netmiko.ssh_dispatcher import CLASS_MAPPER # type: ignore
|
||||
|
||||
|
|
@ -17,11 +43,34 @@ def create_platform_list() -> str:
|
|||
|
||||
builtin_directives = project_root / "hyperglass" / "defaults" / "directives"
|
||||
|
||||
names = [f.stem for f in builtin_directives.iterdir() if not f.name.startswith("_")]
|
||||
platforms: t.Tuple[PlatformSpec] = ()
|
||||
|
||||
platforms = [[p, p in names] for p in CLASS_MAPPER.keys()]
|
||||
keys = []
|
||||
|
||||
for path in builtin_directives.iterdir():
|
||||
if not path.name.startswith("_"):
|
||||
name = get_directive_variable(path, "NAME")
|
||||
if not isinstance(name, str):
|
||||
raise RuntimeError("'NAME' variable is missing or invalid in '{!s}'".format(path))
|
||||
_platforms = get_directive_variable(path, "PLATFORMS")
|
||||
if not isinstance(_platforms, t.Tuple, t.List):
|
||||
raise RuntimeError(
|
||||
"'PLATFORMS' variable is missing or invalid in '{!s}'".format(path)
|
||||
)
|
||||
spec: PlatformSpec = {"name": name, "keys": _platforms, "native": True}
|
||||
platforms += (spec,)
|
||||
keys = [*keys, *_platforms]
|
||||
|
||||
for key in CLASS_MAPPER.keys():
|
||||
if key not in keys:
|
||||
spec: PlatformSpec = {"name": "", "keys": (key,), "native": False}
|
||||
platforms += (spec,)
|
||||
|
||||
sorted_platforms = list(platforms)
|
||||
sorted_platforms.sort(key=lambda x: x["keys"][0])
|
||||
sorted_platforms.sort(key=lambda x: not x["native"])
|
||||
|
||||
with file_.open("w+") as opened_file:
|
||||
json.dump(platforms, opened_file)
|
||||
json.dump(sorted_platforms, opened_file)
|
||||
|
||||
return f"Wrote platforms to {file_!s}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue