YANG_RECORD_JSTREES := $(addsuffix .rec.html, $(YANG_RECORD_MODELS))
OPENAPI_SCHEMAS := osm.yaml
+SOL006_YANG_DESC_MODELS := etsi-nfv-vnfd etsi-nfv-nsd
+SOL006_PYTHON_MODELS := $(addsuffix .py, $(SOL006_YANG_DESC_MODELS))
+SOL006_YANG_DESC_TREES := $(addsuffix .tree.txt, $(SOL006_YANG_DESC_MODELS))
+SOL006_YANG_DESC_JSTREES := $(addsuffix .html, $(SOL006_YANG_DESC_MODELS))
+
OUT_DIR := osm_im
TREES_DIR := osm_im_trees
MODEL_DIR := models/yang
+SOL006_MODEL_DIR := sol006_model/src/yang
+
Q?=@
PYANG_OPTIONS := -Werror
-all: $(PYTHON_MODELS) trees openapi_schemas
+all: sol006_deps $(PYTHON_MODELS) $(SOL006_PYTHON_MODELS) trees openapi_schemas
$(MAKE) package
-trees: $(YANG_DESC_TREES) $(YANG_DESC_JSTREES) $(YANG_RECORD_TREES) $(YANG_RECORD_JSTREES)
+trees: $(YANG_DESC_TREES) $(YANG_DESC_JSTREES) $(SOL006_YANG_DESC_TREES) $(SOL006_YANG_DESC_JSTREES)
openapi_schemas: $(OPENAPI_SCHEMAS)
%.py: yang-ietf
$(Q)echo generating $@ from $*.yang
- $(Q)pyang $(PYANG_OPTIONS) --path $(MODEL_DIR) --plugindir $(PYBINDPLUGIN) -f pybind -o $(OUT_DIR)/$@ $(MODEL_DIR)/$*.yang
-
+ $(if $(findstring etsi,$@), $(eval DIR=$(SOL006_MODEL_DIR)),$(eval DIR = $(MODEL_DIR)))
+ $(Q)pyang $(PYANG_OPTIONS) --path $(DIR) --plugindir $(PYBINDPLUGIN) -f pybind -o $(OUT_DIR)/$@ $(DIR)/$*.yang
+
%.tree.txt: $(TREES_DIR) yang-ietf
$(Q)echo generating $@ from $*.yang
- $(Q)pyang $(PYANG_OPTIONS) --path $(MODEL_DIR) -f tree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang
+ $(if $(findstring etsi,$@), $(eval DIR=$(SOL006_MODEL_DIR)),$(eval DIR = $(MODEL_DIR)))
+ $(Q)pyang $(PYANG_OPTIONS) --path $(DIR) -f tree -o $(TREES_DIR)/$@ $(DIR)/$*.yang
%.html: $(TREES_DIR) yang-ietf
$(Q)echo generating $@ from $*.yang
- $(Q)pyang $(PYANG_OPTIONS) --path $(MODEL_DIR) -f jstree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang
+ $(if $(findstring etsi,$@), $(eval DIR=$(SOL006_MODEL_DIR)),$(eval DIR = $(MODEL_DIR)))
+ $(Q)pyang $(PYANG_OPTIONS) --path $(DIR) -f jstree -o $(TREES_DIR)/$@ $(DIR)/$*.yang
$(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)/$@
$(Q)sed -r -i 's|<a href=\"http://www.tail-f.com">|<a href="http://osm.etsi.org">|g' $(TREES_DIR)/$@
$(Q)$(JAVA) -jar ${HOME}/.m2/repository/com/mrv/yangtools/swagger-generator-cli/1.1.11/swagger-generator-cli-1.1.11-executable.jar -yang-dir $(MODEL_DIR) -output $(OUT_DIR)/$@
yang-ietf:
- $(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
- $(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
+ $(Q)wget -q https://raw.githubusercontent.com/YangModels/yang/master/standard/ietf/RFC/ietf-yang-types%402013-07-15.yang -O $(MODEL_DIR)/ietf-yang-types.yang
+ $(Q)wget -q https://raw.githubusercontent.com/YangModels/yang/master/standard/ietf/RFC/ietf-inet-types%402013-07-15.yang -O $(MODEL_DIR)/ietf-inet-types.yang
+ $(Q)cp $(MODEL_DIR)/ietf-yang-types.yang $(SOL006_MODEL_DIR)/ietf-yang-types.yang
+ $(Q)cp $(MODEL_DIR)/ietf-inet-types.yang $(SOL006_MODEL_DIR)/ietf-inet-types.yang
yang2swagger:
$(Q)mkdir -p ${HOME}/.m2
$(Q)mkdir -p ~/.m2
$(Q)cp -n ~/.m2/settings.xml{,.orig} ; wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
+sol006_deps:
+ $(Q)git clone --single-branch --branch v2.6.1 https://forge.etsi.org/rep/nfv/SOL006.git sol006_model
+ $(Q)patch -p2 < patch/deref_warnings.patch
+ $(Q)patch -p2 < patch/nested_workaround.patch
+
clean:
- $(Q)rm -rf dist osm_im.egg-info deb deb_dist *.gz osm-imdocs* yang2swagger $(TREES_DIR)
+ $(Q)rm -rf dist sol006_model osm_im.egg-info deb deb_dist *.gz osm-imdocs* yang2swagger $(TREES_DIR)
--- /dev/null
+#
+# Copyright 2019 Whitestack LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+--- /tmp/sol006_model/src/yang/etsi-nfv-ns.yang 2019-12-04 13:56:05.510072421 +0000
++++ /tmp/sol006_model/src/yang/etsi-nfv-ns_new.yang 2019-12-04 13:59:32.675856579 +0000
+@@ -434,8 +434,8 @@
+ mandatory "true";
+ container vnf-profile {
+ leaf vnf-profile-id {
+- must ". = deref(../../vnfd-profile-id)" {
+- }
++ // must ". = deref(../../vnfd-profile-id)" {
++ // }
+ type leafref {
+ path "../../../../../nsd/df/vnf-profile/id";
+ }
+@@ -443,8 +443,8 @@
+ }
+ container pnf-profile {
+ leaf pnf-profile-id {
+- must ". = deref(../../pnfd-profile-id)" {
+- }
++ // must ". = deref(../../pnfd-profile-id)" {
++ // }
+ type leafref {
+ path "../../../../../nsd/df/pnf-profile/id";
+ }
+@@ -452,8 +452,8 @@
+ }
+ container ns-profile {
+ leaf ns-profile-id {
+- must ". = deref(../../ns-profile-id)" {
+- }
++ // must ". = deref(../../ns-profile-id)" {
++ // }
+ type leafref {
+ path "../../../../../nsd/df/ns-profile/id";
+ }
+@@ -469,8 +469,8 @@
+ choice constituent-cpd-id {
+ container vnf {
+ leaf vnfd-id {
+- must ". = deref(../../vnfd-profile-id)/../vnfd-id" {
+- }
++ // must ". = deref(../../vnfd-profile-id)/../vnfd-id" {
++ // }
+ type leafref {
+ path "../../../../../vnfd/id";
+ }
+@@ -483,8 +483,8 @@
+ }
+ container pnf {
+ leaf pnfd-id {
+- must ". = deref(../../pnfd-profile-id)/../pnfd-id" {
+- }
++ // must ". = deref(../../pnfd-profile-id)/../pnfd-id" {
++ // }
+ type leafref {
+ path "../../../../../pnfd/id";
+ }
+@@ -497,9 +497,9 @@
+ }
+ container ns {
+ leaf nsd-id {
+- must ". = deref(../../nested-ns-profile-id)/" +
+- "../nsd-id" {
+- }
++ // must ". = deref(../../nested-ns-profile-id)/" +
++ // "../nsd-id" {
++ // }
+
+ type leafref {
+ path "../../../../../nsd/id";
--- /dev/null
+#
+# Copyright 2019 Whitestack LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+--- /tmp/sol006_model/src/yang/etsi-nfv-ns.yang 2019-12-04 14:26:39.453144459 +0000
++++ /tmp/sol006_model/src/yang/etsi-nfv-ns_new.yang 2019-12-04 14:28:34.659419362 +0000
+@@ -159,7 +159,7 @@
+ "GS NFV IFA014: Section 6.2.3.2 Sapd information element";
+ }
+
+- choice associated-cpd-id {
++ //choice associated-cpd-id {
+ container vnf {
+ leaf vnfd-id {
+ mandatory true;
+@@ -209,7 +209,7 @@
+ }
+ }
+ }
+- }
++ //}
+ }
+ }
+