1 # Copyright 2017 Sandvine
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
16 # NOTE: pyang and pyangbind are required for build
19 PYBINDPLUGIN
:=$(shell /usr
/bin
/env python
-c \
20 'import pyangbind; import os; print "%s/plugin" % os.path.dirname(pyangbind.__file__)')
22 YANG_MODELS
:= vnfd nsd
23 PYTHON_MODELS
:= $(addsuffix .py
, $(YANG_MODELS
))
24 PYTHON_JSONSCHEMAS
:= $(addsuffix .jsonschema
, $(YANG_MODELS
))
27 MODEL_DIR
:= models
/yang
28 RW_PB_EXT
:= build
/yang
/rw-pb-ext.yang
31 PYANG_OPTIONS
:= -Werror
33 all: $(PYTHON_MODELS
) pyangbind
37 $(Q
)mkdir
-p
$(OUT_DIR
)
38 $(Q
)touch
$(OUT_DIR
)/__init__.py
40 %.py
: $(OUT_DIR
) $(RW_PB_EXT
)
41 $(Q
)echo generating
$@ from
$*.yang
42 $(Q
)pyang
$(PYANG_OPTIONS
) --path build
/yang
--path
$(MODEL_DIR
) --plugindir
$(PYBINDPLUGIN
) -f pybind
-o
$(OUT_DIR
)/$@
$(MODEL_DIR
)/$*.yang
44 %.jsonschema
: $(OUT_DIR
) $(RW_PB_EXT
) pyang-json-schema-plugin
45 $(Q
)echo generating
$@ from
$*.yang
46 $(Q
)pyang
$(PYANG_OPTIONS
) --path build
/yang
--path
$(MODEL_DIR
) --plugindir pyang-json-schema-plugin
-f json-schema
-o
$(OUT_DIR
)/$@
$(MODEL_DIR
)/$*.yang
49 $(Q
)mkdir
-p
$$(dirname
$@
)
50 $(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
$@
56 git clone https
://github.com
/robshakir
/pyangbind
57 cd pyangbind
; python setup.py
--command-packages
=stdeb.command bdist_deb
; cd ..
59 cp pyangbind
/deb_dist
/*.deb deb_dist
62 git clone https
://github.com
/mbj4668
/pyang
63 cd pyang
; python setup.py
--command-packages
=stdeb.command bdist_deb
; cd ..
65 cp pyang
/deb_dist
/*.deb deb_dist
67 pyang-json-schema-plugin
:
68 git clone https
://github.com
/cmoberg
/pyang-json-schema-plugin
71 $(Q
)rm -rf build
dist osm_im.egg-info deb deb_dist
*.gz pyang pyangbind pyang-json-schema-plugin
$(OUT_DIR
)