github.com/osrg/gobgp@v2.0.0+incompatible/tools/pyang_plugins/README.rst (about)

     1  What's this ?
     2  =============
     3  This is a pyang plugin to generate config/bgp_configs.go from
     4  openconfig yang files (see https://github.com/openconfig/public).
     5  
     6  Prerequisites
     7  =============
     8  Please confirm $GOPATH is configured before the following steps. Note that you need to use Python 2.
     9  
    10  How to use
    11  ==========
    12  Set the environment variables for this tool::
    13  
    14     $ GOBGP_PATH=$GOPATH/src/github.com/osrg/gobgp/
    15  
    16  Clone the required resources by using Git::
    17  
    18     $ cd $HOME
    19     $ git clone https://github.com/osrg/public
    20     $ git clone https://github.com/YangModels/yang
    21     $ git clone https://github.com/mbj4668/pyang
    22  
    23  Setup environments for pyang::
    24  
    25     $ cd $HOME/pyang
    26     $ source ./env.sh
    27  
    28  Generate config/bgp_configs.go from yang files::
    29  
    30     $ PYTHONPATH=. ./bin/pyang \
    31     --plugindir $GOBGP_PATH/tools/pyang_plugins \
    32     -p $HOME/yang/standard/ietf/RFC \
    33     -p $HOME/public/release/models \
    34     -p $HOME/public/release/models/bgp \
    35     -p $HOME/public/release/models/policy \
    36     -f golang \
    37     $HOME/public/release/models/bgp/openconfig-bgp.yang \
    38     $HOME/public/release/models/policy/openconfig-routing-policy.yang \
    39     $GOBGP_PATH/tools/pyang_plugins/gobgp.yang \
    40     | gofmt > $GOBGP_PATH/config/bgp_configs.go