From: garciadeblas Date: Wed, 7 Nov 2018 04:32:41 +0000 (+0100) Subject: Merge branch 'master' into netslice X-Git-Tag: v5.0.0~3^2~3 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FIM.git;a=commitdiff_plain;h=55433c776d1429f91ad2f56a77cd782188ee7775;hp=1620169edb2267ce6c3adf90ecb7cb7aad52eda1 Merge branch 'master' into netslice --- diff --git a/.gitignore b/.gitignore index c1bcfc2..3e381c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,34 @@ -build -.eggs *.pyc -deb_dist -dist +.cache + +#IDEs +.idea + +#Generated folders when building the deb package locally +debian/osm-imdocs.install +.eggs *egg-info *.gz osm_im osm_im_trees -pyangbind -pyang dists pool -.idea +deb_dist +dist +osm-im-*.post* +osm-imdocs-*.post* +osm-imdocs_*.post* + +#Pyang and other tools' folders +pyangbind +pyang +yang2swagger + +#YANG IETF files, retrieved from YANGmodels github +models/yang/ietf-yang-types.yang +models/yang/ietf-inet-types.yang + +#local stuff files that end in ".local" or folders called "local" +*.local +local + diff --git a/Dockerfile b/Dockerfile index 1e89c8f..419f8db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,8 @@ RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get -y install git make wget python \ python3 python3-all python3-pip python-pip \ debhelper tox python-setuptools \ - python3-setuptools build-essential dh-make && \ + python3-setuptools build-essential dh-make \ + openjdk-8-jdk maven && \ 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 4faeb5f..9f0d92b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ # Copyright 2017 Sandvine +# Copyright 2017-2018 Telefonica # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -15,6 +16,7 @@ # NOTE: pyang and pyangbind are required for build +.PHONY: all clean package trees deps yang-ietf openapi_schemas yang2swagger PYANG:= pyang PYBINDPLUGIN:=$(shell /usr/bin/env python3 -c \ 'import pyangbind; import os; print("{}/plugin".format(os.path.dirname(pyangbind.__file__)))') @@ -22,25 +24,26 @@ PYBINDPLUGIN:=$(shell /usr/bin/env python3 -c \ 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)) +OPENAPI_SCHEMAS := osm.yaml OUT_DIR := osm_im TREES_DIR := osm_im_trees MODEL_DIR := models/yang -RW_PB_EXT := build/yang/rw-pb-ext.yang Q?=@ PYANG_OPTIONS := -Werror -all: $(PYTHON_MODELS) pyangbind trees +all: $(PYTHON_MODELS) trees openapi_schemas $(MAKE) package trees: $(YANG_DESC_TREES) $(YANG_DESC_JSTREES) $(YANG_RECORD_TREES) $(YANG_RECORD_JSTREES) +openapi_schemas: $(OPENAPI_SCHEMAS) + $(OUT_DIR): $(Q)mkdir -p $(OUT_DIR) $(Q)touch $(OUT_DIR)/__init__.py @@ -48,66 +51,59 @@ $(OUT_DIR): $(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 - -%.jsonschema: $(OUT_DIR) $(RW_PB_EXT) pyang-json-schema-plugin +%.py: $(OUT_DIR) yang-ietf $(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 + $(Q)pyang $(PYANG_OPTIONS) --path $(MODEL_DIR) --plugindir $(PYBINDPLUGIN) -f pybind -o $(OUT_DIR)/$@ $(MODEL_DIR)/$*.yang -%.tree.txt: $(TREES_DIR) +%.tree.txt: $(TREES_DIR) yang-ietf $(Q)echo generating $@ from $*.yang - $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) -f tree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang + $(Q)pyang $(PYANG_OPTIONS) --path $(MODEL_DIR) -f tree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang -%.html: $(TREES_DIR) +%.html: $(TREES_DIR) yang-ietf $(Q)echo generating $@ from $*.yang - $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) -f jstree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang + $(Q)pyang $(PYANG_OPTIONS) --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|||g' $(TREES_DIR)/$@ -%.rec.tree.txt: $(TREES_DIR) +%.rec.tree.txt: $(TREES_DIR) yang-ietf $(Q)echo generating $@ from $*.yang - $(Q)pyang $(PYANG_OPTIONS) --path build/yang --path $(MODEL_DIR) -f tree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang + $(Q)pyang $(PYANG_OPTIONS) --path $(MODEL_DIR) -f tree -o $(TREES_DIR)/$@ $(MODEL_DIR)/$*.yang $(Q)mv $(TREES_DIR)/$@ $(TREES_DIR)/$*.tree.txt -%.rec.html: $(TREES_DIR) +%.rec.html: $(TREES_DIR) yang-ietf $(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)pyang $(PYANG_OPTIONS) --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|||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 $@ +osm.yaml: $(OUT_DIR) yang-ietf yang2swagger + $(Q)echo generating $@ + $(Q)java -jar ${HOME}/.m2/repository/com/mrv/yangtools/swagger-generator-cli/*-SNAPSHOT/swagger-generator-cli-*-SNAPSHOT-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 + +yang2swagger: + $(Q)mkdir -p ${HOME}/.m2 + $(Q)wget -q -O ${HOME}/.m2/settings.xml https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml + git clone https://github.com/bartoszm/yang2swagger.git + mvn -f yang2swagger/pom.xml clean install package: tox -e build tox -e build3 ./build-docs.sh - -pyangbind: pyang - git clone https://github.com/alf-tierno/pyangbind - cd pyangbind; git checkout issue151; \ - python setup.py --command-packages=stdeb.command bdist_deb; \ - python3 setup.py --command-packages=stdeb.command bdist_deb; \ - cd .. - mkdir -p deb_dist - cp pyangbind/deb_dist/*.deb deb_dist - -pyang: - git clone https://github.com/mbj4668/pyang - cd pyang; \ - python setup.py --command-packages=stdeb.command bdist_deb; \ - python3 setup.py --command-packages=stdeb.command bdist_deb; \ - cd .. - mkdir -p deb_dist - cp pyang/deb_dist/*.deb deb_dist - -pyang-json-schema-plugin: - git clone https://github.com/cmoberg/pyang-json-schema-plugin +deps: + $(Q)sudo apt-get -y install git make wget python python-pip debhelper dh-make tox python3 python3-pip maven + $(Q)sudo -H python3 -m pip install -U pip + $(Q)sudo -H python2 -m pip install -U pip + $(Q)sudo -H python3 -m pip install -U pyang pyangbind stdeb + $(Q)sudo -H python2 -m pip install -U pyang pyangbind stdeb + $(Q)mkdir -p ~/.m2 + $(Q)cp -n ~/.m2/settings.xml{,.orig} ; wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml clean: - $(Q)rm -rf build dist osm_im.egg-info deb deb_dist *.gz pyang pyangbind pyang-json-schema-plugin $(OUT_DIR) $(TREES_DIR) + $(Q)rm -rf dist osm_im.egg-info deb deb_dist *.gz yang2swagger $(OUT_DIR) $(TREES_DIR) diff --git a/build-docs.sh b/build-docs.sh index 3bb29b1..6f21939 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -46,6 +46,8 @@ for dir in $PKG_DIRECTORIES; do ln -s $PWD/$dir $PKG_DIR/. echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL done +cp LICENSE $PKG_DIR/. +echo "LICENSE usr/share/osm-$MDG_NAME" >> $DEB_INSTALL cp -R debian $PKG_DIR/. cd $PKG_DIR diff --git a/debian/control b/debian/control index 5e9a67f..10fb75b 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,12 @@ -Source: osm-im +Source: osm-imdocs Section: devel Priority: optional Maintainer: Michael Marchetti Build-Depends: debhelper (>=9) Standards-Version: 3.9.6 Homepage: http://osm.etsi.org - -Package: osm-im +Package: osm-imdocs Architecture: all Depends: ${misc:Depends} -Description: osm-im is the Information Model package for OSM, providing base classes derived from YANG models to be used by other modules. +Description: osm-imdocs is the Information Model package for OSM, providing base classes derived from YANG models to be used by other modules. + diff --git a/models/yang/ietf-l2-topology.yang b/models/yang/ietf-l2-topology.yang deleted file mode 100644 index 9f572cb..0000000 --- a/models/yang/ietf-l2-topology.yang +++ /dev/null @@ -1,578 +0,0 @@ - -/* - * NO RW COPYRIGHT - * - */ - -module ietf-l2-topology { - yang-version 1; - namespace "urn:ietf:params:xml:ns:yang:ietf-l2-topology"; - prefix "l2t"; - - import ietf-network { - prefix "nw"; - } - - import ietf-network-topology { - prefix "nt"; - } - - import ietf-inet-types { - prefix "inet"; - } - - import ietf-yang-types { - prefix "yang"; - } - - organization "TBD"; - contact "I-D Editor: jie.dong@huawei.com"; - - description - "This module defines a basic model for - the layer-2 topology of a network"; - - revision "2015-06-23" { - description "Initial revision"; - reference "draft-ietf-i2rs-l2-network-topology-01"; - } - - /* - * Typedefs - */ - - typedef vlan { - type uint16 { - range "0..4095"; - } - description "VLAN ID"; - } - - typedef trill-nickname { - type uint16; - description "TRILL Nickname"; - } - - typedef flag-type { - type identityref { - base "flag-identity"; - } - description "Base type for flags"; - } - - typedef l2-network-event-type { - type enumeration { - enum "add" { - value 0; - description "An L2 node or link or termination-point - has been added"; - } - enum "remove" { - value 1; - description "An L2 node or link or termination-point - has been removed"; - } - enum "update" { - value 2; - description "An L2 node or link or termination-point - has been updated"; - } - } - description "l2 network event type for notifications"; - } // l2-topology-event-type - - - /* - * Features - */ - - feature VLAN { - description - "Indicates that the system supports the - vlan functions"; - } - - feature QinQ { - description - "Indicates that the system supports the - qinq functions"; - } - - feature PBB { - description - "Indicates that the device supports the - provider-backbone-bridging functions"; - } - - feature VPLS { - description - "Indicates that the device supports the - VPLS functions"; - reference "RFC 4761, RFC 4762"; - } - - feature TRILL { - description - "Indicates that the device supports the - TRILL functions"; - reference "RFC 6325"; - } - - feature VXLAN { - description - "Indicates that the device supports the - VXLAN functions"; - reference "RFC 7348"; - } - - /* - * Identities - */ - identity flag-identity { - description "Base type for flags"; - } - - identity encapsulation-type { - description - "Base identity from which specific encapsulation - types are derived."; - } - - identity eth-encapsulation-type { - base encapsulation-type; - description - "Base identity from which specific ethernet - encapsulation types are derived."; - - } - - identity ethernet { - base eth-encapsulation-type; - description - "native ethernet encapsulation"; - } - - identity vlan { - base eth-encapsulation-type; - description - "vlan encapsulation"; - } - - identity qinq { - base eth-encapsulation-type; - description - "qinq encapsulation"; - } - - identity pbb { - base eth-encapsulation-type; - description - "pbb encapsulation"; - } - - identity trill { - base eth-encapsulation-type; - description - "trill encapsulation"; - } - - identity vpls { - base eth-encapsulation-type; - description - "vpls encapsulation"; - } - - identity vxlan { - base eth-encapsulation-type; - description - "vxlan encapsulation"; - } - - identity frame-relay { - base encapsulation-type; - description - "Frame Relay encapsulation"; - } - - identity ppp { - base encapsulation-type; - description - "PPP encapsulation"; - } - - identity hdlc { - base encapsulation-type; - description - "HDLC encapsulation"; - } - - identity atm { - base encapsulation-type; - description - "Base identity from which specific ATM - encapsulation types are derived."; - - } - - identity pwe3 { - base encapsulation-type; - description - "Base identity from which specific pw - encapsulation types are derived."; - } - - - /* - * Groupings - */ - - - grouping l2-network-type { - description "Identify the topology type to be L2."; - container l2-network { - presence "indicates L2 Network"; - description - "The presence of the container node indicates - L2 Topology"; - } - } - - grouping l2-network-attributes { - description "L2 Topology scope attributes"; - container l2-network-attributes { - description "Containing L2 network attributes"; - leaf name { - type string; - description "Name of the L2 network"; - } - - leaf-list flag { - type flag-type; - description "L2 network flags"; - } - } - } - - grouping l2-node-attributes { - description "L2 node attributes"; - container l2-node-attributes { - description "Containing L2 node attributes"; - leaf name { - type string; - description "Node name"; - } - leaf description { - type string; - description "Node description"; - } - leaf-list management-address { - type inet:ip-address; - description "System management address"; - } - leaf management-vid { - if-feature VLAN; - type vlan; - description "System management VID"; - } - leaf-list nick-name { - if-feature TRILL; - type trill-nickname; - description "Nickname of the RBridge"; - } - leaf-list flag { - type flag-type; - description "Node operational flags"; - } - } - } // grouping l2-node-attributes - - - grouping l2-link-attributes { - description "L2 link attributes"; - container l2-link-attributes { - description "Containing L2 link attributes"; - leaf name { - type string; - description "Link name"; - } - leaf-list flag { - type flag-type; - description "Link flags"; - } - leaf rate { - type decimal64 { - fraction-digits 2; - } - description "Link rate"; - - } - leaf delay { - type uint32; - description "Link delay in microseconds"; - } - leaf-list srlg { - type uint32; - description - "List of Shared Risk Link Groups - this link belongs to."; - } - } - } // grouping l2-link-attributes - - grouping l2-termination-point-attributes { - description "L2 termination point attributes"; - container l2-termination-point-attributes { - description "Containing L2 TP attributes"; - leaf description { - type string; - description "Port description"; - } - - leaf maximum-frame-size { - type uint32; - description "Maximum frame size"; - } - - choice l2-termination-point-type { - description - "Indicates termination-point type - specific attributes"; - case ethernet { - leaf mac-address { - type yang:mac-address; - description "Interface MAC address"; - } - - leaf eth-encapsulation { - type identityref { - base eth-encapsulation-type; - } - description - "Encapsulation type of this - ternimation point."; - } - - leaf port-vlan-id { - if-feature VLAN; - type vlan; - description "Port VLAN ID"; - } - - list vlan-id-name { - if-feature VLAN; - key "vlan-id"; - description "Interface configured VLANs"; - leaf vlan-id { - type vlan; - description "VLAN ID"; - } - leaf vlan-name { - type string; - description "VLAN Name"; - } - } - } //case ethernet - - case legacy { - leaf encapsulation { - type identityref { - base encapsulation-type; - } - description - "Encapsulation type of this termination point."; - } - } //case legacy - - } //choice termination-point-type - - leaf tp-state { - type enumeration { - enum in-use { - value 0; - description - "the termination point is in forwarding state"; - } - enum blocking { - value 1; - description - "the termination point is in blocking state"; - } - enum down { - value 2; - description - "the termination point is in down state"; - } - enum others { - value 3; - description - "the termination point is in other state"; - } - } - config false; - description "State of the termination point"; - } - } - } // grouping l2-termination-point-attributes - -/*** grouping of network/node/link/tp leaf-refs ***/ - - grouping network-ref { - description - "Grouping for an absolute reference to a network topology - instance."; - leaf network-ref { - type leafref { - path "/nw:network/nw:network-id"; - } - description - "An absolute reference to a network topology instance."; - } - } - - grouping link-ref { - description - "Grouping for an absolute reference to a link instance."; - uses network-ref; - leaf link-ref { - type leafref { - path "/nw:network" - +"[nw:network-id = current()/../network-ref]" - +"/nt:link/nt:link-id"; - } - description - "An absolute reference to a link instance."; - } - } - - grouping node-ref { - description - "Grouping for an absolute reference to a node instance."; - uses network-ref; - leaf node-ref { - type leafref { - path "/nw:network" - +"[nw:network-id = current()/../network-ref]" - +"/nw:node/nw:node-id"; - } - description - "An absolute reference to a node instance."; - } - } - - grouping tp-ref { - description - "Grouping for an absolute reference to a termination point."; - uses node-ref; - leaf tp-ref { - type leafref { - path "/nw:network" - +"[nw:network-id = current()/../network-ref]" - +"/nw:node[nw:node-id = current()/../node-ref]" - +"/nt:termination-point/nt:tp-id"; - } - description - "Grouping for an absolute reference to a TP."; - } - } - - - /* - * Data nodes - */ - augment "/nw:network/nw:network-types" { - description - "Introduce new network type for L2 topology"; - uses l2-network-type; - } - - augment "/nw:network" { - /* RIFT-Change: when not to be used yet - when "nw:network-types/l2-network" { - description - "Augmentation parameters apply only for networks - with L2 topology"; - } - */ - description - "Configuration parameters for the L2 network - as a whole"; - uses l2-network-attributes; - } - - augment "/nw:network/nw:node" { - /* RIFT-Change: when not to be used yet - when "../nw:network-types/l2-network" { - description - "Augmentation parameters apply only for networks - with L2 topology"; - } - */ - description - "Configuration parameters for L2 at the node - level"; - uses l2-node-attributes; - } - - augment "/nw:network/nt:link" { - /* RIFT-Change: when not to be used yet - when "/nw:network/nw:network-types/l2-network" { - description - "Augmentation parameters apply only for networks - with L2 topology"; - } - */ - description "Augment L2 topology link information"; - uses l2-link-attributes; - } - - augment "/nw:network/nw:node/nt:termination-point" { - /* RIFT-Change: when not to be used yet - when "/nw:network/nw:network-types/l2-network" { - description - "Augmentation parameters apply only for networks - with L2 topology"; - } - */ - description - "Augment L2 topology termination point configuration"; - uses l2-termination-point-attributes; - } - - /* - * Notifications - */ - - notification l2-node-event { - description "Notification event for L2 node"; - leaf event-type { - type l2-network-event-type; - description "Event type"; - } - uses node-ref; - uses l2-network-type; - uses l2-node-attributes; - } - - notification l2-link-event { - description "Notification event for L2 link"; - leaf event-type { - type l2-network-event-type; - description "Event type"; - } - uses link-ref; - uses l2-network-type; - uses l2-link-attributes; - } - - notification l2-termination-point-event { - description "Notification event for L2 termination point"; - leaf event-type { - type l2-network-event-type; - description "Event type"; - } - uses tp-ref; - uses l2-network-type; - uses l2-termination-point-attributes; - } - -} // module l2-topology diff --git a/models/yang/ietf-network-topology.yang b/models/yang/ietf-network-topology.yang deleted file mode 100644 index e8f7c79..0000000 --- a/models/yang/ietf-network-topology.yang +++ /dev/null @@ -1,257 +0,0 @@ - -/* - * NO RW COPYRIGHT - * - */ - -module ietf-network-topology { - yang-version 1; - namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology"; - prefix lnk; - - import ietf-inet-types { - prefix inet; - } - import ietf-network { - prefix nd; - } - - organization "TBD"; - contact - "WILL-BE-DEFINED-LATER"; - description - "This module defines a common base model for network topology, - augmenting the base network model with links to connect nodes, - as well as termination points to terminate links on nodes."; - - revision 2015-06-08 { - description - "Initial revision."; - reference "draft-ietf-i2rs-yang-network-topo-01"; - } - - typedef link-id { - type inet:uri; - description - "An identifier for a link in a topology. - The identifier may be opaque. - The identifier SHOULD be chosen such that the same link in a - real network topology will always be identified through the - same identifier, even if the model is instantiated in - separate datastores. An implementation MAY choose to capture - semantics in the identifier, for example to indicate the type - of link and/or the type of topology that the link is a part - of."; - } - - typedef tp-id { - type inet:uri; - description - "An identifier for termination points on a node. - The identifier may be opaque. - The identifier SHOULD be chosen such that the same TP in a - real network topology will always be identified through the - same identifier, even if the model is instantiated in - separate datastores. An implementation MAY choose to capture - semantics in the identifier, for example to indicate the type - of TP and/or the type of node and topology that the TP is a - part of."; - } - - grouping link-ref { - description - "References a link in a specific network."; - leaf link-ref { - type leafref { - path "/nd:network[nd:network-id=current()/../"+ - "nd:network-ref]/link/link-id"; - } - description - "A type for an absolute reference a link instance. - (This type should not be used for relative references. - In such a case, a relative path should be used instead.)"; - } - uses nd:network-ref; - } - - grouping tp-ref { - description - "References a termination point in a specific node."; - leaf tp-ref { - type leafref { - path "/nd:network[nd:network-id=current()/../"+ - "nd:network-ref]/nd:node[nd:node-id=current()/../"+ - "nd:node-ref]/termination-point/tp-id"; - } - description - "A type for an absolute reference to a termination point. - (This type should not be used for relative references. - In such a case, a relative path should be used instead.)"; - } - uses nd:node-ref; - } - - augment "/nd:network" { - description - "Add links to the network model."; - list link { - key "link-id"; - - description - "A Network Link connects a by Local (Source) node and - a Remote (Destination) Network Nodes via a set of the - nodes' termination points. - As it is possible to have several links between the same - source and destination nodes, and as a link could - potentially be re-homed between termination points, to - ensure that we would always know to distinguish between - links, every link is identified by a dedicated link - identifier. - Note that a link models a point-to-point link, not a - multipoint link. - Layering dependencies on links in underlay topologies are - not represented as the layering information of nodes and of - termination points is sufficient."; - container source { - description - "This container holds the logical source of a particular - link."; - leaf source-node { - type leafref { - // RIFT change: - path "../../../../nd:network/nd:node/nd:node-id"; - } - mandatory true; - description - "Source node identifier, must be in same topology."; - } - leaf source-tp { - type leafref { - // RIFT change: - path "../../../../nd:network/nd:node[nd:node-id=current()/../"+ - "source-node]/termination-point/tp-id"; - } - description - "Termination point within source node that terminates - the link."; - } - } - container destination { - description - "This container holds the logical destination of a - particular link."; - leaf dest-node { - type leafref { - // RIFT change - path "../../../../nd:network/nd:node/nd:node-id"; - } - mandatory true; - description - "Destination node identifier, must be in the same - network."; - } - leaf dest-tp { - type leafref { - // RIFT change: - path "../../../../nd:network/nd:node[nd:node-id=current()/../"+ - "dest-node]/termination-point/tp-id"; - } - description - "Termination point within destination node that - terminates the link."; - } - } - leaf link-id { - type link-id; - description - "The identifier of a link in the topology. - A link is specific to a topology to which it belongs."; - } - list supporting-link { - key "network-ref link-ref"; - description - "Identifies the link, or links, that this link - is dependent on."; - leaf network-ref { - type leafref { - // RIFT change: - path "../../../../nd:network/nd:supporting-network/nd:network-ref"; - } - description - "This leaf identifies in which underlay topology - supporting link is present."; - } - leaf link-ref { - type leafref { - path "/nd:network[nd:network-id=current()/.."+ - "/network-ref]/link/link-id"; - } - description - "This leaf identifies a link which is a part - of this link's underlay. Reference loops, in which - a link identifies itself as its underlay, either - directly or transitively, are not allowed."; - } - } - } - } - augment "/nd:network/nd:node" { - description - "Augment termination points which terminate links. - Termination points can ultimately be mapped to interfaces."; - list termination-point { - key "tp-id"; - description - "A termination point can terminate a link. - Depending on the type of topology, a termination point - could, for example, refer to a port or an interface."; - leaf tp-id { - type tp-id; - description - "Termination point identifier."; - } - list supporting-termination-point { - key "network-ref node-ref tp-ref"; - description - "The leaf list identifies any termination points that - the termination point is dependent on, or maps onto. - Those termination points will themselves be contained - in a supporting node. - This dependency information can be inferred from - the dependencies between links. For this reason, - this item is not separately configurable. Hence no - corresponding constraint needs to be articulated. - The corresponding information is simply provided by the - implementing system."; - leaf network-ref { - type leafref { - // RIFT change: - path "/nd:network/nd:node/nd:supporting-node/nd:network-ref"; - } - description - "This leaf identifies in which topology the - supporting termination point is present."; - } - leaf node-ref { - type leafref { - // RIFT change: - path "/nd:network/nd:node/nd:supporting-node/nd:node-ref"; - } - description - "This leaf identifies in which node the supporting - termination point is present."; - } - leaf tp-ref { - type leafref { - path "/nd:network[nd:network-id=current()/../"+ - "network-ref]/nd:node[nd:node-id=current()/../"+ - "node-ref]/termination-point/tp-id"; - } - description - "Reference to the underlay node, must be in a - different topology"; - } - } - } - } -} diff --git a/models/yang/ietf-network.yang b/models/yang/ietf-network.yang deleted file mode 100644 index 9308544..0000000 --- a/models/yang/ietf-network.yang +++ /dev/null @@ -1,153 +0,0 @@ - -/* - * NO RW COPYRIGHT - * - */ - -module ietf-network { - yang-version 1; - namespace "urn:ietf:params:xml:ns:yang:ietf-network"; - prefix nd; - - import ietf-inet-types { - prefix inet; - } - - organization "TBD"; - contact - "WILL-BE-DEFINED-LATER"; - description - "This module defines a common base model for a collection - of nodes in a network. Node definitions s are further used - in network topologies and inventories."; - - revision 2015-06-08 { - description - "Initial revision."; - reference "draft-ietf-i2rs-yang-network-topo-01"; - } - - typedef node-id { - type inet:uri; - description - "Identifier for a node."; - } - - typedef network-id { - type inet:uri; - description - "Identifier for a network."; - } - - grouping network-ref { - description - "Contains the information necessary to reference a network, - for example an underlay network."; - leaf network-ref { - type leafref { - path "/network/network-id"; - } - description - "Used to reference a network, for example an underlay - network."; - } - } - - grouping node-ref { - description - "Contains the information necessary to reference a node."; - leaf node-ref { - type leafref { - path "/network[network-id=current()/../network-ref]"+ - "/node/node-id"; - } - description - "Used to reference a node. - Nodes are identified relative to the network they are - contained in."; - } - uses network-ref; - } - - list network { - config false; - key "network-id"; - description - "Describes a network. - A network typically contains an inventory of nodes, - topological information (augmented through - network-topology model), as well as layering - information."; - container network-types { - description - "Serves as an augmentation target. - The network type is indicated through corresponding - presence containers augmented into this container."; - } - leaf network-id { - type network-id; - description - "Identifies a network."; - } - leaf server-provided { - type boolean; - config false; - description - "Indicates whether the information concerning this - particular network is populated by the server - (server-provided true, the general case for network - information discovered from the server), - or whether it is configured by a client - (server-provided true, possible e.g. for - service overlays managed through a controller)."; - } - list supporting-network { - key "network-ref"; - description - "An underlay network, used to represent layered network - topologies."; - - leaf network-ref { - type leafref { - path "/network/network-id"; - } - description - "References the underlay network."; - } - } - list node { - key "node-id"; - description - "The inventory of nodes of this network."; - leaf node-id { - type node-id; - description - "Identifies a node uniquely within the containing - network."; - } - list supporting-node { - key "network-ref node-ref"; - description - "Represents another node, in an underlay network, that - this node is supported by. Used to represent layering - structure."; - leaf network-ref { - type leafref { - path "../../../supporting-network/network-ref"; - } - description - "References the underlay network that the - underlay node is part of."; - } - leaf node-ref { - type leafref { - path "/network/node/node-id"; - } - description - "References the underlay node itself."; - } - } - } - } -} - diff --git a/models/yang/odl-network-topology.yang b/models/yang/odl-network-topology.yang deleted file mode 100644 index 9c7101d..0000000 --- a/models/yang/odl-network-topology.yang +++ /dev/null @@ -1,359 +0,0 @@ - -/* - * - * Copyright 2016 RIFT.IO Inc - * - * 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 odl-network-topology { - yang-version 1; - namespace "urn:TBD:params:xml:ns:yang:network-topology"; - // replace with IANA namespace when assigned - prefix "nt"; - - import ietf-inet-types { prefix "inet"; } - - organization "TBD"; - - contact "WILL-BE-DEFINED-LATER"; - - description - "This module defines a model for the topology of a network. - Key design decisions are as follows: - A topology consists of a set of nodes and links. - Links are point-to-point and unidirectional. - Bidirectional connections need to be represented through - two separate links. - Multipoint connections, broadcast domains etc can be represented - through a hierarchy of nodes, then connecting nodes at - upper layers of the hierarchy."; - - revision 2013-10-21 { - description - "Initial revision."; - } - - typedef topology-id { - type inet:uri; - description - "An identifier for a topology."; - } - - typedef node-id { - type inet:uri; - description - "An identifier for a node in a topology. - The identifier may be opaque. - The identifier SHOULD be chosen such that the same node in a - real network topology will always be identified through the - same identifier, even if the model is instantiated in separate - datastores. An implementation MAY choose to capture semantics - in the identifier, for example to indicate the type of node - and/or the type of topology that the node is a part of."; - } - - - typedef link-id { - type inet:uri; - description - "An identifier for a link in a topology. - The identifier may be opaque. - The identifier SHOULD be chosen such that the same link in a - real network topology will always be identified through the - same identifier, even if the model is instantiated in separate - datastores. An implementation MAY choose to capture semantics - in the identifier, for example to indicate the type of link - and/or the type of topology that the link is a part of."; - } - - typedef tp-id { - type inet:uri; - description - "An identifier for termination points on a node. - The identifier may be opaque. - The identifier SHOULD be chosen such that the same TP in a - real network topology will always be identified through the - same identifier, even if the model is instantiated in separate - datastores. An implementation MAY choose to capture semantics - in the identifier, for example to indicate the type of TP - and/or the type of node and topology that the TP is a part of."; - } - - typedef tp-ref { - type leafref { - path "/network-topology/topology/node/termination-point/tp-id"; - } - description - "A type for an absolute reference to a termination point. - (This type should not be used for relative references. - In such a case, a relative path should be used instead.)"; - } - typedef topology-ref { - type leafref { - path "/network-topology/topology/topology-id"; - } - description - "A type for an absolute reference a topology instance."; - } - - typedef node-ref { - type leafref { - path "/network-topology/topology/node/node-id"; - } - description - - "A type for an absolute reference to a node instance. - (This type should not be used for relative references. - In such a case, a relative path should be used instead.)"; - } - - typedef link-ref { - type leafref { - path "/network-topology/topology/link/link-id"; - } - description - "A type for an absolute reference a link instance. - (This type should not be used for relative references. - In such a case, a relative path should be used instead.)"; - } - - grouping tp-attributes { - description - "The data objects needed to define a termination point. - (This only includes a single leaf at this point, used - to identify the termination point.) - Provided in a grouping so that in addition to the datastore, - the data can also be included in notifications."; - leaf tp-id { - type tp-id; - } - leaf-list tp-ref { - type tp-ref; - config false; - description - "The leaf list identifies any termination points that the - termination point is dependent on, or maps onto. - Those termination points will themselves be contained - in a supporting node. - This dependency information can be inferred from - the dependencies between links. For this reason, - this item is not separately configurable. Hence no - corresponding constraint needs to be articulated. - The corresponding information is simply provided by the - implementing system."; - } - } - - grouping node-attributes { - description - "The data objects needed to define a node. - The objects are provided in a grouping so that in addition to - the datastore, the data can also be included in notifications - as needed."; - - leaf node-id { - type node-id; - description - "The identifier of a node in the topology. - A node is specific to a topology to which it belongs."; - } - list supporting-node { - description - "This list defines vertical layering information for nodes. - It allows to capture for any given node, which node (or nodes) - in the corresponding underlay topology it maps onto. - A node can map to zero, one, or more nodes below it; - accordingly there can be zero, one, or more elements in the list. - If there are specific layering requirements, for example - specific to a particular type of topology that only allows - for certain layering relationships, the choice - below can be augmented with additional cases. - A list has been chosen rather than a leaf-list in order - to provide room for augmentations, e.g. for - statistics or priorization information associated with - supporting nodes."; - // This is not what was published in the initial draft, - // added topology-ref leaf and added it to the key - key "topology-ref node-ref"; - leaf topology-ref { - type topology-ref; - } - leaf node-ref { - type node-ref; - } - } - } - - grouping link-attributes { - // This is a grouping, not defined inline with the link definition itself, - // so it can be included in a notification, if needed - leaf link-id { - type link-id; - description - "The identifier of a link in the topology. - A link is specific to a topology to which it belongs."; - } - container source { - leaf source-node { - mandatory true; - type node-ref; - description - "Source node identifier, must be in same topology."; - } - leaf source-tp { - type tp-ref; - description - "Termination point within source node that terminates the link."; - - } - } - container destination { - leaf dest-node { - mandatory true; - type node-ref; - description - "Destination node identifier, must be in same topology."; - } - leaf dest-tp { - type tp-ref; - description - "Termination point within destination node that terminates the link."; - } - } - list supporting-link { - key "link-ref"; - leaf link-ref { - type link-ref; - } - } - } - - - container network-topology { - list topology { - description " - This is the model of an abstract topology. - A topology contains nodes and links. - Each topology MUST be identified by - unique topology-id for reason that a network could contain many - topologies. - "; - key "topology-id"; - leaf topology-id { - type topology-id; - description " - It is presumed that a datastore will contain many topologies. To - distinguish between topologies it is vital to have UNIQUE - topology identifiers. - "; - } - leaf server-provided { - type boolean; - config false; - description " - Indicates whether the topology is configurable by clients, - or whether it is provided by the server. This leaf is - - populated by the server implementing the model. - It is set to false for topologies that are created by a client; - it is set to true otherwise. If it is set to true, any - attempt to edit the topology MUST be rejected. - "; - } - container topology-types { - description - "This container is used to identify the type, or types - (as a topology can support several types simultaneously), - of the topology. - Topology types are the subject of several integrity constraints - that an implementing server can validate in order to - maintain integrity of the datastore. - Topology types are indicated through separate data nodes; - the set of topology types is expected to increase over time. - To add support for a new topology, an augmenting module - needs to augment this container with a new empty optional - container to indicate the new topology type. - The use of a container allows to indicate a subcategorization - of topology types. - The container SHALL NOT be augmented with any data nodes - that serve a purpose other than identifying a particular - topology type. - "; - } - list underlay-topology { - key "topology-ref"; - leaf topology-ref { - type topology-ref; - } - // a list, not a leaf-list, to allow for potential augmentation - // with properties specific to the underlay topology, - // such as statistics, preferences, or cost. - description - "Identifies the topology, or topologies, that this topology - is dependent on."; - } - - list node { - description "The list of network nodes defined for the topology."; - key "node-id"; - uses node-attributes; - must "boolean(../underlay-topology[*]/node[./supporting-nodes/node-ref])"; - // This constraint is meant to ensure that a referenced node is in fact - // a node in an underlay topology. - list termination-point { - description - - "A termination point can terminate a link. - Depending on the type of topology, a termination point could, - for example, refer to a port or an interface."; - key "tp-id"; - uses tp-attributes; - } - } - - list link { - description " - A Network Link connects a by Local (Source) node and - a Remote (Destination) Network Nodes via a set of the - nodes' termination points. - As it is possible to have several links between the same - source and destination nodes, and as a link could potentially - be re-homed between termination points, to ensure that we - would always know to distinguish between links, every link - is identified by a dedicated link identifier. - Note that a link models a point-to-point link, not a multipoint - link. - Layering dependencies on links in underlay topologies are - not represented as the layering information of nodes and of - termination points is sufficient. - "; - key "link-id"; - uses link-attributes; - must "boolean(../underlay-topology/link[./supporting-link])"; - // Constraint: any supporting link must be part of an underlay topology - must "boolean(../node[./source/source-node])"; - // Constraint: A link must have as source a node of the same topology - must "boolean(../node[./destination/dest-node])"; - // Constraint: A link must have as source a destination of the same topology - must "boolean(../node/termination-point[./source/source-tp])"; - // Constraint: The source termination point must be contained in the source node - must "boolean(../node/termination-point[./destination/dest-tp])"; - // Constraint: The destination termination point must be contained - // in the destination node - } - } - } -} diff --git a/models/yang/vnfd-base.yang b/models/yang/vnfd-base.yang index a320ed1..ce637d2 100644 --- a/models/yang/vnfd-base.yang +++ b/models/yang/vnfd-base.yang @@ -95,15 +95,17 @@ module vnfd-base description "Specifies the type of virtual interface between VM and host. - VIRTIO : Use the traditional VIRTIO interface. + 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 VIRTIO instead and set the VNF management interface at vnfd:mgmt-interface:cp"; + 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; @@ -112,7 +114,7 @@ module vnfd-base enum RTL8139; enum PCNET; } - default "VIRTIO"; + default "PARAVIRT"; } leaf vpci { diff --git a/models/yang/vnfr.yang b/models/yang/vnfr.yang index ef2edde..8813647 100644 --- a/models/yang/vnfr.yang +++ b/models/yang/vnfr.yang @@ -120,10 +120,12 @@ module vnfr description "Specifies the type of virtual interface between VM and host. - VIRTIO : Use the traditional VIRTIO interface. + 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."; type enumeration { + enum PARAVIRT; enum VIRTIO; enum PCI-PASSTHROUGH; enum SR-IOV; diff --git a/setup.py b/setup.py index b08ea17..cda4c73 100644 --- a/setup.py +++ b/setup.py @@ -9,9 +9,6 @@ setup( author_email='mmarchetti@sandvine.com', packages=find_packages(), include_package_data=True, - install_requires=[ - 'pyangbind' - ], setup_requires=['setuptools-version-command'], test_suite='nose.collector', ) diff --git a/stdeb.cfg b/stdeb.cfg new file mode 100644 index 0000000..7b85a12 --- /dev/null +++ b/stdeb.cfg @@ -0,0 +1,5 @@ +[DEFAULT] +Suite: xenial +Maintainer: Gerardo Garcia +Depends: osm-imdocs +Depends3: osm-imdocs diff --git a/tests/test_python.py b/tests/test_python.py index f6b4f7d..874d442 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -44,7 +44,7 @@ vnfd-catalog: - name: eth0 type: EXTERNAL virtual-interface: - type: VIRTIO + type: PARAVIRT bandwidth: '0' vpci: 0000:00:0a.0 external-connection-point-ref: eth0