Skip to content

codeout/junoser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

285de4b · Feb 3, 2025
May 18, 2024
Jul 12, 2015
Feb 2, 2025
Jan 24, 2018
Feb 3, 2025
Sep 8, 2024
Feb 2, 2025
Aug 24, 2019
Mar 11, 2024
Feb 3, 2025
Jul 12, 2015
Feb 3, 2025
Feb 3, 2025
Feb 3, 2025
Dec 19, 2024
Nov 1, 2022
Dec 9, 2022

Repository files navigation

Junoser

Test on Ubuntu Code Climate Inline docs

Junoser is a JUNOS configuration PEG parser which can be automatically generated from Juniper's netconf.xsd. (XML Schema Definition for NETCONF)

Features

  • Configuration Validation

    • Structured "show configuration" format
    • One-liner "| display set" format
  • Configuration Translation

    • Inter-translation between structured form and display-set form

NOTE

Inter-translation from display-set form into structured form is experimental feature in this release.

Getting Started

$ gem install junoser

Usage

Syntax validation

$ junoser -c config.txt

# or

$ cat config.txt | junoser -c

Syntax translation

Structured form into "display set"
$ junoser -d config.txt
set protocols bgp group ebgp-peers neighbor 192.0.2.2

# or

$ cat config.txt | junoser -d
set protocols bgp group ebgp-peers neighbor 192.0.2.2
"display set" into structured form
$ junoser -s config.txt

# or

$ cat config.txt | junoser -s

Updating parser for new directives

From Juniper website, you can download the XSD schema for the version of JunOS you want to target:

  • Junos XML API
  • Select your version
  • Application Tools
  • XML Schema for Configurator Data

Alternatively, you can retrieve the schema with Netconf:

$ ssh -Csp 830 JUNOS netconf < example/get-schema.xml | sed -n '/^<xsd:schema/,/^<\/xsd:schema/p' > junos-XXX.xsd

Put it in tmp/, update xsd_path in Rakefile and run:

$ bundle exec rake build:config build:rule

Alternatively, you may look in example/ for some prebuilt rules file. If you want to use them, copy one to tmp/rules.rb and run:

$ bundle exec rake build:rule

Contributing

Please report issues or enhancement requests to GitHub issues. For questions or feedbacks write to my twitter @codeout.

Or send a pull request to fix.

Copyright and License

Copyright (c) 2015-2025 Shintaro Kojima. Code released under the MIT license.