From: garciadeblas Date: Wed, 30 Aug 2017 12:55:49 +0000 (+0200) Subject: Preliminary JSON schemas based on YANG models X-Git-Tag: v3.0.0rc02~13 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F2106%2F1;p=osm%2FIM.git Preliminary JSON schemas based on YANG models Change-Id: I0d8a823c26514298583048def80669cdbc49e1f8 Signed-off-by: garciadeblas --- diff --git a/Makefile b/Makefile index 6305363..3da5670 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ PYBINDPLUGIN:=$(shell /usr/bin/env python -c \ YANG_MODELS := vnfd nsd PYTHON_MODELS := $(addsuffix .py, $(YANG_MODELS)) +PYTHON_JSONSCHEMAS := $(addsuffix .jsonschema, $(YANG_MODELS)) OUT_DIR := osm_im MODEL_DIR := models/yang @@ -29,7 +30,7 @@ Q?=@ PYANG_OPTIONS := -Werror -all: $(PYTHON_MODELS) pyangbind +all: $(PYTHON_MODELS) pyangbind $(PYTHON_JSONSCHEMAS) $(MAKE) package $(OUT_DIR): @@ -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 +%.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 $@ @@ -51,5 +56,8 @@ pyangbind: git clone https://github.com/robshakir/pyangbind cd pyangbind; 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: $(Q)rm -rf build deb deb_dist *.gz pyangbind $(OUT_DIR)