2019-03-04 01:24:46 +00:00
|
|
|
#+TITLE: yang layer
|
|
|
|
|
2019-05-07 08:21:07 +00:00
|
|
|
#+TAGS: dsl|layer|markup|programming
|
2019-05-05 17:26:40 +00:00
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2019-03-04 01:24:46 +00:00
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#features][Features:]]
|
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#syntax-checking-with-flycheck][Syntax checking with flycheck]]
|
|
|
|
- [[#configuration][Configuration]]
|
|
|
|
|
|
|
|
* Description
|
2019-04-12 19:31:31 +00:00
|
|
|
This layer provides support for the YANG file format.
|
2019-03-04 01:24:46 +00:00
|
|
|
|
|
|
|
** Features:
|
|
|
|
- Syntax highlighting
|
|
|
|
- Syntax checking via [[http://www.flycheck.org/en/latest/languages.html#yaml][flycheck]]
|
|
|
|
|
|
|
|
* Install
|
2019-04-12 19:31:31 +00:00
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
add =yang= to the existing =dotspacemacs-configuration-layers= list in this
|
|
|
|
file.
|
2019-03-04 01:24:46 +00:00
|
|
|
|
2019-04-12 19:31:31 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2019-03-04 01:24:46 +00:00
|
|
|
(setq-default dotspacemacs-configuration-layers '(yang))
|
2019-04-12 19:31:31 +00:00
|
|
|
#+END_SRC
|
2019-03-04 01:24:46 +00:00
|
|
|
|
|
|
|
* Syntax checking with flycheck
|
2019-04-12 19:31:31 +00:00
|
|
|
Flycheck is used to check the yang syntax utilizing =pyang= which needs to be
|
|
|
|
installed on your system. Documentation for pyang can be found at the [[https://github.com/mbj4668/pyang][pyang
|
|
|
|
repository]], and can be installed using python packaging mechanisms
|
2019-03-04 01:24:46 +00:00
|
|
|
|
|
|
|
** Configuration
|
2019-04-12 19:31:31 +00:00
|
|
|
By default the syntax checking is done according to ~pyang --lint~ which uses
|
|
|
|
rules outlined in RFC 6020. To use a different set of rules set the
|
|
|
|
~yang-pyang-rules~ variable. The valid values at the time of writing were:
|
|
|
|
- mef Validate the module(s) according to MEF rules.
|
|
|
|
- ietf Validate the module(s) according to IETF rules.
|
|
|
|
- bbf Validate the module(s) according to BBF rules.
|
|
|
|
- ieee Validate the module(s) according to IEEE rules.
|
|
|
|
- lint Validate the module(s) according to RFC 6087 rules.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2019-03-04 01:24:46 +00:00
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
'((yang :variables yang-pyang-rules "ietf")))
|
2019-04-12 19:31:31 +00:00
|
|
|
#+END_SRC
|
2019-03-04 01:24:46 +00:00
|
|
|
|
2019-04-12 19:31:31 +00:00
|
|
|
To allow further customization one can set the ~yang-pyang-extra-args~
|
|
|
|
variable to a string that will be passed directly to the =pyang= command.
|
2019-03-04 01:24:46 +00:00
|
|
|
|
2019-04-12 19:31:31 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2019-03-04 01:24:46 +00:00
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
'((yang :variables yang-pyang-extra-args "--max-line-length=69")))
|
2019-04-12 19:31:31 +00:00
|
|
|
#+END_SRC
|