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:
WG List:
WG Chair: Loa Andersson
WG Chair: Ross Callon
WG Chair: George Swallow
Editor: Tarek Saad
Editor: Kamran Raza
Editor: Rakesh Gandhi
Editor: Xufeng Liu
Editor: Vishnu Pavan Beeram
Editor: Himanshu Shah
Editor: Igor Bryskin
Editor: Xia Chen
Editor: Raqib Jones
Editor: Bin Wen
";
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;
}
*/
}