Skip to content

Latest commit

 

History

History
 
 

pyang_plugins

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Generating config code from yang

What's this ?

This is a pyang plugin to generate config/bgp_configs.go from openconfig yang files.

Prerequisites

Python 2.

How to use

Clone the required resources by using Git:

$ cd $HOME
$ git clone https://github.com/osrg/gobgp
$ git clone https://github.com/osrg/public
$ git clone https://github.com/osrg/yang
$ git clone https://github.com/osrg/pyang

Generate config/bgp_configs.go from yang files:

$ export GOBGP=`pwd`
$ cd $HOME/pyang
$ source ./env.sh
$ PYTHONPATH=. ./bin/pyang \
  --plugindir $GOBGP/tools/pyang_plugins \
  -p $HOME/yang/standard/ietf/RFC \
  -p $HOME/public/release/models \
  -p $HOME/public/release/models/bgp \
  -p $HOME/public/release/models/policy \
  -f golang \
  $HOME/public/release/models/bgp/openconfig-bgp.yang \
  $HOME/public/release/models/policy/openconfig-routing-policy.yang \
  $GOBGP/tools/pyang_plugins/gobgp.yang \
  | gofmt > $GOBGP/internal/pkg/config/bgp_configs.go