Difference between revisions of "Convert YANG to MIB model"

m
 
Line 1: Line 1:
YANG2SMI is an extensible output plugin for pyang. This plugin can be used to generate MIB model from YANG data models.
+
==Introduction==
 +
:YANG2SMI is an extensible output plugin for pyang. This plugin can be used to generate MIB model from YANG model data.
  
 
Step to convert YANG to MIB model:
 
Step to convert YANG to MIB model:
1. You need an installation of pyang:  
+
# You need an installation of pyang:  
1.1 cd <SAFplus-Management-Framework>/3rdparty
+
## cd <SAFplus-Management-Framework>/3rdparty
1.2 make pyang
+
## make pyang
 
+
#Add the YANG2SMI plugin to your existing pyang installation. This may be done in one of the following three ways:
2. Add the YANG2SMI plugin to your existing pyang installation. This may be done in one of the following three ways:
+
##Add <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to <SAFplus-Management-Framework>/3rdparty/pyang/pyang/plugins,
 
+
##Add the location of <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to the $PYANG_PLUGINPATH environment variable, or
2.1. Add <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to <SAFplus-Management-Framework>/3rdparty/pyang/pyang/plugins,
+
##Use the --plugindir option of pyang each time you want to use YANG2SMI
2.2. Add the location of <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to the $PYANG_PLUGINPATH environment variable, or
+
#Change directory to <SAFplus-Management-Framework>/3rdparty/pyang and launch pyang with specific yang2smi output format, YANG module file, OID root module and MIB model file.
2.3. Use the --plugindir option of pyang each time you want to use YANG2SMI
+
 
+
3. Change directory to <SAFplus-Management-Framework>/3rdparty/pyang and launch pyang with specific yang2smi output format, YANG module file, OID root module and MIB model file.
+
  
 
For example, to generate the network.yang to NETWORK.MIB , type:
 
For example, to generate the network.yang to NETWORK.MIB , type:
 
+
root@desktop:/# source env.sh;./bin/pyang -f yang2smi network.yang --yang2smi-oid=99840 -o NETWORK.MIB
$source env.sh;./bin/pyang -f yang2smi network.yang --yang2smi-oid=99840 -o NETWORK.MIB
+

Latest revision as of 07:13, 23 January 2013

[edit] Introduction

YANG2SMI is an extensible output plugin for pyang. This plugin can be used to generate MIB model from YANG model data.

Step to convert YANG to MIB model:

  1. You need an installation of pyang:
    1. cd <SAFplus-Management-Framework>/3rdparty
    2. make pyang
  2. Add the YANG2SMI plugin to your existing pyang installation. This may be done in one of the following three ways:
    1. Add <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to <SAFplus-Management-Framework>/3rdparty/pyang/pyang/plugins,
    2. Add the location of <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to the $PYANG_PLUGINPATH environment variable, or
    3. Use the --plugindir option of pyang each time you want to use YANG2SMI
  3. Change directory to <SAFplus-Management-Framework>/3rdparty/pyang and launch pyang with specific yang2smi output format, YANG module file, OID root module and MIB model file.

For example, to generate the network.yang to NETWORK.MIB , type:

root@desktop:/# source env.sh;./bin/pyang -f yang2smi network.yang --yang2smi-oid=99840 -o NETWORK.MIB