1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
Files
checktheroads-hyperglass/hyperglass/constants.py

152 lines
4.1 KiB
Python
Raw Normal View History

"""Constant definitions used throughout the application."""
2020-04-14 10:24:20 -07:00
2020-02-03 02:35:11 -07:00
# Standard Library
from datetime import datetime
__name__ = "hyperglass"
2020-07-05 17:21:06 -07:00
__version__ = "1.0.0-beta.49"
__author__ = "Matt Love"
__copyright__ = f"Copyright {datetime.now().year} Matthew Love"
__license__ = "BSD 3-Clause Clear License"
METADATA = (__name__, __version__, __author__, __copyright__, __license__)
MIN_PYTHON_VERSION = (3, 6)
2020-01-31 02:06:27 -10:00
TARGET_FORMAT_SPACE = ("huawei", "huawei_vrpv8")
2019-09-13 00:36:58 -07:00
2020-04-12 02:17:16 -07:00
TARGET_JUNIPER_ASPATH = ("juniper", "juniper_junos")
SUPPORTED_STRUCTURED_OUTPUT = ("juniper",)
2020-01-21 17:32:31 -07:00
STATUS_CODE_MAP = {"warning": 400, "error": 400, "danger": 500}
DNS_OVER_HTTPS = {
"google": "https://dns.google/resolve",
"cloudflare": "https://cloudflare-dns.com/dns-query",
}
PARSED_RESPONSE_FIELDS = (
2020-05-29 17:47:53 -07:00
("Prefix", "prefix", "left"),
("Active", "active", None),
("RPKI State", "rpki_state", "center"),
("AS Path", "as_path", "left"),
("Next Hop", "next_hop", "left"),
2020-05-02 18:58:15 -07:00
("Origin", "source_as", None),
("Weight", "weight", "center"),
("Local Preference", "local_preference", "center"),
("MED", "med", "center"),
("Communities", "communities", "center"),
("Originator", "source_rid", "right"),
("Peer", "peer_rid", "right"),
("Age", "age", "right"),
)
2020-01-17 02:50:57 -07:00
CREDIT = """
2020-03-23 01:11:15 -07:00
Powered by [**hyperglass**](https://github.com/checktheroads/hyperglass) version \
{version}. Source code licensed \
2020-01-17 02:50:57 -07:00
[_BSD 3-Clause Clear_](https://github.com/checktheroads/hyperglass/blob/master/LICENSE).
"""
2020-01-16 02:51:10 -07:00
DEFAULT_TERMS = """
2020-01-17 02:50:57 -07:00
By using {site_title}, you agree to be bound by the following terms of use:
All queries executed on this page are logged for analysis and troubleshooting. \
2020-01-16 02:51:10 -07:00
Users are prohibited from automating queries, or attempting to process queries in \
2020-01-17 02:50:57 -07:00
bulk. This service is provided on a best effort basis, and {org_name} \
2020-01-16 02:51:10 -07:00
makes no availability or performance warranties or guarantees whatsoever.
"""
DEFAULT_DETAILS = {
2020-01-17 02:50:57 -07:00
"bgp_aspath": """
{site_title} accepts the following `AS_PATH` regular expression patterns:
2020-01-16 02:51:10 -07:00
| Expression | Match |
| :------------------- | :-------------------------------------------- |
| `_65000$` | Originated by 65000 |
| `^65000_` | Received from 65000 |
| `_65000_` | Via 65000 |
| `_65000_65001_` | Via 65000 and 65001 |
| `_65000(_.+_)65001$` | Anything from 65001 that passed through 65000 |
""",
"bgp_community": """
2020-01-17 02:50:57 -07:00
{site_title} makes use of the following BGP communities:
2020-01-16 02:51:10 -07:00
| Community | Description |
| :-------- | :---------- |
| `65000:1` | Example 1 |
| `65000:2` | Example 2 |
| `65000:3` | Example 3 |
2020-01-17 02:50:57 -07:00
""",
"bgp_route": """
Performs BGP table lookup based on IPv4/IPv6 prefix.
""",
"ping": """
Sends 5 ICMP echo requests to the target.
""",
"traceroute": """
Performs UDP Based traceroute to the target. \
For information about how to interpret traceroute results, [click here]\
2020-07-04 15:00:21 -07:00
(https://hyperglass.io/traceroute_nanog.pdf).
2020-01-16 02:51:10 -07:00
""",
}
DEFAULT_HELP = """
##### BGP Route
2020-01-17 02:50:57 -07:00
2020-01-16 02:51:10 -07:00
Performs BGP table lookup based on IPv4/IPv6 prefix.
2020-01-17 02:50:57 -07:00
---
2020-01-16 02:51:10 -07:00
##### BGP Community
2020-01-17 02:50:57 -07:00
Performs BGP table lookup based on [Extended](https://tools.ietf.org/html/rfc4360) \
or [Large](https://tools.ietf.org/html/rfc8195) community value.
---
2020-01-16 02:51:10 -07:00
##### BGP AS Path
2020-01-17 02:50:57 -07:00
2020-01-16 02:51:10 -07:00
Performs BGP table lookup based on `AS_PATH` regular expression.
2020-01-17 02:50:57 -07:00
---
2020-01-16 02:51:10 -07:00
##### Ping
2020-01-17 02:50:57 -07:00
2020-01-16 02:51:10 -07:00
Sends 5 ICMP echo requests to the target.
2020-01-17 02:50:57 -07:00
---
2020-01-16 02:51:10 -07:00
##### Traceroute
2020-01-17 02:50:57 -07:00
Performs UDP Based traceroute to the target.
For information about how to interpret traceroute results, [click here]\
(https://hyperglass.io/traceroute_nanog.pdf).
2020-01-16 02:51:10 -07:00
"""
2020-01-26 02:21:12 -07:00
SUPPORTED_QUERY_FIELDS = ("query_location", "query_type", "query_target", "query_vrf")
SUPPORTED_QUERY_TYPES = (
"bgp_route",
"bgp_community",
"bgp_aspath",
"ping",
"traceroute",
)
2020-01-28 12:03:47 -07:00
FUNC_COLOR_MAP = {
"primary": "cyan",
"secondary": "blue",
"success": "green",
"warning": "yellow",
"error": "orange",
"danger": "red",
}
2020-01-31 02:06:27 -10:00
TRANSPORT_REST = ("frr", "bird")
2020-04-12 02:17:16 -07:00
SCRAPE_HELPERS = {
"junos": "juniper",
"ios": "cisco_ios",
}