github.com/osrg/gobgp/v3@v3.30.0/tools/pyang_plugins/README.md (about)

     1  # Generating config code from yang
     2  
     3  ## What's this ?
     4  
     5  This is a pyang plugin to generate config/bgp_configs.go from
     6  [openconfig yang files](https://github.com/openconfig/public).
     7  
     8  ## Prerequisites
     9  
    10  Python 2.
    11  
    12  ## How to use
    13  
    14  Clone the required resources by using Git:
    15  
    16  ```shell
    17  $ cd $HOME
    18  $ git clone https://github.com/osrg/gobgp
    19  $ git clone https://github.com/osrg/public
    20  $ git clone https://github.com/osrg/yang
    21  $ git clone https://github.com/osrg/pyang
    22  ```
    23  
    24  Generate config/bgp_configs.go from yang files:
    25  
    26  ```shell
    27  $ export GOBGP=`pwd`
    28  $ cd $HOME/pyang
    29  $ source ./env.sh
    30  $ PYTHONPATH=. ./bin/pyang \
    31    --plugindir $GOBGP/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/tools/pyang_plugins/gobgp.yang \
    40    | gofmt > $GOBGP/pkg/config/oc/bgp_configs.go
    41  ```