*egg-info
*.gz
osm_im
+osm_im_trees
pyangbind
pyang
dists
pool
+.idea
PYBINDPLUGIN:=$(shell /usr/bin/env python -c \
'import pyangbind; import os; print "%s/plugin" % os.path.dirname(pyangbind.__file__)')
-YANG_MODELS := vnfd nsd
-PYTHON_MODELS := $(addsuffix .py, $(YANG_MODELS))
-PYTHON_JSONSCHEMAS := $(addsuffix .jsonschema, $(YANG_MODELS))
+YANG_DESC_MODELS := vnfd nsd
+YANG_RECORD_MODELS := vnfr nsr
+PYTHON_MODELS := $(addsuffix .py, $(YANG_DESC_MODELS))
+PYTHON_JSONSCHEMAS := $(addsuffix .jsonschema, $(YANG_DESC_MODELS))
+YANG_DESC_TREES := $(addsuffix .tree.txt, $(YANG_DESC_MODELS))
+YANG_DESC_JSTREES := $(addsuffix .html, $(YANG_DESC_MODELS))
+YANG_RECORD_TREES := $(addsuffix .rec.tree.txt, $(YANG_RECORD_MODELS))
+YANG_RECORD_JSTREES := $(addsuffix .rec.html, $(YANG_RECORD_MODELS))
OUT_DIR := osm_im
+TREES_DIR := osm_im_trees
MODEL_DIR := models/yang
RW_PB_EXT := build/yang/rw-pb-ext.yang
Q?=@
all: $(PYTHON_MODELS) pyangbind
$(MAKE) package
+trees: $(YANG_DESC_TREES) $(YANG_DESC_JSTREES) $(YANG_RECORD_TREES) $(YANG_RECORD_JSTREES)
+
$(OUT_DIR):
$(Q)mkdir -p $(OUT_DIR)
$(Q)touch $(OUT_DIR)/__init__.py
+$(TREES_DIR):
+ $(Q)mkdir -p $(TREES_DIR)
+
%.py: $(OUT_DIR) $(RW_PB_EXT)
$(Q)echo generating $@ from $*.yang
$(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) --plugindir $(PYBINDPLUGIN) -f pybind -o $(OUT_DIR)/$@ $(MODEL_DIR)/$*.yang
$(Q)echo generating $@ from $*.yang
$(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) --plugindir pyang-json-schema-plugin -f json-schema -o $(OUT_DIR)/$@ $(MODEL_DIR)/$*.yang
+%.tree.txt: $(TREES_DIR)
+ $(Q)echo generating $@ from $*.yang
+ $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) -f tree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang
+
+%.html: $(TREES_DIR)
+ $(Q)echo generating $@ from $*.yang
+ $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) -f jstree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang
+ $(Q)sed -r -i 's|data\:image/gif\;base64,R0lGODlhS.*RCAA7|https://osm.etsi.org/images/OSM-logo.png\" width=\"175\" height=\"60|g' $(TREES_DIR)/$@
+ $(Q)sed -r -i 's|<a href=\"http://www.tail-f.com">|<a href="http://osm.etsi.org">|g' $(TREES_DIR)/$@
+
+%.rec.tree.txt: $(TREES_DIR)
+ $(Q)echo generating $@ from $*.yang
+ $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) -f tree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang
+ $(Q)mv $(TREES_DIR)/$@ $(TREES_DIR)/$*.tree.txt
+
+%.rec.html: $(TREES_DIR)
+ $(Q)echo generating $@ from $*.yang
+ $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) -f jstree -o $(TREES_DIR)/$@ $(MODEL_DIR)/rw-project.yang $(MODEL_DIR)/$*.yang
+ $(Q)sed -r -i 's|data\:image/gif\;base64,R0lGODlhS.*RCAA7|https://osm.etsi.org/images/OSM-logo.png\" width=\"175\" height=\"60|g' $(TREES_DIR)/$@
+ $(Q)sed -r -i 's|<a href=\"http://www.tail-f.com">|<a href="http://osm.etsi.org">|g' $(TREES_DIR)/$@
+ $(Q)mv $(TREES_DIR)/$@ $(TREES_DIR)/$*.html
+
$(RW_PB_EXT):
$(Q)mkdir -p $$(dirname $@)
$(Q)wget -q https://raw.githubusercontent.com/RIFTIO/RIFT.ware/RIFT.ware-4.4.1/modules/core/util/yangtools/yang/rw-pb-ext.yang -O $@
tox -e build
pyangbind: pyang
- git clone https://github.com/robshakir/pyangbind
- cd pyangbind; python setup.py --command-packages=stdeb.command bdist_deb; cd ..
+ git clone https://github.com/alf-tierno/pyangbind
+ cd pyangbind; git checkout issue151; python setup.py --command-packages=stdeb.command bdist_deb; cd ..
mkdir -p deb_dist
cp pyangbind/deb_dist/*.deb deb_dist
git clone https://github.com/cmoberg/pyang-json-schema-plugin
clean:
- $(Q)rm -rf build dist osm_im.egg-info deb deb_dist *.gz pyang pyangbind pyang-json-schema-plugin $(OUT_DIR)
+ $(Q)rm -rf build dist osm_im.egg-info deb deb_dist *.gz pyang pyangbind pyang-json-schema-plugin $(OUT_DIR) $(TREES_DIR)
}
}
}
-
+
grouping image-properties {
leaf image {
description
the same name as entered here.
";
type string;
+ mandatory "true";
}
leaf image-checksum {
description "Juju charm to use with the VNF or VDU.";
type string;
}
+ leaf proxy {
+ description "Is this a proxy charm?";
+ type boolean;
+ default true;
+ }
uses manotypes:vca-relationships;
}
}
prefix "manotypes";
}
+ import ietf-inet-types {
+ prefix "inet";
+ }
+
revision 2017-02-28 {
description
"Update model to support projects.";
}
}
+ leaf vnfd-connection-point-ref {
+ description "A reference to a connection point name";
+ type leafref {
+ path "/vnfd:vnfd-catalog/vnfd:vnfd" +
+ "[vnfd:id = current()/../vnfd-id-ref]/" +
+ "vnfd:connection-point/vnfd:name";
+ }
+ }
+
leaf vnfd-id-ref {
description
"A reference to a VNFD";
}
}
- leaf vnfd-connection-point-ref {
- description "A reference to a connection point name";
- type leafref {
- path "/vnfd:vnfd-catalog/vnfd:vnfd" +
- "[vnfd:id = current()/../vnfd-id-ref]/" +
- "vnfd:connection-point/vnfd:name";
- }
+ leaf ip-address {
+ description "IP address of the connection point";
+ type inet:ip-address;
}
+
}
}
}
container nsd-catalog {
+ leaf schema-version {
+ description "Schema version for the NSD. If unspecified, it assumes v3.0";
+ type string;
+ default "v3.0";
+ }
+
list nsd {
key id;
key "id";
unique "name";
+ leaf schema-version {
+ description "Schema version for the NSR. If unspecified, it assumes v3.0";
+ type string;
+ default "v3.0";
+ }
+
leaf id {
description "Identifier for the NSR.";
type yang:uuid;
augment "/rw-project:project" {
container vlr-catalog {
+ leaf schema-version {
+ description "Schema version for the VLR. If unspecified, it assumes v3.0";
+ type string;
+ default "v3.0";
+ }
+
config false;
list vlr {
E1000 : Emulate E1000 interface.
RTL8139 : Emulate RTL8139 interface.
PCNET : Emulate PCNET interface.
- OM-MGMT : Used to specify openmano mgmt external-connection type";
+ OM-MGMT : Deprecated! Use VIRTIO instead and set the VNF management interface at vnfd:mgmt-interface:cp";
type enumeration {
enum OM-MGMT;
case cp {
description
- "Use the ip address associated with this connection point.";
+ "Use the ip address associated with this connection point. This cp is then considered as management.";
leaf cp {
type leafref {
path "../../connection-point/name";
path "../../../vdu/internal-connection-point/id";
}
}
+ leaf ip-address {
+ description "IP address of the internal connection point";
+ type inet:ip-address;
+ }
}
uses manotypes:provider-network;
uses manotypes:image-properties;
+ list alternative-images {
+ key "vim-type";
+ 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";
+
+ leaf vim-type {
+ description "VIM type: openvim, openstack, vmware, aws, etc.";
+ type string;
+ }
+
+ uses manotypes:image-properties;
+ }
+
container vdu-configuration {
uses manotypes:vca-configuration;
}
default "EXTERNAL";
}
+ 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;
+ }
+
choice connection-point-type {
case internal {
leaf internal-connection-point-ref {
description
"Virtual Network Function Descriptor (VNFD).";
+ leaf schema-version {
+ description "Schema version for the VNFD. If unspecified, it assumes v3.0";
+ type string;
+ default "v3.0";
+ }
+
list vnfd {
key "id";
augment "/rw-project:project" {
container vnfr-catalog {
+ leaf schema-version {
+ description "Schema version for the VNFR. If unspecified, it assumes v3.0";
+ type string;
+ default "v3.0";
+ }
+
config false;
list vnfr {
description
--- /dev/null
+import osm_im.vnfd as vnfd_catalog
+from pyangbind.lib.serialise import pybindJSONDecoder
+import unittest
+import yaml
+
+VNFD_YAML = """
+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
+"""
+
+class PythonTest(unittest.TestCase):
+
+
+ def test_python_compatibility(self):
+ """A simple test to verify Python compatibility.
+
+ This test exercises basic IM interoperability with supported versions
+ of Python in order to verify the IM libraries compatibility.
+
+ As of 30 Nov 2017, the IM library fails with Python3. This invokes that
+ failing code so that it can be repeatably tested:
+
+ ValueError: '_pybind_generated_by' in __slots__ conflicts with class variable
+ """
+
+ try:
+ data = yaml.load(VNFD_YAML)
+
+ myvnfd = vnfd_catalog.vnfd()
+ pybindJSONDecoder.load_ietf_json(data, None, None, obj=myvnfd)
+ except ValueError:
+ assert False
[testenv]
deps=nose
mock
+ pyyaml
commands=nosetests
[testenv:flake8]