diff --git a/hyperglass/models/parsing/juniper.py b/hyperglass/models/parsing/juniper.py
index e519fd6..514ffc0 100644
--- a/hyperglass/models/parsing/juniper.py
+++ b/hyperglass/models/parsing/juniper.py
@@ -75,6 +75,9 @@ class JuniperRouteTableEntry(_JuniperBase):
if "selected-next-hop" in hop:
selected_next_hop = hop.get("to", "")
break
+ elif hop.get("to") is not None:
+ selected_next_hop = hop["to"]
+ break
values["next-hop"] = selected_next_hop
diff --git a/hyperglass/models/parsing/juniper_route_direct.xml b/hyperglass/models/parsing/juniper_route_direct.xml
new file mode 100644
index 0000000..a96084a
--- /dev/null
+++ b/hyperglass/models/parsing/juniper_route_direct.xml
@@ -0,0 +1,774 @@
+
+
+
+
+
+ inet.0
+
+
+ 851482
+
+
+ 3145808
+
+
+ 851445
+
+
+ 1
+
+
+ 94
+
+
+
+
+
+
+
+
+
diff --git a/hyperglass/models/parsing/juniper_route_indirect.xml b/hyperglass/models/parsing/juniper_route_indirect.xml
new file mode 100644
index 0000000..ba2f651
--- /dev/null
+++ b/hyperglass/models/parsing/juniper_route_indirect.xml
@@ -0,0 +1,201 @@
+
+
+
+
+
+ inet.0
+
+
+ 851462
+
+
+ 3145810
+
+
+ 851425
+
+
+ 1
+
+
+ 94
+
+
+
+
+
+
+
+
+
diff --git a/hyperglass/parsing/test_juniper.py b/hyperglass/parsing/test_juniper.py
new file mode 100644
index 0000000..3b11265
--- /dev/null
+++ b/hyperglass/parsing/test_juniper.py
@@ -0,0 +1,31 @@
+"""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",
+)
+
+if __name__ == "__main__":
+ 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)