module ietf-l2-topology {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-l2-topology";
prefix "l2t";
import ietf-network {
prefix "nw";
reference
"RFC 8345: A YANG Data Model for Network Topologies";
}
import ietf-network-topology {
prefix "nt";
reference
"RFC 8345: A YANG Data Model for Network Topologies";
}
import ietf-inet-types {
prefix "inet";
reference "Section 4 of RFC 6991";
}
import ietf-yang-types {
prefix "yang";
reference "Section 3 of RFC 6991";
}
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web:
WG List:
Editor: Jie Dong
Editor: Xiugang Wei
Editor: Qin Wu
Editor: Mohamed Boucadair
Editor: Anders Liu
";
description
"This module defines a basic model for
the layer-2 topology of a network.
Copyright (c) 2019 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
draft-ietf-i2rs-yang-l2-network-topo-07;
see the RFC itself for full legal notices.";
revision "2019-06-21" {
description "Initial revision";
reference
"RFC XXXX: A YANG Data Model for Layer-2 Network Topologies";
}
/*
* Typedefs
*/
typedef vlan {
type uint16 {
range "1..4094";
}
description "VLAN ID";
reference "IEEE 802.1Q";
}
typedef trill-nickname {
type uint16;
description "TRILL Nickname";
reference "RFC 6326";
}
typedef vni {
type uint32 {
range "1..16777215";
}
description "VxLAN Network Identifier";
reference "RFC 7348";
}
typedef l2-flag-type {
type identityref {
base "flag-identity";
}
description "Base type for l2 flags";
}
typedef node-flag-type {
type identityref {
base "flag-identity";
}
description "Node flag attributes";
}
typedef link-flag-type {
type identityref {
base "flag-identity";
}
description "Link flag attributes";
}
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";
reference "IEEE 802.1ad.";
}
feature PBB {
description
"Indicates that the device supports the
provider-backbone-bridging functions";
reference "IEEE 802.1ah.";
}
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 l2-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 sys-mac-address {
type yang:mac-address;
description "System MAC-address.";
}
leaf management-vid {
if-feature VLAN;
type vlan;
description "System management VID.";
}
leaf-list flag {
type node-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 link-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.";
reference "RFC 4202";
}
}
} // 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 is the VLAN id that
will be assigned to any untagged frames entering
the switch on the specific port.";
}
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 layer-2-address {
type yang:phys-address;
description "Interface Layer 2 address.";
}
leaf encapsulation {
type identityref {
base encapsulation-type;
}
description
"Encapsulation type of this termination point.";
}
} //case legacy such as atm, ppp, hdlc,etc.
} //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
/*
* Data nodes
*/
augment "/nw:networks/nw:network/nw:network-types" {
description
"Introduce new network type for L2 topology.";
uses l2-network-type;
}
augment "/nw:networks/nw:network" {
when "/nw:networks/nw:network/nw:network-types/l2t: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:networks/nw:network/nw:node" {
when "/nw:networks/nw:network/nw:network-types/l2t: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:networks/nw:network/nt:link" {
when "/nw:networks/nw:network/nw:network-types/l2t:l2-network" {
description
"Augmentation parameters apply only for networks
with L2 topology.";
}
description "Augment L2 topology link information";
uses l2-link-attributes;
}
augment "/nw:networks/nw:network/nw:node/nt:termination-point" {
when "/nw:networks/nw:network/nw:network-types/l2t:l2-network" {
description
"Augmentation parameters apply only for networks
with L2 topology.";
}
description
"Augment L2 topology termination point information.";
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 nw: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 nt: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 nt:tp-ref;
uses l2-network-type;
uses l2-termination-point-attributes;
}
} // module l2-topology