From 76f6a62b4cc15bc77cf1270d2b1630524fb2879f Mon Sep 17 00:00:00 2001 From: garciaale Date: Thu, 19 Nov 2020 17:57:42 -0300 Subject: [PATCH] Updates branch master with sol006 branch, introducing new SOL006 model classes Change-Id: Ica385dd2e44a0e72561b450554f7fa9e450f08c9 Signed-off-by: garciaale --- .gitignore | 2 + Dockerfile | 3 +- Makefile | 38 +- devops-stages/stage-test.sh | 20 + models/augments/additional-info.yang | 42 ++ models/augments/alarm.yang | 70 +++ models/augments/alternative-images.yang | 57 ++ models/augments/cloud-init.yang | 54 ++ models/augments/common-augments.yang | 554 ++++++++++++++++++ models/augments/configuration.yang | 92 +++ models/augments/day1-2.yang | 65 ++ models/augments/epa.yang | 262 +++++++++ models/augments/interface.yang | 58 ++ models/augments/ip-profiles.yang | 218 +++++++ models/augments/kdu.yang | 165 ++++++ models/augments/mgmt-interface.yang | 40 ++ models/augments/ns-configuration.yang | 44 ++ models/augments/ns-various.yang | 65 ++ models/augments/ns-vld.yang | 57 ++ models/augments/scaling.yang | 168 ++++++ models/augments/various.yang | 120 ++++ models/augments/vip.yang | 63 ++ osm_im/validation.py | 13 +- patch/deref_warnings.patch | 86 +++ patch/nested_workaround.patch | 36 ++ setup.py | 17 +- tests/examples/alternative_image_im.yaml | 46 ++ tests/examples/alternative_image_sol006.yaml | 77 +++ tests/examples/cirros_nsd_im.yaml | 59 ++ tests/examples/cirros_nsd_sol006.yaml | 46 ++ tests/examples/cirros_vnfd_im.yaml | 63 ++ tests/examples/cirros_vnfd_sol006.yaml | 71 +++ tests/examples/epa_im.yaml | 154 +++++ tests/examples/epa_sol006.yaml | 164 ++++++ tests/examples/etsi_complex_vnfd_sol006.yaml | 218 +++++++ tests/examples/etsi_nsd_sol006.yaml | 40 ++ tests/examples/hackfest_charmed_nsd_im.yaml | 54 ++ .../examples/hackfest_charmed_nsd_sol006.yaml | 57 ++ tests/examples/hackfest_charmed_vnfd_im.yaml | 157 +++++ .../hackfest_charmed_vnfd_sol006.yaml | 177 ++++++ tests/examples/magma_knf_im.yaml | 35 ++ tests/examples/magma_knf_sol006.yaml | 44 ++ tests/examples/vepc_im.yaml | 182 ++++++ tests/examples/vepc_nsd_im.yaml | 62 ++ tests/examples/vepc_nsd_sol006.yaml | 57 ++ tests/examples/vepc_sol006.yaml | 219 +++++++ tests/examples/vnfd_im.yaml | 87 +++ tests/examples/vnfd_sol006.yaml | 66 +++ tests/test_validation.py | 54 ++ tox.ini | 25 +- 50 files changed, 4582 insertions(+), 41 deletions(-) create mode 100644 models/augments/additional-info.yang create mode 100644 models/augments/alarm.yang create mode 100644 models/augments/alternative-images.yang create mode 100644 models/augments/cloud-init.yang create mode 100644 models/augments/common-augments.yang create mode 100644 models/augments/configuration.yang create mode 100644 models/augments/day1-2.yang create mode 100644 models/augments/epa.yang create mode 100644 models/augments/interface.yang create mode 100644 models/augments/ip-profiles.yang create mode 100644 models/augments/kdu.yang create mode 100644 models/augments/mgmt-interface.yang create mode 100644 models/augments/ns-configuration.yang create mode 100644 models/augments/ns-various.yang create mode 100644 models/augments/ns-vld.yang create mode 100644 models/augments/scaling.yang create mode 100644 models/augments/various.yang create mode 100644 models/augments/vip.yang create mode 100644 patch/deref_warnings.patch create mode 100644 patch/nested_workaround.patch create mode 100644 tests/examples/alternative_image_im.yaml create mode 100644 tests/examples/alternative_image_sol006.yaml create mode 100644 tests/examples/cirros_nsd_im.yaml create mode 100644 tests/examples/cirros_nsd_sol006.yaml create mode 100644 tests/examples/cirros_vnfd_im.yaml create mode 100644 tests/examples/cirros_vnfd_sol006.yaml create mode 100644 tests/examples/epa_im.yaml create mode 100644 tests/examples/epa_sol006.yaml create mode 100644 tests/examples/etsi_complex_vnfd_sol006.yaml create mode 100644 tests/examples/etsi_nsd_sol006.yaml create mode 100644 tests/examples/hackfest_charmed_nsd_im.yaml create mode 100644 tests/examples/hackfest_charmed_nsd_sol006.yaml create mode 100644 tests/examples/hackfest_charmed_vnfd_im.yaml create mode 100644 tests/examples/hackfest_charmed_vnfd_sol006.yaml create mode 100644 tests/examples/magma_knf_im.yaml create mode 100644 tests/examples/magma_knf_sol006.yaml create mode 100644 tests/examples/vepc_im.yaml create mode 100644 tests/examples/vepc_nsd_im.yaml create mode 100644 tests/examples/vepc_nsd_sol006.yaml create mode 100644 tests/examples/vepc_sol006.yaml create mode 100644 tests/examples/vnfd_im.yaml create mode 100644 tests/examples/vnfd_sol006.yaml create mode 100644 tests/test_validation.py diff --git a/.gitignore b/.gitignore index 893f025..f1e4221 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,8 @@ osm_im/vnfd.py osm_im/nst.py osm_im/nsi.py osm_im/osm.yaml +osm_im/etsi-nfv-nsd.py +osm_im/etsi-nfv-vnfd.py #Pyang and other tools' folders pyangbind diff --git a/Dockerfile b/Dockerfile index 419f8db..a5c912e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -FROM ubuntu:16.04 +FROM ubuntu:18.04 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get -y install git make wget python \ @@ -22,6 +22,7 @@ RUN apt-get update && \ debhelper tox python-setuptools \ python3-setuptools build-essential dh-make \ openjdk-8-jdk maven && \ + update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64 && \ DEBIAN_FRONTEND=noninteractive pip3 install pip==9.0.3 && \ DEBIAN_FRONTEND=noninteractive pip3 install -U pyang pyangbind && \ DEBIAN_FRONTEND=noninteractive pip3 install -U stdeb && \ diff --git a/Makefile b/Makefile index 190a9b1..325fd9d 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ PYANG:= pyang PYBINDPLUGIN:=$(shell /usr/bin/env python3 -c \ 'import pyangbind; import os; print("{}/plugin".format(os.path.dirname(pyangbind.__file__)))') -YANG_DESC_MODELS := vnfd nsd nst nsi +YANG_DESC_MODELS := vnfd nsd nst nsi etsi-nfv-vnfd etsi-nfv-nsd YANG_RECORD_MODELS := vnfr nsr PYTHON_MODELS := $(addsuffix .py, $(YANG_DESC_MODELS)) YANG_DESC_TREES := $(addsuffix .tree.txt, $(YANG_DESC_MODELS)) @@ -34,13 +34,18 @@ OPENAPI_SCHEMAS := osm.yaml OUT_DIR := osm_im TREES_DIR := osm_im_trees MODEL_DIR := models/yang +SOL006_MODEL_DIR := sol006_model/src/yang +SOL006_AUGMENTS_DIR := models/augments/* + Q?=@ PYANG_OPTIONS := -Werror -all: $(PYTHON_MODELS) trees openapi_schemas +all: models trees openapi_schemas $(MAKE) package +models: sol006_deps $(PYTHON_MODELS) + trees: $(YANG_DESC_TREES) $(YANG_DESC_JSTREES) $(YANG_RECORD_TREES) $(YANG_RECORD_JSTREES) openapi_schemas: $(OPENAPI_SCHEMAS) @@ -50,26 +55,32 @@ $(TREES_DIR): %.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))) + $(if $(findstring etsi,$@), $(eval AUGMENTS_DIR=$(SOL006_AUGMENTS_DIR)),$(eval AUGMENTS_DIR=)) + $(Q)pyang $(PYANG_OPTIONS) --path $(DIR) --plugindir $(PYBINDPLUGIN) -f pybind -o $(OUT_DIR)/$@ $(AUGMENTS_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|||g' $(TREES_DIR)/$@ %.rec.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 $(Q)mv $(TREES_DIR)/$@ $(TREES_DIR)/$*.tree.txt %.rec.html: $(TREES_DIR) yang-ietf $(Q)echo generating $@ from $*.yang - $(Q)pyang $(PYANG_OPTIONS) --path $(MODEL_DIR) -f jstree -o $(TREES_DIR)/$@ $(MODEL_DIR)/osm-project.yang $(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)/osm-project.yang $(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|||g' $(TREES_DIR)/$@ $(Q)mv $(TREES_DIR)/$@ $(TREES_DIR)/$*.html @@ -79,8 +90,10 @@ osm.yaml: yang-ietf yang2swagger $(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 @@ -102,5 +115,10 @@ deps: $(Q)mkdir -p ~/.m2 $(Q)cp -n ~/.m2/settings.xml ~/.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) diff --git a/devops-stages/stage-test.sh b/devops-stages/stage-test.sh index 1a24852..36bb8d3 100755 --- a/devops-stages/stage-test.sh +++ b/devops-stages/stage-test.sh @@ -1 +1,21 @@ #!/bin/sh + +# Copyright 2017 Sandvine +# Copyright 2017-2018 Telefonica +# All Rights Reserved. +# +# 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. + +make clean +make models +tox diff --git a/models/augments/additional-info.yang b/models/augments/additional-info.yang new file mode 100644 index 0000000..2119073 --- /dev/null +++ b/models/augments/additional-info.yang @@ -0,0 +1,42 @@ +/* + Copyright 2020 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. +*/ + +module additional-info { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:additional-info"; + prefix "additional-info"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + import common-augments { + prefix common; + } + + augment "/vnfd:vnfd" { + uses common:description; + } + + augment "/vnfd:vnfd/vnfd:df/vnfd:virtual-link-profile/vnfd:virtual-link-protocol-data/vnfd:l3-protocol-data" { + uses common:description; + } + + augment "/vnfd:vnfd/vnfd:virtual-storage-desc" { + uses common:description; + } +} diff --git a/models/augments/alarm.yang b/models/augments/alarm.yang new file mode 100644 index 0000000..7b6db1f --- /dev/null +++ b/models/augments/alarm.yang @@ -0,0 +1,70 @@ +/* + Copyright 2020 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. +*/ + +module alarm { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:alarm"; + prefix "alarm"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + import common-augments { + prefix common; + } + + grouping extended-alarm { + list alarm { + key "alarm-id"; + + leaf alarm-id { + description + "This field is reserved for the identifier assigned by the VIM provider"; + + type string; + } + + + leaf vnf-monitoring-param-ref { + description + "Reference to the VNF level monitoring parameter + that is aggregated"; + type leafref { + path "/vnfd:vnfd/vnfd:df/vnfd:monitoring-parameter/vnfd:id"; + } + } + + uses common:alarm-properties; + } + + } + + augment "/vnfd:vnfd/vnfd:vdu" { + uses extended-alarm; + } +} + + + + + + + + + + diff --git a/models/augments/alternative-images.yang b/models/augments/alternative-images.yang new file mode 100644 index 0000000..08adcc3 --- /dev/null +++ b/models/augments/alternative-images.yang @@ -0,0 +1,57 @@ +/* + Copyright 2020 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. +*/ + +module alternative-images { + yang-version 1.1; + namespace "urn:etsi:osm:yang:alternative-images"; + prefix "alternative-images"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + grouping extended-vim-type { + leaf vim-type { + description + "VIM type: openvim, openstack, vmware, aws, etc."; + type string; + } + } + grouping extended-alternative-images { + leaf-list alternative-sw-image-desc { + description + "List of alternative images per VIM type. + Different images can be used for specific types of VIMs instead + of the default image. This allows deployments in sites where the + image identifier in the VIM is given by the VIM provider and + cannot be modified. + If an alternative image is specified for a VIM type, it will prevail + over the default image"; + type leafref { + path "/vnfd:vnfd/vnfd:sw-image-desc/vnfd:id"; + } + } + } + + augment "/vnfd:vnfd/vnfd:sw-image-desc" { + uses extended-vim-type; + } + + augment "/vnfd:vnfd/vnfd:vdu" { + uses extended-alternative-images; + } +} \ No newline at end of file diff --git a/models/augments/cloud-init.yang b/models/augments/cloud-init.yang new file mode 100644 index 0000000..160c5c8 --- /dev/null +++ b/models/augments/cloud-init.yang @@ -0,0 +1,54 @@ +/* + 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. +*/ + +module cloud-init { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:cloud-init"; + prefix "cloud-init"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + grouping extended-cloud-init { + choice cloud-init-input { + description + "Indicates how the contents of cloud-init script are provided. + There are 2 choices - inline or in a file"; + + case inline { + leaf cloud-init { + description + "Contents of cloud-init script, provided inline, in cloud-config format"; + type string; + } + } + + case filename { + leaf cloud-init-file { + description + "Name of file with contents of cloud-init script in cloud-config format"; + type string; + } + } + } + } + + augment "/vnfd:vnfd/vnfd:vdu" { + uses extended-cloud-init; + } +} \ No newline at end of file diff --git a/models/augments/common-augments.yang b/models/augments/common-augments.yang new file mode 100644 index 0000000..7beec89 --- /dev/null +++ b/models/augments/common-augments.yang @@ -0,0 +1,554 @@ +/* + Copyright 2020 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. +*/ + +module common-augments { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments"; + prefix "common"; + + typedef parameter-data-type { + type enumeration { + enum STRING; + enum INTEGER; + enum BOOLEAN; + } + } + + grouping primitive-parameter-value { + list parameter { + description + "List of parameters to the configuration primitive."; + key "name"; + leaf name { + description + "Name of the parameter."; + type string; + } + + leaf data-type { + description + "Data type associated with the value."; + type common:parameter-data-type; + } + + leaf value { + description + "Value associated with the name."; + type string; + } + } + } + + grouping primitive-parameter { + leaf name { + description + "Name of the parameter."; + type string; + } + + leaf data-type { + description + "Data type associated with the name."; + type common:parameter-data-type; + } + + leaf mandatory { + description + "Is this field mandatory"; + type boolean; + default false; + } + + leaf default-value { + description + "The default value for this field"; + type string; + } + + leaf parameter-pool { + description + "NSD parameter pool name to use for this parameter"; + type string; + } + + leaf read-only { + description + "The value should be dimmed by the UI. + Only applies to parameters with default values."; + type boolean; + default false; + } + + leaf hidden { + description + "The value should be hidden by the UI. + Only applies to parameters with default values."; + type boolean; + default false; + } + } + + grouping vnfc-relations { + list relation { + description + "List of relations between elements in this descriptor."; + key "name"; + + leaf name { + description + "Name of the relation."; + + type string; + } + + list entities { + description + "List of two elements to be related. + Elements to be related are identified by a pair (id, endpoint). + The relation will relate (id1, endpoint1) to (id2, endpoint2)."; + key "id"; + + leaf id { + description + "A string, reference to the element id in the descriptor. + It could be a vnfd-id or a vdu-id in a VNFD, + or a nsd-id or member-vnf-index in a NSD."; + type string; + } + + leaf endpoint { + description + "Endpoint name defining the relation."; + type string; + } + } + } + } + + grouping vnfc-metrics { + description + "Information about the VNF or VDU metrics"; + list metrics { + description + "List of VNFC related metrics"; + key "name"; + leaf name { + description + "Name of the metric, as defined in the Juju charm."; + type string; + } + } + } + + grouping configuration-method { + choice config-method { + description + "Defines the configuration method for the VNF or VDU."; + case script { + description + "Use custom script for configuring the VNF or VDU. + This script is executed in the context of + Orchestrator (The same system and environment + as the Launchpad)."; + container script { + leaf script-type { + description + "Script type - currently supported - Scripts confirming to Rift CA plugin"; + type enumeration { + enum rift; + } + } + } + } + + case juju { + description + "Configure the VNF or VDU through Juju."; + container juju { + leaf charm { + description + "Juju charm to use with the VNF or VDU."; + type string; + } + leaf proxy { + description + "Is this a proxy charm?"; + type boolean; + default true; + } + } + } + } + } + + grouping vdu-config-access { + + container config-access { + + description + "Indicates the way to access to the xNF or xDU for VCA configuration. + For the moment there is a single way (ssh-access)."; + + container ssh-access { + + description + "If the xNF requires ssh and this parameter is set, SSH keys + will be injected so that VCA can configure the xNF or xDU via ssh."; + + leaf required { + description + "whether ssh access is needed or not"; + type boolean; + default false; + } + + leaf default-user { + description + "Default user for ssh"; + type string; + } + } + } + } + + grouping vnfc-configuration { + description + "Common information in the descriptors for NS, VNF or VDU configuration. + Note: If the NS contains multiple instances of the + same VNF or VDU, each instance could have a different + configuration."; + + uses common:configuration-method; + + list config-primitive { + description + "List of config primitives supported by the + configuration agent for this VNF or VDU."; + key "name"; + + leaf name { + description + "Name of the config primitive."; + type string; + } + + list parameter { + description + "List of parameters to the config primitive."; + key "name"; + uses primitive-parameter; + } + + leaf user-defined-script { + description + "A user defined script. If user defined script is defined, + the script will be executed using bash"; + type string; + } + } + + list initial-config-primitive { + description + "Initial set of configuration primitives."; + key "seq"; + leaf seq { + description + "Sequence number for the configuration primitive."; + type uint64; + } + + choice primitive-type { + case primitive-definition { + leaf name { + description + "Name of the configuration primitive."; + type string; + } + + uses primitive-parameter-value; + + leaf user-defined-script { + description + "A user defined script."; + type string; + } + } + } + } + + list terminate-config-primitive { + description + "Terminate set of configuration primitives."; + key "seq"; + leaf seq { + description + "Sequence number for the configuration primitive."; + type uint64; + } + leaf name { + description + "Name of the configuration primitive."; + type string; + } + + uses primitive-parameter-value; + + leaf user-defined-script { + description + "A user defined script."; + type string; + } + } + uses common:vnfc-metrics; + } + + typedef alarm-severity-type { + description + "An indication of the importance or urgency of the alarm"; + type enumeration { + enum LOW; + enum MODERATE; + enum CRITICAL; + } + } + + typedef alarm-statistic-type { + description + "Statistic type to use to determine threshold crossing + for an alarm."; + type enumeration { + enum AVERAGE; + enum MINIMUM; + enum MAXIMUM; + enum COUNT; + enum SUM; + } + } + + typedef relational-operation-type { + description + "The relational operator used to define whether an alarm, + scaling event, etc. should be triggered in certain scenarios, + such as if the metric statistic goes above or below a specified + value."; + type enumeration { + enum GE; // greater than or equal + enum LE; // less than or equal + enum GT; // greater than + enum LT; // less than + enum EQ; // equal + } + } + + grouping alarm-properties { + leaf name { + description + "A human readable string to identify the alarm"; + type string; + } + + leaf description { + description + "A description of this alarm"; + type string; + } + + leaf vdur-id { + description + "The identifier of the VDUR that the alarm is associated with"; + type string; + } + + container actions { + list ok { + key "url"; + leaf url { + type string; + } + } + + list insufficient-data { + key "url"; + leaf url { + type string; + } + } + + list alarm { + key "url"; + leaf url { + type string; + } + } + } + + leaf repeat { + description + "This flag indicates whether the alarm should be repeatedly emitted + while the associated threshold has been crossed."; + + type boolean; + default true; + } + + leaf enabled { + description + "This flag indicates whether the alarm has been enabled or + disabled."; + + type boolean; + default true; + } + + leaf severity { + description + "A measure of the importance or urgency of the alarm"; + type alarm-severity-type; + } + + leaf statistic { + description + "The type of metric statistic that is tracked by this alarm"; + type alarm-statistic-type; + } + + leaf operation { + description + "The relational operator used to define whether an alarm should be + triggered in certain scenarios, such as if the metric statistic + goes above or below a specified value."; + type relational-operation-type; + } + + leaf value { + description + "This value defines the threshold that, if crossed, will trigger + the alarm."; + type decimal64 { + fraction-digits 4; + } + } + + leaf period { + description + "The period defines the length of time (seconds) that the metric + data are collected over in oreder to evaluate the chosen + statistic."; + type uint32; + } + + leaf evaluations { + description + "Defines the length of time (seconds) in which metric data are + collected in order to evaluate the chosen statistic."; + type uint32; + } + } + + grouping virtual-interface { + container virtual-interface { + description + "Container for the virtual interface properties"; + + leaf type { + description + "Specifies the type of virtual interface + between VM and host. + PARAVIRT : Use the default paravirtualized interface for the VIM (virtio, vmxnet3, etc.). + VIRTIO : Deprecated! Use the traditional VIRTIO interface. + PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface. + SR-IOV : Use SR-IOV interface. + E1000 : Emulate E1000 interface. + RTL8139 : Emulate RTL8139 interface. + PCNET : Emulate PCNET interface. + OM-MGMT : Deprecated! Use PARAVIRT instead and set the VNF management interface at vnfd:mgmt-interface:cp"; + + type enumeration { + enum PARAVIRT; + enum OM-MGMT; + enum PCI-PASSTHROUGH; + enum SR-IOV; + enum VIRTIO; + enum E1000; + enum RTL8139; + enum PCNET; + } + default "PARAVIRT"; + } + + leaf vpci { + description + "Specifies the virtual PCI address. Expressed in + the following format dddd:dd:dd.d. For example + 0000:00:12.0. This information can be used to + pass as metadata during the VM creation."; + type string; + } + + leaf bandwidth { + description + "Aggregate bandwidth of the NIC."; + type uint64; + } + } + } + + grouping description { + leaf description { + type string; + } + } + + typedef scaling-trigger { + type enumeration { + enum pre-scale-in { + value 1; + } + enum post-scale-in { + value 2; + } + enum pre-scale-out { + value 3; + } + enum post-scale-out { + value 4; + } + } + } + + typedef scaling-policy-type { + type enumeration { + enum manual { + value 1; + } + enum automatic { + value 2; + } + } + } + + typedef scaling-criteria-operation { + type enumeration { + enum AND { + value 1; + } + enum OR { + value 2; + } + } + } +} \ No newline at end of file diff --git a/models/augments/configuration.yang b/models/augments/configuration.yang new file mode 100644 index 0000000..94a226d --- /dev/null +++ b/models/augments/configuration.yang @@ -0,0 +1,92 @@ +/* + Copyright 2020 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. +*/ + +module configuration { + yang-version 1.1; + namespace "urn:etsi:osm:yang:configuration"; + prefix "configuration"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + import day1-2 { + prefix day1-2; + } + + import kdu { + prefix kdu; + } + grouping extended-vnf-configuration { + leaf vnf-configuration-id { + description + "Reference for the VNF configuration to use in this DF"; + type leafref { + path "/vnfd:vnfd/day1-2:vnf-configuration/day1-2:id"; + } + } + } + + grouping extended-vdu-configuration { + leaf vdu-configuration-id { + description + "Reference for the VDU configuration to use in this DF"; + type leafref { + path "/vnfd:vnfd/day1-2:vdu-configuration/day1-2:id"; + } + } + } + + grouping extended-kdu-configuration { + list kdu-profile { + key "name"; + + leaf name { + description + "Reference to the KDU"; + type leafref { + path "/vnfd:vnfd/kdu:kdu/kdu:name"; + } + } + + leaf kdu-configuration-id { + description + "Reference to the KDU configuration to use in this DF"; + type leafref { + path "/vnfd:vnfd/kdu:kdu-configuration/kdu:id"; + } + } + + leaf kdu-model-id { + description + "Reference to the KDU model to use in this DF"; + type leafref { + path "/vnfd:vnfd/kdu:kdu-model/kdu:id"; + } + } + } + } + + augment "/vnfd:vnfd/vnfd:df" { + uses extended-vnf-configuration; + uses extended-kdu-configuration; + } + + augment "/vnfd:vnfd/vnfd:df/vnfd:vdu-profile" { + uses extended-vdu-configuration; + } +} \ No newline at end of file diff --git a/models/augments/day1-2.yang b/models/augments/day1-2.yang new file mode 100644 index 0000000..e66ce16 --- /dev/null +++ b/models/augments/day1-2.yang @@ -0,0 +1,65 @@ +/* + Copyright 2020 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. +*/ + +module day1-2 { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:day1-2"; + prefix "day1-2"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + import common-augments { + prefix common; + } + + grouping extended-vnf-configuration { + list vnf-configuration { + key "id"; + leaf id { + description + "Internal identifier for the VNF configuration"; + type string; + } + uses common:vnfc-configuration; + uses common:vnfc-relations; + uses common:vdu-config-access; + } + } + + grouping extended-vdu-configuration { + list vdu-configuration { + key "id"; + leaf id { + description + "Internal identifier for the VDU configuration"; + type string; + } + uses common:vnfc-configuration; + uses common:vdu-config-access; + } + } + + augment "/vnfd:vnfd" { + uses extended-vnf-configuration; + } + + augment "/vnfd:vnfd" { + uses extended-vdu-configuration; + } +} \ No newline at end of file diff --git a/models/augments/epa.yang b/models/augments/epa.yang new file mode 100644 index 0000000..d47d6a9 --- /dev/null +++ b/models/augments/epa.yang @@ -0,0 +1,262 @@ +/* + Copyright 2020 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. +*/ + +module epa { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:epa"; + prefix "epa"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + grouping allocation-properties { + leaf limit { + description + "Defines the maximum allocation. The value 0 indicates that usage is not limited. + This parameter ensures that the instance never uses more than the defined amount of resource."; + type uint64; + } + + leaf reserve { + description + "Defines the guaranteed minimum reservation. + If needed, the machine will definitely get allocated the reserved amount of resources."; + type uint64; + } + + leaf shares { + description + "Number of shares allocated. + Specifies the proportional weighted share for the domain. + If this element is omitted, the service defaults to the OS provided defaults"; + type uint64; + } + } + + grouping extended-mem-quota { + container mem-quota { + description + "Memory quota describes the memory resource allocation policy. + Limit and Reserve values are defined in MB"; + uses allocation-properties; + } + } + + grouping extended-vif-quota { + container vif-quota { + description + "Virtual interfaces quota describes the virtual interface bandwidth resource allocation policy. + Limit and Reserve values are defined in Mbps"; + uses allocation-properties; + } + } + + grouping extended-disk-io-quota { + container disk-io-quota { + description + "Disk IO quota describes the disk IO operations resource allocation policy. + Limit and Reserve values are defined in IOPS"; + uses allocation-properties; + } + } + + grouping extended-cpu-quota { + container cpu-quota { + description + "CPU quota describes the CPU resource allocation policy. + Limit and Reserve values are defined in MHz"; + uses allocation-properties; + } + } + + grouping extended-cpu-policy { + leaf thread-policy { + description + "CPU thread pinning policy describes how to + place the guest CPUs when the host supports + hyper threads: + AVOID : Avoids placing a guest on a host + with threads. + SEPARATE: Places vCPUs on separate cores, + and avoids placing two vCPUs on + two threads of same core. + ISOLATE : Places each vCPU on a different core, + and places no vCPUs from a different + guest on the same core. + PREFER : Attempts to place vCPUs on threads + of the same core."; + type enumeration { + enum AVOID; + enum SEPARATE; + enum ISOLATE; + enum PREFER; + } + } + } + + grouping extended-mempage-size { + leaf mempage-size { + description + "Memory page allocation size. If a VM requires + hugepages, it should choose LARGE or SIZE_2MB + or SIZE_1GB. If the VM prefers hugepages it + should choose PREFER_LARGE. + LARGE : Require hugepages (either 2MB or 1GB) + SMALL : Doesn't require hugepages + SIZE_2MB : Requires 2MB hugepages + SIZE_1GB : Requires 1GB hugepages + PREFER_LARGE : Application prefers hugepages"; + type enumeration { + enum LARGE; + enum SMALL; + enum SIZE_2MB; + enum SIZE_1GB; + enum PREFER_LARGE; + } + } + } + grouping extended-numa { + container numa-node-policy { + description + "This policy defines NUMA topology of the + guest. Specifically identifies if the guest + should be run on a host with one NUMA + node or multiple NUMA nodes. As an example + a guest might need 8 VCPUs and 4 GB of + memory. However, it might need the VCPUs + and memory distributed across multiple + NUMA nodes. In this scenario, NUMA node + 1 could run with 6 VCPUs and 3GB, and + NUMA node 2 could run with 2 VCPUs and + 1GB."; + + leaf node-cnt { + description + "The number of NUMA nodes to expose to the VM."; + type uint16; + } + + leaf mem-policy { + description + "This policy specifies how the memory should + be allocated in a multi-node scenario. + STRICT : The memory must be allocated + strictly from the memory attached + to the NUMA node. + PREFERRED : The memory should be allocated + preferentially from the memory + attached to the NUMA node"; + type enumeration { + enum STRICT; + enum PREFERRED; + } + } + + list node { + key id; + leaf id { + description + "NUMA node identification. Typically + it's 0 or 1"; + type uint64; + } + + list vcpu { + key "id"; + description + "List of VCPUs to allocate on + this NUMA node."; + leaf id { + type uint64; + description + "List of VCPUs ids to allocate on + this NUMA node"; + } + } + + leaf memory-mb { + description + "Memory size expressed in MB + for this NUMA node."; + type uint64; + } + + choice om-numa-type { + description + "OpenMANO Numa type selection"; + + case cores { + leaf num-cores { + type uint8; + } + } + + case paired-threads { + container paired-threads { + leaf num-paired-threads { + type uint8; + } + + list paired-thread-ids { + description + "List of thread pairs to use in case of paired-thread NUMA"; + max-elements 16; + key thread-a; + + leaf thread-a { + type uint8; + } + + leaf thread-b { + type uint8; + } + } + } + } + case threads { + leaf num-threads { + type uint8; + } + } + } + } + } + } + + augment "/vnfd:vnfd/vnfd:virtual-compute-desc/vnfd:virtual-memory" { + uses extended-numa; + uses extended-mempage-size; + uses extended-mem-quota; + } + + augment "/vnfd:vnfd/vnfd:virtual-compute-desc/vnfd:virtual-cpu/vnfd:pinning" { + uses extended-cpu-policy; + } + + augment "/vnfd:vnfd/vnfd:virtual-compute-desc/vnfd:virtual-cpu" { + uses extended-cpu-quota; + } + + augment "/vnfd:vnfd/vnfd:virtual-storage-desc" { + uses extended-disk-io-quota; + } + + augment "/vnfd:vnfd/vnfd:vdu/vnfd:int-cpd/vnfd:virtual-network-interface-requirement" { + uses extended-vif-quota; + } +} \ No newline at end of file diff --git a/models/augments/interface.yang b/models/augments/interface.yang new file mode 100644 index 0000000..a33eed1 --- /dev/null +++ b/models/augments/interface.yang @@ -0,0 +1,58 @@ +/* + Copyright 2020 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. +*/ + +module interface { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:interface"; + prefix "interface"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + import common-augments { + prefix common; + } + + grouping extended-interface { + description + "List of Interfaces (external and internal) for the VNF"; + + leaf position { + description + "Explicit Position of the interface within the list"; + type uint32; + } + + leaf mac-address { + description + "MAC address of the interface. + Some VNFs require a specific MAC address to be configured + in the interface. While this is not recommended at all in + NFV environments, this parameter exists to allow those + scenarios. + This parameter will be likely deprecated in the future."; + type string; + } + + uses common:virtual-interface; + } + + augment "/vnfd:vnfd/vnfd:vdu/vnfd:int-cpd/vnfd:virtual-network-interface-requirement" { + uses extended-interface; + } +} \ No newline at end of file diff --git a/models/augments/ip-profiles.yang b/models/augments/ip-profiles.yang new file mode 100644 index 0000000..391afa8 --- /dev/null +++ b/models/augments/ip-profiles.yang @@ -0,0 +1,218 @@ +/* + 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. +*/ +module ip-profiles { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:ip-profiles"; + prefix "ip-profiles"; + + import etsi-nfv-nsd { + prefix nsd; + } + + import ietf-inet-types { + prefix inet; + } + + import etsi-nfv-descriptors { + prefix nfv; + } + + grouping extended-vld-protocol-data{ + container virtual-link-protocol-data { + leaf associated-layer-protocol { + type identityref { + base nfv:layer-protocol; + } + description + "One of the values of the attribute layerProtocol of + the ConnectivityType IE."; + reference + "GS NFV IFA011: Section 7.1.8.13, + VirtualLinkProtocolData information element."; + } + + container l2-protocol-data { + when "(../associated-layer-protocol = 'Ethernet') or " + + "(../associated-layer-protocol = 'MPLS') or " + + "(../associated-layer-protocol = 'ODU2') or " + + "(../associated-layer-protocol = 'Pseudo-Wire')"; + + leaf name { + type string; + description + "Network name associated with this L2 protocol."; + reference + "GS NFV IFA011: Section 7.1.8.14, + L2ProtocolData information element."; + } + + leaf network-type { + type enumeration { + enum flat; + enum vlan; + enum vxlan; + enum gre; + } + description + "Specifies the network type for this L2 protocol. + Possible values: FLAT, VLAN, VXLAN, GRE."; + reference + "GS NFV IFA011: Section 7.1.8.14, + L2ProtocolData information element."; + } + + leaf vlan-transparent { + type boolean; + description + "Specifies whether to support VLAN transparency for + this L2 protocol or not."; + reference + "GS NFV IFA011: Section 7.1.8.14, + L2ProtocolData information element."; + } + + leaf mtu { + type uint16; + description + "Specifies the maximum transmission unit (MTU) value + for this L2 protocol."; + reference + "GS NFV IFA011: Section 7.1.8.14, + L2ProtocolData information element."; + } + description + "Specifies the L2 protocol data for this virtual link. + Shall be present when the associatedLayerProtocol + attribute indicates a L2 protocol and shall be absent + otherwise."; + reference + "GS NFV IFA011: Section 7.1.8.13, + VirtualLinkProtocolData information element."; + } + + container l3-protocol-data { + when "(../associated-layer-protocol = 'IPv4') or " + + "(../associated-layer-protocol = 'IPv6')"; + + leaf name { + type string; + description + "Network name associated with this L3 protocol."; + reference + "GS NFV IFA011: Section 7.1.8.15, + L3ProtocolData information element."; + } + + leaf ip-version { + type enumeration { + enum ipv4; + enum ipv6; + } + default "ipv4"; + description + "Specifies IP version of this L3 protocol. + Value: + • IPV4. + • IPV6."; + reference + "GS NFV IFA011: Section 7.1.8.15, + L3ProtocolData information element."; + } + + leaf cidr { + type string; + description + "Specifies the CIDR (Classless InterDomain Routing) + of this L3 protocol."; + reference + "GS NFV IFA011: Section 7.1.8.15, + L3ProtocolData information element."; + } + + leaf-list ip-allocation-pools { + type string; + description + "Specifies the allocation pools with start and end + IP addresses for this L3 protocol."; + reference + "GS NFV IFA011: Section 7.1.8.15, + L3ProtocolData information element."; + } + + leaf gateway-ip { + type inet:ip-address; + description + "Specifies the gateway IP address for this L3 + protocol."; + reference + "GS NFV IFA011: Section 7.1.8.15, + L3ProtocolData information element."; + } + + leaf dhcp-enabled { + type boolean; + default "true"; + description + "Indicates whether DHCP (Dynamic Host Configuration + Protocol) is enabled or disabled for this L3 + protocol."; + reference + "GS NFV IFA011: Section 7.1.8.15, + L3ProtocolData information element."; + } + + leaf ipv6-address-mode { + when "../ip-version = 'ipv6'"; + type enumeration { + enum slaac; + enum dhcpv6-stateful; + enum dhcpv6-stateless; + } + description + "Specifies IPv6 address mode. Possible values: + • SLAAC. + • DHCPV6-STATEFUL. + • DHCPV6-STATELESS. + May be present when the value of the ipVersion + attribute is 'IPV6' and shall be absent otherwise."; + reference + "GS NFV IFA011: Section 7.1.8.15, + L3ProtocolData information element."; + } + description + "Specifies the L3 protocol data for this virtual link. + Shall be present when the associatedLayerProtocol + attribute indicates a L3 protocol and shall be absent + otherwise."; + reference + "GS NFV IFA011: Section 7.1.8.13, + VirtualLinkProtocolData information element."; + } + description + "Specifies the protocol data for a VL instantiated + according to this profile. Cardinality 0 is used when + no protocol data needs to be specified."; + reference + "GS NFV IFA011: Section 7.1.8.4, VirtualLinkProfile + information element."; + } + } + + augment "/nsd:nsd/nsd:nsd/nsd:df/nsd:virtual-link-profile" { + uses extended-vld-protocol-data; + } +} diff --git a/models/augments/kdu.yang b/models/augments/kdu.yang new file mode 100644 index 0000000..0cad701 --- /dev/null +++ b/models/augments/kdu.yang @@ -0,0 +1,165 @@ +/* + Copyright 2020 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. +*/ + +module kdu { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:kdu"; + prefix "kdu"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + import common-augments { + prefix common; + } + + grouping extended-ext-cpd { + leaf k8s-cluster-net { + description + "Reference to the K8s cluster network + to which CPs instantiated from this external CP + Descriptor (CPD) connect."; + type leafref { + path "/vnfd:vnfd/kdu:k8s-cluster/kdu:nets/kdu:id"; + } + } + } + + grouping extended-kdu-configuration { + list kdu-configuration { + key "id"; + leaf id { + description + "Internal identifier for the KDU configuration"; + type string; + } + uses common:vnfc-configuration; + uses common:vdu-config-access; + + leaf-list blacklist-config-primitive { + description + "List of blacklisted config primitives from the list of + default kdu config primitives"; + + type enumeration { + enum upgrade; + enum rollback; + } + } + } + } + + grouping extended-kdu-model { + list kdu-model { + key "id"; + + leaf id { + description + "Internal identifier for the KDU model"; + type string; + } + + leaf kdu-model-type { + description + "Indicates the KDU model, either as a helm-chart or as a juju-bundle."; + + type enumeration { + enum helm-chart; + enum juju-bundle; + } + } + + leaf kdu-model-locator { + description + "Indicates the KDU model location, either as a path to a folder in the + package or as a URL where to fetch the model."; + + type string; + } + } + } + + grouping extended-kdu { + list kdu { + description + "List of K8s Deployment Units"; + key "name"; + + leaf name { + description + "Unique name for the KDU"; + type string; + } + + leaf description { + description + "Description of the KDU."; + type string; + } + } + + container k8s-cluster { + leaf-list version { + description + "List of supported K8s versions. + The cluster where the KDUs will be deployed will have to match + one of these versions."; + + type string; + } + + leaf-list cni { + description + "List of supported CNI plugins. + The cluster where the KDUs will be deployed will have to use + one of these CNI plugins."; + + type enumeration { + enum calico; + enum flannel; + enum multus; + } + } + + list nets { + description + "List of required networks in the K8s cluster. + The cluster where the KDUs will be deployed will have to use + one of these CNI plugins."; + + key "id"; + + leaf id { + description + "Internal identifier for the K8s cluster network in this VNF"; + type string; + } + } + } + } + + augment "/vnfd:vnfd" { + uses extended-kdu; + uses extended-kdu-configuration; + uses extended-kdu-model; + } + + augment "/vnfd:vnfd/vnfd:ext-cpd/vnfd:cp-connection" { + uses extended-ext-cpd; + } +} \ No newline at end of file diff --git a/models/augments/mgmt-interface.yang b/models/augments/mgmt-interface.yang new file mode 100644 index 0000000..b4353d0 --- /dev/null +++ b/models/augments/mgmt-interface.yang @@ -0,0 +1,40 @@ +/* + Copyright 2020 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. +*/ + +module mgmt-interface { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:mgmt-interface"; + prefix "mgmt-interface"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + grouping extended-mgmt-interface { + leaf mgmt-cp { + description + "Connection point over which the VNF is managed."; + type leafref { + path "/vnfd:vnfd/vnfd:ext-cpd/vnfd:id"; + } + } + } + + augment "/vnfd:vnfd" { + uses extended-mgmt-interface; + } +} \ No newline at end of file diff --git a/models/augments/ns-configuration.yang b/models/augments/ns-configuration.yang new file mode 100644 index 0000000..a4effd2 --- /dev/null +++ b/models/augments/ns-configuration.yang @@ -0,0 +1,44 @@ +/* + Copyright 2020 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. +*/ + +module ns-configuration { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:ns-configuration"; + prefix "ns-configuration"; + + import etsi-nfv-nsd { + prefix nsd; + } + + import common-augments { + prefix common; + } + + grouping extended-ns-configuration { + container ns-configuration { + description + "Information about NS configuration."; + + uses common:vnfc-configuration; + uses common:vnfc-relations; + } + } + + augment "/nsd:nsd/nsd:nsd" { + uses extended-ns-configuration; + } +} diff --git a/models/augments/ns-various.yang b/models/augments/ns-various.yang new file mode 100644 index 0000000..921278d --- /dev/null +++ b/models/augments/ns-various.yang @@ -0,0 +1,65 @@ +/* + Copyright 2020 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. +*/ + +module ns-various { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:ns-various"; + prefix "ns-various"; + + import etsi-nfv-nsd { + prefix nsd; + } + + import ip-profiles { + prefix ip-profiles; + } + + import common-augments { + prefix common; + } + + grouping extended-floating-ip { + leaf floating-ip-required { + description + "Boolean parameter to indicate whether the CP must be exposed. + A public IP address will be allocated to this CP if exposed is true. + The default is false meaning a floating IP address is not required. + It must be explicitly asked for a floating IP address to be allocated."; + type boolean; + } + } + + grouping extended-security-group { + leaf security-group { + description + "Name of the security group"; + type string; + } + } + + augment "/nsd:nsd/nsd:nsd" { + uses common:description; + } + + augment "/nsd:nsd/nsd:nsd/nsd:sapd" { + uses extended-floating-ip; + } + + augment "/nsd:nsd/nsd:nsd/nsd:df/nsd:virtual-link-profile/ip-profiles:virtual-link-protocol-data/ip-profiles:l3-protocol-data" { + uses extended-security-group; + } +} diff --git a/models/augments/ns-vld.yang b/models/augments/ns-vld.yang new file mode 100644 index 0000000..e892d8a --- /dev/null +++ b/models/augments/ns-vld.yang @@ -0,0 +1,57 @@ +/* + Copyright 2020 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. +*/ + +module ns-vld { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:ns-vld"; + prefix "ns-vld"; + + import etsi-nfv-nsd { + prefix nsd; + } + + grouping extended-vld { + container provider-network { + description + "Container for the provider network."; + leaf physical-network { + description + "Name of the physical network on which the provider + network is built."; + type string; + } + + leaf segmentation_id { + description + "ID of segregated virtual networks"; + type uint32; + } + } + + leaf mgmt-network { + description + "Flag indicating whether this network is a VIM management network"; + type boolean; + default false; + } + } + + + augment "/nsd:nsd/nsd:nsd/nsd:virtual-link-desc" { + uses extended-vld; + } +} diff --git a/models/augments/scaling.yang b/models/augments/scaling.yang new file mode 100644 index 0000000..647edf1 --- /dev/null +++ b/models/augments/scaling.yang @@ -0,0 +1,168 @@ +/* + Copyright 2020 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. +*/ + +module scaling { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:scaling"; + prefix "scaling"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + import common-augments { + prefix common; + } + + import day1-2 { + prefix day1-2; + } + + grouping extended-scaling { + list scaling-policy { + + key "name"; + + leaf name { + description + "Name of the scaling policy"; + type string; + } + + leaf scaling-type { + description + "Type of scaling"; + type common:scaling-policy-type; + } + + leaf enabled { + description + "Specifies if the scaling policy can be applied"; + type boolean; + default true; + } + + leaf scale-in-operation-type { + description + "Operation to be applied to check between scaling criterias to + check if the scale in threshold condition has been met. + Defaults to AND"; + type common:scaling-criteria-operation; + default AND; + } + + leaf scale-out-operation-type { + description + "Operation to be applied to check between scaling criterias to + check if the scale out threshold condition has been met. + Defauls to OR"; + type common:scaling-criteria-operation; + default OR; + } + + leaf threshold-time { + description + "The duration for which the criteria must hold true"; + type uint32; + mandatory true; + } + + leaf cooldown-time { + description + "The duration after a scaling-in/scaling-out action has been + triggered, for which there will be no further optional"; + type uint32; + mandatory true; + } + + list scaling-criteria { + description + "list of conditions to be met for generating scaling + requests"; + key "name"; + + leaf name { + type string; + } + + leaf scale-in-threshold { + description + "Value below which scale-in requests are generated"; + type decimal64{ + fraction-digits 10; + } + } + + leaf scale-in-relational-operation { + description + "The relational operator used to compare the monitoring param + against the scale-in-threshold."; + type common:relational-operation-type; + default LE; + } + + leaf scale-out-threshold { + description + "Value above which scale-out requests are generated"; + type decimal64{ + fraction-digits 10; + } + } + + leaf scale-out-relational-operation { + description + "The relational operator used to compare the monitoring param + against the scale-out-threshold."; + type common:relational-operation-type; + default GE; + } + + leaf vnf-monitoring-param-ref { + description + "Reference to the VNF level monitoring parameter + that is aggregated"; + type string; + + } + } + } + + list scaling-config-action { + description + "List of scaling config actions"; + key "trigger"; + + leaf trigger { + description + "scaling trigger"; + type common:scaling-trigger; + } + + leaf vnf-config-primitive-name-ref { + description + "Reference to the VNF config primitive"; + type leafref { + path "/vnfd:vnfd/day1-2:vnf-configuration/day1-2:config-primitive/day1-2:name"; + } + } + } + } + + augment "/vnfd:vnfd/vnfd:df/vnfd:scaling-aspect" { + uses extended-scaling; + } +} diff --git a/models/augments/various.yang b/models/augments/various.yang new file mode 100644 index 0000000..23f86ca --- /dev/null +++ b/models/augments/various.yang @@ -0,0 +1,120 @@ +/* + Copyright 2020 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. +*/ + +module various { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:various"; + prefix "various"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + grouping extended-vld { + container provider-network { + description + "Container for the provider network."; + leaf physical-network { + description + "Name of the physical network on which the provider + network is built."; + type string; + } + + leaf segmentation_id { + description + "ID of segregated virtual networks"; + type uint32; + } + } + } + + grouping extended-security-group { + leaf security-group { + description + "Name of the security group"; + type string; + } + } + + grouping extended-cpd { + leaf port-security-enabled { + description + "Enables the port security for the port."; + type boolean; + default true; + } + } + + grouping extended-vdu { + leaf pdu-type { + description + "Type of PDU. If this field exists, the deployment unit must be + understood as a PDU, not as a VDU. This field is used to identify + the category of PDU instances to be used at instantiation time. For + the instantiation to be successful, there must be available + PDU instances of this type in the selected datacenter."; + type string; + } + + container supplemental-boot-data { + leaf boot-data-drive { + description + "Some VIMs implement additional drives to host config-files or meta-data"; + type boolean; + default false; + } + } + } + + grouping extended-device-bus { + leaf device-bus { + description + "Type of disk-bus on which this disk is exposed to guest"; + type enumeration { + enum ide; + enum usb; + enum virtio; + enum scsi; + } + } + } + + augment "/vnfd:vnfd/vnfd:int-virtual-link-desc" { + uses extended-vld; + } + + augment "/vnfd:vnfd/vnfd:df/vnfd:virtual-link-profile/vnfd:virtual-link-protocol-data/vnfd:l3-protocol-data" { + uses extended-security-group; + } + + augment "/vnfd:vnfd/vnfd:ext-cpd" { + uses extended-cpd; + } + + augment "/vnfd:vnfd/vnfd:vdu/vnfd:int-cpd" { + uses extended-cpd; + } + + augment "/vnfd:vnfd/vnfd:vdu" { + uses extended-vdu; + } + + augment "/vnfd:vnfd/vnfd:virtual-storage-desc" { + uses extended-device-bus; + } +} \ No newline at end of file diff --git a/models/augments/vip.yang b/models/augments/vip.yang new file mode 100644 index 0000000..1db62eb --- /dev/null +++ b/models/augments/vip.yang @@ -0,0 +1,63 @@ +/* + Copyright 2020 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. +*/ + +module vip { + yang-version 1.1; + namespace "urn:etsi:osm:yang:augments:vip"; + prefix "vip"; + + import etsi-nfv-vnfd { + prefix vnfd; + } + + grouping extended-vip { + list vip { + description + "Paired interfaces from different VDUs that share a Virtual IP"; + + key "name"; + leaf name { + description + "Name of the Virtual IP"; + type string; + } + + list paired-interfaces { + key "vdu-id-ref"; + leaf vdu-id-ref { + description + "Reference to the VDU"; + type leafref { + path "/vnfd:vnfd/vnfd:vdu/vnfd:id"; + } + } + + leaf interface-ref { + description + "Reference to the interface"; + type leafref { + path "/vnfd:vnfd/vnfd:vdu/vnfd:int-cpd/vnfd:virtual-network-interface-requirement/vnfd:name"; + } + } + } + } + } + + augment "/vnfd:vnfd" { + uses extended-vip; + } +} \ No newline at end of file diff --git a/osm_im/validation.py b/osm_im/validation.py index 7334fbb..6cc4f0d 100644 --- a/osm_im/validation.py +++ b/osm_im/validation.py @@ -14,11 +14,12 @@ # limitations under the License. import yaml -import json -# import logging +import importlib from osm_im.vnfd import vnfd as vnfd_im from osm_im.nsd import nsd as nsd_im from osm_im.nst import nst as nst_im +etsi_nfv_vnfd = importlib.import_module("osm_im.etsi-nfv-vnfd") +etsi_nfv_nsd = importlib.import_module("osm_im.etsi-nfv-nsd") from pyangbind.lib.serialise import pybindJSONDecoder import pyangbind.lib.pybindJSON as pybindJSON @@ -39,6 +40,10 @@ class Validation: myobj = nsd_im() elif item == "nst": myobj = nst_im() + elif item == "etsi_nfv_vnfd": + myobj = etsi_nfv_vnfd.etsi_nfv_vnfd() + elif item == "etsi_nfv_nsd": + myobj = etsi_nfv_nsd.etsi_nfv_nsd() else: raise ValidationException("Not possible to validate '{}' item".format(item)) @@ -62,6 +67,10 @@ class Validation: item = "nsd" elif 'nst' in data: item = "nst" + elif 'vnfd' in data: + item = "etsi_nfv_vnfd" + elif 'nsd' in data: + item = "etsi_nfv_nsd" else: raise ValidationException("Error in YAML validation. Not possible to determine the type of descriptor in the first line. Expected values: vnfd:vnfd-catalog, vnfd-catalog, nsd:nsd-catalog, nsd-catalog, nst") diff --git a/patch/deref_warnings.patch b/patch/deref_warnings.patch new file mode 100644 index 0000000..457b73a --- /dev/null +++ b/patch/deref_warnings.patch @@ -0,0 +1,86 @@ +# +# 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"; diff --git a/patch/nested_workaround.patch b/patch/nested_workaround.patch new file mode 100644 index 0000000..68f3fb1 --- /dev/null +++ b/patch/nested_workaround.patch @@ -0,0 +1,36 @@ +# +# 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 @@ + } + } + } +- } ++ //} + } + } + diff --git a/setup.py b/setup.py index f59e790..dfa5cee 100644 --- a/setup.py +++ b/setup.py @@ -35,20 +35,9 @@ class Install_osm_im(install): import pyangbind print("Using dir {}/{} for python artifacts".format(os.getcwd(), self.im_dir)) path = "{}/{}".format(os.getcwd(), self.im_dir) - for files_item in ['vnfd', 'nsd', 'nst']: - protoc_command = ["pyang", - "-Werror", - "--plugindir", - "{}/plugin".format(os.path.dirname(pyangbind.__file__)), - "--path", - self.model_dir, - "-f", "pybind", - "-o", - "{}/{}.py".format(self.im_dir, files_item), - "{}/{}.yang".format(self.model_dir, files_item)] - print("Generating {}.py from {}.yang".format(files_item, files_item)) - if subprocess.call(protoc_command) != 0: - sys.exit(-1) + protoc_command = ["make", "models"] + if subprocess.call(protoc_command) != 0: + sys.exit(-1) # To ensure generated files are copied to the python installation folder self.copy_tree(self.im_dir, "{}{}".format(self.install_lib, self.im_dir)) install.run(self) diff --git a/tests/examples/alternative_image_im.yaml b/tests/examples/alternative_image_im.yaml new file mode 100644 index 0000000..db06e75 --- /dev/null +++ b/tests/examples/alternative_image_im.yaml @@ -0,0 +1,46 @@ +# Copyright 2020 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. + +vnfd:vnfd-catalog: + vnfd: + - id: hackfest_basic-vnf + name: hackfest_basic-vnf + short-name: hackfest_basic-vnf + version: "1.0" + description: A basic VNF descriptor w/ one VDU + logo: osm.png + connection-point: + - name: vnf-cp0 + + vdu: + - id: hackfest_basic-VM + name: hackfest_basic-VM + image: ubuntu1604 + alternative-images: + - vim-type: aws + image: ubuntu/images/hvm-ssd/ubuntu-artful-17.10-amd64-server-20180509 + count: "1" + vm-flavor: + vcpu-count: "1" + memory-mb: "1024" + storage-gb: "10" + interface: + - name: vdu-eth0 + type: EXTERNAL + virtual-interface: + type: PARAVIRT + external-connection-point-ref: vnf-cp0 + mgmt-interface: + cp: vnf-cp0 diff --git a/tests/examples/alternative_image_sol006.yaml b/tests/examples/alternative_image_sol006.yaml new file mode 100644 index 0000000..446eae4 --- /dev/null +++ b/tests/examples/alternative_image_sol006.yaml @@ -0,0 +1,77 @@ +# Copyright 2020 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. + +vnfd: + id: hackfest_basic-vnf + product-name: hackfest_basic-vnf + description: A basic VNF descriptor w/ one VDU + version: "1.0" + mgmt-cp: vnf-cp0 + + virtual-compute-desc: + - id: cirros-compute + virtual-cpu: + num-virtual-cpu: 1 + virtual-memory: + size: 1 # Memory size in GB + + virtual-storage-desc: + - id: cirros-storage + size-of-storage: 10 + + sw-image-desc: + - id: ubuntu1604 + name: ubuntu1604 + checksum: + hash: # Mandatory? + - id: ubuntu1604-aws + name: ubuntu1604-aws + image: ubuntu/images/hvm-ssd/ubuntu-artful-17.10-amd64-server-20180509 + vim-type: aws + checksum: + hash: # Mandatory? + + vdu: + - id: hackfest_basic-VM + name: hackfest_basic-VM + virtual-compute-desc: cirros-compute + virtual-storage-desc: + - cirros-storage + sw-image-desc: ubuntu1604 + alternative-sw-image-desc: + - ubuntu1604-aws + int-cpd: + - id: eth0-int + virtual-network-interface-requirement: + - name: vdu-eth0 + virtual-interface: + type: PARAVIRT + + df: + - id: cirros_default + vdu-profile: + - id: hackfest_basic-VM + min-number-of-instances: 1 + instantiation-level: + - id: default + vdu-level: + - vdu-id: hackfest_basic-VM + number-of-instances: 1 + + ext-cpd: + - id: vnf-cp0 + int-cpd: # Connection to int-cpd + vdu-id: hackfest_basic-VM + cpd: eth0-int diff --git a/tests/examples/cirros_nsd_im.yaml b/tests/examples/cirros_nsd_im.yaml new file mode 100644 index 0000000..dcc832b --- /dev/null +++ b/tests/examples/cirros_nsd_im.yaml @@ -0,0 +1,59 @@ +# Copyright 2020 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. + +nsd:nsd-catalog: + nsd: + - id: cirros_2vnf_nsd + name: cirros_2vnf_ns + short-name: cirros_2vnf_ns + description: Generated by OSM pacakage generator + vendor: OSM + version: "1.0" + + # Place the logo as png in icons directory and provide the name here + logo: osm_2x.png + + # Specify the VNFDs that are part of this NSD + constituent-vnfd: + # The member-vnf-index needs to be unique, starting from 1 + # vnfd-id-ref is the id of the VNFD + # Multiple constituent VNFDs can be specified + - member-vnf-index: 1 + vnfd-id-ref: cirros_vnfd + - member-vnf-index: 2 + vnfd-id-ref: cirros_vnfd + + vld: + # Networks for the VNFs + - id: cirros_2vnf_nsd_vld1 + name: cirros_2vnf_nsd_vld1 + short-name: cirros_2vnf_nsd_vld1 + type: ELAN + mgmt-network: "true" + # vim-network-name: + # provider-network: + # overlay-type: VLAN + # segmentation_id: + vnfd-connection-point-ref: + # Specify the constituent VNFs + # member-vnf-index-ref - entry from constituent vnf + # vnfd-id-ref - VNFD id + # vnfd-connection-point-ref - connection point name in the VNFD + - member-vnf-index-ref: 1 + vnfd-id-ref: cirros_vnfd + vnfd-connection-point-ref: eth0 + - member-vnf-index-ref: 2 + vnfd-id-ref: cirros_vnfd + vnfd-connection-point-ref: eth0 diff --git a/tests/examples/cirros_nsd_sol006.yaml b/tests/examples/cirros_nsd_sol006.yaml new file mode 100644 index 0000000..ee279ca --- /dev/null +++ b/tests/examples/cirros_nsd_sol006.yaml @@ -0,0 +1,46 @@ +# Copyright 2020 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. + +nsd: + nsd: + - id: cirros_2vnf_nsd + name: cirros_2vnf_nsd + description: Generated by OSM package generator + designer: OSM + version: "1.0" + vnfd-id: + - cirros_vnfd + + virtual-link-desc: + - id: cirros_2vnf_nsd_vld1 + mgmt-network: "true" + + df: + - id: cirros_DF + vnf-profile: + - id: cirros_vnf1 # member-vnf-index-ref: 1 + vnfd-id: cirros_vnfd + virtual-link-connectivity: + - virtual-link-profile-id: cirros_2vnf_nsd_vld1 + constituent-cpd-id: + - constituent-base-element-id: cirros_vnf1 + constituent-cpd-id: eth0-ext + - id: cirros_vnf2 # member-vnf-index-ref: 2 + vnfd-id: cirros_vnfd + virtual-link-connectivity: + - virtual-link-profile-id: cirros_2vnf_nsd_vld1 + constituent-cpd-id: + - constituent-base-element-id: cirros_vnf2 + constituent-cpd-id: eth0-ext diff --git a/tests/examples/cirros_vnfd_im.yaml b/tests/examples/cirros_vnfd_im.yaml new file mode 100644 index 0000000..fbfd5ee --- /dev/null +++ b/tests/examples/cirros_vnfd_im.yaml @@ -0,0 +1,63 @@ +# Copyright 2020 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. + +vnfd:vnfd-catalog: + vnfd: + - id: cirros_vnfd + name: cirros_vnf + short-name: cirros_vnf + description: Simple VNF example with a cirros + vendor: OSM + version: "1.0" + + # Place the logo as png in icons directory and provide the name here + logo: cirros-64.png + + # Management interface + mgmt-interface: + cp: eth0 + + # Atleast one VDU need to be specified + vdu: + - id: cirros_vnfd-VM + name: cirros_vnfd-VM + description: cirros_vnfd-VM + count: 1 + + # Flavour of the VM to be instantiated for the VDU + # flavor below can fit into m1.micro + vm-flavor: + vcpu-count: 1 + memory-mb: 256 + storage-gb: 2 + + # Image/checksum or image including the full path + image: cirros034 + #checksum: + + interface: + # Specify the external interfaces + # There can be multiple interfaces defined + - name: eth0 + type: EXTERNAL + virtual-interface: + type: VIRTIO + bandwidth: "0" + vpci: 0000:00:0a.0 + external-connection-point-ref: eth0 + + connection-point: + - name: eth0 + type: VPORT diff --git a/tests/examples/cirros_vnfd_sol006.yaml b/tests/examples/cirros_vnfd_sol006.yaml new file mode 100644 index 0000000..9ecdd7b --- /dev/null +++ b/tests/examples/cirros_vnfd_sol006.yaml @@ -0,0 +1,71 @@ +# Copyright 2020 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. + +vnfd: + id: cirros_vnfd + product-name: cirros_vnf + description: Simple VNF example with a cirros + provider: OSM + version: "1.0" + mgmt-cp: eth0-ext + + virtual-compute-desc: + - id: cirros-compute + virtual-cpu: + num-virtual-cpu: 1 + virtual-memory: + size: 0.256 # Memory size in GB + + virtual-storage-desc: + - id: cirros-storage + size-of-storage: 2 + + sw-image-desc: + - id: cirros034 + name: cirros034 + + vdu: + - id: cirros_vnfd-VM + name: cirros_vnfd-VM + description: cirros_vnfd-VM + virtual-compute-desc: cirros-compute + virtual-storage-desc: + - cirros-storage + sw-image-desc: cirros034 + int-cpd: + - id: eth0-int + virtual-network-interface-requirement: + - name: eth0 + virtual-interface: + type: VIRTIO + bandwidth: "0" + vpci: 0000:00:0a.0 + + df: + - id: cirros_default + vdu-profile: + - id: cirros_vnfd-VM + min-number-of-instances: 1 + instantiation-level: + - id: default + vdu-level: + - vdu-id: cirros_vnfd-VM + number-of-instances: 1 + + ext-cpd: + - id: eth0-ext + int-cpd: # Connection to int-cpd + vdu-id: cirros_vnfd-VM + cpd: eth0-int diff --git a/tests/examples/epa_im.yaml b/tests/examples/epa_im.yaml new file mode 100644 index 0000000..f13d08b --- /dev/null +++ b/tests/examples/epa_im.yaml @@ -0,0 +1,154 @@ +# Copyright 2020 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. + +vnfd-catalog: + vnfd: + - connection-point: + - name: eth0 + type: VPORT + - name: xe0 + type: VPORT + - name: xe1 + type: VPORT + - name: xe2 + type: VPORT + - name: xe3 + type: VPORT + - name: xe4 + type: VPORT + - name: xe5 + type: VPORT + - name: xe6 + type: VPORT + - name: xe7 + type: VPORT + description: vBNG VNF for performance tests, with 34 HTs + id: vbng34 + logo: intel.png + mgmt-interface: + cp: eth0 + name: vbng34 + service-function-chain: UNAWARE + short-name: vbng34 + vdu: + - count: "1" + description: vbng34-VM + guest-epa: + cpu-pinning-policy: DEDICATED + cpu-thread-pinning-policy: PREFER + mempage-size: LARGE + numa-node-policy: + mem-policy: STRICT + node: + - id: "0" + paired-threads: + num-paired-threads: "17" + node-cnt: "1" + host-epa: + om-cpu-feature: + - feature: 64b + - feature: iommu + - feature: lps + - feature: tlbps + - feature: hwsv + - feature: dioc + - feature: ht + om-cpu-model-string: Intel(R) Xeon(R) CPU E5-4620 0 @ 2.20GHz + hypervisor-epa: + type: REQUIRE_KVM + version: 10002|12001|2.6.32-358.el6.x86_64 + id: vbng34-VM + image: intel_vbng34 + interface: + - external-connection-point-ref: eth0 + name: eth0 + position: "1" + type: EXTERNAL + virtual-interface: + bandwidth: "1000000" + type: PARAVIRT + vpci: 0000:00:0a.0 + - external-connection-point-ref: xe0 + name: xe0 + position: "2" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:10.0" + - external-connection-point-ref: xe1 + name: xe1 + position: "3" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:11.0" + - external-connection-point-ref: xe2 + name: xe2 + position: "4" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:12.0" + - external-connection-point-ref: xe3 + name: xe3 + position: "5" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:13.0" + - external-connection-point-ref: xe4 + name: xe4 + position: "6" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:14.0" + - external-connection-point-ref: xe5 + name: xe5 + position: "7" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:15.0" + - external-connection-point-ref: xe6 + name: xe6 + position: "8" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:16.0" + - external-connection-point-ref: xe7 + name: xe7 + position: "9" + type: EXTERNAL + virtual-interface: + bandwidth: "10000000000" + type: PCI-PASSTHROUGH + vpci: "0000:00:17.0" + name: vbng34-VM + supplemental-boot-data: + boot-data-drive: "false" + vm-flavor: + memory-mb: "32768" + storage-gb: "15" + vendor: Intel + version: "1.0" diff --git a/tests/examples/epa_sol006.yaml b/tests/examples/epa_sol006.yaml new file mode 100644 index 0000000..275cfcb --- /dev/null +++ b/tests/examples/epa_sol006.yaml @@ -0,0 +1,164 @@ +# Copyright 2020 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. + +vnfd: + id: epa-advanced-vnfd + description: vBNG VNF for performance tests, with 34 HTs + product-name: vbng34 + provider: Intel + version: "1.0" + mgmt-cp: eth0-ext + sw-image-desc: + - id: intel_vbng34 + name: intel_vbng34 + virtual-compute-desc: + - id: epa-compute + virtual-cpu: + pinning: # Generic key/value pairs + policy: static + thread-policy: PREFER + virtual-memory: + size: 32 + mempage-size: LARGE + numa-enabled: true # Replaces NUMA aware/unaware choice + numa-node-policy: + mem-policy: STRICT + node: + - id: "1" + paired-threads: + num-paired-threads: "17" + node-cnt: "1" + virtual-storage-desc: + - id: epa-storage + size-of-storage: 10 + vdu: + - id: epa-vdu + name: epa-vdu + sw-image-desc: intel_vbng34 + virtual-compute-desc: epa-compute + virtual-storage-desc: + - epa-storage + int-cpd: + - id: eth0 + virtual-network-interface-requirement: + - name: eth0 + position: 1 + virtual-interface: + type: PARAVIRT + bandwidth: 1000000 + vpci: 0000:00:0a.0 + - id: xe0 + virtual-network-interface-requirement: + - name: xe0 + position: 2 + virtual-interface: + type: PCI-PASSTHROUGH + bandwidth: 10000000000 + vpci: 0000:00:10.0 + - id: xe1 + virtual-network-interface-requirement: + - name: xe1 + position: 3 + virtual-interface: + type: PCI-PASSTHROUGH + bandwidth: 10000000000 + vpci: 0000:00:11.0 + - id: xe2 + virtual-network-interface-requirement: + - name: xe2 + position: 4 + virtual-interface: + type: PCI-PASSTHROUGH + bandwidth: 10000000000 + vpci: 0000:00:12.0 + - id: xe3 + virtual-network-interface-requirement: + - name: xe3 + position: 5 + virtual-interface: + type: PCI-PASSTHROUGH + bandwidth: 10000000000 + vpci: 0000:00:13.0 + - id: xe4 + virtual-network-interface-requirement: + - name: xe4 + position: 6 + virtual-interface: + type: PCI-PASSTHROUGH + bandwidth: 10000000000 + vpci: 0000:00:14.0 + - id: xe5 + virtual-network-interface-requirement: + - name: xe5 + position: 7 + virtual-interface: + type: PCI-PASSTHROUGH + bandwidth: 10000000000 + vpci: 0000:00:15.0 + - id: xe6 + virtual-network-interface-requirement: + - name: xe6 + position: 8 + virtual-interface: + type: PCI-PASSTHROUGH + bandwidth: 10000000000 + vpci: 0000:00:16.0 + - id: xe7 + virtual-network-interface-requirement: + - name: xe7 + position: 9 + virtual-interface: + type: VIRTIO + bandwidth: 10000000000 + vpci: 0000:00:17.0 + supplemental-boot-data: + boot-data-drive: false + ext-cpd: + - id: eth0-ext + int-cpd: + vdu-id: epa-vdu + cpd: eth0 + - id: xe0-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe0 + - id: xe1-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe1 + - id: xe2-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe2 + - id: xe3-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe3 + - id: xe4-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe4 + - id: xe5-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe5 + - id: xe6-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe6 + - id: xe7-ext + int-cpd: + vdu-id: epa-vdu + cpd: xe7 \ No newline at end of file diff --git a/tests/examples/etsi_complex_vnfd_sol006.yaml b/tests/examples/etsi_complex_vnfd_sol006.yaml new file mode 100644 index 0000000..189557a --- /dev/null +++ b/tests/examples/etsi_complex_vnfd_sol006.yaml @@ -0,0 +1,218 @@ +# Copyright 2020 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. + +# Example adapted from official ETSI repo: +# https://forge.etsi.org/rep/nfv/SOL006/blob/master/example-data/complex-vnfd.xml + +vnfd: + provider: My Company + product-name: complex-vnf + software-version: '1.0' + version: '1.0' + vnfm-info: netconf + id: complex-vnf + vdu: + - id: control-plane-active + name: control-plane-active + int-cpd: + - id: internal + int-virtual-link-desc: internal-vl + layer-protocol: ipv4 + - id: mgmt + int-virtual-link-desc: mgmt + layer-protocol: ipv4 + virtual-compute-desc: CP + virtual-storage-desc: + - root + sw-image-desc: CP + - id: control-plane-standby + name: control-plane-standby + int-cpd: + - id: internal + int-virtual-link-desc: internal-vl + layer-protocol: ipv4 + - id: mgmt + int-virtual-link-desc: mgmt + layer-protocol: ipv4 + virtual-compute-desc: CP + virtual-storage-desc: + - root + sw-image-desc: CP + - id: data-plane + name: data-plane + int-cpd: + - id: in + layer-protocol: ipv4 + - id: internal + int-virtual-link-desc: internal-vl + layer-protocol: ipv4 + - id: out + layer-protocol: ipv4 + virtual-compute-desc: DP + virtual-storage-desc: + - root + sw-image-desc: DP + virtual-compute-desc: + - id: CP + virtual-memory: + size: '16.0' + virtual-cpu: + num-virtual-cpu: '8' + - id: DP + virtual-memory: + size: '32.0' + virtual-cpu: + num-virtual-cpu: '16' + virtual-storage-desc: + - id: root + type-of-storage: ephemeral-storage + size-of-storage: '10' + rdma-enabled: 'true' + sw-image-desc: CP + sw-image-desc: + - id: CP + name: CP + version: '1.1' + checksum: + algorithm: sha-224 + hash: deadbeef + container-format: bare + disk-format: qcow2 + min-disk: '1' + min-ram: '2.0' + size: '1' + image: 'http://mycompany.images.com/control-plane.qcow2' + - id: DP + name: DP + version: '1.1' + checksum: + algorithm: sha-224 + hash: deadbeef + container-format: bare + disk-format: qcow2 + min-disk: '1' + min-ram: '2.0' + size: '1' + image: 'http://mycompany.images.com/data-plane.qcow2' + int-virtual-link-desc: + - id: internal-vl + connectivity-type: + layer-protocol: ipv4 + - id: mgmt + connectivity-type: + layer-protocol: ipv4 + ext-cpd: + - id: in + int-cpd: + vdu-id: data-plane + cpd: in + layer-protocol: ipv4 + - id: mgmt + int-virtual-link-desc: mgmt + layer-protocol: ipv4 + - id: out + int-cpd: + vdu-id: data-plane + cpd: out + layer-protocol: ipv4 + df: + - id: gold + vdu-profile: + - id: control-plane-active + min-number-of-instances: '1' + max-number-of-instances: '1' + affinity-or-anti-affinity-group: + - id: control-plane + - id: control-plane-standby + min-number-of-instances: '1' + max-number-of-instances: '1' + affinity-or-anti-affinity-group: + - id: control-plane + - id: data-plane + min-number-of-instances: '2' + max-number-of-instances: '8' + instantiation-level: + - id: il-1 + vdu-level: + - vdu-id: control-plane-active + number-of-instances: '1' + - vdu-id: control-plane-standby + number-of-instances: '1' + - vdu-id: data-plane + number-of-instances: '2' + - id: il-2 + vdu-level: + - vdu-id: control-plane-active + number-of-instances: '1' + - vdu-id: control-plane-standby + number-of-instances: '1' + - vdu-id: data-plane + number-of-instances: '4' + default-instantiation-level: il-1 + lcm-operations-configuration: + scale-vnf-to-level-op-config: + arbitrary-target-levels-supported: 'true' + terminate-vnf-op-config: + min-graceful-termination: '1' + operate-vnf-op-config: + min-graceful-stop-timeout: '1' + affinity-or-anti-affinity-group: + - id: control-plane + type: anti-affinity + scope: nfvi-node + - id: silver + vdu-profile: + - id: control-plane-active + min-number-of-instances: '1' + max-number-of-instances: '1' + affinity-or-anti-affinity-group: + - id: control-plane + - id: control-plane-standby + min-number-of-instances: '1' + max-number-of-instances: '1' + affinity-or-anti-affinity-group: + - id: control-plane + - id: data-plane + min-number-of-instances: '1' + max-number-of-instances: '4' + instantiation-level: + - id: il-1 + vdu-level: + - vdu-id: control-plane-active + number-of-instances: '1' + - vdu-id: control-plane-standby + number-of-instances: '1' + - vdu-id: data-plane + number-of-instances: '1' + - id: il-2 + vdu-level: + - vdu-id: control-plane-active + number-of-instances: '1' + - vdu-id: control-plane-standby + number-of-instances: '1' + - vdu-id: data-plane + number-of-instances: '2' + default-instantiation-level: il-1 + lcm-operations-configuration: + scale-vnf-to-level-op-config: + arbitrary-target-levels-supported: 'true' + terminate-vnf-op-config: + min-graceful-termination: '1' + operate-vnf-op-config: + min-graceful-stop-timeout: '1' + affinity-or-anti-affinity-group: + - id: control-plane + type: anti-affinity + scope: nfvi-node \ No newline at end of file diff --git a/tests/examples/etsi_nsd_sol006.yaml b/tests/examples/etsi_nsd_sol006.yaml new file mode 100644 index 0000000..f5d33fa --- /dev/null +++ b/tests/examples/etsi_nsd_sol006.yaml @@ -0,0 +1,40 @@ +# Copyright 2020 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. + +# Example adapted from official ETSI repo: +# https://forge.etsi.org/rep/nfv/SOL006/blob/master/example-data/nfv-nsd.xml + +nsd: + nsd: + - id: firewall-nsd + vnfd-id: ASA + sapd: + - id: inside + - id: management + - id: outside + df: + - id: firewall + vnf-profile: + - id: firewall + vnfd-id: ASA + flavour-id: normal + instantiation-level: single + min-number-of-instances: '1' + max-number-of-instances: '1' + ns-instantiation-level: + - id: single + vnf-to-level-mapping: + - vnf-profile-id: firewall + number-of-instances: '1' diff --git a/tests/examples/hackfest_charmed_nsd_im.yaml b/tests/examples/hackfest_charmed_nsd_im.yaml new file mode 100644 index 0000000..cb90dbc --- /dev/null +++ b/tests/examples/hackfest_charmed_nsd_im.yaml @@ -0,0 +1,54 @@ +# Copyright 2020 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. + +nsd:nsd-catalog: + nsd: + - constituent-vnfd: + - member-vnf-index: '1' + vnfd-id-ref: hackfest3charmed-vnf + - member-vnf-index: '2' + vnfd-id-ref: hackfest3charmed-vnf + description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs + id: hackfest3charmed-ns + logo: osm.png + name: hackfest3charmed-ns + short-name: hackfest3charmed-ns + version: '1.0' + vld: + - id: mgmt + mgmt-network: true + name: mgmt + short-name: mgmt + type: ELAN + vim-network-name: mgmt + vnfd-connection-point-ref: + - member-vnf-index-ref: '1' + vnfd-connection-point-ref: vnf-mgmt + vnfd-id-ref: hackfest3charmed-vnf + - member-vnf-index-ref: '2' + vnfd-connection-point-ref: vnf-mgmt + vnfd-id-ref: hackfest3charmed-vnf + - id: datanet + name: datanet + short-name: datanet + type: ELAN + vnfd-connection-point-ref: + - member-vnf-index-ref: '1' + vnfd-connection-point-ref: vnf-data + vnfd-id-ref: hackfest3charmed-vnf + - member-vnf-index-ref: '2' + vnfd-connection-point-ref: vnf-data + vnfd-id-ref: hackfest3charmed-vnf + diff --git a/tests/examples/hackfest_charmed_nsd_sol006.yaml b/tests/examples/hackfest_charmed_nsd_sol006.yaml new file mode 100644 index 0000000..0d6533e --- /dev/null +++ b/tests/examples/hackfest_charmed_nsd_sol006.yaml @@ -0,0 +1,57 @@ +# Copyright 2020 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. + +nsd: + nsd: + - id: hackfest3charmed-ns + name: hackfest3charmed-ns + description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs + designer: OSM + version: '1.0' + + vnfd-id: + - hackfest3charmed-vnf + + virtual-link-desc: + - id: mgmt + mgmt-network: "true" + - id: datanet + mgmt-network: "false" + + df: + - id: hackfest_charmed_DF + vnf-profile: + - id: hackfest_vnf1 # member-vnf-index-ref: 1 + vnfd-id: hackfest3charmed-vnf + virtual-link-connectivity: + - virtual-link-profile-id: mgmt + constituent-cpd-id: + - constituent-base-element-id: hackfest_vnf1 + constituent-cpd-id: vnf-mgmt-ext + - virtual-link-profile-id: datanet + constituent-cpd-id: + - constituent-base-element-id: hackfest_vnf1 + constituent-cpd-id: vnf-data-ext + - id: hackfest_vnf2 # member-vnf-index-ref: 2 + vnfd-id: hackfest3charmed-vnf + virtual-link-connectivity: + - virtual-link-profile-id: mgmt + constituent-cpd-id: + - constituent-base-element-id: hackfest_vnf2 + constituent-cpd-id: vnf-mgmt-ext + - virtual-link-profile-id: datanet + constituent-cpd-id: + - constituent-base-element-id: hackfest_vnf2 + constituent-cpd-id: vnf-data-ext \ No newline at end of file diff --git a/tests/examples/hackfest_charmed_vnfd_im.yaml b/tests/examples/hackfest_charmed_vnfd_im.yaml new file mode 100644 index 0000000..f7828fe --- /dev/null +++ b/tests/examples/hackfest_charmed_vnfd_im.yaml @@ -0,0 +1,157 @@ +# Copyright 2020 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. + +vnfd:vnfd-catalog: + vnfd: + - connection-point: + - id: vnf-mgmt + name: vnf-mgmt + short-name: vnf-mgmt + type: VPORT + - id: vnf-data + name: vnf-data + short-name: vnf-data + type: VPORT + description: >- + A VNF consisting of 2 VDUs connected to an internal VL, and one VDU with + cloud-init + id: hackfest3charmed-vnf + internal-vld: + - id: internal + internal-connection-point: + - id-ref: mgmtVM-internal + - id-ref: dataVM-internal + name: internal + short-name: internal + type: ELAN + logo: osm.png + mgmt-interface: + cp: vnf-mgmt + monitoring-param: + - aggregation-type: AVERAGE + id: monitor1 + name: monitor1 + vdu-monitoring-param: + vdu-monitoring-param-ref: dataVM_cpu_util + vdu-ref: dataVM + name: hackfest3charmed-vnf + scaling-group-descriptor: + - max-instance-count: 10 + name: scale_dataVM + scaling-config-action: + - trigger: post-scale-out + vnf-config-primitive-name-ref: touch + - trigger: pre-scale-in + vnf-config-primitive-name-ref: touch + scaling-policy: + - cooldown-time: 60 + name: auto_cpu_util_above_threshold + scaling-criteria: + - name: cpu_util_above_threshold + scale-in-relational-operation: LE + scale-in-threshold: '15.0000000000' + scale-out-relational-operation: GE + scale-out-threshold: '60.0000000000' + vnf-monitoring-param-ref: monitor1 + scaling-type: automatic + threshold-time: 0 + vdu: + - count: 1 + vdu-id-ref: dataVM + short-name: hackfest3charmed-vnf + vdu: + - count: '1' + cloud-init-file: cloud-config.txt + id: mgmtVM + image: hackfest3-mgmt + interface: + - external-connection-point-ref: vnf-mgmt + name: mgmtVM-eth0 + position: 1 + type: EXTERNAL + virtual-interface: + type: VIRTIO + - internal-connection-point-ref: mgmtVM-internal + name: mgmtVM-eth1 + position: 2 + type: INTERNAL + virtual-interface: + type: VIRTIO + internal-connection-point: + - id: mgmtVM-internal + name: mgmtVM-internal + short-name: mgmtVM-internal + type: VPORT + name: mgmtVM + vm-flavor: + memory-mb: '1024' + storage-gb: '10' + vcpu-count: 1 + - count: '1' + id: dataVM + image: hackfest3-mgmt + interface: + - internal-connection-point-ref: dataVM-internal + name: dataVM-eth0 + position: 1 + type: INTERNAL + virtual-interface: + type: VIRTIO + - external-connection-point-ref: vnf-data + name: dataVM-xe0 + position: 2 + type: EXTERNAL + virtual-interface: + type: VIRTIO + internal-connection-point: + - id: dataVM-internal + name: dataVM-internal + short-name: dataVM-internal + type: VPORT + monitoring-param: + - id: dataVM_cpu_util + nfvi-metric: cpu_utilization + name: dataVM + vm-flavor: + memory-mb: '1024' + storage-gb: '10' + vcpu-count: 1 + version: '1.0' + vnf-configuration: + config-primitive: + - name: touch + parameter: + - data-type: STRING + default-value: + name: filename + initial-config-primitive: + - name: config + parameter: + - name: ssh-hostname + value: + - name: ssh-username + value: ubuntu + - name: ssh-password + value: osm4u + seq: '1' + - name: touch + parameter: + - name: filename + value: + seq: '2' + juju: + charm: simple + + diff --git a/tests/examples/hackfest_charmed_vnfd_sol006.yaml b/tests/examples/hackfest_charmed_vnfd_sol006.yaml new file mode 100644 index 0000000..f73264f --- /dev/null +++ b/tests/examples/hackfest_charmed_vnfd_sol006.yaml @@ -0,0 +1,177 @@ +# Copyright 2020 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. + +vnfd: + id: hackfest3charmed-vnf + description: >- + A VNF consisting of 2 VDUs connected to an internal VL, and one VDU with + cloud-init + product-name: hackfest3charmed-vnf + version: '1.0' + mgmt-cp: vnf-mgmt-ext + + virtual-compute-desc: + - id: mgmt-compute + virtual-cpu: + num-virtual-cpu: 1 + virtual-memory: + size: 1 + - id: data-compute + virtual-cpu: + num-virtual-cpu: 1 + virtual-memory: + size: 1 + + virtual-storage-desc: + - id: mgmt-storage + size-of-storage: 10 + - id: data-storage + size-of-storage: 10 + + sw-image-desc: + - id: hackfest3-mgmt + name: hackfest3-mgmt + + vdu: + - id: mgmtVM + name: mgmtVM + cloud-init-file: cloud-config.txt + sw-image-desc: hackfest3-mgmt + virtual-compute-desc: mgmt-compute + virtual-storage-desc: + - mgmt-storage + int-cpd: + - id: vnf-mgmt + virtual-network-interface-requirement: + - name: mgmtVM-eth0 + position: 1 + virtual-interface: + type: VIRTIO + - id: mgmtVM-internal + int-virtual-link-desc: internal + virtual-network-interface-requirement: + - name: mgmtVM-eth1 + position: 2 + virtual-interface: + type: VIRTIO + - id: dataVM + name: dataVM + sw-image-desc: hackfest3-mgmt + virtual-compute-desc: data-compute + virtual-storage-desc: + - data-storage + int-cpd: + - id: dataVM-internal + int-virtual-link-desc: internal + virtual-network-interface-requirement: + - name: dataVM-eth1 + position: 1 + virtual-interface: + type: VIRTIO + - id: vnf-data + virtual-network-interface-requirement: + - name: dataVM-eth0 + position: 2 + virtual-interface: + type: VIRTIO + monitoring-parameter: + - id: dataVM_cpu_util + name: dataVM_cpu_util + performance-metric: cpu_utilization + + int-virtual-link-desc: + - id: internal + + ext-cpd: + - id: vnf-mgmt-ext + int-cpd: # Connection to int-cpd + vdu-id: mgmtVM + cpd: vnf-mgmt + - id: vnf-data-ext + int-cpd: # Connection to int-cpd + vdu-id: dataVM + cpd: vnf-data + + df: + - id: hackfest_default + vnf-configuration-id: vnf-configuration-example + vdu-profile: + - id: mgmtVM + min-number-of-instances: 1 + - id: dataVM + min-number-of-instances: 1 + max-number-of-instances: 10 + vdu-configuration-id: vdu-configuration-example + instantiation-level: + - id: default + vdu-level: + - vdu-id: mgmtVM + number-of-instances: 1 + - vdu-id: dataVM + number-of-instances: 1 + scaling-aspect: + - id: scale_dataVM + name: scale_dataVM + max-scale-level: 10 + aspect-delta-details: + deltas: + - id: delta1 + vdu-delta: + - id: vdudelta1 + number-of-instances: 1 + scaling-policy: + - name: auto_cpu_util_above_threshold + scaling-type: automatic + enabled: true + threshold-time: 0 + cooldown-time: 60 + scaling-criteria: + - name: cpu_util_above_threshold + scale-in-relational-operation: LE + scale-in-threshold: '15.0000000000' + scale-out-relational-operation: GE + scale-out-threshold: '60.0000000000' + vnf-monitoring-param-ref: dataVM_cpu_util + scaling-config-action: + - trigger: post-scale-out + vnf-config-primitive-name-ref: touch + - trigger: pre-scale-in + vnf-config-primitive-name-ref: touch + + vnf-configuration: + - id: vnf-configuration-example + initial-config-primitive: + - seq: "1" + name: config + parameter: + - name: ssh-hostname + value: + - name: ssh-username + value: ubuntu + - name: ssh-password + value: osm4u + - seq: "2" + name: touch + parameter: + - name: filename + value: + config-primitive: + - name: touch + parameter: + - data-type: STRING + default-value: + name: filename + juju: + charm: simple diff --git a/tests/examples/magma_knf_im.yaml b/tests/examples/magma_knf_im.yaml new file mode 100644 index 0000000..feefeba --- /dev/null +++ b/tests/examples/magma_knf_im.yaml @@ -0,0 +1,35 @@ +# Copyright 2020 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. + +vnfd-catalog: + schema-version: "3.0" + vnfd: + - id: fb_magma_knf + name: fb_magma_knf + short-name: fb_magma_knf + description: KNF with KDU using a helm-chart for Facebook magma orc8r + vendor: ATOS + version: "1.0" + mgmt-interface: + cp: mgmt + connection-point: + - name: mgmt + k8s-cluster: + nets: + - id: mgmtnet + external-connection-point-ref: mgmt + kdu: + - name: orc8r + helm-chart: magma/orc8r diff --git a/tests/examples/magma_knf_sol006.yaml b/tests/examples/magma_knf_sol006.yaml new file mode 100644 index 0000000..58bdb96 --- /dev/null +++ b/tests/examples/magma_knf_sol006.yaml @@ -0,0 +1,44 @@ +# Copyright 2020 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. + +vnfd: + id: fb_magma_knf + product-name: fb_magma_knf + description: KNF with KDU using a helm-chart for Facebook magma orc8r + provider: ATOS + version: "1.0" + mgmt-cp: mgmt-ext + + ext-cpd: + - id: mgmt-ext + k8s-cluster-net: mgmtnet + + k8s-cluster: + nets: + - id: mgmtnet + + kdu: + - name: orc8r + + kdu-model: + - id: orc8r-model + kdu-model-type: helm-chart + kdu-model-locator: magma/orc8r + + df: + - id: kdu-df + kdu-profile: + - name: orc8r + kdu-model-id: orc8r-model \ No newline at end of file diff --git a/tests/examples/vepc_im.yaml b/tests/examples/vepc_im.yaml new file mode 100644 index 0000000..d816967 --- /dev/null +++ b/tests/examples/vepc_im.yaml @@ -0,0 +1,182 @@ +# Copyright 2020 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. + +vnfd:vnfd-catalog: + vnfd: + - id: vEPC_vnfd + name: vEPC_vnfd # To product-name + short-name: vEPC_vnfd # Deprecated + description: Generated by OSM package generator + vendor: OSM_VNFONB_TF # To do provider + version: "1.0" + mgmt-interface: # To mgmt-cp + cp: spgwmme-mgmt + ip-profiles: # To deployment flavour (DF) + - name: s6a + description: s6a network + ip-profile-params: + ip-version: ipv4 + subnet-address: 10.0.6.0/24 + dhcp-params: + enabled: true + vdu: + - id: spgwmme + name: spgwmme + description: spgwmme + count: 1 # To DF vdu-profile or instantiation-level + vm-flavor: + vcpu-count: 2 + memory-mb: 4096 + storage-gb: 10 + image: "nextepc-spgwmme-base" + cloud-init-file: spgwmme-init + interface: + - name: eth0 + type: EXTERNAL + virtual-interface: + type: PARAVIRT + external-connection-point-ref: spgwmme-mgmt + - name: eth1 + type: EXTERNAL + virtual-interface: + type: PARAVIRT + external-connection-point-ref: spgwmme-s1 + - name: eth2 + type: EXTERNAL + virtual-interface: + type: PARAVIRT + external-connection-point-ref: spgwmme-sgi + - name: eth3 + type: INTERNAL + virtual-interface: + type: PARAVIRT + internal-connection-point-ref: spgwmme-s6a + internal-connection-point: + - id: spgwmme-s6a + name: spgwmme-s6a + type: VPORT + monitoring-param: # To be removed (feature 8157) + - id: "spgw_cpu_util" + nfvi-metric: "cpu_utilization" + - id: "spgw_memory_util" + nfvi-metric: "average_memory_utilization" + - id: hss + name: hss + description: hss + count: 1 + vm-flavor: + vcpu-count: 1 + memory-mb: 2048 + storage-gb: 10 + image: "nextepc-hss-base" + cloud-init-file: hss-init + interface: + - name: eth0 + type: EXTERNAL + virtual-interface: + type: PARAVIRT + mgmt-interface: true + external-connection-point-ref: hss-mgmt + - name: eth1 + type: INTERNAL + virtual-interface: + type: PARAVIRT + internal-connection-point-ref: hss-s6a + internal-connection-point: + - id: hss-s6a + name: hss-s6a + type: VPORT + vdu-configuration: + initial-config-primitive: + - seq: "1" + name: config + parameter: + - name: ssh-hostname + value: + - name: ssh-username + value: ubuntu + - name: ssh-password + value: + - seq: "2" + name: configure-hss + parameter: + - name: spgw-ip + data-type: STRING + value: + - name: hss-ip + data-type: STRING + value: + - seq: "3" + name: restart-hss + juju: + charm: hsscharm + internal-vld: + - id: s6a + ip-profile-ref: s6a + internal-connection-point: + - id-ref: spgwmme-s6a + - id-ref: hss-s6a + name: s6a + connection-point: + - name: spgwmme-mgmt + - name: spgwmme-s1 + - name: spgwmme-sgi + - name: hss-mgmt + vnf-configuration: + initial-config-primitive: + - seq: "1" + name: config + parameter: + - name: ssh-hostname + value: + - name: ssh-username + value: ubuntu + - name: ssh-password + value: + - seq: "2" + name: configure-spgw + parameter: + - name: spgw-ip + data-type: STRING + value: + - name: hss-ip + data-type: STRING + value: + - seq: "3" + name: restart-spgw + config-primitive: + - name: add-route + parameter: + - name: external-prefix + data-type: STRING + default-value: "8.8.8.8/32" + - name: next-hop + data-type: STRING + default-value: "192.168.2.1" + juju: + charm: spgwcharm + monitoring-param: + - id: "spgw_cpu_util" + name: "spgw_cpu_util" + aggregation-type: AVERAGE + vdu-monitoring-param: + vdu-ref: "spgwmme" + vdu-monitoring-param-ref: "spgw_cpu_util" + - id: "spgw_memory_util" + name: "spgw_memory_util" + aggregation-type: AVERAGE + vdu-monitoring-param: + vdu-ref: "spgwmme" + vdu-monitoring-param-ref: "spgw_memory_util" diff --git a/tests/examples/vepc_nsd_im.yaml b/tests/examples/vepc_nsd_im.yaml new file mode 100644 index 0000000..2306936 --- /dev/null +++ b/tests/examples/vepc_nsd_im.yaml @@ -0,0 +1,62 @@ +# Copyright 2020 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. + +nsd:nsd-catalog: + nsd: + - id: vEPC_nsd + name: vEPC_nsd + short-name: vEPC_nsd # Deprecated + description: Generated by OSM package generator + vendor: OSM_VNFONB_TF # To designer + version: "1.0" + constituent-vnfd: + - member-vnf-index: 1 + vnfd-id-ref: vEPC_vnfd + + vld: + - id: management + name: management # Deprecated + short-name: management # Deprecated + type: ELAN # Deprecated + mgmt-network: "true" + vim-network-name: osm-ext + + vnfd-connection-point-ref: + - member-vnf-index-ref: 1 + vnfd-id-ref: vEPC_vnfd + vnfd-connection-point-ref: spgwmme-mgmt + - member-vnf-index-ref: 1 + vnfd-id-ref: vEPC_vnfd + vnfd-connection-point-ref: hss-mgmt + - id: s1 + name: s1 + short-name: s1 + type: ELAN + vim-network-name: s1 + vnfd-connection-point-ref: + - member-vnf-index-ref: 1 + vnfd-id-ref: vEPC_vnfd + vnfd-connection-point-ref: spgwmme-s1 + ip-address: 192.168.0.11 + - id: sgi + name: sgi + short-name: sgi + type: ELAN + vim-network-name: sgi + vnfd-connection-point-ref: + - member-vnf-index-ref: 1 + vnfd-id-ref: vEPC_vnfd + vnfd-connection-point-ref: spgwmme-sgi + ip-address: 192.168.2.11 diff --git a/tests/examples/vepc_nsd_sol006.yaml b/tests/examples/vepc_nsd_sol006.yaml new file mode 100644 index 0000000..21ea2dc --- /dev/null +++ b/tests/examples/vepc_nsd_sol006.yaml @@ -0,0 +1,57 @@ +# Copyright 2020 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. + +nsd: + nsd: + - id: vEPC_nsd + name: vEPC_nsd + description: Generated by OSM package generator + designer: OSM_VNFONB_TF + version: "1.0" + vnfd-id: + - vEPC_vnfd + + virtual-link-desc: + - id: management + mgmt-network: "true" + provider-network: + physical-network: osm-ext + - id: s1 + provider-network: + physical-network: s1 + - id: sgi + provider-network: + physical-network: sgi + + df: + - id: vEPC_DF + vnf-profile: + - id: vEPC-VNF + vnfd-id: vEPC_vnfd + virtual-link-connectivity: + - virtual-link-profile-id: management + constituent-cpd-id: + - constituent-base-element-id: vEPC_vnfd + constituent-cpd-id: spgwmme-mgmt + - constituent-base-element-id: vEPC_vnfd + constituent-cpd-id: hss-mgmt + - virtual-link-profile-id: s1 + constituent-cpd-id: + - constituent-base-element-id: vEPC_vnfd + constituent-cpd-id: spgwmme-s1 + - virtual-link-profile-id: sgi + constituent-cpd-id: + - constituent-base-element-id: vEPC_vnfd + constituent-cpd-id: spgwmme-sgi diff --git a/tests/examples/vepc_sol006.yaml b/tests/examples/vepc_sol006.yaml new file mode 100644 index 0000000..b4e43c2 --- /dev/null +++ b/tests/examples/vepc_sol006.yaml @@ -0,0 +1,219 @@ +# Copyright 2020 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. + +vnfd: + id: vEPC_vnfd + product-name: vEPC_vnfd + description: Generated by OSM package generator + provider: OSM_VNFONB_TF + version: "1.0" + mgmt-cp: spgwmme-mgmt-ext #Simplified from mgmt-interface + virtual-compute-desc: + - id: spgwmme-compute + virtual-cpu: + num-virtual-cpu: 2 + virtual-memory: + size: 4 # Memory size in GB + - id: hss-compute + virtual-cpu: + num-virtual-cpu: 1 + virtual-memory: + size: 2 # Memory size in GB + virtual-storage-desc: + - id: spgwmme-storage + size-of-storage: 10 + - id: hss-storage + size-of-storage: 10 + sw-image-desc: + - id: nextepc-spgwmme-base + name: nextepc-spgwmme-base + checksum: + hash: # Mandatory? + - id: nextepc-hss-bas + name: nextepc-hss-bas + checksum: + hash: # Mandatory? + vdu: + - id: spgwmme + name: spgwmme + description: spgwmme + cloud-init-file: spgwmme-init + virtual-compute-desc: spgwmme-compute + virtual-storage-desc: + - spgwmme-storage + sw-image-desc: nextepc-spgwmme-base + int-cpd: + - id: spgwmme-mgmt-int + virtual-network-interface-requirement: + - name: eth0 + virtual-interface: + type: PARAVIRT + - id: spgwmme-s1-int + virtual-network-interface-requirement: + - name: eth1 + virtual-interface: + type: PARAVIRT + - id: spgwmme-sgi-int + virtual-network-interface-requirement: + - name: eth2 + virtual-interface: + type: PARAVIRT + - id: spgwmme-s6a-int + int-virtual-link-desc: s6a # Connection to VLD! + virtual-network-interface-requirement: + - name: eth3 + virtual-interface: + type: PARAVIRT + - id: hss + name: hss + description: hss + cloud-init-file: hss-init + virtual-compute-desc: hss-compute + virtual-storage-desc: + - hss-storage + sw-image-desc: nextepc-hss-bas + int-cpd: + - id: hss-mgmt-int + virtual-network-interface-requirement: + - name: eth0 + virtual-interface: + type: PARAVIRT + - id: hss-s6a-int + int-virtual-link-desc: s6a # Connection to VLD! + virtual-network-interface-requirement: + - name: eth1 + virtual-interface: + type: PARAVIRT + df: + - id: vepc_default + vnf-configuration-id: vnf-configuration-example + vdu-profile: + - id: spgwmme + min-number-of-instances: 1 + - id: hss + min-number-of-instances: 1 + vdu-configuration-id: vdu-configuration-example + instantiation-level: + - id: default + vdu-level: + - vdu-id: spgwmme + number-of-instances: 1 + - vdu-id: hss + number-of-instances: 1 + virtual-link-profile: + - id: s6a + flavour: + virtual-link-protocol-data: + l3-protocol-data: + name: s6a + description: s6a network + ip-version: ipv4 + cidr: 10.0.6.0/24 + dhcp-enabled: true + monitoring-parameter: + - id: "spgw_cpu_util" + name: "spgw_cpu_util" + performance-metric: "cpu_load" + collection-period: 123456 + #aggregation-type: AVERAGE # Not included in augments + #vdu-monitoring-param: # Not included in augments + # vdu-ref: "spgwmme" # Not included in augments + # vdu-monitoring-param-ref: "spgw_cpu_util" # Not included in augments + - id: "spgw_memory_util" + name: "spgw_memory_util" + #aggregation-type: AVERAGE # Not included in augments + #vdu-monitoring-param: # Not included in augments + # vdu-ref: "spgwmme" # Not included in augments + # vdu-monitoring-param-ref: "spgw_memory_util" # Not included in augments + vdu-configuration: + - id: vdu-configuration-example + initial-config-primitive: + - seq: "1" + name: config + parameter: + - name: ssh-hostname + value: + - name: ssh-username + value: ubuntu + - name: ssh-password + value: + - seq: "2" + name: configure-hss + parameter: + - name: spgw-ip + data-type: STRING + value: + - name: hss-ip + data-type: STRING + value: + - seq: "3" + name: restart-hss + juju: + charm: hsscharm + vnf-configuration: + - id: vnf-configuration-example + initial-config-primitive: + - seq: "1" + name: config + parameter: + - name: ssh-hostname + value: + - name: ssh-username + value: ubuntu + - name: ssh-password + value: + - seq: "2" + name: configure-spgw + parameter: + - name: spgw-ip + data-type: STRING + value: + - name: hss-ip + data-type: STRING + value: + - seq: "3" + name: restart-spgw + config-primitive: + - name: add-route + parameter: + - name: external-prefix + data-type: STRING + default-value: "8.8.8.8/32" + - name: next-hop + data-type: STRING + default-value: "192.168.2.1" + juju: + charm: spgwcharm + int-virtual-link-desc: + - id: s6a + ext-cpd: + # SPGWMME + - id: spgwmme-mgmt-ext + int-cpd: # Connection to int-cpd + vdu-id: spgwmme + cpd: spgwmme-mgmt-int + - id: spgwmme-s1-ext + int-cpd: # Connection to int-cpd + vdu-id: spgwmme + cpd: spgwmme-mgmt-int + - id: spgwmme-sgi-ext + int-cpd: # Connection to int-cpd + vdu-id: spgwmme + cpd: spgwmme-mgmt-int + # HSS + - id: hss-mgmt-ext + int-cpd: # Connection to int-cpd + vdu-id: spgwmme + cpd: spgwmme-mgmt-int diff --git a/tests/examples/vnfd_im.yaml b/tests/examples/vnfd_im.yaml new file mode 100644 index 0000000..587cb89 --- /dev/null +++ b/tests/examples/vnfd_im.yaml @@ -0,0 +1,87 @@ +# Copyright 2020 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. + +# Using old OSM IM model + +vnfd:vnfd-catalog: + vnfd: + id: vnfd + + mgmt-interface: + cp: vnf-mgmt + + connection-point: + - id: vnf-mgmt + name: vnf-mgmt + short-name: vnf-mgmt + type: VPORT + - id: vnf-data + name: vnf-data + short-name: vnf-data + type: VPORT + + internal-vld: + - id: internal + name: internal + short-name: internal + type: ELAN + internal-connection-point: + - id-ref: mgmtVM-internal + - id-ref: dataVM-internal + + vdu: + - id: mgmtVM + + interface: + - name: mgmtVM-eth0 + position: "1" + type: EXTERNAL + virtual-interface: + type: VIRTIO + external-connection-point-ref: vnf-mgmt + - name: mgmtVM-eth1 + position: "2" + type: INTERNAL + virtual-interface: + type: VIRTIO + internal-connection-point-ref: mgmtVM-internal + + internal-connection-point: + - id: mgmtVM-internal + name: mgmtVM-internal + short-name: mgmtVM-internal + type: VPORT + + - id: dataVM + + interface: + - name: dataVM-eth0 + position: "1" + type: INTERNAL + virtual-interface: + type: VIRTIO + internal-connection-point-ref: dataVM-internal + - name: dataVM-xe0 + position: "2" + type: EXTERNAL + virtual-interface: + type: VIRTIO + external-connection-point-ref: vnf-data + + internal-connection-point: + - id: dataVM-internal + name: dataVM-internal + short-name: dataVM-internal + type: VPORT diff --git a/tests/examples/vnfd_sol006.yaml b/tests/examples/vnfd_sol006.yaml new file mode 100644 index 0000000..6ecbb82 --- /dev/null +++ b/tests/examples/vnfd_sol006.yaml @@ -0,0 +1,66 @@ +# Copyright 2020 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. + +# Using new SOL006-based OSM model + +vnfd: + id: vnfd + mgmt-cp: vnf-mgmt-ext + + ext-cpd: + - id: vnf-mgmt-ext + int-cpd: + vdu-id: mgmtVM + cpd: vnf-mgmt-int + - id: vnf-data-ext + int-cpd: + vdu-id: dataVM + cpd: vnf-data-int + + int-virtual-link-desc: + - id: internal + + vdu: + - id: mgmtVM + int-cpd: + - id: vnf-mgmt-int + virtual-network-interface-requirement: + - name: mgmtVM-eth0 + position: "1" + virtual-interface: + type: VIRTIO + - id: mgmtVM-internal + int-virtual-link-desc: internal + virtual-network-interface-requirement: + - name: mgmtVM-eth1 + position: "2" + virtual-interface: + type: VIRTIO + + - id: dataVM + int-cpd: + - id: dataVM-internal + int-virtual-link-desc: internal + virtual-network-interface-requirement: + - name: dataVM-eth0 + position: "1" + virtual-interface: + type: VIRTIO + - id: vnf-data-int + virtual-network-interface-requirement: + - name: dataVM-xe0 + position: "2" + virtual-interface: + type: VIRTIO diff --git a/tests/test_validation.py b/tests/test_validation.py new file mode 100644 index 0000000..a9dc8a4 --- /dev/null +++ b/tests/test_validation.py @@ -0,0 +1,54 @@ +# Copyright 2020 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. +# + +from osm_im.validation import Validation +import unittest + +TESTS_EXAMPLES_FOLDER = 'tests/examples/' + +VNFD_FILES = [ + 'alternative_image_sol006.yaml', + 'cirros_vnfd_sol006.yaml', + 'epa_sol006.yaml', + 'etsi_complex_vnfd_sol006.yaml', + 'hackfest_charmed_vnfd_sol006.yaml', + 'magma_knf_sol006.yaml', + 'vepc_sol006.yaml', + 'vnfd_sol006.yaml' +] + +NSD_FILES = [ + 'cirros_nsd_sol006.yaml', + 'etsi_nsd_sol006.yaml', + 'hackfest_charmed_nsd_sol006.yaml', + 'vepc_nsd_sol006.yaml' +] + +class ValidationTest(unittest.TestCase): + + def test_descriptor_validation_of_etsi_nfv_vnfd(self): + for file in VNFD_FILES: + file_path = TESTS_EXAMPLES_FOLDER + file + with open(file_path, 'r') as vnfd_file: + vnfd_file_content = vnfd_file.read() + Validation().descriptor_validation(vnfd_file_content) + + def test_descriptor_validation_of_etsi_nfv_nsd(self): + for file in NSD_FILES: + file_path = TESTS_EXAMPLES_FOLDER + file + with open(file_path, 'r') as nsd_file: + nsd_file_content = nsd_file.read() + Validation().descriptor_validation(nsd_file_content) diff --git a/tox.ini b/tox.ini index ed1ef21..d8d9e3b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,16 @@ -# Copyright 2019 ETSI OSM +# 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 # -# All Rights Reserved. -# -# 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. +# 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. + [tox] envlist = py3 toxworkdir={homedir}/.tox -- 2.17.1