asterust-junos 0.3.13

Typed Juniper JunOS config views (interfaces, OSPF, BGP, IS-IS, routing instances, policy options, firewall filters, system) extracted from an asterust config tree.
Documentation

asterust-junos

Typed views of common Juniper JunOS config statements, extracted from a config tree parsed by asterust (config::juniper, brace-format show configuration).

Module Block Extracted
interfaces interfaces description, disable, mtu, speed, encapsulation, vlan-tagging, flexible-vlan-tagging, native-vlan-id, per-unit-scheduler, no-gratuitous-arp-request, hold-time, ether-options (also gigether-options and fastether-options: auto-negotiation, flow-control, loopback, source-filtering, speed, link-mode, fec, 802.3ad bundle membership), aggregated-ether-options (lacp, bfd-liveness-detection, link-speed, minimum-links, flow-control, loopback, source-filtering), optics-options (low-light alarm and warning, wavelength, tx-power, fec, modulation-format, laser-enable, ...), otn-options (fec, rate, tti, signal-degrade, ...), link-degrade-monitor (thresholds, recovery), auto-configure (vlan-ranges and stacked-vlan-ranges with their dynamic profiles; the authentication password with the secrets feature), units (description, vlan-id, vlan-id-range, vlan-tags, input-vlan-map and output-vlan-map, encapsulation, families, inet/inet6/iso addresses, and per family: mtu, filter, rpf-check, policer, sampling, address options such as primary, preferred, destination, arp vlan-id and vlan-id-list of family bridge, and vrrp-group/vrrp-inet6-group with tracking; the VRRP authentication-key with the secrets feature)
protocols::ospf protocols ospf global options (reference-bandwidth, preferences, export and import policies, rib-group, overload, spf-options including microloop-avoidance, graceful-restart, traffic-engineering, database-protection, backup-spf-options, source-packet-routing (including flexible algorithm participation), topologies, domain-id, lsa-refresh-interval, prefix-export-limit and flags), areas (stub, nssa, area-range, virtual-link, network-summary policies, label-switched-path, context-identifier) and their interfaces: passive, metric, priority, hello, dead, retransmit and poll intervals, transit delay, interface type, authentication (key ids, and the keys with the secrets feature), BFD, LDP synchronization, neighbors, topologies, protection, post-convergence-lfa and the other interface flags
protocols::bgp protocols bgp groups (type, peer-as, local-as, local-address, cluster, families, import/export policies) and neighbors, plus the peer options shared by bgp, group and neighbor (local-as, multihop, remove-private, authentication algorithm and key-chain, timers, keep, preferences, metric-out and session flags; keys with the secrets feature), bfd-liveness-detection (including strict mode), graceful-restart (long-lived helper, forwarding-state-bit and notification flags), multipath (including prioritization), per-family settings (family <afi> <safi>: prefix-limit, accepted-prefix-limit, add-path, loops, aigp, rib-group, no-validate, extended-nexthop, extended-nexthop-color, extended-nexthop-tunnel, entropy-label, output-queue, route-refresh and withdraw priorities, per-family graceful-restart and flags), group allow, peer-as-list and dynamic-neighbor blocks (including peer-auto-discovery for BGP unnumbered), and the bgp-level path-selection, multipath-build-priority and output-queue-priority, source-packet-routing srv6 locators (end-dt4/dt6/dt46-sid, micro-dt4/dt6/dt46-sid, non-default) and the per-family advertise-srv6-service and accept-srv6-service
protocols::isis protocols isis global options (reference-bandwidth, export and import policies, LSP and SNP sizes, rib-group, overload, spf-options including microloop-avoidance and weighted one-hop multipath, graceful-restart, traceoptions, traffic-engineering, backup-spf-options, topologies, dynamic-overload, no-external-export, source-packet-routing (including flexible algorithm participation and srv6 locators with end-sid, flavors, micro-node-sid and algorithm), strict-dual-isis and flags), the `level <1
protocols::ldp protocols ldp disable, keepalive and targeted-hello timers, preference, families, dual-transport, transport address and preference, deaggregate, mtu-discovery, explicit-null, no-forwarding, track-igp-metric, l2-smart-policy, strict-targeted-hellos, upstream-label-assignment, p2mp, longest-match, export, import and egress policies, dod-request-policy, igp-synchronization, graceful-restart, session-protection, auto-targeted-session, make-before-break, label-withdrawal-delay, log-updown, traceoptions, the interfaces (disable, hello-interval, hold-time, transport-address, allow-subnet-mismatch, link-protection) and the sessions and session groups (authentication algorithm and key chain, downstream-on-demand, mtu-discovery, transport-address; the authentication key with the secrets feature)
protocols::mpls protocols mpls the router-wide options (disable, explicit-null, no-cspf, no-propagate-ttl, no-decrement-ttl, ipv6-tunneling, expand-loose-hop, traffic-engineering, the optimize and smart-optimize timers, rsvp-error-hold-time), admin-groups, path-mtu, log-updown, the interfaces (disable, admin-group, srlg) and the dynamic label-switched-paths (to, from, bandwidth, priority, metric, preference, timers, link and node protection, fast-reroute, admin-group, install, primary and secondary paths), the explicit path hop lists, static-label-switched-path (ingress, transit and bypass) and container-label-switched-path; the traffic engineering database and segment routing statements are not extracted
protocols::pim protocols pim disable, assert-timeout, dense-groups, dr-election-on-p2p, export and import policies, families, graceful-restart, join-load-balance, join-prune-timeout, mldp-inband-signalling, nonstop-routing, override-interval, propagation-delay, reset-tracking-bit, rib-group, sglimit, spt-threshold, traceoptions, tunnel-devices; interfaces (mode, version, hello-interval, priority, timers, neighbor and join policies, families, dual-dr, df-election, multiple-triggered-joins, BFD with the key chain name); and the rp (auto-rp, bidirectional, bootstrap, embedded-rp, local with anycast-pim, static, register-limit, policies)
protocols::rsvp protocols rsvp disable, keep-multiplier, refresh-time, node-hello, no-enhanced-frr-bypass, load-balance, preemption, soft-preemption, graceful-restart, traceoptions and the interfaces (disable, aggregate, bandwidth, hello-interval, reliable, subscription, update-threshold, link-protection with its bypasses; the authentication key with the secrets feature)
protocols::source_packet_routing protocols source-packet-routing SR-TE: segment lists (hops with ip-address, label, label-type, strict/loose, srv6-sid; srv6, compute, dynamic, auto-translate, inherit-label-nexthops), source-routing-paths (to, from, color, binding-sid, metric, no-ingress, sr-preference, te-group-id, srv6, primary and secondary segment lists with weight, return-path and compute) and the global depth, preference, retry-timer, sbfd-frr, srv6, preserve-nexthop-hierarchy and tunnel-tracking options
routing_instances routing-instances instance-type, route-distinguisher, interfaces, vrf-target, vrf-import/vrf-export, and the BGP source-packet-routing srv6 locators of the instance
routing_options routing-options router-id, ipv6-router-id, autonomous-system (loops, asdot-notation, independent-domain), confederation, graceful-restart, nonstop-routing, maximum-paths, forwarding-table (including srv6-chain-merge), interface-routes, resolution, options syslog, static routes (next-hop, qualified-next-hop, discard/reject/receive, next-table, route attributes and defaults), aggregate and generate routes (policy, brief/full, discard, attributes), martians, ribs (per-table static, aggregate, generate, martians), rib-groups, instance-import/instance-export, auto-export, fate-sharing, flex-algorithm (color, use-transport-class, definition with metric-type, priority, spf, strict-spf, admin-group, exclude-srlg and use-flex-algorithm-prefix-metric), source-packet-routing srv6 (no-reduced-srh, transit-srh-insert, oam, uSID blocks, classic and micro-sid locators with algorithm, anycast, end-sid and flavors)
policy_options policy-options policy statements (terms with from/to conditions and then actions, including load-balance, resolution-map, multipath-resolve and srv6 locator), communities, prefix lists, AS paths, AS path groups and resolution maps
firewall firewall family filters (terms with from conditions and then actions) and policers
system system host-name, domain-name, domain-search, time-zone, static-host-mapping, backup-router, authentication-order, radius-server and tacplus-server (secrets with the secrets feature), root-authentication (method names, and the passwords and keys with the secrets feature), master-password (iteration count and function), diag-port-authentication and pic-console-authentication (method names, and the passwords with the secrets feature), license (autoupdate URL, key count, renew), location, ports (console, auxiliary), max-configurations-on-flash, max-configuration-rollbacks, no-redirects, default-address-selection, internet-options, commit, processes, scripts, dynamic-profile-options, extensions (JET applications and providers), autoinstallation (server URLs without passwords; the passwords with the secrets feature), schema, pixel-tracing, system flags (no-multicast-echo, auto-snapshot, ...), archival (site URLs without passwords), accounting (events and destination servers), name-servers, ntp (servers, peers, boot-server, source-address, trusted keys; key values with the secrets feature), syslog (hosts, files, users, console and their facility/severity rules, archive size/files, per-destination options such as match and explicit-priority), login (message, announcement, idle-timeout, deny-sources, password policy, retry-options, classes with access restrictions, users, whose passwords and keys need the secrets feature), services (ssh settings including ciphers, macs, key-exchange and authentication switches, telnet, ftp, netconf over ssh, web-management (http, https, interfaces, ports, certificates, session limits), netconf, xnm-clear-text, xnm-ssl, outbound-ssh clients, subscriber-management, static-subscribers, dhcp-local-server groups, local-policy-decision-function statistics, flow-tap-dtcp, service-deployment; secrets with the secrets feature)

The source tree mirrors the configuration hierarchy so a statement is easy to find: a folder per top-level block (system/, protocols/, policy_options/), a file per statement inside it (system/radius_server.rs, system/root_authentication.rs), and a folder instead of a file when that statement has many children of its own (system/services/ssh.rs, system/login/class.rs, system/syslog/host.rs). The types of each level are re-exported from its parent, e.g. system::RadiusServer.

use asterust_junos::JunosDevice;

let device = JunosDevice::parse(show_configuration_text);
for iface in device.interfaces() {
    println!("{}: {:?}", iface.name, iface.units);
}
if let Some(bgp) = device.bgp() {
    println!("{} BGP groups", bgp.groups.len());
}

Unlike the Cisco crates, JunOS singleton protocols are returned as Option (device.ospf(), device.bgp(), device.isis()), and the views read from named top-level blocks rather than one struct per block. JunosDevice also implements asterust::device::Device.

Secrets: passwords, keys and shared secrets are not read by default, only a has_* flag says whether one is configured. With the secrets feature (asterust-junos = { version = "...", features = ["secrets"] }) the matching Option<Secret> fields are filled with the value as written (usually the encrypted $9$... form). Secret prints as Secret(<redacted>) in Debug; read it with Secret::expose. Covered: BGP, OSPF, IS-IS, LDP, RSVP, VRRP, auto-configure, and in system the RADIUS and TACACS+ servers, NTP, login users, root and diag/PIC console authentication, archival, autoinstallation, license, outbound-ssh, static subscribers and subscriber-management. master-password has nothing to read, since the password is not part of the configuration.

Limitations: statements deactivated with inactive: are skipped; | display set output is not supported; ospf3, protocols nested inside routing instances, apply-groups expansion and BGP group-to-neighbor setting inheritance are not resolved.

Sources

The BGP, interface, OSPF and routing-options test fixtures (the DOC_* constants and doc_* tests) are adapted from Juniper's BGP User Guide, read on 2026-11-26. They are reindented and shortened, not verbatim, and the guide's typographic quotes are written as plain quotes.

Page Example used Fixtures
BGP Peering Sessions Example: Configuring External BGP Point-to-Point Peer Sessions (Device E) protocols::bgp::DOC_EXTERNAL_PEERS, interfaces::DOC_POINT_TO_POINT
same page Example: Configuring Internal BGP Peer Sessions (Device A) protocols::bgp::DOC_INTERNAL_PEERS, protocols::ospf::DOC_OSPF, the routing_options doc test
same page Example: Configure Multiple Single-Hop EBGP Sessions on Different Links Using the Same IPv6 Link-Local Address (R1) protocols::bgp::DOC_LINK_LOCAL (quoted neighbor names), interfaces::DOC_LINK_LOCAL (VLAN units, primary address)
BGP Route Reflectors Example: Configuring a Route Reflector (Device A) protocols::bgp::DOC_ROUTE_REFLECTOR (the guide's rendering of this output drops a closing brace, which is restored)
Routing Policies for BGP Communities Examples: Redistribute BGP Routes with a Specific Community Tag into IS-IS (Device C), Removes BGP Communities (R1, R2), Based on the Number of BGP Communities (R2) policy_options::DOC_COMMUNITY_TAG, policy_options::DOC_COMMUNITY_ACTIONS (the rendered output wraps lines mid-statement, which are rejoined)
TCP Access Restriction for BGP Examples: Configuring a Filter to Block TCP Access to a Port Except from Specified BGP Peers (Device E), Configuring a Filter to Limit TCP Access to a Port Based On a Prefix List firewall::DOC_BGP179_PEERS, firewall::DOC_BGP179_PREFIX_LIST (wrapped lines are rejoined)
Configuring Segment Routing Microloop Avoidance in OSPFv2 Networks (Segment Routing User Guide, read on 2026-11-27) Device R0 show protocols, the OSPF spf-options, backup-spf-options, source-packet-routing and interface post-convergence-lfa parts the protocols::ospf tests reads_microloop_avoidance, reads_the_bare_form, reads_post_convergence_lfa_and_source_packet_routing and reads_the_one_line_forms_of_the_guide_example (maximum-labels, the second interface and the block forms are added from the CLI Reference)
How to Configure Flexible Algorithms in OSPF for Segment Routing Traffic Engineering (OSPF User Guide, read on 2026-11-27) Device R0 show routing-options and show protocols ospf the routing_options::flex_algorithm tests (use-transport-class, color, strict-spf, priority, exclude-srlg, use-flex-algorithm-prefix-metric and the bare forms are added from the CLI Reference), the protocols::ospf source_packet_routing and traffic_engineering flex-algorithm tests
Example: Configuring SRv6 Network Programming in IS-IS Networks (Segment Routing User Guide, read on 2026-11-27) Device R0 show routing-options and show protocols (IS-IS part), shortened; the guide's rendering of flavor is irregular and is written as flavor { usd; } and flavor psp; routing_options::srv6 reads_the_guide_locator, the protocols::isis::srv6 tests reads_the_guide_node_segment and reads_the_guide_adjacency_segments (other cases are not from documentation)
Example: Configuring Layer 3 Services over SRv6 in BGP Networks (Segment Routing User Guide, read on 2026-11-27) Router R0 show protocols (BGP part) and show routing-instances, shortened the protocols::bgp::srv6 tests reads_the_guide_locator, reads_the_service_families and reads_the_routing_instance_locator (the micro-SID cases are not from documentation)
BGP Egress Traffic Engineering (BGP User Guide, read on 2026-11-27) Example: Configuring Static SR-TE Policy for an SRv6 Tunnel, Device R1 source-packet-routing results, with the guide's column padding removed the protocols::source_packet_routing tests reads_the_guide_segment_lists and reads_the_guide_source_routing_paths (the MPLS hops, secondary paths and global options are written from the CLI Reference and are not from documentation)
Basic MPLS Configuration (MPLS Applications User Guide, read on 2026-11-27) Example: Configuring MPLS on EX8200 and EX4500 Switches, provider and local PE show configuration (MPLS part), shortened the protocols::mpls tests reads_the_guide_interfaces and reads_the_guide_label_switched_path (the other tests are written from the CLI Reference and are not from documentation)
same page, and Link-State Distribution Using BGP (BGP User Guide, read on 2026-11-27) the provider switch rsvp interfaces, and Router R1 show protocols (RSVP part) of Example: Configuring Link State Distribution Using BGP the protocols::rsvp test reads_the_guide_interfaces (the other tests are written from the CLI Reference and are not from documentation)
LDP Configuration (MPLS Applications User Guide, read on 2026-11-29) the link protection, native IPv6 support (including dual-transport), downstream on demand, longest match and traceoptions examples, and the egress, export, import and graceful-restart examples, shortened the protocols::ldp tests reads_the_guide_link_protection, reads_the_guide_ipv6_transport, reads_the_guide_downstream_on_demand_session and reads_the_guide_longest_match_policies_and_tracing (the other tests are written from the CLI Reference and are not from documentation)
Examples: Configuring PIM Sparse Mode, Configuring Static RP, Configuring PIM Bootstrap Router, Example: Configuring Anycast RP, Example: Configuring Bidirectional PIM, Configuring PIM and the Bidirectional Forwarding Detection (BFD) Protocol and Example: Configuring Nonstop Active Routing for PIM (Multicast Protocols User Guide, read on 2026-11-29) the show protocols pim blocks of those pages, shortened, with the guide's inline comments removed and the bidirectional block wrapped in protocols the protocols::pim tests reads_the_guide_sparse_mode_example, reads_the_guide_static_rp_example, reads_the_guide_anycast_rp_example, reads_the_guide_bootstrap_examples, reads_the_guide_bidirectional_example, reads_the_guide_bfd_examples and reads_the_guide_nonstop_routing_example (the other tests are written from the CLI Reference and are not from documentation)
same page Device R1 show policy-options the policy_options tests doc_load_balance_and_multipath_resolve and doc_resolution_map_action_and_definition (the srv6 action and the two-mode resolution-map are written from srv6.md and the CLI Reference and are not from documentation)

Other pages consulted but not used for fixtures:

Not yet grounded in documentation or a real device: protocols isis, routing-instances (VRFs, vrf-target, vrf-import/vrf-export), the inactive: handling, disable, bracketed policy lists (export [ a b ]), and the other extra cases in the tests, including policy_options prefix lists, AS paths and AS path groups, local-preference, next-hop, as-path-prepend, next term/next policy and block-form communities, and the firewall policers, flag and list match conditions, and the count, policer, log, syslog, forwarding-class and loss-priority actions. Those fixtures are marked "not from documentation" in the code and were written from knowledge of the JunOS hierarchy, so treat the corresponding fields as unverified. A Juniper IS-IS or Layer 3 VPN example page, or a sanitized show configuration snippet, would let these be replaced.

The system fixtures (host-name, domain-name, domain-search, static-host-mapping, backup-router, authentication-order, radius-server, tacplus-server, location, ports, max-configurations-on-flash, internet-options, commit, processes, scripts, dynamic-profile-options, extensions, autoinstallation, schema, pixel-tracing, archival, accounting, time-zone, root-authentication, master-password, diag-port-authentication, pic-console-authentication, license, name-server, ntp, syslog, login, services, outbound-ssh) follow the syntax in the Junos CLI Reference pages, not an example configuration.