Adding pyang folder to .gitignore
[osm/IM.git] / Makefile
index c72183e..b606e30 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,13 +21,14 @@ PYBINDPLUGIN:=$(shell /usr/bin/env python -c \
 
 YANG_MODELS := vnfd nsd
 PYTHON_MODELS := $(addsuffix .py, $(YANG_MODELS))
 
 YANG_MODELS := vnfd nsd
 PYTHON_MODELS := $(addsuffix .py, $(YANG_MODELS))
+PYTHON_JSONSCHEMAS := $(addsuffix .jsonschema, $(YANG_MODELS))
 
 OUT_DIR := osm_im
 MODEL_DIR := models/yang
 RW_PB_EXT := build/yang/rw-pb-ext.yang
 Q?=@
 
 
 OUT_DIR := osm_im
 MODEL_DIR := models/yang
 RW_PB_EXT := build/yang/rw-pb-ext.yang
 Q?=@
 
-PYANG_OPTIONS := -Wnone
+PYANG_OPTIONS := -Werror
 
 all: $(PYTHON_MODELS) pyangbind
        $(MAKE) package
 
 all: $(PYTHON_MODELS) pyangbind
        $(MAKE) package
@@ -40,6 +41,10 @@ $(OUT_DIR):
        $(Q)echo generating $@ from $*.yang
        $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) --plugindir $(PYBINDPLUGIN) -f pybind -o $(OUT_DIR)/$@ $(MODEL_DIR)/$*.yang
 
        $(Q)echo generating $@ from $*.yang
        $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) --plugindir $(PYBINDPLUGIN) -f pybind -o $(OUT_DIR)/$@ $(MODEL_DIR)/$*.yang
 
+%.jsonschema: $(OUT_DIR) $(RW_PB_EXT) pyang-json-schema-plugin
+       $(Q)echo generating $@ from $*.yang
+       $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) --plugindir pyang-json-schema-plugin -f json-schema -o $(OUT_DIR)/$@ $(MODEL_DIR)/$*.yang
+
 $(RW_PB_EXT):
        $(Q)mkdir -p $$(dirname $@)
        $(Q)wget -q https://raw.githubusercontent.com/RIFTIO/RIFT.ware/RIFT.ware-4.4.1/modules/core/util/yangtools/yang/rw-pb-ext.yang -O $@
 $(RW_PB_EXT):
        $(Q)mkdir -p $$(dirname $@)
        $(Q)wget -q https://raw.githubusercontent.com/RIFTIO/RIFT.ware/RIFT.ware-4.4.1/modules/core/util/yangtools/yang/rw-pb-ext.yang -O $@
@@ -47,9 +52,16 @@ $(RW_PB_EXT):
 package:
        tox -e build
 
 package:
        tox -e build
 
-pyangbind:
+pyangbind: pyang
        git clone https://github.com/robshakir/pyangbind
        cd pyangbind; python setup.py --command-packages=stdeb.command bdist_deb; cd ..
 
        git clone https://github.com/robshakir/pyangbind
        cd pyangbind; python setup.py --command-packages=stdeb.command bdist_deb; cd ..
 
+pyang:
+       git clone https://github.com/mbj4668/pyang
+       cd pyang; python setup.py --command-packages=stdeb.command bdist_deb; cd ..
+
+pyang-json-schema-plugin:
+       git clone https://github.com/cmoberg/pyang-json-schema-plugin
+
 clean:
 clean:
-       $(Q)rm -rf build deb deb_dist *.gz pyangbind $(OUT_DIR)
+       $(Q)rm -rf build dist osm_im.egg-info deb deb_dist *.gz pyang pyangbind pyang-json-schema-plugin $(OUT_DIR)