| # ----------------------------------------------------------------------------- |
| # ONOS YANG to XML skeleton convert via pyang |
| # ----------------------------------------------------------------------------- |
| [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| . $ONOS_ROOT/tools/build/envDefaults |
| errorstring="Pyang no installed, please download and intall from https://github.com/mbj4668/pyang" |
| grep -q "pyang: command not found" $aux && echo $errorString && exit 1 |
| echo "$1 input directory not found" >&2 |
| echo "$1 not a directory for output" >&2 |
| find . -name '*.yang' | while read file; do f=$(basename $file ".yang"); \ |
| directory=$ONOS_ROOT/drivers/utilities/src/main/resources/${PWD##*/}; \ |
| if [ ! -d "$directory" ]; then |
| pyang -f sample-xml-skeleton $f.yang > $directory/$f.xml; done |