Difference between revisions of "Convert YANG to MIB model"

(Created page with "YANG2SMI is an extensible output plugin for pyang. This plugin can be used to generate MIB model from YANG data models. Step to convert YANG to MIB model: 1. You need an inst...")
 
Line 8: Line 8:
 
2. 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:
  
2.1. Add <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to <SAFplus-Management-Framework>/3rdparty/pyang/plugins,
+
2.1. Add <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to <SAFplus-Management-Framework>/3rdparty/pyang/pyang/plugins,
 
2.2. Add the location of <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to the $PYANG_PLUGINPATH environment variable, or
 
2.2. Add the location of <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to the $PYANG_PLUGINPATH environment variable, or
 
2.3. Use the --plugindir option of pyang each time you want to use YANG2SMI
 
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.
 
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.
Line 17: Line 16:
 
For example, to generate the network.yang to NETWORK.MIB , type:
 
For example, to generate the network.yang to NETWORK.MIB , type:
  
$./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

Revision as of 08:01, 21 January 2013

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

Step to convert YANG to MIB model: 1. You need an installation of pyang: 1.1 cd <SAFplus-Management-Framework>/3rdparty 1.2 make pyang

2. Add the YANG2SMI plugin to your existing pyang installation. This may be done in one of the following three ways:

2.1. Add <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to <SAFplus-Management-Framework>/3rdparty/pyang/pyang/plugins, 2.2. Add the location of <SAFplus-Management-Framework>/model/src/extras/pyplugin/yang2smi.py to the $PYANG_PLUGINPATH environment variable, or 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:

$source env.sh;./bin/pyang -f yang2smi network.yang --yang2smi-oid=99840 -o NETWORK.MIB