mirror of
https://github.com/thatmattlove/hyperglass.git
synced 2026-01-17 08:48:05 +00:00
Move structured samples and remove old tests
This commit is contained in:
parent
74fcb5dba4
commit
b9503546df
8 changed files with 0 additions and 64 deletions
|
|
@ -1,25 +0,0 @@
|
||||||
"""Test Arista JSON Parsing."""
|
|
||||||
|
|
||||||
# Standard Library
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Project
|
|
||||||
from hyperglass.log import log
|
|
||||||
|
|
||||||
# Local
|
|
||||||
from .arista import parse_arista
|
|
||||||
|
|
||||||
SAMPLE_FILE = Path(__file__).parent.parent / "models" / "parsing" / "arista_route.json"
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if len(sys.argv) == 2:
|
|
||||||
sample = sys.argv[1]
|
|
||||||
else:
|
|
||||||
with SAMPLE_FILE.open("r") as file:
|
|
||||||
sample = file.read()
|
|
||||||
|
|
||||||
parsed = parse_arista([sample])
|
|
||||||
log.info(json.dumps(parsed, indent=2))
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
"""Test Juniper XML Parsing."""
|
|
||||||
|
|
||||||
# Standard Library
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Project
|
|
||||||
from hyperglass.log import log
|
|
||||||
|
|
||||||
# Local
|
|
||||||
from .juniper import parse_juniper
|
|
||||||
|
|
||||||
SAMPLE_FILES = (
|
|
||||||
Path(__file__).parent.parent / "models" / "parsing" / "juniper_route_direct.xml",
|
|
||||||
Path(__file__).parent.parent / "models" / "parsing" / "juniper_route_indirect.xml",
|
|
||||||
Path(__file__).parent.parent / "models" / "parsing" / "juniper_route_aspath.xml",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@log.catch
|
|
||||||
def run():
|
|
||||||
"""Run tests."""
|
|
||||||
samples = ()
|
|
||||||
if len(sys.argv) == 2:
|
|
||||||
samples += (sys.argv[1],)
|
|
||||||
else:
|
|
||||||
for sample_file in SAMPLE_FILES:
|
|
||||||
with sample_file.open("r") as file:
|
|
||||||
samples += (file.read(),)
|
|
||||||
|
|
||||||
for sample in samples:
|
|
||||||
parsed = parse_juniper([sample])
|
|
||||||
log.info(json.dumps(parsed, indent=2))
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
run()
|
|
||||||
Loading…
Add table
Reference in a new issue