summaryrefslogtreecommitdiffstats
path: root/mpls/api
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-10-25 10:45:48 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-11-06 06:46:08 +0000
commitcacb95739aed54605b6c89fa0f58898aadaece2f (patch)
treef0de937d3733e26e73269f45aecf65ef5a607a54 /mpls/api
parent24cebefb5177f2fe922d98a9122a9e79fcb756d1 (diff)
HC2VPP-256: MPLS API
Adds following models: - hc2vpp-ietf-mpls - hc2vpp-ietf-mpls-static - hc2vpp-ietf-routing-types Models were modified due to YANGTOOLS/MDSAL issues and some problems with the models itself. More information can be found in the YANG files. Original YANG files were downloaded from https://github.com/ietf-mpls-yang/te/ Change-Id: I3d04a3bf8be026fbe74a6f5833d38e980490e737 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'mpls/api')
-rw-r--r--mpls/api/asciidoc/Readme.adoc14
-rw-r--r--mpls/api/pom.xml48
-rw-r--r--mpls/api/src/main/yang/hc2vpp-ietf-mpls-static@2017-03-10.yang317
-rw-r--r--mpls/api/src/main/yang/hc2vpp-ietf-mpls@2017-07-02.yang397
-rw-r--r--mpls/api/src/main/yang/hc2vpp-ietf-routing-types@2017-02-27.yang723
5 files changed, 1499 insertions, 0 deletions
diff --git a/mpls/api/asciidoc/Readme.adoc b/mpls/api/asciidoc/Readme.adoc
new file mode 100644
index 000000000..35ae1b079
--- /dev/null
+++ b/mpls/api/asciidoc/Readme.adoc
@@ -0,0 +1,14 @@
+= mpls-api
+
+Hc2vpp implementation of MPLS uses following ietf models:
+- ietf-mpls
+- ietf-mpls-static
+- ietf-routing-types
+
+Models were modified due to YANGTOOLS/MDSAL issues
+and some problems with the models itself.
+More information can be found in yang files.
+
+Original YANG files were downloaded from
+
+https://github.com/ietf-mpls-yang/te/ \ No newline at end of file
diff --git a/mpls/api/pom.xml b/mpls/api/pom.xml
new file mode 100644
index 000000000..8c4f81491
--- /dev/null
+++ b/mpls/api/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2017 Cisco and/or its affiliates.
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>io.fd.hc2vpp.common</groupId>
+ <artifactId>api-parent</artifactId>
+ <version>1.18.01-SNAPSHOT</version>
+ <relativePath>../../common/api-parent</relativePath>
+ </parent>
+
+ <groupId>io.fd.hc2vpp.mpls</groupId>
+ <artifactId>mpls-api</artifactId>
+ <name>${project.artifactId}</name>
+ <version>1.18.01-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.fd.hc2vpp.routing</groupId>
+ <artifactId>routing-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types-2013-07-15</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-interfaces</artifactId>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/mpls/api/src/main/yang/hc2vpp-ietf-mpls-static@2017-03-10.yang b/mpls/api/src/main/yang/hc2vpp-ietf-mpls-static@2017-03-10.yang
new file mode 100644
index 000000000..143d87022
--- /dev/null
+++ b/mpls/api/src/main/yang/hc2vpp-ietf-mpls-static@2017-03-10.yang
@@ -0,0 +1,317 @@
+module hc2vpp-ietf-mpls-static {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-mpls-static";
+
+ prefix "mpls-static";
+
+ import hc2vpp-ietf-mpls {
+ prefix mpls;
+ }
+
+/*
+ TODO: changed to modified version of ietf-routing that we use
+ Set back to ietf-routing after HC2VPP-253 is resolved.
+*/
+ import hc2vpp-ietf-routing {
+ prefix "rt";
+ }
+
+ import hc2vpp-ietf-routing-types {
+ prefix "rt-types";
+ }
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ import ietf-interfaces {
+ prefix "if";
+ }
+
+ /* Import TE generic types */
+ /*
+ Yangtools has some issues with ietf-te model.
+ There is no plan to support tunnels currently, so we simply comment this out.
+ TODO: remove comment after following issues are resolved:
+ https://jira.opendaylight.org/browse/MDSAL-182
+ https://jira.opendaylight.org/browse/YANGTOOLS-677
+
+ import ietf-te {
+ prefix te;
+ }
+*/
+
+ organization "IETF MPLS Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/mpls/>
+
+ WG List: <mailto:mpls@ietf.org>
+
+ WG Chair: Loa Andersson
+ <mailto:loa@pi.nu>
+
+ WG Chair: Ross Callon
+ <mailto:rcallon@juniper.net>
+
+ WG Chair: George Swallow
+ <mailto:swallow.ietf@gmail.com>
+
+ Editor: Tarek Saad
+ <mailto:tsaad@cisco.com>
+
+ Editor: Kamran Raza
+ <mailto:skraza@cisco.com>
+
+ Editor: Rakesh Gandhi
+ <mailto:rgandhi@cisco.com>
+
+ Editor: Xufeng Liu
+ <mailto: xufeng.liu.ietf@gmail.com>
+
+ Editor: Vishnu Pavan Beeram
+ <mailto:vbeeram@juniper.net>
+
+ Editor: Himanshu Shah
+ <mailto:hshah@ciena.com>
+
+ Editor: Igor Bryskin
+ <mailto: Igor.Bryskin@huawei.com>
+
+ Editor: Xia Chen
+ <mailto:jescia.chenxia@huawei.com>
+
+ Editor: Raqib Jones
+ <mailto:raqib@Brocade.com>
+
+ Editor: Bin Wen
+ <mailto:Bin_Wen@cable.comcast.com>";
+
+ description
+ "This YANG module augments the 'ietf-routing' module with basic
+ configuration and operational state data for MPLS static";
+
+/*
+TODO: 2017-07-02 defines grouping in-segment but does not use it.
+Bump to newer version after the issue is resolved.
+*/
+ revision "2017-03-10" {
+ description
+ "Latest revision:
+ - Addressed MPLS-RT review comments";
+ reference "RFC 3031: A YANG Data Model for Static MPLS LSPs";
+ }
+
+ typedef static-lsp-ref {
+ type leafref {
+ path "/rt:routing/mpls:mpls/mpls-static:static-lsps/" +
+ "mpls-static:static-lsp/mpls-static:name";
+ }
+ description
+ "This type is used by data models that need to reference
+ configured static LSP.";
+ }
+
+ grouping path-basic_config {
+ description "common definitions for statics";
+
+ leaf next-hop {
+ type inet:ip-address;
+ description "next hop IP address for the LSP";
+ }
+
+ leaf outgoing-label {
+ type rt-types:mpls-label;
+ description
+ "label value to push at the current hop for the
+ LSP";
+ }
+
+ leaf outgoing-interface {
+ type if:interface-ref;
+ description
+ "The outgoing interface";
+ }
+ }
+
+ grouping path-properties_config {
+ description
+ "MPLS path properties";
+ leaf path-index {
+ type uint16;
+ description
+ "Path identifier";
+ }
+
+ leaf backup-path-index {
+ type uint16;
+ description
+ "Backup path identifier";
+ }
+
+ leaf next-hop {
+ type inet:ip-address;
+ description
+ "The address of the next-hop";
+ }
+
+ leaf-list outgoing-labels {
+ type rt-types:mpls-label;
+ ordered-by user;
+ description
+ "The outgoing MPLS labels to impose";
+ }
+
+ leaf outgoing-interface {
+ type if:interface-ref;
+ description
+ "The outgoing interface";
+ }
+
+ leaf loadshare {
+ type uint16;
+ description
+ "This value is used to compute a loadshare to perform un-equal
+ load balancing when multiple outgoing path(s) are specified. A
+ share is computed as a ratio of this number to the total under
+ all configured path(s).";
+ }
+
+ leaf role {
+ type enumeration {
+ enum PRIMARY {
+ description
+ "Path as primary traffic carrying";
+ }
+ enum BACKUP {
+ description
+ "Path acts as backup";
+ }
+ enum PRIMARY_AND_BACKUP {
+ description
+ "Path acts as primary and backup simultaneously";
+ }
+ }
+ description
+ "The MPLS path role";
+ }
+ }
+
+ grouping static-lsp_config {
+ description "common definitions for static LSPs";
+
+ container in-segment {
+ description
+ "MPLS incoming segment";
+ choice type {
+ description
+ "Basic FEC choice";
+ case ip-prefix {
+ leaf ip-prefix {
+ type inet:ip-prefix;
+ description "An IP prefix";
+ }
+ }
+ case mpls-label {
+ leaf incoming-label {
+ type rt-types:mpls-label;
+ description "label value on the incoming packet";
+ }
+ }
+ /*
+ Currently not supported. Commented out due to ODL issues (MDSAL-182, YANGTOOLS-677).
+ case tunnel {
+ leaf tunnel {
+ type te:tunnel-ref;
+ description "TE tunnel FEC mapping";
+ }
+ }
+ */
+ }
+ leaf incoming-interface {
+ type if:interface-ref;
+ description
+ "Optional incoming interface if FEC is restricted
+ to traffic incoming on a specific interface";
+ }
+ }
+
+ leaf operation {
+ type enumeration {
+ enum impose-and-forward {
+ description
+ "Operation impose outgoing label(s) and forward to
+ next-hop";
+ }
+ enum pop-and-forward {
+ description
+ "Operation pop incoming label and forward to next-hop";
+ }
+ enum pop-impose-and-forward {
+ description
+ "Operation pop incoming label, impose one or more
+ outgoing label(s) and forward to next-hop";
+ }
+ enum swap-and-forward {
+ description
+ "Operation swap incoming label, with outgoing label and
+ forward to next-hop";
+ }
+ enum pop-and-lookup {
+ description
+ "Operation pop incoming label and perform a lookup";
+ }
+ }
+ description
+ "The MPLS operation to be executed on the incoming packet";
+ }
+
+ choice out-segment {
+ description "The MPLS out-segment type choice";
+ case simple-path {
+ uses path-basic_config;
+ }
+ case path-list {
+ list paths {
+ key path-index;
+ description
+ "The list of MPLS paths associated with the FEC";
+ uses path-properties_config;
+ }
+ }
+ }
+ }
+
+ grouping static-lsp {
+ description "grouping for top level list of static LSPs";
+ container config {
+ description
+ "Holds the intended configuration";
+ uses static-lsp_config;
+ }
+ container state {
+ config false;
+ description
+ "Holds the state and inuse configuration";
+ uses static-lsp_config;
+ }
+ }
+
+ augment "/rt:routing/mpls:mpls" {
+ description "Augmentations for MPLS Static LSPs";
+ container static-lsps {
+ description
+ "Statically configured LSPs, without dynamic signaling";
+ list static-lsp {
+ key name;
+ description "list of defined static LSPs";
+
+ leaf name {
+ type string;
+ description "name to identify the LSP";
+ }
+ uses static-lsp;
+ }
+ }
+ }
+}
diff --git a/mpls/api/src/main/yang/hc2vpp-ietf-mpls@2017-07-02.yang b/mpls/api/src/main/yang/hc2vpp-ietf-mpls@2017-07-02.yang
new file mode 100644
index 000000000..7aa1a5c35
--- /dev/null
+++ b/mpls/api/src/main/yang/hc2vpp-ietf-mpls@2017-07-02.yang
@@ -0,0 +1,397 @@
+module hc2vpp-ietf-mpls {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-mpls";
+
+ prefix "mpls";
+
+/*
+ TODO: changed to modified version of ietf-routing that we use
+ Set back to ietf-routing after HC2VPP-253 is resolved.
+*/
+ import hc2vpp-ietf-routing {
+ prefix "rt";
+ }
+
+ import ietf-interfaces {
+ prefix "if";
+ }
+
+ import hc2vpp-ietf-routing-types {
+ prefix "rt-types";
+ }
+
+ organization "IETF MPLS Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/mpls/>
+
+ WG List: <mailto:mpls@ietf.org>
+
+ WG Chair: Loa Andersson
+ <mailto:loa@pi.nu>
+
+ WG Chair: Ross Callon
+ <mailto:rcallon@juniper.net>
+
+ WG Chair: George Swallow
+ <mailto:swallow.ietf@gmail.com>
+
+ Editor: Tarek Saad
+ <mailto:tsaad@cisco.com>
+
+ Editor: Kamran Raza
+ <mailto:skraza@cisco.com>
+
+ Editor: Rakesh Gandhi
+ <mailto:rgandhi@cisco.com>
+
+ Editor: Xufeng Liu
+ <mailto: xufeng.liu.ietf@gmail.com>
+
+ Editor: Vishnu Pavan Beeram
+ <mailto:vbeeram@juniper.net>
+
+ Editor: Himanshu Shah
+ <mailto:hshah@ciena.com>
+
+ Editor: Igor Bryskin
+ <mailto: Igor.Bryskin@huawei.com>
+
+ Editor: Xia Chen
+ <mailto:jescia.chenxia@huawei.com>
+
+ Editor: Raqib Jones
+ <mailto:raqib@Brocade.com>
+
+ Editor: Bin Wen
+ <mailto:Bin_Wen@cable.comcast.com>";
+
+ description
+ "This YANG module defines the essential components for the
+ management of the MPLS subsystem.";
+
+ revision "2017-07-02" {
+ description
+ "Latest revision:
+ - Addressed MPLS-RT review comments";
+ reference "RFC 3031: A YANG Data Model for base MPLS";
+ }
+
+ /* Identities */
+
+ identity mpls {
+ base rt:address-family;
+ description
+ "This identity represents the MPLS address family.";
+ }
+
+ identity label-block-alloc-mode {
+ description
+ "Base identity label-block allocation mode";
+ }
+
+ identity label-block-alloc-mode-manager {
+ base label-block-alloc-mode;
+ description
+ "Label block allocation on reserved block
+ is managed by label manager";
+ }
+
+ identity label-block-alloc-mode-application {
+ base label-block-alloc-mode;
+ description
+ "Label block allocation on reserved block
+ is managed by application";
+ }
+
+ typedef nhlfe-role {
+ type enumeration {
+ enum PRIMARY {
+ description
+ "Next-hop acts as primary traffic carrying";
+ }
+ enum BACKUP {
+ description
+ "Next-hop acts as backup";
+ }
+ enum PRIMARY_AND_BACKUP {
+ description
+ "Next-hop acts as primary and backup simultaneously";
+ }
+ }
+ description "The next-hop role";
+ }
+
+ grouping nhlfe-simple-contents {
+ description
+ "MPLS simple NHLFE contents";
+ list remote-labels {
+ key "index";
+ description "Remote label list";
+ leaf index {
+ type uint8 {
+ range "0..255";
+ }
+ description
+ "Index of the label. Index 0 indicates
+ top of the label stack";
+ }
+ leaf label {
+ type rt-types:mpls-label;
+ description
+ "The outgoing MPLS labels to impose";
+ }
+ }
+ }
+
+ grouping nhlfe-contents {
+ description
+ "MPLS NHLFE contents";
+ leaf index {
+ type string;
+ description
+ "A user-specified identifier utilised to uniquely
+ reference the next-hop entry in the next-hop list.
+ The value of this index has no semantic meaning
+ other than for referencing the entry.";
+ }
+
+ leaf backup-index {
+ type string;
+ description
+ "A user-specified identifier utilised to uniquely
+ reference the backup next-hop entry in the NHLFE list.
+ The value of this index has no semantic meaning
+ other than for referencing the entry.";
+ }
+
+ leaf loadshare {
+ type uint16;
+ description
+ "This value is used to compute a loadshare to perform un-equal
+ load balancing when multiple outgoing next-hop(s) are
+ specified. A share is computed as a ratio of this number to the
+ total under all next-hops(s).";
+ }
+
+ leaf role {
+ type nhlfe-role;
+ description "NHLFE role";
+ }
+ uses nhlfe-simple-contents;
+ }
+
+ grouping interface-mpls_config {
+ description "MPLS interface contents grouping";
+ leaf enabled {
+ type boolean;
+ description
+ "'true' if mpls encapsulation is enabled on the
+ interface. 'false' if mpls encapsulation is enabled
+ on the interface.";
+ }
+ leaf mtu {
+ type uint32;
+ description
+ "MPLS Maximum Transmission Unit (MTU)";
+ }
+ }
+
+ grouping interfaces-mpls {
+ description "List of MPLS interfaces";
+ list interface {
+ key "name";
+ description "List of MPLS interfaces";
+ leaf name {
+ type if:interface-ref;
+ description
+ "The name of a configured MPLS interface";
+ }
+ container config {
+ description "Holds intended configuration";
+ uses interface-mpls_config;
+ }
+ container state {
+ config false;
+ description "Holds inuse configuration";
+ uses interface-mpls_config;
+ }
+ }
+ }
+
+ grouping label-block_config {
+ description "Label-block configuration items";
+ leaf index {
+ type string;
+ description
+ "A user-specified identifier utilised to uniquely
+ reference the next-hop entry in the next-hop list.
+ The value of this index has no semantic meaning
+ other than for referencing the entry.";
+ }
+ leaf start-label {
+ type rt-types:mpls-label;
+ description "Label-block start";
+ }
+ leaf end-label {
+ type rt-types:mpls-label;
+ description "Label-block end";
+ }
+ leaf block-allocation-mode {
+ type identityref {
+ base label-block-alloc-mode;
+ }
+ description "Label-block allocation mode";
+ }
+ }
+
+ grouping label-block_state {
+ description "Label-block state items";
+ leaf free-labels-count {
+ when
+ "../block-allocation-mode = 'label-block-alloc-mode-manager'";
+ type uint32;
+ description "Label-block free labels count";
+ }
+ leaf inuse-labels-count {
+ when
+ "../block-allocation-mode = 'label-block-alloc-mode-manager'";
+ type uint32;
+ description "Label-block inuse labels count";
+ }
+ }
+
+ grouping globals_config {
+ description "MPLS global configuration leafs grouping";
+ leaf ttl-propagate {
+ type boolean;
+ default 'true';
+ description "Propagate TTL between IP and MPLS";
+ }
+ }
+
+ grouping globals {
+ description "MPLS global configuration grouping";
+ container config {
+ description "Holds intended configuration";
+ uses globals_config;
+ }
+ container state {
+ config false;
+ description "Holds inuse configuration";
+ uses globals_config;
+ }
+ }
+ grouping label-blocks {
+ description "Label-block allocation grouping";
+ container label-blocks {
+ description "Label-block allocation container";
+ list label-block {
+ must "start-label >= end-label" {
+ error-message "start-label can not be less than end-label";
+ }
+ key index;
+ unique "start-label end-label";
+ leaf index {
+ type leafref {
+ path "../config/index";
+ }
+ description "Label-block index";
+ }
+ leaf start-label {
+ type leafref {
+ path "../config/start-label";
+ }
+ description
+ "Label-block start label reference";
+ }
+ leaf end-label {
+ type leafref {
+ path "../config/end-label";
+ }
+ description
+ "Label-block end label reference";
+ }
+ description "List of MPLS label-blocks";
+ container config {
+ description "Holds intended configuration";
+ uses label-block_config;
+ }
+ container state {
+ config false;
+ description "Holds inuse configuration";
+ uses label-block_config;
+ uses label-block_state;
+ }
+ }
+ }
+ }
+
+ augment "/rt:routing" {
+ description "MPLS augmentation.";
+ container mpls {
+ description
+ "MPLS container, to be used as an augmentation target node
+ other MPLS sub-features config, e.g. MPLS static LSP, MPLS
+ LDP LSPs, and Trafic Engineering MPLS LSP Tunnels, etc.";
+ uses globals;
+ uses label-blocks;
+ uses interfaces-mpls;
+ }
+ }
+
+ /* State data */
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
+ description
+ "This leaf augments an IPv4 unicast route.";
+ leaf local-label {
+ type rt-types:mpls-label;
+ description
+ "MPLS local label.";
+ }
+ }
+/*
+ TODO: we use older routing model which does not define next-hop container under route.
+ Uncomment following augmentation after HC2VPP-253 is resolved.
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
+ + "rt:next-hop/rt:next-hop-options/rt:simple-next-hop" {
+ description
+ "Augment 'simple-next-hop' case in IPv4 unicast routes.";
+ uses nhlfe-simple-contents;
+ }
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
+ + "rt:next-hop/rt:next-hop-options/rt:next-hop-list/"
+ + "rt:next-hop-list/rt:next-hop" {
+ description
+ "This leaf augments the 'next-hop-list' case of IPv4 unicast
+ routes.";
+ uses nhlfe-contents;
+ }
+
+ */
+
+/*
+ TODO(HC2VPP-253): we use older routing model which does not define active-route
+ as action but as an RPC.
+ Even after bump to ietf-routing@2016-08-18, we would fail due to
+ https://jira.opendaylight.org/browse/YANGTOOLS-822
+
+ augment
+ "/rt:routing-state/rt:ribs/rt:rib/rt:active-route/rt:input" {
+ description
+ "This augment adds the input parameter of the 'active-route'
+ action.";
+ uses nhlfe-contents;
+ }
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:active-route/"
+ + "rt:output/rt:route" {
+ description
+ "This augment adds the destination prefix to the reply of the
+ 'active-route' action.";
+ uses nhlfe-contents;
+ }
+*/
+}
diff --git a/mpls/api/src/main/yang/hc2vpp-ietf-routing-types@2017-02-27.yang b/mpls/api/src/main/yang/hc2vpp-ietf-routing-types@2017-02-27.yang
new file mode 100644
index 000000000..b39357ae2
--- /dev/null
+++ b/mpls/api/src/main/yang/hc2vpp-ietf-routing-types@2017-02-27.yang
@@ -0,0 +1,723 @@
+module hc2vpp-ietf-routing-types {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types";
+ prefix "rt-types";
+
+ import ietf-yang-types {
+ prefix "yang";
+ }
+
+ import ietf-inet-types {
+ prefix "inet";
+ }
+
+ organization "IETF Routing Area Working Group (rtgwg)";
+
+ contact
+ "Routing Area Working Group - <rtgwg@ietf.org>";
+
+ description
+ "This module contains a collection of YANG data types
+ considered generally useful for routing protocols.";
+
+ revision 2017-02-27 {
+ description
+ "Initial revision.";
+ reference
+ "RFC TBD: Routing YANG Data Types";
+ }
+
+ /*** collection of types related to routing ***/
+ typedef router-id {
+ type yang:dotted-quad;
+ description
+ "A 32-bit number in the dotted quad format assigned to each
+ router. This number uniquely identifies the router within an
+ Autonomous System.";
+ }
+
+ // address-family
+ identity address-family {
+ description
+ "Base identity from which identities describing address
+ families are derived.";
+ }
+
+ identity ipv4 {
+ base address-family;
+ description
+ "This identity represents IPv4 address family.";
+ }
+
+ identity ipv6 {
+ base address-family;
+ description
+ "This identity represents IPv6 address family.";
+ }
+
+ //The rest of the values deinfed in the IANA registry
+
+ identity nsap {
+ base address-family;
+ description
+ "Address family from IANA registry.";
+ }
+ identity hdlc {
+ base address-family;
+ description
+ "(8-bit multidrop)
+ Address family from IANA registry.";
+ }
+ identity bbn1822 {
+ base address-family;
+ description
+ "AHIP (BBN report #1822)
+ Address family from IANA registry.";
+ }
+ identity ieee802 {
+ base address-family;
+ description
+ "(includes all 802 media plus Ethernet canonical format)
+ Address family from IANA registry.";
+ }
+ identity e163 {
+ base address-family;
+ description
+ "Address family from IANA registry.";
+ }
+ identity e164 {
+ base address-family;
+ description
+ "SMDS, Frame Relay, ATM
+ Address family from IANA registry.";
+ }
+ identity f69 {
+ base address-family;
+ description
+ "(Telex)
+ Address family from IANA registry.";
+ }
+ identity x121 {
+ base address-family;
+ description
+ "(X.25, Frame Relay)
+ Address family from IANA registry.";
+ }
+ identity ipx {
+ base address-family;
+ description
+ "Address family from IANA registry.";
+ }
+ identity appletalk {
+ base address-family;
+ description
+ "Address family from IANA registry.";
+ }
+ identity decnet-iv {
+ base address-family;
+ description
+ "Decnet IV
+ Address family from IANA registry.";
+ }
+ identity vines {
+ base address-family;
+ description
+ "Banyan Vines
+ Address family from IANA registry.";
+ }
+ identity e164-nsap {
+ base address-family;
+ description
+ "E.164 with NSAP format subaddress
+ Address family from IANA registry.";
+ }
+ identity dns {
+ base address-family;
+ description
+ "Domain Name System
+ Address family from IANA registry.";
+ }
+ identity dn {
+ base address-family;
+ description
+ "Distinguished Name
+ Address family from IANA registry.";
+ }
+ identity as-num {
+ base address-family;
+ description
+ "AS Number
+ Address family from IANA registry.";
+ }
+ identity xtp-v4 {
+ base address-family;
+ description
+ "XTP over IPv4
+ Address family from IANA registry.";
+ }
+ identity xtp-v6 {
+ base address-family;
+ description
+ "XTP over IPv6
+ Address family from IANA registry.";
+ }
+ identity xtp {
+ base address-family;
+ description
+ "XTP native mode XTP
+ Address family from IANA registry.";
+ }
+ identity fc-port {
+ base address-family;
+ description
+ "Fibre Channel World-Wide Port Name
+ Address family from IANA registry.";
+ }
+ identity fc-node {
+ base address-family;
+ description
+ "Fibre Channel World-Wide Node Name
+ Address family from IANA registry.";
+ }
+ identity gwid {
+ base address-family;
+ description
+ "Address family from IANA registry.";
+ }
+ identity l2vpn {
+ base address-family;
+ description
+ "Address family from IANA registry.";
+ }
+ identity mpls-tp-section-eid {
+ base address-family;
+ description
+ "MPLS-TP Section Endpoint Identifier
+ Address family from IANA registry.";
+ }
+ identity mpls-tp-lsp-eid {
+ base address-family;
+ description
+ "MPLS-TP LSP Endpoint Identifier
+ Address family from IANA registry.";
+ }
+ identity mpls-tp-pwe-eid {
+ base address-family;
+ description
+ "MPLS-TP Pseudowire Endpoint Identifier
+ Address family from IANA registry.";
+ }
+ identity mt-v4 {
+ base address-family;
+ description
+ "Multi-Topology IPv4.
+ Address family from IANA registry.";
+ }
+ identity mt-v6 {
+ base address-family;
+ description
+ "Multi-Topology IPv6.
+ Address family from IANA registry.";
+ }
+
+ /*** collection of types related to VPN ***/
+ typedef route-target {
+ type string {
+ pattern
+ '(0:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
+ + '[0-5]?\d{0,3}\d):(429496729[0-5]|42949672[0-8]\d|'
+ + '4294967[01]\d{2}|429496[0-6]\d{3}|42949[0-5]\d{4}|'
+ + '4294[0-8]\d{5}|429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|'
+ + '[0-3]?\d{0,8}\d))|'
+ + '(1:(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|'
+ + '1\d{2}|2[0-4]\d|25[0-5])):(6553[0-5]|655[0-2]\d|'
+ + '65[0-4]\d{2}|6[0-4]\d{3}|[0-5]?\d{0,3}\d))|'
+ + '(2:(429496729[0-5]|42949672[0-8]\d|4294967[01]\d{2}|'
+ + '429496[0-6]\d{3}|42949[0-5]\d{4}|4294[0-8]\d{5}|'
+ + '429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|[0-3]?\d{0,8}\d):'
+ + '(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
+ + '[0-5]?\d{0,3}\d))';
+ }
+ description
+ "A route target is an 8-octet BGP extended community
+ initially identifying a set of sites in a BGP
+ VPN (RFC 4364). However, it has since taken on a more
+ general role in BGP route filtering.
+ A route target consists of three fields:
+ a 2-octet type field, an administrator field,
+ and an assigned number field.
+ According to the data formats for type 0, 1, and 2 defined in
+ RFC4360 and RFC5668, the encoding pattern is defined as:
+
+ 0:2-octet-asn:4-octet-number
+ 1:4-octet-ipv4addr:2-octet-number
+ 2:4-octet-asn:2-octet-number.
+
+ Some valid examples are: 0:100:100, 1:1.1.1.1:100, and
+ 2:1234567890:203.";
+ reference
+ "RFC4360: BGP Extended Communities Attribute.
+ RFC5668: 4-Octet AS Specific BGP Extended Community.";
+ }
+
+ typedef route-target-type {
+ type enumeration {
+ enum "import" {
+ value "0";
+ description
+ "The route target applies to route import.";
+ }
+ enum "export" {
+ value "1";
+ description
+ "The route target applies to route export.";
+ }
+ enum "both" {
+ value "2";
+ description
+ "The route target applies to both route import and
+ route export.";
+ }
+ }
+ description
+ "Indicates the role a route target takes
+ in route filtering.";
+ reference
+ "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
+ }
+
+ typedef route-distinguisher {
+ type string {
+ pattern
+ '(0:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
+ + '[0-5]?\d{0,3}\d):(429496729[0-5]|42949672[0-8]\d|'
+ + '4294967[01]\d{2}|429496[0-6]\d{3}|42949[0-5]\d{4}|'
+ + '4294[0-8]\d{5}|429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|'
+ + '[0-3]?\d{0,8}\d))|'
+ + '(1:(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|'
+ + '1\d{2}|2[0-4]\d|25[0-5])):(6553[0-5]|655[0-2]\d|'
+ + '65[0-4]\d{2}|6[0-4]\d{3}|[0-5]?\d{0,3}\d))|'
+ + '(2:(429496729[0-5]|42949672[0-8]\d|4294967[01]\d{2}|'
+ + '429496[0-6]\d{3}|42949[0-5]\d{4}|4294[0-8]\d{5}|'
+ + '429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|[0-3]?\d{0,8}\d):'
+ + '(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
+ + '[0-5]?\d{0,3}\d))|'
+ + '(([3-9a-fA-F]|[1-9a-fA-F][\da-fA-F]{1,3}):'
+ + '[\da-fA-F]{1,12})';
+ }
+ description
+ "A route distinguisher is an 8-octet value used to distinguish
+ routes from different BGP VPNs (RFC 4364). A route
+ distinguisher consists of three fields: A 2-octet type field,
+ an administrator field, and an assigned number field.
+ According to the data formats for type 0, 1, and 2 defined in
+ RFC4364, the encoding pattern is defined as:
+
+ 0:2-octet-asn:4-octet-number
+ 1:4-octet-ipv4addr:2-octet-number
+ 2:4-octet-asn:2-octet-number.
+ 2-octet-other-hex-number:6-octet-hex-number
+
+ Some valid examples are: 0:100:100, 1:1.1.1.1:100, and
+ 2:1234567890:203.";
+ reference
+ "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
+ }
+
+ /*** collection of types common to multicast ***/
+ typedef ipv4-multicast-group-address {
+ type inet:ipv4-address {
+ pattern '(2((2[4-9])|(3[0-9]))\.).*';
+ }
+ description
+ "This type represents an IPv4 multicast group address,
+ which is in the range from 224.0.0.0 to 239.255.255.255.";
+ reference
+ "RFC1112: Host Extensions for IP Multicasting.";
+ }
+
+ typedef ipv6-multicast-group-address {
+ type inet:ipv6-address {
+ pattern
+ '(([fF]{2}[0-9a-fA-F]{2}):).*';
+ }
+ description
+ "This type represents an IPv6 multicast group address,
+ which is in the range of FF00::/8.";
+ reference
+ "RFC4291: IP Version 6 Addressing Architecture. Sec 2.7.
+ RFC7346: IPv6 Multicast Address Scopes.";
+ }
+
+ typedef ip-multicast-group-address {
+ type union {
+ type ipv4-multicast-group-address;
+ type ipv6-multicast-group-address;
+ }
+ description
+ "This type represents an IP multicast group address and is IP
+ version neutral. The format of the textual representation
+ implies the IP version.";
+ }
+
+ typedef ipv4-multicast-source-address {
+ type union {
+ type enumeration {
+ enum 'any' {
+ /*
+ ODL does not support * as enum name (how it should be named to java identifier?)
+ enum '*' {
+ */
+ description
+ "Any source address.";
+ }
+ }
+ type inet:ipv4-address;
+ }
+ description
+ "Multicast source IPv4 address type.";
+ }
+
+ typedef ipv6-multicast-source-address {
+ type union {
+ type enumeration {
+ enum 'any' {
+ /*
+ ODL does not support * as enum name (how it should be named to java identifier?)
+ enum '*' {
+ */
+ description
+ "Any source address.";
+ }
+ }
+ type inet:ipv6-address;
+ }
+ description
+ "Multicast source IPv6 address type.";
+ }
+
+ /*** collection of types common to protocols ***/
+ typedef bandwidth-ieee-float32 {
+ type string {
+ pattern
+ '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
+ + '1(\.([\da-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
+ + '1[01]\d|0?\d?\d)?)';
+ }
+ description
+ "Bandwidth in IEEE 754 floating point 32-bit binary format:
+ (-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
+ where Exponent uses 8 bits, and Fraction uses 23 bits.
+ The units are octets per second.
+ The encoding format is the external hexadecimal-significand
+ character sequences specified in IEEE 754 and C99,
+ restricted to be normalized, non-negative, and non-fraction:
+ 0x1.hhhhhhp{+}d or 0X1.HHHHHHP{+}D
+ where 'h' and 'H' are hexadecimal digits, 'd' and 'D' are
+ integers in the range of [0..127].
+ When six hexadecimal digits are used for 'hhhhhh' or 'HHHHHH',
+ the least significant digit must be an even number.
+ 'x' and 'X' indicate hexadecimal; 'p' and 'P' indicate power
+ of two.
+ Some examples are: 0x0p0, 0x1p10, and 0x1.abcde2p+20";
+ reference
+ "IEEE Std 754-2008: IEEE Standard for Floating-Point
+ Arithmetic.";
+ }
+
+ typedef link-access-type {
+ type enumeration {
+ enum "broadcast" {
+ description
+ "Specify broadcast multi-access network.";
+ }
+ enum "non-broadcast-multiaccess" {
+ description
+ "Specify Non-Broadcast Multi-Access (NBMA) network.";
+ }
+ enum "point-to-multipoint" {
+ description
+ "Specify point-to-multipoint network.";
+ }
+ enum "point-to-point" {
+ description
+ "Specify point-to-point network.";
+ }
+ }
+ description
+ "Link access type.";
+ }
+
+ typedef timer-multiplier {
+ type uint8;
+ description
+ "The number of timer value intervals that should be
+ interpreted as a failure.";
+ }
+
+ typedef timer-value-seconds16 {
+ type union {
+ type uint16 {
+ range "1..65535";
+ }
+ type enumeration {
+ enum "infinity" {
+ description "The timer is set to infinity.";
+ }
+ enum "not-set" {
+ description "The timer is not set.";
+ }
+ }
+ }
+ units seconds;
+ description "Timer value type, in seconds (16 bit range).";
+ }
+
+ typedef timer-value-seconds32 {
+ type union {
+ type uint32 {
+ range "1..4294967295";
+ }
+ type enumeration {
+ enum "infinity" {
+ description "The timer is set to infinity.";
+ }
+ enum "not-set" {
+ description "The timer is not set.";
+ }
+ }
+ }
+ units seconds;
+ description "Timer value type, in seconds (32 bit range).";
+ }
+
+ typedef timer-value-milliseconds {
+ type union {
+ type uint32{
+ range "1..4294967295";
+ }
+ type enumeration {
+ enum "infinity" {
+ description "The timer is set to infinity.";
+ }
+ enum "not-set" {
+ description "The timer is not set.";
+ }
+ }
+ }
+ units milliseconds;
+ description "Timer value type, in milliseconds.";
+ }
+
+ /*** collection of types related to MPLS/GMPLS ***/
+ typedef generalized-label {
+ type binary;
+ description
+ "Generalized label. Nodes sending and receiving the
+ Generalized Label know the kinds of link they are
+ using. Hence, the Generalized Label does not identify
+ its type. Instead, nodes are expected to know from
+ the context and type of label to expect.";
+ reference "RFC3471: Section 3.2";
+ }
+
+ identity mpls-label-special-purpose-value {
+ description
+ "Base identity for deriving identities describing
+ special-purpose Multiprotocol Label Switching (MPLS) label
+ values.";
+ reference
+ "RFC7274: Allocating and Retiring Special-Purpose MPLS
+ Labels.";
+ }
+
+ identity ipv4-explicit-null-label {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the IPv4 Explicit NULL Label.";
+ reference
+ "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
+ }
+
+ identity router-alert-label {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the Router Alert Label.";
+ reference
+ "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
+ }
+
+ identity ipv6-explicit-null-label {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the IPv6 Explicit NULL Label.";
+ reference
+ "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
+ }
+
+ identity implicit-null-label {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the Implicit NULL Label.";
+ reference
+ "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
+ }
+
+ identity entropy-label-indicator {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the Entropy Label Indicator.";
+ reference
+ "RFC6790: The Use of Entropy Labels in MPLS Forwarding.
+ Sections 3 and 10.1.";
+ }
+
+ identity gal-label {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the Generic Associated Channel Label
+ (GAL).";
+ reference
+ "RFC5586: MPLS Generic Associated Channel.
+ Sections 4 and 10.";
+ }
+
+ identity oam-alert-label {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the OAM Alert Label.";
+ reference
+ "RFC3429: Assignment of the 'OAM Alert Label' for Multiprotocol
+ Label Switching Architecture (MPLS) Operation and Maintenance
+ (OAM) Functions.
+ Sections 3 and 6.";
+ }
+
+ identity extension-label {
+ base mpls-label-special-purpose-value;
+ description
+ "This identity represents the Extension Label.";
+ reference
+ "RFC7274: Allocating and Retiring Special-Purpose MPLS Labels.
+ Sections 3.1 and 5.";
+ }
+
+ typedef mpls-label-special-purpose {
+ type identityref {
+ base mpls-label-special-purpose-value;
+ }
+ description
+ "This type represents the special-purpose Multiprotocol Label
+ Switching (MPLS) label values.";
+ reference
+ "RFC3032: MPLS Label Stack Encoding.
+ RFC7274: Allocating and Retiring Special-Purpose MPLS
+ Labels.";
+ }
+
+ typedef mpls-label-general-use {
+ type uint32 {
+ range "16..1048575";
+ }
+ description
+ "The 20 bits label values in an MPLS label stack entry,
+ specified in RFC3032. This label value does not include
+ the encodings of Traffic Class and TTL (time to live).
+ The label range specified by this type is for general use,
+ with special-purpose MPLS label values excluded.";
+ reference
+ "RFC3032: MPLS Label Stack Encoding.";
+ }
+
+
+ typedef mpls-label {
+/*
+TODO: binding generator creates invalid type bindings, so we changed type to uint32.
+Change back after https://jira.opendaylight.org/browse/MDSAL-269 is resolved.
+ type union {
+ type mpls-label-special-purpose;
+ type mpls-label-general-use;
+ }
+*/
+ type mpls-label-general-use;
+ description
+ "The 20 bits label values in an MPLS label stack entry,
+ specified in RFC3032. This label value does not include
+ the encodings of Traffic Class and TTL (time to live).";
+ reference
+ "RFC3032: MPLS Label Stack Encoding.";
+ }
+
+ /*
+ * Groupings
+ */
+ grouping mpls-label-stack {
+ description
+ "A grouping that specifies an MPLS label stack.";
+ container mpls-label-stack {
+ description
+ "Container for a list of MPLS label stack entries.";
+ list entry {
+ key "id";
+ description
+ "List of MPLS label stack entries.";
+ leaf id {
+ type uint8;
+ description
+ "Identifies the sequence of an MPLS label stack entries.
+ An entry with smaller ID value is precedes an entry in
+ the label stack with a smaller ID.";
+ }
+ leaf label {
+ type rt-types:mpls-label;
+ description
+ "Label value.";
+ }
+ leaf ttl {
+ type uint8;
+ description
+ "Time to Live (TTL).";
+ reference
+ "RFC3032: MPLS Label Stack Encoding.";
+ }
+ leaf traffic-class {
+ type uint8 {
+ range "0..7";
+ }
+ description
+ "Traffic Class (TC).";
+ reference
+ "RFC5462: Multiprotocol Label Switching (MPLS) Label
+ Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
+ Field.";
+ }
+ }
+ }
+ } // mpls-label-stack
+
+ grouping vpn-route-targets {
+ description
+ "A grouping that specifies Route Target import-export rules
+ used in the BGP enabled Virtual Private Networks (VPNs).";
+ reference
+ "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).
+ RFC4664: Framework for Layer 2 Virtual Private Networks
+ (L2VPNs)";
+ list vpn-target {
+ key route-target;
+ description
+ "List of Route Targets.";
+ leaf route-target {
+ type rt-types:route-target;
+ description
+ "Route Target value";
+ }
+ leaf route-target-type {
+ type rt-types:route-target-type;
+ mandatory true;
+ description
+ "Import/export type of the Route Target.";
+ }
+ }
+ } // vpn-route-targets
+}