summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-05-12 13:31:33 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-06-03 05:51:19 +0900
commit449e1acb8d5a271917274c96b0fca88e318a6949 (patch)
tree9dcd992d443a4b0af38876afe8153253205b7aab
parent3d01f04c8cb10ad91fb53e432d82ad9c4d8efff2 (diff)
tools: Update usage of pyang_plugins
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r--tools/pyang_plugins/README.rst37
1 files changed, 27 insertions, 10 deletions
diff --git a/tools/pyang_plugins/README.rst b/tools/pyang_plugins/README.rst
index ddf41f27..976b878c 100644
--- a/tools/pyang_plugins/README.rst
+++ b/tools/pyang_plugins/README.rst
@@ -3,21 +3,38 @@ What's this ?
This is a pyang plugin to generate config/bgp_configs.go from
openconfig yang files (see https://github.com/openconfig/public).
+Prerequisites
+=============
+Please confirm $GOPATH is configured before the following steps.
+
How to use
==========
-::
+Set the environment variables for this tool::
+
+ $ GOBGP_PATH=$GOPATH/src/github.com/osrg/gobgp/
+
+Clone the required resources by using Git::
+ $ cd $HOME
$ git clone https://github.com/osrg/public
$ git clone https://github.com/YangModels/yang
- $ YANG_DIR=`pwd`
- $ cd $PYANG_INSTALL_DIR
+ $ git clone https://github.com/mbj4668/pyang
+
+Setup environments for pyang::
+
+ $ cd $HOME/pyang
$ source ./env.sh
- $ PYTHONPATH=. ./bin/pyang --plugindir $GOBGP_PATH/tools/pyang_plugins \
- -p $YANG_DIR/yang/standard/ietf/RFC \
- -p $YANG_DIR/public/release/models \
- -p $YANG_DIR/public/release/models/bgp \
- -p $YANG_DIR/public/release/models/policy \
- -f golang $YANG_DIR/public/release/models/bgp/openconfig-bgp.yang \
- $YANG_DIR/public/release/models/policy/openconfig-routing-policy.yang \
+
+Generate config/bgp_configs.go from yang files::
+
+ $ PYTHONPATH=. ./bin/pyang \
+ --plugindir $GOBGP_PATH/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_PATH/tools/pyang_plugins/gobgp.yang \
| gofmt > $GOBGP_PATH/config/bgp_configs.go