summaryrefslogtreecommitdiffstats
path: root/routing
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-11-10 09:48:40 +0100
committerMaros Marsalek <mmarsale@cisco.com>2016-11-10 09:11:50 +0000
commitaa7e652e6105a6972d6c41ff0738cd9e31ce0188 (patch)
tree14e5247b9a702723ff10177677078f232213f75c /routing
parentbe5cfe7728f780e08aa466d69259d8f1e3a45be3 (diff)
HONEYCOMB-58 - Routing Api
Change-Id: Id887c12bea1983c0d185689c633902b691cf52f6 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'routing')
-rw-r--r--routing/asciidoc/Readme.adoc3
-rw-r--r--routing/pom.xml60
-rw-r--r--routing/routing-api/asciidoc/Readme.adoc8
-rw-r--r--routing/routing-api/pom.xml70
-rw-r--r--routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang421
-rw-r--r--routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang822
-rw-r--r--routing/routing-api/src/main/yang/ietf-routing.yang1030
-rw-r--r--routing/routing-api/src/main/yang/vpp-routing.yang59
8 files changed, 2473 insertions, 0 deletions
diff --git a/routing/asciidoc/Readme.adoc b/routing/asciidoc/Readme.adoc
new file mode 100644
index 000000000..2add06ff4
--- /dev/null
+++ b/routing/asciidoc/Readme.adoc
@@ -0,0 +1,3 @@
+= routing-aggregator
+
+Overview of routing-aggregator \ No newline at end of file
diff --git a/routing/pom.xml b/routing/pom.xml
new file mode 100644
index 000000000..e947d457e
--- /dev/null
+++ b/routing/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 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">
+
+ <parent>
+ <groupId>io.fd.honeycomb.common</groupId>
+ <artifactId>honeycomb-parent</artifactId>
+ <version>1.16.12-SNAPSHOT</version>
+ <relativePath>../common/honeycomb-parent</relativePath>
+ </parent>
+
+ <groupId>io.fd.honeycomb.routing</groupId>
+ <artifactId>routing-aggregator</artifactId>
+ <version>1.16.12-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <packaging>pom</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <description>Aggregator for Honeycomb Routing plugin</description>
+
+ <modules>
+ <module>routing-api</module>
+ </modules>
+
+ <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/routing/routing-api/asciidoc/Readme.adoc b/routing/routing-api/asciidoc/Readme.adoc
new file mode 100644
index 000000000..af09b9fa7
--- /dev/null
+++ b/routing/routing-api/asciidoc/Readme.adoc
@@ -0,0 +1,8 @@
+= routing-api
+
+Contains 4 models
+
+- *ietf-routing* - Common model for routing
+- *ietf-ipv4-unicast-routing* - Ipv4 address family specific routing
+- *ietf-ipv6-unicast-routing* - Ipv6 address family specific routing
+- *vpp-routing* - Vpp specific attributes necessary to map routes
diff --git a/routing/routing-api/pom.xml b/routing/routing-api/pom.xml
new file mode 100644
index 000000000..92c8824d7
--- /dev/null
+++ b/routing/routing-api/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 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">
+ <parent>
+ <groupId>io.fd.honeycomb.common</groupId>
+ <artifactId>api-parent</artifactId>
+ <version>1.16.12-SNAPSHOT</version>
+ <relativePath>../../common/api-parent</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>io.fd.honeycomb.routing</groupId>
+ <artifactId>routing-api</artifactId>
+ <version>1.16.12-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>mdsal-model-artifacts</artifactId>
+ <version>0.8.2-Beryllium-SR2</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>iana-if-type-2014-05-08</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-yang-types-20130715</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-interfaces</artifactId>
+ </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>yang-ext</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.fd.honeycomb.v3po</groupId>
+ <artifactId>v3po-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang b/routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang
new file mode 100644
index 000000000..ed320fd2d
--- /dev/null
+++ b/routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang
@@ -0,0 +1,421 @@
+module ietf-ipv4-unicast-routing {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-ipv4-unicast-routing";
+
+ prefix "v4ur";
+
+ import ietf-routing {
+ prefix "rt";
+ }
+
+ import ietf-inet-types {
+ prefix "inet";
+ }
+
+ //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
+ import vpp-routing {
+ prefix vpp-r;
+ }
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: Thomas Nadeau
+ <mailto:tnadeau@lucidvision.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Ladislav Lhotka
+ <mailto:lhotka@nic.cz>";
+
+ description
+ "This YANG module augments the 'ietf-routing' module with basic
+ configuration and operational state data for IPv4 unicast
+ routing.
+
+ Copyright (c) 2014 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject to
+ the license terms contained in, the Simplified BSD License set
+ forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC XXXX; see the
+ RFC itself for full legal notices.";
+
+ revision 2014-05-24 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: A YANG Data Model for Routing Management";
+ }
+
+ /* Identities */
+
+ identity ipv4-unicast {
+ base rt:ipv4;
+ description
+ "This identity represents the IPv4 unicast address family.";
+ }
+
+ /* Operational state data */
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
+ when "../../rt:address-family = 'v4ur:ipv4-unicast'" {
+ description
+ "This augment is valid only for IPv4 unicast.";
+ }
+ description
+ "This leaf augments an IPv4 unicast route.";
+ leaf destination-prefix {
+ type inet:ipv4-prefix;
+ description
+ "IPv4 destination prefix.";
+ }
+ }
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
+ + "rt:next-hop-options/rt:simple-next-hop" {
+ when "../../rt:address-family = 'v4ur:ipv4-unicast'" {
+ description
+ "This augment is valid only for IPv4 unicast.";
+ }
+ description
+ "This leaf augments the 'simple-next-hop' case of IPv4 unicast
+ routes.";
+ leaf next-hop {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+ }
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
+ + "rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/"
+ + "rt:next-hop" {
+ when "../../../../rt:address-family = 'v4ur:ipv4-unicast'" {
+ description
+ "This augment is valid only for IPv4 unicast.";
+ }
+ if-feature rt:multipath-routes;
+ description
+ "This leaf augments the 'next-hop-list' case of IPv4 unicast
+ routes.";
+ leaf address {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+ }
+
+ //NODE Added same augmentation for operation state
+ augment "/rt:routing-state/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
+ description
+ "This augment defines the configuration of the 'static'
+ pseudo-protocol with data specific to IPv4 unicast.";
+ container ipv4 {
+ description
+ "Configuration of a 'static' pseudo-protocol instance
+ consists of a list of routes.";
+ list route {
+ key "id";
+ ordered-by "user";
+ description
+ "A user-ordered list of static routes.";
+ leaf id {
+ type uint32 {
+ //WARNING - range changed from 1..max to be mappable on vpp table ids
+ range "0..max";
+ }
+ description
+ "Unique numeric identifier of the route.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of routes in RIBs.";
+ }
+ leaf description {
+ type string;
+ description
+ "Textual description of the route.";
+ }
+ leaf destination-prefix {
+ type inet:ipv4-prefix;
+ mandatory "true";
+ description
+ "IPv4 destination prefix.";
+ }
+ choice next-hop-options {
+ mandatory "true";
+ description
+ "Options for expressing the next-hop in static routes.";
+ case special-next-hop {
+ uses rt:special-next-hop-grouping;
+ }
+ case simple-next-hop {
+ leaf next-hop {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
+ + "rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor routing
+ instance can be given.";
+ }
+ }
+ case next-hop-list {
+ if-feature rt:multipath-routes;
+ container next-hop-list {
+ description
+ "Configuration of multiple next-hops.";
+ list next-hop {
+ key "id";
+ description
+ "An entry of a next-hop list.";
+ leaf id {
+ type uint32;
+ description
+ "Unique numeric identifier of the entry.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of next-hops in RIBs.";
+ }
+ leaf address {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/"
+ + "rt:interface/rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor
+ routing instance can be given.";
+ }
+ uses rt:next-hop-classifiers {
+ refine "priority" {
+ default "primary";
+ }
+ refine "weight" {
+ default "0";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
+ container vpp-ipv4-route-state{
+ uses vpp-r:vpp-routing-state-attributes;
+ }
+ }
+ }
+ }
+
+
+ /* Configuration data */
+
+ augment "/rt:routing/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
+ description
+ "This augment defines the configuration of the 'static'
+ pseudo-protocol with data specific to IPv4 unicast.";
+ container ipv4 {
+ description
+ "Configuration of a 'static' pseudo-protocol instance
+ consists of a list of routes.";
+ list route {
+ key "id";
+ ordered-by "user";
+ description
+ "A user-ordered list of static routes.";
+ leaf id {
+ type uint32 {
+ //WARNING - range changed from 1..max to be mappable on vpp table ids
+ range "0..max";
+ }
+ description
+ "Unique numeric identifier of the route.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of routes in RIBs.";
+ }
+ leaf description {
+ type string;
+ description
+ "Textual description of the route.";
+ }
+ leaf destination-prefix {
+ type inet:ipv4-prefix;
+ mandatory "true";
+ description
+ "IPv4 destination prefix.";
+ }
+ choice next-hop-options {
+ mandatory "true";
+ description
+ "Options for expressing the next-hop in static routes.";
+ case special-next-hop {
+ uses rt:special-next-hop-grouping;
+ }
+ case simple-next-hop {
+ leaf next-hop {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
+ + "rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor routing
+ instance can be given.";
+ }
+ }
+ case next-hop-list {
+ if-feature rt:multipath-routes;
+ container next-hop-list {
+ description
+ "Configuration of multiple next-hops.";
+ list next-hop {
+ key "id";
+ description
+ "An entry of a next-hop list.";
+ leaf id {
+ type uint32;
+ description
+ "Unique numeric identifier of the entry.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of next-hops in RIBs.";
+ }
+ leaf address {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/"
+ + "rt:interface/rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor
+ routing instance can be given.";
+ }
+ uses rt:next-hop-classifiers {
+ refine "priority" {
+ default "primary";
+ }
+ refine "weight" {
+ default "0";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
+ container vpp-ipv4-route{
+ uses vpp-r:vpp-routing-attributes;
+ }
+ }
+ }
+ }
+
+ /* RPC methods */
+
+ augment "/rt:active-route/rt:input/rt:destination-address" {
+ when "rt:address-family='v4ur:ipv4-unicast'" {
+ description
+ "This augment is valid only for IPv4 unicast.";
+ }
+ description
+ "This leaf augments the 'rt:destination-address' parameter of
+ the 'rt:active-route' operation.";
+ leaf address {
+ type inet:ipv4-address;
+ description
+ "IPv4 destination address.";
+ }
+ }
+
+ augment "/rt:active-route/rt:output/rt:route" {
+ when "rt:address-family='v4ur:ipv4-unicast'" {
+ description
+ "This augment is valid only for IPv4 unicast.";
+ }
+ description
+ "This leaf augments the reply to the 'rt:active-route'
+ operation.";
+ leaf destination-prefix {
+ type inet:ipv4-prefix;
+ description
+ "IPv4 destination prefix.";
+ }
+ }
+
+ augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
+ + "rt:simple-next-hop" {
+ when "rt:address-family='v4ur:ipv4-unicast'" {
+ description
+ "This augment is valid only for IPv4 unicast.";
+ }
+ description
+ "This leaf augments the 'simple-next-hop' case in the reply to
+ the 'rt:active-route' operation.";
+ leaf next-hop {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+ }
+
+ augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
+ + "rt:next-hop-list/rt:next-hop-list/rt:next-hop" {
+ when "../../rt:address-family='v4ur:ipv4-unicast'" {
+ description
+ "This augment is valid only for IPv4 unicast.";
+ }
+ if-feature rt:multipath-routes;
+ description
+ "This leaf augments the 'next-hop-list' case in the reply to
+ the 'rt:active-route' operation.";
+ leaf address {
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the next-hop.";
+ }
+ }
+} \ No newline at end of file
diff --git a/routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang b/routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang
new file mode 100644
index 000000000..93de395d6
--- /dev/null
+++ b/routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang
@@ -0,0 +1,822 @@
+module ietf-ipv6-unicast-routing {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-ipv6-unicast-routing";
+
+ prefix "v6ur";
+
+ import ietf-routing {
+ prefix "rt";
+ }
+
+ import ietf-inet-types {
+ prefix "inet";
+ }
+
+ import ietf-interfaces {
+ prefix "if";
+ }
+
+ import ietf-ip {
+ prefix "ip";
+ }
+
+ //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
+ import vpp-routing {
+ prefix vpp-r;
+ }
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: Thomas Nadeau
+ <mailto:tnadeau@lucidvision.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Ladislav Lhotka
+ <mailto:lhotka@nic.cz>";
+
+ description
+ "This YANG module augments the 'ietf-routing' module with basic
+ configuration and operational state data for IPv6 unicast
+ routing.
+
+ Copyright (c) 2014 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject to
+ the license terms contained in, the Simplified BSD License set
+ forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC XXXX; see the
+ RFC itself for full legal notices.";
+
+ revision 2014-05-25 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: A YANG Data Model for Routing Management";
+ }
+
+ /* Identities */
+
+ identity ipv6-unicast {
+ base rt:ipv6;
+ description
+ "This identity represents the IPv6 unicast address family.";
+ }
+
+ /* Operational state data */
+
+ augment "/rt:routing-state/rt:routing-instance/rt:interfaces/"
+ + "rt:interface" {
+ description
+ "IPv6-specific parameters of router interfaces.";
+ container ipv6-router-advertisements {
+ description
+ "Parameters of IPv6 Router Advertisements.";
+ leaf send-advertisements {
+ type boolean;
+ description
+ "A flag indicating whether or not the router sends periodic
+ Router Advertisements and responds to Router
+ Solicitations.";
+ }
+ leaf max-rtr-adv-interval {
+ type uint16 {
+ range "4..1800";
+ }
+ units "seconds";
+ description
+ "The maximum time allowed between sending unsolicited
+ multicast Router Advertisements from the interface.";
+ }
+ leaf min-rtr-adv-interval {
+ type uint16 {
+ range "3..1350";
+ }
+ units "seconds";
+ description
+ "The minimum time allowed between sending unsolicited
+ multicast Router Advertisements from the interface.";
+ }
+ leaf managed-flag {
+ type boolean;
+ description
+ "The value that is placed in the 'Managed address
+ configuration' flag field in the Router Advertisement.";
+ }
+ leaf other-config-flag {
+ type boolean;
+ description
+ "The value that is placed in the 'Other configuration' flag
+ field in the Router Advertisement.";
+ }
+ leaf link-mtu {
+ type uint32;
+ description
+ "The value that is placed in MTU options sent by the
+ router. A value of zero indicates that no MTU options are
+ sent.";
+ }
+ leaf reachable-time {
+ type uint32 {
+ range "0..3600000";
+ }
+ units "milliseconds";
+ description
+ "The value that is placed in the Reachable Time field in
+ the Router Advertisement messages sent by the router. A
+ value of zero means unspecified (by this router).";
+ }
+ leaf retrans-timer {
+ type uint32;
+ units "milliseconds";
+ description
+ "The value that is placed in the Retrans Timer field in the
+ Router Advertisement messages sent by the router. A value
+ of zero means unspecified (by this router).";
+ }
+ leaf cur-hop-limit {
+ type uint8;
+ description
+ "The value that is placed in the Cur Hop Limit field in the
+ Router Advertisement messages sent by the router. A value
+ of zero means unspecified (by this router).";
+ }
+ leaf default-lifetime {
+ type uint16 {
+ range "0..9000";
+ }
+ units "seconds";
+ description
+ "The value that is placed in the Router Lifetime field of
+ Router Advertisements sent from the interface, in seconds.
+ A value of zero indicates that the router is not to be
+ used as a default router.";
+ }
+ container prefix-list {
+ description
+ "A list of prefixes that are placed in Prefix Information
+ options in Router Advertisement messages sent from the
+ interface.
+
+ By default, these are all prefixes that the router
+ advertises via routing protocols as being on-link for the
+ interface from which the advertisement is sent.";
+ list prefix {
+ key "prefix-spec";
+ description
+ "Advertised prefix entry and its parameters.";
+ leaf prefix-spec {
+ type inet:ipv6-prefix;
+ description
+ "IPv6 address prefix.";
+ }
+ leaf valid-lifetime {
+ type uint32;
+ units "seconds";
+ description
+ "The value that is placed in the Valid Lifetime in the
+ Prefix Information option. The designated value of all
+ 1's (0xffffffff) represents infinity.";
+ }
+ leaf on-link-flag {
+ type boolean;
+ description
+ "The value that is placed in the on-link flag ('L-bit')
+ field in the Prefix Information option.";
+ }
+ leaf preferred-lifetime {
+ type uint32;
+ units "seconds";
+ description
+ "The value that is placed in the Preferred Lifetime in
+ the Prefix Information option, in seconds. The
+ designated value of all 1's (0xffffffff) represents
+ infinity.";
+ }
+ leaf autonomous-flag {
+ type boolean;
+ description
+ "The value that is placed in the Autonomous Flag field
+ in the Prefix Information option.";
+ }
+ }
+ }
+ }
+ }
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
+ when "../../rt:address-family = 'v6ur:ipv6-unicast'" {
+ description
+ "This augment is valid only for IPv6 unicast.";
+ }
+ description
+ "This leaf augments an IPv6 unicast route.";
+ leaf destination-prefix {
+ type inet:ipv6-prefix;
+ description
+ "IPv6 destination prefix.";
+ }
+ }
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
+ + "rt:next-hop-options/rt:simple-next-hop" {
+ when "../../rt:address-family = 'v6ur:ipv6-unicast'" {
+ description
+ "This augment is valid only for IPv6 unicast.";
+ }
+ description
+ "This leaf augments the 'simple-next-hop' case of IPv6 unicast
+ routes.";
+ leaf next-hop {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ }
+
+ augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
+ + "rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/"
+ + "rt:next-hop" {
+ when "../../../../rt:address-family = 'v6ur:ipv6-unicast'" {
+ description
+ "This augment is valid only for IPv6 unicast.";
+ }
+ if-feature rt:multipath-routes;
+ description
+ "This leaf augments the 'next-hop-list' case of IPv6 unicast
+ routes.";
+ leaf address {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ }
+
+ /* Configuration data */
+
+ augment
+ "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface" {
+ when "/if:interfaces/if:interface[if:name=current()/rt:name]/"
+ + "ip:ipv6/ip:enabled='true'" {
+ description
+ "This augment is only valid for router interfaces with
+ enabled IPv6.";
+ }
+ description
+ "Configuration of IPv6-specific parameters of router
+ interfaces.";
+ container ipv6-router-advertisements {
+ description
+ "Configuration of IPv6 Router Advertisements.";
+ leaf send-advertisements {
+ type boolean;
+ default "false";
+ description
+ "A flag indicating whether or not the router sends periodic
+ Router Advertisements and responds to Router
+ Solicitations.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvSendAdvertisements.";
+ }
+ leaf max-rtr-adv-interval {
+ type uint16 {
+ range "4..1800";
+ }
+ units "seconds";
+ default "600";
+ description
+ "The maximum time allowed between sending unsolicited
+ multicast Router Advertisements from the interface.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ MaxRtrAdvInterval.";
+ }
+ leaf min-rtr-adv-interval {
+ type uint16 {
+ range "3..1350";
+ }
+ units "seconds";
+ must ". <= 0.75 * ../max-rtr-adv-interval" {
+ description
+ "The value MUST NOT be greater than 75 % of
+ 'max-rtr-adv-interval'.";
+ }
+ description
+ "The minimum time allowed between sending unsolicited
+ multicast Router Advertisements from the interface.
+
+ The default value to be used operationally if this leaf is
+ not configured is determined as follows:
+
+ - if max-rtr-adv-interval >= 9 seconds, the default value
+ is 0.33 * max-rtr-adv-interval;
+
+ - otherwise it is 0.75 * max-rtr-adv-interval.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ MinRtrAdvInterval.";
+ }
+ leaf managed-flag {
+ type boolean;
+ default "false";
+ description
+ "The value to be placed in the 'Managed address
+ configuration' flag field in the Router Advertisement.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvManagedFlag.";
+ }
+ leaf other-config-flag {
+ type boolean;
+ default "false";
+ description
+ "The value to be placed in the 'Other configuration' flag
+ field in the Router Advertisement.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvOtherConfigFlag.";
+ }
+ leaf link-mtu {
+ type uint32;
+ default "0";
+ description
+ "The value to be placed in MTU options sent by the router.
+ A value of zero indicates that no MTU options are sent.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvLinkMTU.";
+ }
+ leaf reachable-time {
+ type uint32 {
+ range "0..3600000";
+ }
+ units "milliseconds";
+ default "0";
+ description
+ "The value to be placed in the Reachable Time field in the
+ Router Advertisement messages sent by the router. A value
+ of zero means unspecified (by this router).";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvReachableTime.";
+ }
+ leaf retrans-timer {
+ type uint32;
+ units "milliseconds";
+ default "0";
+ description
+ "The value to be placed in the Retrans Timer field in the
+ Router Advertisement messages sent by the router. A value
+ of zero means unspecified (by this router).";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvRetransTimer.";
+ }
+ leaf cur-hop-limit {
+ type uint8;
+ description
+ "The value to be placed in the Cur Hop Limit field in the
+ Router Advertisement messages sent by the router. A value
+ of zero means unspecified (by this router).
+
+ If this parameter is not configured, the device SHOULD use
+ the value specified in IANA Assigned Numbers that was in
+ effect at the time of implementation.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvCurHopLimit.
+
+ IANA: IP Parameters,
+ http://www.iana.org/assignments/ip-parameters";
+ }
+ leaf default-lifetime {
+ type uint16 {
+ range "0..9000";
+ }
+ units "seconds";
+ description
+ "The value to be placed in the Router Lifetime field of
+ Router Advertisements sent from the interface, in seconds.
+ It MUST be either zero or between max-rtr-adv-interval and
+ 9000 seconds. A value of zero indicates that the router is
+ not to be used as a default router. These limits may be
+ overridden by specific documents that describe how IPv6
+ operates over different link layers.
+
+ If this parameter is not configured, the device SHOULD use
+ a value of 3 * max-rtr-adv-interval.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvDefaultLifeTime.";
+ }
+ container prefix-list {
+ description
+ "Configuration of prefixes to be placed in Prefix
+ Information options in Router Advertisement messages sent
+ from the interface.
+
+ Prefixes that are advertised by default but do not have
+ their entries in the child 'prefix' list are advertised
+ with the default values of all parameters.
+
+ The link-local prefix SHOULD NOT be included in the list
+ of advertised prefixes.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
+ AdvPrefixList.";
+ list prefix {
+ key "prefix-spec";
+ description
+ "Configuration of an advertised prefix entry.";
+ leaf prefix-spec {
+ type inet:ipv6-prefix;
+ description
+ "IPv6 address prefix.";
+ }
+ choice control-adv-prefixes {
+ default "advertise";
+ description
+ "The prefix either may be explicitly removed from the
+ set of advertised prefixes, or parameters with which
+ it is advertised may be specified (default case).";
+ leaf no-advertise {
+ type empty;
+ description
+ "The prefix will not be advertised.
+
+ This can be used for removing the prefix from the
+ default set of advertised prefixes.";
+ }
+ case advertise {
+ leaf valid-lifetime {
+ type uint32;
+ units "seconds";
+ default "2592000";
+ description
+ "The value to be placed in the Valid Lifetime in
+ the Prefix Information option. The designated
+ value of all 1's (0xffffffff) represents
+ infinity.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6
+ (IPv6) - AdvValidLifetime.";
+ }
+ leaf on-link-flag {
+ type boolean;
+ default "true";
+ description
+ "The value to be placed in the on-link flag
+ ('L-bit') field in the Prefix Information
+ option.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6
+ (IPv6) - AdvOnLinkFlag.";
+ }
+ leaf preferred-lifetime {
+ type uint32;
+ units "seconds";
+ must ". <= ../valid-lifetime" {
+ description
+ "This value MUST NOT be greater than
+ valid-lifetime.";
+ }
+ default "604800";
+ description
+ "The value to be placed in the Preferred Lifetime
+ in the Prefix Information option. The designated
+ value of all 1's (0xffffffff) represents
+ infinity.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6
+ (IPv6) - AdvPreferredLifetime.";
+ }
+ leaf autonomous-flag {
+ type boolean;
+ default "true";
+ description
+ "The value to be placed in the Autonomous Flag
+ field in the Prefix Information option.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6
+ (IPv6) - AdvAutonomousFlag.";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //NOTE - added same augmentation for operational state
+
+ augment "/rt:routing-state/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
+ description
+ "This augment defines the configuration of the 'static'
+ pseudo-protocol with data specific to IPv6 unicast.";
+ container ipv6 {
+ description
+ "Configuration of a 'static' pseudo-protocol instance
+ consists of a list of routes.";
+ list route {
+ key "id";
+ ordered-by "user";
+ description
+ "A user-ordered list of static routes.";
+ leaf id {
+ type uint32 {
+ //WARNING - range changed from 1..max to be mappable on vpp table ids
+ range "0..max";
+ }
+ description
+ "Unique numeric identifier of the route.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of routes in RIBs.";
+ }
+ leaf description {
+ type string;
+ description
+ "Textual description of the route.";
+ }
+ leaf destination-prefix {
+ type inet:ipv6-prefix;
+ mandatory "true";
+ description
+ "IPv6 destination prefix.";
+ }
+ choice next-hop-options {
+ mandatory "true";
+ description
+ "Options for expressing the next-hop in static routes.";
+ case special-next-hop {
+ //WARNING - changed, see ietf-routing.yang
+ uses rt:special-next-hop-grouping;
+ }
+ case simple-next-hop {
+ leaf next-hop {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
+ + "rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor routing
+ instance can be given.";
+ }
+ }
+ case next-hop-list {
+ if-feature rt:multipath-routes;
+ container next-hop-list {
+ description
+ "Configuration of multiple next-hops.";
+ list next-hop {
+ key "id";
+ description
+ "An entry of a next-hop list.";
+ leaf id {
+ type uint32;
+ description
+ "Unique numeric identifier of the entry.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of next-hops in RIBs.";
+ }
+ leaf address {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
+ + "rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor
+ routing instance can be given.";
+ }
+ uses rt:next-hop-classifiers {
+ refine "priority" {
+ default "primary";
+ }
+ refine "weight" {
+ default "0";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
+ container vpp-ipv6-route-state{
+ uses vpp-r:vpp-routing-state-attributes;
+ }
+ }
+ }
+ }
+
+ augment "/rt:routing/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
+ description
+ "This augment defines the configuration of the 'static'
+ pseudo-protocol with data specific to IPv6 unicast.";
+ container ipv6 {
+ description
+ "Configuration of a 'static' pseudo-protocol instance
+ consists of a list of routes.";
+ list route {
+ key "id";
+ ordered-by "user";
+ description
+ "A user-ordered list of static routes.";
+ leaf id {
+ type uint32 {
+ //WARNING - range changed from 1..max to be mappable on vpp table ids
+ range "0..max";
+ }
+ description
+ "Unique numeric identifier of the route.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of routes in RIBs.";
+ }
+ leaf description {
+ type string;
+ description
+ "Textual description of the route.";
+ }
+ leaf destination-prefix {
+ type inet:ipv6-prefix;
+ mandatory "true";
+ description
+ "IPv6 destination prefix.";
+ }
+ choice next-hop-options {
+ mandatory "true";
+ description
+ "Options for expressing the next-hop in static routes.";
+ case special-next-hop {
+ //WARNING - changed, see ietf-routing.yang
+ uses rt:special-next-hop-grouping;
+ }
+ case simple-next-hop {
+ leaf next-hop {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
+ + "rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor routing
+ instance can be given.";
+ }
+ }
+ case next-hop-list {
+ if-feature rt:multipath-routes;
+ container next-hop-list {
+ description
+ "Configuration of multiple next-hops.";
+ list next-hop {
+ key "id";
+ description
+ "An entry of a next-hop list.";
+ leaf id {
+ type uint32;
+ description
+ "Unique numeric identifier of the entry.
+
+ This value is unrelated to system-assigned 'id'
+ parameters of next-hops in RIBs.";
+ }
+ leaf address {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
+ + "rt:name";
+ }
+ description
+ "Name of the outgoing interface.
+
+ Only interfaces configured for the ancestor
+ routing instance can be given.";
+ }
+ uses rt:next-hop-classifiers {
+ refine "priority" {
+ default "primary";
+ }
+ refine "weight" {
+ default "0";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
+ container vpp-ipv6-route{
+ uses vpp-r:vpp-routing-attributes;
+ }
+ }
+ }
+ }
+
+ /* RPC methods */
+
+ augment "/rt:active-route/rt:input/rt:destination-address" {
+ when "rt:address-family='v6ur:ipv6-unicast'" {
+ description
+ "This augment is valid only for IPv6 unicast.";
+ }
+ description
+ "This leaf augments the 'rt:destination-address' parameter of
+ the 'rt:active-route' operation.";
+ leaf address {
+ type inet:ipv6-address;
+ description
+ "IPv6 destination address.";
+ }
+ }
+
+ augment "/rt:active-route/rt:output/rt:route" {
+ when "rt:address-family='v6ur:ipv6-unicast'" {
+ description
+ "This augment is valid only for IPv6 unicast.";
+ }
+ description
+ "This leaf augments the reply to the 'rt:active-route'
+ operation.";
+ leaf destination-prefix {
+ type inet:ipv6-prefix;
+ description
+ "IPv6 destination prefix.";
+ }
+ }
+
+ augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
+ + "rt:simple-next-hop" {
+ when "rt:address-family='v6ur:ipv6-unicast'" {
+ description
+ "This augment is valid only for IPv6 unicast.";
+ }
+ description
+ "This leaf augments the 'simple-next-hop' case in the reply to
+ the 'rt:active-route' operation.";
+ leaf next-hop {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ }
+
+ augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
+ + "rt:next-hop-list/rt:next-hop-list/rt:next-hop" {
+ when "../../rt:address-family='v6ur:ipv6-unicast'" {
+ description
+ "This augment is valid only for IPv6 unicast.";
+ }
+ if-feature rt:multipath-routes;
+ description
+ "This leaf augments the 'next-hop-list' case in the reply to
+ the 'rt:active-route' operation.";
+ leaf address {
+ type inet:ipv6-address;
+ description
+ "IPv6 address of the next-hop.";
+ }
+ }
+} \ No newline at end of file
diff --git a/routing/routing-api/src/main/yang/ietf-routing.yang b/routing/routing-api/src/main/yang/ietf-routing.yang
new file mode 100644
index 000000000..6902cd0bf
--- /dev/null
+++ b/routing/routing-api/src/main/yang/ietf-routing.yang
@@ -0,0 +1,1030 @@
+module ietf-routing{
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-routing";
+
+ prefix "rt";
+
+ import ietf-yang-types {
+ prefix "yang";
+ }
+
+ import ietf-interfaces {
+ prefix "if";
+ }
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: Thomas Nadeau
+ <mailto:tnadeau@lucidvision.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Ladislav Lhotka
+ <mailto:lhotka@nic.cz>";
+
+ description
+ "This YANG module defines essential components for the management
+ of a routing subsystem.
+
+ Copyright (c) 2014 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject to
+ the license terms contained in, the Simplified BSD License set
+ forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC XXXX; see the
+ RFC itself for full legal notices.";
+
+ revision 2014-05-24 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: A YANG Data Model for Routing Management";
+ }
+
+ /* Features */
+
+ feature multiple-ribs {
+ description
+ "This feature indicates that the device supports multiple RIBS
+ per address family, and the framework for passing routes
+ between RIBs.
+
+ Devices that do not support this feature MUST provide exactly
+ one system-controlled RIB per supported address family. These
+ RIBs then appear as entries of the list
+ /routing-state/ribs/rib.";
+ }
+
+ feature multipath-routes {
+ description
+ "This feature indicates that the device supports multipath
+ routes that have a list of next-hops.";
+ }
+
+ /* Identities */
+
+ 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.";
+ }
+
+ identity routing-instance-type {
+ description
+ "Base identity from which identities describing routing
+ instance types are derived.
+
+ It is primarily intended for discriminating among different
+ types of logical routers or router virtualization.";
+ }
+
+ identity standard-routing-instance {
+ base routing-instance-type;
+ description
+ "This identity represents a default routing instance.";
+ }
+
+ identity routing-protocol {
+ description
+ "Base identity from which routing protocol identities are
+ derived.";
+ }
+
+ identity direct {
+ base routing-protocol;
+ description
+ "Routing pseudo-protocol which provides routes to directly
+ connected networks.";
+ }
+
+ identity static {
+ base routing-protocol;
+ description
+ "Static routing pseudo-protocol.";
+ }
+
+ identity route-filter {
+ description
+ "Base identity from which all route filters are derived.";
+ }
+
+ identity deny-all-route-filter {
+ base route-filter;
+ description
+ "Route filter that blocks all routes.";
+ }
+
+ identity allow-all-route-filter {
+ base route-filter;
+ description
+ "Route filter that permits all routes.";
+ }
+
+ /* Type Definitions */
+
+ typedef routing-instance-ref {
+ type leafref {
+ path "/rt:routing/rt:routing-instance/rt:name";
+ }
+ description
+ "This type is used for leafs that reference a routing instance
+ configuration.";
+ }
+
+ typedef routing-instance-state-ref {
+ type leafref {
+ path "/rt:routing-state/rt:routing-instance/rt:name";
+ }
+ description
+ "This type is used for leafs that reference state data of a
+ routing instance.";
+ }
+
+ typedef rib-ref {
+ type leafref {
+ path "/rt:routing/rt:ribs/rt:rib/rt:name";
+ }
+ description
+ "This type is used for leafs that reference a RIB
+ configuration.";
+ }
+
+ typedef rib-state-ref {
+ type leafref {
+ path "/rt:routing-state/rt:ribs/rt:rib/rt:name";
+ }
+ description
+ "This type is used for leafs that reference a RIB in state
+ data.";
+ }
+
+ typedef route-filter-ref {
+ type leafref {
+ path "/rt:routing/rt:route-filters/rt:route-filter/rt:name";
+ }
+ description
+ "This type is used for leafs that reference a route filter
+ configuration.";
+ }
+
+ typedef route-filter-state-ref {
+ type leafref {
+ path "/rt:routing-state/rt:route-filters/rt:route-filter/"
+ + "rt:name";
+ }
+ description
+ "This type is used for leafs that reference a route filter in
+ state data.";
+ }
+
+ /* Groupings */
+
+ grouping address-family-grouping {
+ description
+ "This grouping provides a leaf identifying an address
+ family.";
+ leaf address-family {
+ type identityref {
+ base address-family;
+ }
+ mandatory "true";
+ description
+ "Address family.";
+ }
+ }
+
+ grouping state-entry-id {
+ description
+ "This grouping defines a unique identifier for entries in
+ several operational state lists.";
+ leaf id {
+ type uint64;
+ description
+ "Unique numerical identifier of a list entry in operational
+ state. It may be used by protocols or tools that inspect
+ and/or manipulate operational state data and prefer
+ fixed-size integers as list entry handles.
+
+ These identifiers are always ephemeral, i.e., they may
+ change after a reboot.";
+ }
+ }
+
+ grouping router-id {
+ description
+ "This grouping provides the definition of router ID.";
+ leaf router-id {
+ type yang:dotted-quad;
+ description
+ "Router ID - 32-bit number in the form of a dotted quad. Some
+ protocols use this parameter for identifying a router to its
+ neighbors.";
+ }
+ }
+
+ grouping outgoing-interface {
+ description
+ "This grouping defines the outgoing interface for use in
+ next-hops.";
+ leaf outgoing-interface {
+ type leafref {
+ path "/rt:routing-state/rt:routing-instance/rt:interfaces/"
+ + "rt:interface/rt:name";
+ }
+ description
+ "Name of the outgoing interface.";
+ }
+ }
+
+ // WARNING - renamed due to yang sources generation problem(having same name for grouping and it's leaf ends up in error against Java Language Specification)
+ grouping special-next-hop-grouping {
+ description
+ "This grouping provides the leaf for specifying special
+ next-hop options.";
+ leaf special-next-hop {
+ type enumeration {
+ enum blackhole {
+ description
+ "Silently discard the packet.";
+ }
+ enum unreachable {
+ description
+ "Discard the packet and notify the sender with an error
+ message indicating that the destination host is
+ unreachable.";
+ }
+ enum prohibit {
+ description
+ "Discard the packet and notify the sender with an error
+ message indicating that the communication is
+ administratively prohibited.";
+ }
+ enum receive {
+ description
+ "The packet will be received by the local network
+ device.";
+ }
+ }
+ description
+ "Special next-hop options.";
+ }
+ }
+
+ grouping next-hop-classifiers {
+ description
+ "This grouping provides two next-hop classifiers.";
+ leaf priority {
+ type enumeration {
+ enum primary {
+ value "1";
+ description
+ "Primary next-hop.";
+ }
+ enum backup {
+ value "2";
+ description
+ "Backup next-hop.";
+ }
+ }
+ description
+ "Simple priority for distinguishing between primary and
+ backup next-hops.
+
+ Backup next-hops are used if and only if no primary
+ next-hops are reachable.";
+ }
+ leaf weight {
+ type uint8;
+ must ". = 0 or not(../../next-hop/weight = 0)" {
+ error-message "Illegal combination of zero and non-zero "
+ + "next-hop weights.";
+ description
+ "Next-hop weights must be either all zero (equal
+ load-balancing) or all non-zero.";
+ }
+ description
+ "This parameter specifies the weight of the next-hop for load
+ balancing. The number specifies the relative fraction of the
+ traffic that will use the corresponding next-hop.
+
+ A value of 0 represents equal load-balancing.
+
+ If both primary and backup next-hops are present, then the
+ weights for each priority level are used separately.";
+ }
+ }
+
+ grouping next-hop-content {
+ description
+ "Generic parameters of next-hops in routes.";
+ choice next-hop-options {
+ mandatory "true";
+ description
+ "Options for expressing the next-hop in routes.";
+ case special-next-hop {
+ uses special-next-hop-grouping;
+ }
+ case simple-next-hop {
+ uses outgoing-interface;
+ }
+ case next-hop-list {
+ if-feature multipath-routes;
+ container next-hop-list {
+ description
+ "Container for multiple next-hops.";
+ list next-hop {
+ key "id";
+ description
+ "An entry of a next-hop list.";
+ uses state-entry-id;
+ uses outgoing-interface;
+ uses next-hop-classifiers;
+ }
+ }
+ }
+ }
+ }
+
+ grouping route-metadata {
+ description
+ "Route metadata.";
+ leaf source-protocol {
+ type identityref {
+ base routing-protocol;
+ }
+ mandatory "true";
+ description
+ "Type of the routing protocol from which the route
+ originated.";
+ }
+ leaf last-updated {
+ type yang:date-and-time;
+ description
+ "Time stamp of the last modification of the route. If the
+ route was never modified, it is the time when the route was
+ inserted into the RIB.";
+ }
+ }
+
+ /* Operational state data */
+
+ container routing-state {
+ config "false";
+ description
+ "Operational state of the routing subsystem.";
+ list routing-instance {
+ key "name";
+ unique "id";
+ description
+ "Each list entry is a container for operational state data of
+ a routing instance.
+
+ An implementation MAY create one or more system-controlled
+ instances, other user-controlled instances MAY be created by
+ configuration.";
+ leaf name {
+ type string;
+ description
+ "The name of the routing instance.
+
+ For system-controlled instances the name is persistent,
+ i.e., it SHOULD NOT change across reboots.";
+ }
+ uses state-entry-id {
+ refine "id" {
+ mandatory "true";
+ }
+ }
+ leaf type {
+ type identityref {
+ base routing-instance-type;
+ }
+ description
+ "The routing instance type, primarily intended for
+ discriminating among different types of logical routers,
+ route virtualization, master-slave arrangements etc.,
+ while keeping all routing instances in the same flat
+ list.";
+ }
+ uses router-id {
+ description
+ "Global router ID.
+
+ An implementation may choose a value if none is
+ configured.
+
+ Routing protocols that use router ID MAY override this
+ global parameter.";
+ }
+ container default-ribs {
+ description
+ "Default RIBs used by the routing instance.";
+ list default-rib {
+ key "address-family";
+ description
+ "Each list entry specifies the default RIB for one
+ address family.
+
+ The default RIB is operationally connected to all
+ routing protocols for which a connected RIB has not been
+ explicitly configured.
+
+ The 'direct' pseudo-protocol is always connected to the
+ default RIBs.";
+ uses address-family-grouping;
+ leaf rib-name {
+ type rib-state-ref;
+ mandatory "true";
+ description
+ "Name of an existing RIB to be used as the default RIB
+ for the given routing instance and address family.";
+ }
+ }
+ }
+ container interfaces {
+ description
+ "Network layer interfaces belonging to the routing
+ instance.";
+ list interface {
+ key "name";
+ description
+ "List of network layer interfaces assigned to the routing
+ instance.";
+ leaf name {
+ type if:interface-state-ref;
+ description
+ "A reference to the name of a configured network layer
+ interface.";
+ }
+ }
+ }
+ container routing-protocols {
+ description
+ "Container for the list of routing protocol instances.";
+ list routing-protocol {
+ key "name";
+ description
+ "Operational state of a routing protocol instance.
+
+ An implementation MUST provide exactly one
+ system-controlled instance of the type 'direct'. Other
+ instances MAY be created by configuration.";
+ leaf name {
+ type string;
+ description
+ "The name of the routing protocol instance.
+
+ For system-controlled instances this name is
+ persistent, i.e., it SHOULD NOT change across
+ reboots.";
+ }
+ leaf type {
+ type identityref {
+ base routing-protocol;
+ }
+ mandatory "true";
+ description
+ "Type of the routing protocol.";
+ }
+ container connected-ribs {
+ description
+ "Container for connected RIBs.";
+ list connected-rib {
+ key "rib-name";
+ description
+ "List of RIBs to which the routing protocol instance
+ is connected (at most one RIB per address
+ family).";
+ leaf rib-name {
+ type rib-state-ref;
+ description
+ "Name of an existing RIB.";
+ }
+ leaf import-filter {
+ type route-filter-state-ref;
+ description
+ "Reference to a route filter that is used for
+ filtering routes passed from this routing protocol
+ instance to the RIB specified by the 'rib-name'
+ sibling node.
+
+ If this leaf is not present, the behavior is
+ protocol-specific, but typically it means that all
+ routes are accepted.";
+ }
+ leaf export-filter {
+ type route-filter-state-ref;
+ description
+ "Reference to a route filter that is used for
+ filtering routes passed from the RIB specified by
+ the 'rib-name' sibling node to this routing
+ protocol instance.
+
+ If this leaf is not present, the behavior is
+ protocol-specific - typically it means that all
+ routes are accepted.
+
+ The 'direct' and 'static' pseudo-protocols accept
+ no routes from any RIB.";
+ }
+ }
+ }
+
+ //NOTE -added to allow operational state for static-routes
+ container static-routes {
+ when "../type='rt:static'" {
+ description
+ "This container is only valid for the 'static'
+ routing protocol.";
+ }
+ description
+ "Configuration of the 'static' pseudo-protocol.
+
+ Address family specific modules augment this node with
+ their lists of routes.";
+ }
+ }
+ }
+ }
+ container ribs {
+ description
+ "Container for RIBs.";
+ list rib {
+ key "name";
+ unique "id";
+ description
+ "Each entry represents a RIB identified by the 'name' key.
+ All routes in a RIB MUST belong to the same address
+ family.
+
+ The server MUST provide a system-controlled default RIB
+ for each address family, and MAY provide other
+ system-controlled RIBs. Additional RIBs MAY be created in
+ the configuration.";
+ leaf name {
+ type string;
+ description
+ "The name of the RIB.";
+ }
+ uses state-entry-id {
+ refine "id" {
+ mandatory "true";
+ }
+ }
+ uses address-family-grouping;
+ container routes {
+ description
+ "Current contents of the RIB.";
+ list route {
+ key "id";
+ description
+ "A RIB route entry. This data node MUST be augmented
+ with information specific for routes of each address
+ family.";
+ uses state-entry-id;
+ uses next-hop-content;
+ uses route-metadata;
+ }
+ }
+ container recipient-ribs {
+ if-feature multiple-ribs;
+ description
+ "Container for recipient RIBs.";
+ list recipient-rib {
+ key "rib-name";
+ description
+ "List of RIBs that receive routes from this RIB.";
+ leaf rib-name {
+ type rib-state-ref;
+ description
+ "The name of the recipient RIB.";
+ }
+ leaf filter {
+ type route-filter-state-ref;
+ description
+ "A route filter which is applied to the routes passed
+ to the recipient RIB.";
+ }
+ }
+ }
+ }
+ }
+ container route-filters {
+ description
+ "Container for route filters.";
+ list route-filter {
+ key "name";
+ description
+ "Route filters are used for filtering and/or manipulating
+ routes that are passed between a routing protocol and a
+ RIB and vice versa, or between two RIBs.
+
+ It is expected that other modules augment this list with
+ contents specific for a particular route filter type.";
+ leaf name {
+ type string;
+ description
+ "The name of the route filter.";
+ }
+ leaf type {
+ type identityref {
+ base route-filter;
+ }
+ mandatory "true";
+ description
+ "Type of the route-filter - an identity derived from the
+ 'route-filter' base identity.";
+ }
+ }
+ }
+ }
+
+ /* Configuration Data */
+
+ container routing {
+ description
+ "Configuration parameters for the routing subsystem.";
+ list routing-instance {
+ key "name";
+ description
+ "Configuration of a routing instance.";
+ leaf name {
+ type string;
+ description
+ "The name of the routing instance.
+
+ For system-controlled entries, the value of this leaf must
+ be the same as the name of the corresponding entry in
+ state data.
+
+ For user-controlled entries, an arbitrary name can be
+ used.";
+ }
+ leaf type {
+ type identityref {
+ base routing-instance-type;
+ }
+ default "rt:standard-routing-instance";
+ description
+ "The type of the routing instance.";
+ }
+ leaf enabled {
+ type boolean;
+ default "true";
+ description
+ "Enable/disable the routing instance.
+
+ If this parameter is false, the parent routing instance is
+ disabled and does not appear in operational state data,
+ despite any other configuration that might be present.";
+ }
+ uses router-id {
+ description
+ "Configuration of the global router ID.";
+ }
+ leaf description {
+ type string;
+ description
+ "Textual description of the routing instance.";
+ }
+ container default-ribs {
+ if-feature multiple-ribs;
+ description
+ "Configuration of the default RIBs used by the routing
+ instance.
+
+ The default RIB for an addressed family if by default
+ connected to all routing protocol instances supporting
+ that address family, and always receives direct routes.";
+ list default-rib {
+ must "address-family=/routing/ribs/rib[name=current()/"
+ + "rib-name]/address-family" {
+ error-message "Address family mismatch.";
+ description
+ "The entry's address family MUST match that of the
+ referenced RIB.";
+ }
+ key "address-family";
+ description
+ "Each list entry configures the default RIB for one
+ address family.";
+ uses address-family-grouping;
+ leaf rib-name {
+ type string;
+ mandatory "true";
+ description
+ "Name of an existing RIB to be used as the default RIB
+ for the given routing instance and address family.";
+ }
+ }
+ }
+ container interfaces {
+ description
+ "Configuration of the routing instance's interfaces.";
+ list interface {
+ key "name";
+ description
+ "List of network layer interfaces assigned to the routing
+ instance.";
+ leaf name {
+ type if:interface-ref;
+ description
+ "A reference to the name of a configured network layer
+ interface.";
+ }
+ }
+ }
+ container routing-protocols {
+ description
+ "Configuration of routing protocol instances.";
+ list routing-protocol {
+ key "name";
+ description
+ "Each entry contains configuration of a routing protocol
+ instance.";
+ leaf name {
+ type string;
+ description
+ "An arbitrary name of the routing protocol instance.";
+ }
+ leaf description {
+ type string;
+ description
+ "Textual description of the routing protocol
+ instance.";
+ }
+ leaf enabled {
+ type boolean;
+ default "true";
+ description
+ "Enable/disable the routing protocol instance.
+
+ If this parameter is false, the parent routing
+ protocol instance is disabled and does not appear in
+ operational state data, despite any other
+ configuration that might be present.";
+ }
+ leaf type {
+ type identityref {
+ base routing-protocol;
+ }
+ mandatory "true";
+ description
+ "Type of the routing protocol - an identity derived
+ from the 'routing-protocol' base identity.";
+ }
+ container connected-ribs {
+ description
+ "Configuration of connected RIBs.";
+ list connected-rib {
+ must "not(/routing/ribs/rib[name=current()/"
+ + "preceding-sibling::connected-rib/"
+ + "rib-name and address-family=/routing/ribs/"
+ + "rib[name=current()/rib-name]/address-family])" {
+ error-message
+ "Duplicate address family for connected RIBs.";
+ description
+ "For each address family, there MUST NOT be more
+ than one connected RIB.";
+ }
+ key "rib-name";
+ description
+ "List of RIBs to which the routing protocol instance
+ is connected (at most one RIB per address family).
+
+ If no connected RIB is configured for an address
+ family, the routing protocol is connected to the
+ default RIB for that address family.";
+ leaf rib-name {
+ type rib-ref;
+ must "../../../type != 'rt:direct' or "
+ + "../../../../../default-ribs/ "
+ + "default-rib/rib-name=." {
+ error-message "The 'direct' protocol can be "
+ + "connected only to a default RIB.";
+ description
+ "For the 'direct' pseudo-protocol, the connected
+ RIB must always be a default RIB.";
+ }
+ description
+ "Name of an existing RIB.";
+ }
+ leaf import-filter {
+ type route-filter-ref;
+ description
+ "Configuration of import filter.";
+ }
+ leaf export-filter {
+ type route-filter-ref;
+ description
+ "Configuration of export filter.";
+ }
+ }
+ }
+ container static-routes {
+ when "../type='rt:static'" {
+ description
+ "This container is only valid for the 'static'
+ routing protocol.";
+ }
+ description
+ "Configuration of the 'static' pseudo-protocol.
+
+ Address family specific modules augment this node with
+ their lists of routes.";
+ }
+ }
+ }
+ }
+ container ribs {
+ description
+ "Configured RIBs.";
+ list rib {
+ key "name";
+ description
+ "Each entry represents a configured RIB identified by the
+ 'name' key.
+
+ Entries having the same key as a system-controlled entry
+ of the list /routing-state/ribs/rib are used for
+ configuring parameters of that entry. Other entries define
+ additional user-controlled RIBs.";
+ leaf name {
+ type string;
+ description
+ "The name of the RIB.
+
+ For system-controlled entries, the value of this leaf
+ must be the same as the name of the corresponding entry
+ in state data.
+
+ For user-controlled entries, an arbitrary name can be
+ used.";
+ }
+ uses address-family-grouping;
+ leaf description {
+ type string;
+ description
+ "Textual description of the RIB.";
+ }
+ container recipient-ribs {
+ if-feature multiple-ribs;
+ description
+ "Configuration of recipient RIBs.";
+ list recipient-rib {
+ must "rib-name != ../../name" {
+ error-message
+ "Source and recipient RIBs are identical.";
+ description
+ "A RIB MUST NOT appear among its recipient RIBs.";
+ }
+ must "/routing/ribs/rib[name=current()/rib-name]/"
+ + "address-family=../../address-family" {
+ error-message "Address family mismatch.";
+ description
+ "Address family of the recipient RIB MUST match that
+ of the source RIB.";
+ }
+ key "rib-name";
+ description
+ "Each entry configures a recipient RIB.";
+ leaf rib-name {
+ type rib-ref;
+ description
+ "The name of the recipient RIB.";
+ }
+ leaf filter {
+ type route-filter-ref;
+ description
+ "A route filter which is applied to the routes passed
+ to the recipient RIB.";
+ }
+ }
+ }
+ }
+ }
+ container route-filters {
+ description
+ "Configuration of route filters.";
+ list route-filter {
+ key "name";
+ description
+ "Each entry configures a named route filter.";
+ leaf name {
+ type string;
+ description
+ "The name of the route filter.";
+ }
+ leaf description {
+ type string;
+ description
+ "Textual description of the route filter.";
+ }
+ leaf type {
+ type identityref {
+ base route-filter;
+ }
+ mandatory "true";
+ description
+ "Type of the route filter..";
+ }
+ }
+ }
+ }
+
+ /* RPC methods */
+
+ rpc active-route {
+ description
+ "Return the active route that a routing-instance uses for
+ sending packets to a destination address.";
+ input {
+ leaf routing-instance-name {
+ type routing-instance-state-ref;
+ mandatory "true";
+ description
+ "Name of the routing instance whose forwarding information
+ base is being queried.
+
+ If the routing instance with name equal to the value of
+ this parameter doesn't exist, then this operation SHALL
+ fail with error-tag 'data-missing' and error-app-tag
+ 'routing-instance-not-found'.";
+ }
+ container destination-address {
+ description
+ "Network layer destination address.
+
+ Address family specific modules MUST augment this
+ container with a leaf named 'address'.";
+ uses address-family-grouping;
+ }
+ }
+ output {
+ container route {
+ description
+ "The active route for the specified destination.
+
+ If the routing instance has no active route for the
+ destination address, no output is returned - the server
+ SHALL send an <rpc-reply> containing a single element
+ <ok>.
+
+ Address family specific modules MUST augment this list
+ with appropriate route contents.";
+ uses address-family-grouping;
+ uses next-hop-content;
+ uses route-metadata;
+ }
+ }
+ }
+
+ rpc route-count {
+ description
+ "Return the current number of routes in a RIB.";
+ input {
+ leaf rib-name {
+ type rib-state-ref;
+ mandatory "true";
+ description
+ "Name of the RIB.
+
+ If the RIB with name equal to the value of this parameter
+ doesn't exist, then this operation SHALL fail with
+ error-tag 'data-missing' and error-app-tag
+ 'rib-not-found'.";
+ }
+ }
+ output {
+ leaf number-of-routes {
+ type uint64;
+ mandatory "true";
+ description
+ "Number of routes in the RIB.";
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/routing/routing-api/src/main/yang/vpp-routing.yang b/routing/routing-api/src/main/yang/vpp-routing.yang
new file mode 100644
index 000000000..1979db9e1
--- /dev/null
+++ b/routing/routing-api/src/main/yang/vpp-routing.yang
@@ -0,0 +1,59 @@
+module vpp-routing{
+
+ namespace "urn:ietf:params:xml:ns:yang:vpp-routing";
+ prefix "vpp-routing";
+ description "General extensions for routes to be able to use VPP route defining apis";
+
+ revision 2016-10-18 {
+ description "Initial revision.";
+ }
+
+ import yang-ext {
+ prefix "ext";
+ }
+
+ import vpp-classifier {
+ prefix "classifier";
+ }
+
+ typedef vni-reference{
+ type uint32;
+ description "Vrf index reference";
+ }
+
+ grouping vpp-routing-attributes{
+ //vrf_id
+ leaf primary-vrf{
+ type vni-reference;
+ mandatory true;
+ description "Main vrf associated to route";
+ }
+
+ leaf auto-create-vrf{
+ type boolean;
+ default false;
+ description "If referenced primary vrf not exists,create while creating route";
+ }
+
+ //lookup_in_vrf
+ leaf secondary-vrf{
+ type vni-reference;
+ description "Optional secondary vrf used to lookup in";
+ }
+
+ leaf classify-table{
+ // classify_table_index + is_classify flag
+ type classifier:classify-table-ref;
+ description "Optional reference to classify table";
+ }
+ }
+
+ grouping vpp-routing-state-attributes{
+ //vrf_id
+ leaf primary-vrf{
+ type vni-reference;
+ mandatory true;
+ description "Main vrf associated to route";
+ }
+ }
+} \ No newline at end of file