2019-12-29 23:57:39 -07:00
|
|
|
"""Constant definitions used throughout the application."""
|
2020-04-14 10:24:20 -07:00
|
|
|
|
2020-02-03 02:35:11 -07:00
|
|
|
# Standard Library
|
2020-01-20 19:50:08 -07:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
__name__ = "hyperglass"
|
2021-09-07 22:58:39 -07:00
|
|
|
__version__ = "2.0.0-dev"
|
2020-01-20 19:50:08 -07:00
|
|
|
__author__ = "Matt Love"
|
|
|
|
__copyright__ = f"Copyright {datetime.now().year} Matthew Love"
|
|
|
|
__license__ = "BSD 3-Clause Clear License"
|
|
|
|
|
|
|
|
METADATA = (__name__, __version__, __author__, __copyright__, __license__)
|
2019-07-07 02:49:54 -07:00
|
|
|
|
2021-09-07 22:58:39 -07:00
|
|
|
MIN_PYTHON_VERSION = (3, 8)
|
2019-12-30 23:00:53 -07:00
|
|
|
|
2021-01-18 14:35:10 -07:00
|
|
|
MIN_NODE_VERSION = 14
|
|
|
|
|
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")
|
|
|
|
|
2021-02-12 23:05:24 -07:00
|
|
|
SUPPORTED_STRUCTURED_OUTPUT = ("juniper", "arista_eos")
|
2020-05-02 23:05:17 -07:00
|
|
|
|
2020-01-21 17:32:31 -07:00
|
|
|
STATUS_CODE_MAP = {"warning": 400, "error": 400, "danger": 500}
|
|
|
|
|
2020-02-01 01:13:26 -10:00
|
|
|
DNS_OVER_HTTPS = {
|
|
|
|
"google": "https://dns.google/resolve",
|
|
|
|
"cloudflare": "https://cloudflare-dns.com/dns-query",
|
|
|
|
}
|
|
|
|
|
2020-04-24 11:41:43 -07:00
|
|
|
PARSED_RESPONSE_FIELDS = (
|
2020-05-29 17:47:53 -07:00
|
|
|
("Prefix", "prefix", "left"),
|
2020-04-24 11:41:43 -07:00
|
|
|
("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),
|
2020-04-24 11:41:43 -07:00
|
|
|
("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-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",
|
|
|
|
}
|
|
|
|
|
2021-05-30 15:46:30 -07:00
|
|
|
TRANSPORT_REST = ("frr_legacy", "bird_legacy")
|
2020-01-31 02:06:27 -10:00
|
|
|
|
2020-04-12 02:17:16 -07:00
|
|
|
SCRAPE_HELPERS = {
|
2021-02-09 22:31:55 -07:00
|
|
|
"arista": "arista_eos",
|
|
|
|
"ios": "cisco_ios",
|
2021-01-16 12:47:38 -07:00
|
|
|
"juniper_junos": "juniper",
|
2020-04-12 02:17:16 -07:00
|
|
|
"junos": "juniper",
|
2021-02-09 22:31:55 -07:00
|
|
|
"mikrotik": "mikrotik_routeros",
|
2020-10-18 12:15:13 -07:00
|
|
|
"tsnr": "tnsr",
|
2020-04-12 02:17:16 -07:00
|
|
|
}
|
2020-07-23 09:09:40 -07:00
|
|
|
|
|
|
|
DRIVER_MAP = {
|
2021-04-23 00:28:00 -07:00
|
|
|
# TODO: Troubleshoot Arista with Scrapli, broken after upgrading to 2021.1.30.
|
|
|
|
# "arista_eos": "scrapli", # noqa: E800
|
2021-05-30 15:46:30 -07:00
|
|
|
"bird": "scrapli",
|
2020-07-23 17:48:13 -07:00
|
|
|
"cisco_ios": "scrapli",
|
|
|
|
"cisco_xe": "scrapli",
|
|
|
|
"cisco_xr": "scrapli",
|
|
|
|
"cisco_nxos": "scrapli",
|
2021-09-07 22:58:39 -07:00
|
|
|
# TODO: Troubleshoot Juniper with Scrapli, broken after upgrading to 2021.7.30.
|
|
|
|
# "juniper": "scrapli", # noqa: E800
|
2020-10-18 12:15:13 -07:00
|
|
|
"tnsr": "scrapli",
|
2021-05-30 15:46:30 -07:00
|
|
|
"frr": "scrapli",
|
|
|
|
"frr_legacy": "hyperglass_agent",
|
|
|
|
"bird_legacy": "hyperglass_agent",
|
2020-07-23 09:09:40 -07:00
|
|
|
}
|