1 # Copyright 2017 Sandvine
2 # Copyright 2017-2018 Telefonica
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
17 # NOTE: pyang and pyangbind are required for build
19 .PHONY
: all clean package trees deps yang-ietf
21 PYBINDPLUGIN
:=$(shell /usr
/bin
/env python3
-c \
22 'import pyangbind; import os; print("{}/plugin".format(os.path.dirname(pyangbind.__file__)))')
24 YANG_DESC_MODELS
:= vnfd nsd
25 YANG_RECORD_MODELS
:= vnfr nsr
26 PYTHON_MODELS
:= $(addsuffix .py
, $(YANG_DESC_MODELS
))
27 YANG_DESC_TREES
:= $(addsuffix .tree.txt
, $(YANG_DESC_MODELS
))
28 YANG_DESC_JSTREES
:= $(addsuffix .html
, $(YANG_DESC_MODELS
))
29 YANG_RECORD_TREES
:= $(addsuffix .rec.tree.txt
, $(YANG_RECORD_MODELS
))
30 YANG_RECORD_JSTREES
:= $(addsuffix .rec.html
, $(YANG_RECORD_MODELS
))
33 TREES_DIR
:= osm_im_trees
34 MODEL_DIR
:= models
/yang
37 PYANG_OPTIONS
:= -Werror
39 all: $(PYTHON_MODELS
) trees
42 trees
: $(YANG_DESC_TREES
) $(YANG_DESC_JSTREES
) $(YANG_RECORD_TREES
) $(YANG_RECORD_JSTREES
)
45 $(Q
)mkdir
-p
$(OUT_DIR
)
46 $(Q
)touch
$(OUT_DIR
)/__init__.py
49 $(Q
)mkdir
-p
$(TREES_DIR
)
51 %.py
: $(OUT_DIR
) yang-ietf
52 $(Q
)echo generating
$@ from
$*.yang
53 $(Q
)pyang
$(PYANG_OPTIONS
) --path
$(MODEL_DIR
) --plugindir
$(PYBINDPLUGIN
) -f pybind
-o
$(OUT_DIR
)/$@
$(MODEL_DIR
)/$*.yang
55 %.tree.txt
: $(TREES_DIR
) yang-ietf
56 $(Q
)echo generating
$@ from
$*.yang
57 $(Q
)pyang
$(PYANG_OPTIONS
) --path
$(MODEL_DIR
) -f tree
-o
$(TREES_DIR
)/$@
$(MODEL_DIR
)/$*.yang
59 %.html
: $(TREES_DIR
) yang-ietf
60 $(Q
)echo generating
$@ from
$*.yang
61 $(Q
)pyang
$(PYANG_OPTIONS
) --path
$(MODEL_DIR
) -f jstree
-o
$(TREES_DIR
)/$@
$(MODEL_DIR
)/$*.yang
62 $(Q
)sed
-r
-i
's|data\:image/gif\;base64,R0lGODlhS.*RCAA7|https://osm.etsi.org/images/OSM-logo.png\" width=\"175\" height=\"60|g' $(TREES_DIR
)/$@
63 $(Q
)sed
-r
-i
's|<a href=\"http://www.tail-f.com">|<a href="http://osm.etsi.org">|g' $(TREES_DIR
)/$@
65 %.rec.tree.txt
: $(TREES_DIR
) yang-ietf
66 $(Q
)echo generating
$@ from
$*.yang
67 $(Q
)pyang
$(PYANG_OPTIONS
) --path
$(MODEL_DIR
) -f tree
-o
$(TREES_DIR
)/$@
$(MODEL_DIR
)/$*.yang
68 $(Q
)mv
$(TREES_DIR
)/$@
$(TREES_DIR
)/$*.tree.txt
70 %.rec.html
: $(TREES_DIR
) yang-ietf
71 $(Q
)echo generating
$@ from
$*.yang
72 $(Q
)pyang
$(PYANG_OPTIONS
) --path
$(MODEL_DIR
) -f jstree
-o
$(TREES_DIR
)/$@
$(MODEL_DIR
)/rw-project.yang
$(MODEL_DIR
)/$*.yang
73 $(Q
)sed
-r
-i
's|data\:image/gif\;base64,R0lGODlhS.*RCAA7|https://osm.etsi.org/images/OSM-logo.png\" width=\"175\" height=\"60|g' $(TREES_DIR
)/$@
74 $(Q
)sed
-r
-i
's|<a href=\"http://www.tail-f.com">|<a href="http://osm.etsi.org">|g' $(TREES_DIR
)/$@
75 $(Q
)mv
$(TREES_DIR
)/$@
$(TREES_DIR
)/$*.html
78 $(Q
)wget
-q https
://raw.githubusercontent.com
/YangModels
/yang
/master
/standard
/ietf
/RFC
/ietf-yang-types
%402013-07-15.yang
-O models
/yang
/ietf-yang-types.yang
79 $(Q
)wget
-q https
://raw.githubusercontent.com
/YangModels
/yang
/master
/standard
/ietf
/RFC
/ietf-inet-types
%402013-07-15.yang
-O models
/yang
/ietf-inet-types.yang
87 $(Q
)sudo apt-get
-y
install git make wget python python-pip debhelper dh-make tox python3 python3-pip maven
88 $(Q
)sudo
-H python3
-m pip
install -U pip
89 $(Q
)sudo
-H python2
-m pip
install -U pip
90 $(Q
)sudo
-H python3
-m pip
install -U pyang pyangbind stdeb
91 $(Q
)sudo
-H python2
-m pip
install -U pyang pyangbind stdeb
93 $(Q
)cp
-n ~
/.m2
/settings.xml
{,.orig
} ; wget
-q
-O
- https
://raw.githubusercontent.com
/opendaylight
/odlparent
/master
/settings.xml
> ~
/.m2
/settings.xml
96 $(Q
)rm -rf
dist osm_im.egg-info deb deb_dist
*.gz
$(OUT_DIR
) $(TREES_DIR
)