blob: 9f572cb0ab15ec05e1ba3e4bd19384ea42fd5a6d [file] [log] [blame]
/*
* NO RW COPYRIGHT
*
*/
module ietf-l2-topology {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-l2-topology";
prefix "l2t";
import ietf-network {
prefix "nw";
}
import ietf-network-topology {
prefix "nt";
}
import ietf-inet-types {
prefix "inet";
}
import ietf-yang-types {
prefix "yang";
}
organization "TBD";
contact "I-D Editor: jie.dong@huawei.com";
description
"This module defines a basic model for
the layer-2 topology of a network";
revision "2015-06-23" {
description "Initial revision";
reference "draft-ietf-i2rs-l2-network-topology-01";
}
/*
* Typedefs
*/
typedef vlan {
type uint16 {
range "0..4095";
}
description "VLAN ID";
}
typedef trill-nickname {
type uint16;
description "TRILL Nickname";
}
typedef flag-type {
type identityref {
base "flag-identity";
}
description "Base type for flags";
}
typedef l2-network-event-type {
type enumeration {
enum "add" {
value 0;
description "An L2 node or link or termination-point
has been added";
}
enum "remove" {
value 1;
description "An L2 node or link or termination-point
has been removed";
}
enum "update" {
value 2;
description "An L2 node or link or termination-point
has been updated";
}
}
description "l2 network event type for notifications";
} // l2-topology-event-type
/*
* Features
*/
feature VLAN {
description
"Indicates that the system supports the
vlan functions";
}
feature QinQ {
description
"Indicates that the system supports the
qinq functions";
}
feature PBB {
description
"Indicates that the device supports the
provider-backbone-bridging functions";
}
feature VPLS {
description
"Indicates that the device supports the
VPLS functions";
reference "RFC 4761, RFC 4762";
}
feature TRILL {
description
"Indicates that the device supports the
TRILL functions";
reference "RFC 6325";
}
feature VXLAN {
description
"Indicates that the device supports the
VXLAN functions";
reference "RFC 7348";
}
/*
* Identities
*/
identity flag-identity {
description "Base type for flags";
}
identity encapsulation-type {
description
"Base identity from which specific encapsulation
types are derived.";
}
identity eth-encapsulation-type {
base encapsulation-type;
description
"Base identity from which specific ethernet
encapsulation types are derived.";
}
identity ethernet {
base eth-encapsulation-type;
description
"native ethernet encapsulation";
}
identity vlan {
base eth-encapsulation-type;
description
"vlan encapsulation";
}
identity qinq {
base eth-encapsulation-type;
description
"qinq encapsulation";
}
identity pbb {
base eth-encapsulation-type;
description
"pbb encapsulation";
}
identity trill {
base eth-encapsulation-type;
description
"trill encapsulation";
}
identity vpls {
base eth-encapsulation-type;
description
"vpls encapsulation";
}
identity vxlan {
base eth-encapsulation-type;
description
"vxlan encapsulation";
}
identity frame-relay {
base encapsulation-type;
description
"Frame Relay encapsulation";
}
identity ppp {
base encapsulation-type;
description
"PPP encapsulation";
}
identity hdlc {
base encapsulation-type;
description
"HDLC encapsulation";
}
identity atm {
base encapsulation-type;
description
"Base identity from which specific ATM
encapsulation types are derived.";
}
identity pwe3 {
base encapsulation-type;
description
"Base identity from which specific pw
encapsulation types are derived.";
}
/*
* Groupings
*/
grouping l2-network-type {
description "Identify the topology type to be L2.";
container l2-network {
presence "indicates L2 Network";
description
"The presence of the container node indicates
L2 Topology";
}
}
grouping l2-network-attributes {
description "L2 Topology scope attributes";
container l2-network-attributes {
description "Containing L2 network attributes";
leaf name {
type string;
description "Name of the L2 network";
}
leaf-list flag {
type flag-type;
description "L2 network flags";
}
}
}
grouping l2-node-attributes {
description "L2 node attributes";
container l2-node-attributes {
description "Containing L2 node attributes";
leaf name {
type string;
description "Node name";
}
leaf description {
type string;
description "Node description";
}
leaf-list management-address {
type inet:ip-address;
description "System management address";
}
leaf management-vid {
if-feature VLAN;
type vlan;
description "System management VID";
}
leaf-list nick-name {
if-feature TRILL;
type trill-nickname;
description "Nickname of the RBridge";
}
leaf-list flag {
type flag-type;
description "Node operational flags";
}
}
} // grouping l2-node-attributes
grouping l2-link-attributes {
description "L2 link attributes";
container l2-link-attributes {
description "Containing L2 link attributes";
leaf name {
type string;
description "Link name";
}
leaf-list flag {
type flag-type;
description "Link flags";
}
leaf rate {
type decimal64 {
fraction-digits 2;
}
description "Link rate";
}
leaf delay {
type uint32;
description "Link delay in microseconds";
}
leaf-list srlg {
type uint32;
description
"List of Shared Risk Link Groups
this link belongs to.";
}
}
} // grouping l2-link-attributes
grouping l2-termination-point-attributes {
description "L2 termination point attributes";
container l2-termination-point-attributes {
description "Containing L2 TP attributes";
leaf description {
type string;
description "Port description";
}
leaf maximum-frame-size {
type uint32;
description "Maximum frame size";
}
choice l2-termination-point-type {
description
"Indicates termination-point type
specific attributes";
case ethernet {
leaf mac-address {
type yang:mac-address;
description "Interface MAC address";
}
leaf eth-encapsulation {
type identityref {
base eth-encapsulation-type;
}
description
"Encapsulation type of this
ternimation point.";
}
leaf port-vlan-id {
if-feature VLAN;
type vlan;
description "Port VLAN ID";
}
list vlan-id-name {
if-feature VLAN;
key "vlan-id";
description "Interface configured VLANs";
leaf vlan-id {
type vlan;
description "VLAN ID";
}
leaf vlan-name {
type string;
description "VLAN Name";
}
}
} //case ethernet
case legacy {
leaf encapsulation {
type identityref {
base encapsulation-type;
}
description
"Encapsulation type of this termination point.";
}
} //case legacy
} //choice termination-point-type
leaf tp-state {
type enumeration {
enum in-use {
value 0;
description
"the termination point is in forwarding state";
}
enum blocking {
value 1;
description
"the termination point is in blocking state";
}
enum down {
value 2;
description
"the termination point is in down state";
}
enum others {
value 3;
description
"the termination point is in other state";
}
}
config false;
description "State of the termination point";
}
}
} // grouping l2-termination-point-attributes
/*** grouping of network/node/link/tp leaf-refs ***/
grouping network-ref {
description
"Grouping for an absolute reference to a network topology
instance.";
leaf network-ref {
type leafref {
path "/nw:network/nw:network-id";
}
description
"An absolute reference to a network topology instance.";
}
}
grouping link-ref {
description
"Grouping for an absolute reference to a link instance.";
uses network-ref;
leaf link-ref {
type leafref {
path "/nw:network"
+"[nw:network-id = current()/../network-ref]"
+"/nt:link/nt:link-id";
}
description
"An absolute reference to a link instance.";
}
}
grouping node-ref {
description
"Grouping for an absolute reference to a node instance.";
uses network-ref;
leaf node-ref {
type leafref {
path "/nw:network"
+"[nw:network-id = current()/../network-ref]"
+"/nw:node/nw:node-id";
}
description
"An absolute reference to a node instance.";
}
}
grouping tp-ref {
description
"Grouping for an absolute reference to a termination point.";
uses node-ref;
leaf tp-ref {
type leafref {
path "/nw:network"
+"[nw:network-id = current()/../network-ref]"
+"/nw:node[nw:node-id = current()/../node-ref]"
+"/nt:termination-point/nt:tp-id";
}
description
"Grouping for an absolute reference to a TP.";
}
}
/*
* Data nodes
*/
augment "/nw:network/nw:network-types" {
description
"Introduce new network type for L2 topology";
uses l2-network-type;
}
augment "/nw:network" {
/* RIFT-Change: when not to be used yet
when "nw:network-types/l2-network" {
description
"Augmentation parameters apply only for networks
with L2 topology";
}
*/
description
"Configuration parameters for the L2 network
as a whole";
uses l2-network-attributes;
}
augment "/nw:network/nw:node" {
/* RIFT-Change: when not to be used yet
when "../nw:network-types/l2-network" {
description
"Augmentation parameters apply only for networks
with L2 topology";
}
*/
description
"Configuration parameters for L2 at the node
level";
uses l2-node-attributes;
}
augment "/nw:network/nt:link" {
/* RIFT-Change: when not to be used yet
when "/nw:network/nw:network-types/l2-network" {
description
"Augmentation parameters apply only for networks
with L2 topology";
}
*/
description "Augment L2 topology link information";
uses l2-link-attributes;
}
augment "/nw:network/nw:node/nt:termination-point" {
/* RIFT-Change: when not to be used yet
when "/nw:network/nw:network-types/l2-network" {
description
"Augmentation parameters apply only for networks
with L2 topology";
}
*/
description
"Augment L2 topology termination point configuration";
uses l2-termination-point-attributes;
}
/*
* Notifications
*/
notification l2-node-event {
description "Notification event for L2 node";
leaf event-type {
type l2-network-event-type;
description "Event type";
}
uses node-ref;
uses l2-network-type;
uses l2-node-attributes;
}
notification l2-link-event {
description "Notification event for L2 link";
leaf event-type {
type l2-network-event-type;
description "Event type";
}
uses link-ref;
uses l2-network-type;
uses l2-link-attributes;
}
notification l2-termination-point-event {
description "Notification event for L2 termination point";
leaf event-type {
type l2-network-event-type;
description "Event type";
}
uses tp-ref;
uses l2-network-type;
uses l2-termination-point-attributes;
}
} // module l2-topology