module ietf-sr-policy {
namespace "urn:ietf:params:xml:ns:yang:ietf-sr-policy";
prefix "sr-policy";
import ietf-inet-types {
prefix "inet";
}
import ietf-interfaces {
prefix if;
}
import ietf-routing {
prefix "rt";
}
import ietf-routing-types {
prefix "rt-types";
}
import ietf-yang-types {
prefix "yang";
}
import ietf-srv6-types {
prefix "srv6-types";
}
import ietf-sr-policy-types {
prefix "sr-policy-types";
}
organization "IETF SPRING Working Group";
contact
"WG Web:
WG List:
Editor: Kamran Raza
Editor: Zhuang Shunwan
Editor: Daniel Voyer
Editor: Muhammad Durrani
Editor: Satoru Matsushima
";
description
"This module contains a collection of YANG definitions
for SR policy module.
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).";
revision "2019-07-08" {
description
"Dynamic TE candidate-path support";
reference
"draft-ietf-spring-segment-routing-policy";
}
revision "2018-07-01" {
description
"Initial version";
reference
"draft-ietf-spring-segment-routing-policy";
}
grouping segment_config {
description "Segment properties grouping";
leaf index {
type uint32;
description "Segment index";
}
leaf type {
type sr-policy-types:segment-type;
description "Segment type";
}
container segment-types {
description "Types of segments";
container segment-type-1 {
description
"Segment declared by MPLS label";
leaf sid-value {
type rt-types:mpls-label;
description "MPLS label value";
}
}
container segment-type-2 {
description
"Segment declared by SRv6 SID value";
leaf sid-value {
type srv6-types:srv6-sid;
description "SRv6 SID value";
}
}
container segment-type-3 {
description
"Segment declared by IPv4 Prefix with optional SR Algorithm";
leaf ipv4-address {
type inet:ipv4-address;
description "Segment IPv4 address";
}
leaf algorithm {
type uint8;
description "Prefix SID algorithm identifier";
}
}
container segment-type-4 {
description
"Segment declared by IPv6 Global Prefix with optional
SR Algorithm for SR-MPLS";
leaf ipv6-address {
type inet:ipv6-address;
description "Segment IPv6 address";
}
leaf algorithm {
type uint8;
description "Prefix SID algorithm identifier";
}
}
container segment-type-5 {
description
"Segment declared by IPv4 Prefix with Local Interface ID";
leaf ipv4-address {
type inet:ipv4-address;
description "Node IPv4 address";
}
leaf interface-identifier {
type uint32;
description "local interface identifier";
}
}
container segment-type-6 {
description
"Segment declared by IPv4 Addresses for link endpoints
as Local, Remote pair";
leaf local-ipv4-address {
type inet:ipv4-address;
description "Segment local IPv4 adjacency address";
}
leaf remote-ipv4-address {
type inet:ipv4-address;
description "Segment remote IPv4 adjacency address";
}
}
container segment-type-7 {
description
"Segment declared by IPv6 Prefix and Interface ID for
link endpoints as Local, Remote pair for SR-MPLS";
leaf local-ipv6-address {
type inet:ipv6-address;
description "Local link IPv6 address";
}
leaf local-interface-identifier {
type uint32;
description "Local interface identifier";
}
leaf remote-ipv6-address {
type inet:ipv6-address;
description "Remote link IPv6 address";
}
leaf remote-interface-identifier {
type uint32;
description "Remote interface identifier";
}
}
container segment-type-8 {
description
"Segment declared by IPv6 Addresses for link endpoints as
Local, Remote pair for SR-MPLS";
leaf local-ipv6-address {
type inet:ipv6-address;
description "Segment local IPv6 adjacency address";
}
leaf remote-ipv6-address {
type inet:ipv6-address;
description "Segment remote IPv6 adjacency address";
}
}
container segment-type-9 {
description
"Segment declared by IPv6 Global Prefix with optional
SR Algorithm for SRv6";
leaf ipv6-address {
type inet:ipv6-address;
description "Segment IPv6 prefix";
}
leaf algorithm {
type uint8;
description "Prefix SID algorithm identifier";
}
}
container segment-type-10 {
description
"Segment declared by IPv6 Prefix and Interface ID for
link endpoints as Local, Remote pair for SRv6";
leaf local-ipv6-address {
type inet:ipv6-address;
description "Local link IPv6 address";
}
leaf local-interface-identifier {
type uint32;
description "Local interface identifier";
}
leaf remote-ipv6-address {
type inet:ipv6-address;
description "Remote link IPv6 address";
}
leaf remote-interface-identifier {
type uint32;
description "Remote interface identifier";
}
}
container segment-type-11 {
description
"Segment declared by IPv6 Addresses for link endpoints as
Local, Remote pair for SRv6";
leaf local-ipv6-address {
type inet:ipv6-address;
description "Segment local IPv6 adjacency address";
}
leaf remote-ipv6-address {
type inet:ipv6-address;
description "Segment remote IPv6 adjacency address";
}
}
}
leaf validate {
type boolean;
default 'false';
description "Indicates whether the segment should be validated. The default
applies to all segments other than the first segment. For the
first segment, validation is always done.";
}
}
grouping segment-properties {
description
"SR segment properties grouping";
uses segment_config;
}
grouping policy-attributes {
description
"Grouping containing attributes applicable to all SR policies";
container policy-attributes {
description
"Attributes applicable to all SR policies";
uses affinity-mapping;
uses segment-lists;
uses explicit-binding-sid-rules;
}
}
grouping segment-lists {
description
"Segment lists grouping";
container segment-lists {
description "Segment-lists properties";
list segment-list {
key "name";
description "Segment-list properties";
leaf name {
type string;
description "Segment-list name";
}
container segments {
description
"Segments for given segment list";
list segment {
key "index";
description "Configure Segment/hop at the index";
uses segment-properties;
}
}
}
}
}
grouping binding-sid_config {
description
"Binding SID configuration properties grouping";
leaf dataplane {
type sr-policy-types:dataplane-type;
description "Binding SID dataplane type";
}
leaf value {
type sr-policy-types:sid-value-type;
description "Binding SID value";
}
}
grouping forwarding-counters {
description
"Grouping for counters";
container counters {
config false;
description
"Counters containing stats related to forwarding";
leaf pkts {
type yang:counter64;
description "Number of packets forwarded";
}
leaf octets {
type yang:counter64;
units "byte";
description "Number of bytes forwarded";
}
}
}
grouping binding-sid_state {
description
"Binding SID state properties grouping";
leaf alloc-mode {
type sr-policy-types:binding-sid-alloc-mode;
config false;
description "Binding SID type";
}
leaf allocated-sid {
type sr-policy-types:sid-value-type;
config false;
description "Allocated SID value for the Binding SID";
}
leaf oper-state {
type sr-policy-types:binding-sid-oper-state;
config false;
description
"Binding SID operational state";
}
}
grouping binding-sid-properties {
description
"Binding SID properties grouping";
container binding-sid {
description "Binding Segment ID";
uses binding-sid_config;
uses binding-sid_state;
}
}
grouping mpls-label-stack {
description
"Grouping for MPLS label stack";
list labels {
key "label";
description
"Stack containing MPLS labels";
leaf label {
type rt-types:mpls-label;
description
"MPLS label value";
}
}
}
grouping srv6-sid-stack {
description
"Grouping for SRv6 label stack";
list sids {
key "sid";
description
"Stack containing SRv6 SIDs";
leaf sid {
type srv6-types:srv6-sid;
description
"SRv6 sid value";
}
}
}
grouping path-forwarding_state {
description "Policy Forwarding path information";
leaf path-id {
type uint8;
description "Primary path id";
}
leaf next-hop-address {
type inet:ip-address;
description "Nexthop address";
}
leaf next-hop-table-id {
type uint32;
description "Table ID for nexthop address";
}
leaf outgoing-interface {
type if:interface-ref;
description "Outgoing interface handle";
}
container outgoing-sids {
description
"Outgoing sid stack";
choice dataplanetype {
description
"Outgoing sids dataplane choice";
case mpls {
uses mpls-label-stack;
}
case srv6 {
uses srv6-sid-stack;
}
}
}
leaf is-protected {
type boolean;
description "Is this path protected ?";
}
leaf is-pure-backup {
type boolean;
description "Is this path a pure backup ?";
}
leaf backup-path-id {
type uint8;
description "Backup path id";
}
leaf weight {
type uint32;
description "Path's weight for W-ECMP balancing";
}
}
grouping cpath-cmn-properties {
description
"Common properties of the candidate path";
leaf is-valid {
type boolean;
config false;
description
"True if the segment-list is valid, False otherwise";
}
container forwarding-paths {
config false;
description
"Forwarding state of paths";
list forwarding-path {
key "path-id";
description "Forwarding path";
uses path-forwarding_state;
}
}
}
grouping explicit-path-properties {
description
"Explicit path properties of the candidate path";
container segment-lists {
description
"Path segment list(s) properties";
list segment-list {
key "name-ref";
description "SR policy candidate path segment lists";
leaf name-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policy-attributes/sr-policy:segment-lists/sr-policy:segment-list/sr-policy:name";
}
description "Reference to segment-list name";
}
leaf weight {
type uint32;
description "Segment-list weighted loadshare";
}
}
}
}
grouping affinity-mapping {
description "Affinity-map grouping";
container affinity-map {
description
"Mapping of affinity names to bit position";
list affinity {
key "name";
unique "bit-position";
leaf name {
type string;
description
"Name of the affinity";
}
leaf bit-position {
type uint16;
description
"The affinity entry in this list is mapped to the this bit-position in the
affinity bitmap";
}
description "Affinity";
}
}
}
grouping dynamic-path-properties {
description
"Dynamic path properties of the candidate path";
leaf sid-dataplane-type {
type sr-policy-types:dataplane-type;
description
"The dataplane type for the sid";
}
container constraints {
description "Constraints for the dynamic path computation";
container affinities {
description "Affinity constraints on the computed dynamic path";
leaf-list exclude-any {
type string;
description
"The link is excluded if it has any of these affinities.";
}
leaf-list include-any {
type string;
description
"The link is accepted if it has any of these affinities";
}
leaf-list include-all {
type string;
description
"The link is accepted if it has all these affinities";
}
}
container bounds {
description "Upper-bound constraints on the computed dynamic path";
leaf igp-metric-bound {
type uint32;
description
"Path is invalid if its IGP metric exceeds this value";
}
leaf te-metric-bound {
type uint32;
description
"Path is invalid if its TE metric exceeds this value";
}
leaf latency-metric-bound {
type uint32;
units "microsecond";
description
"Path is invalid if its latency exceeds this value";
}
leaf segment-bound {
type uint32;
description
"Path is invalid if it has more segments than this value";
}
}
container segment-rules {
description "Constraints on the segments to be used in the path";
leaf sid-algorithm {
type uint8 {
range "128..255";
}
description
"The prefix-sid algorithm to be used in path calculation";
}
}
container disjoint-path {
description "Path disjointness constraints";
leaf group-id {
type uint32 { range "1..65535"; }
description "";
}
leaf disjointness-type {
type identityref { base sr-policy-types:path-disjointness; }
description
"Type of disjointness computation used to find the path";
}
leaf subgroup-id {
type uint32 { range "1..65535"; }
description "";
}
}
}
}
grouping candidate-path_state {
description
"Candidate path state properties grouping";
leaf is-best-candidate-path {
type boolean;
default 'false';
config false;
description
"True if the candidate path is the best candidate path, False otherwise";
}
leaf non-selection-reason {
type identityref {
base sr-policy-types:candidate-path-not-selected-reason;
}
config false;
description
"Candidate path not selected reason";
}
}
grouping policy-properties_config {
description
"SR policy configuration grouping";
leaf name {
type string {
length "1..59";
}
description "SR policy name";
}
leaf color {
type uint32 {
range "1..4294967295";
}
description "Color associated with the policy";
}
leaf endpoint {
type inet:ip-address;
description "Policy end point IP address";
}
leaf description {
type string;
description "Description of the policy";
}
leaf admin-state {
type sr-policy-types:policy-admin-state;
default 'UP';
description
"SR policy administrative state, true for
enabled, false for disabled";
}
}
grouping policy-properties_state {
description
"SR policy property grouping";
leaf oper-state {
type sr-policy-types:policy-oper-state;
config false;
description
"SR policy operational state";
}
leaf transition-count {
type uint32;
config false;
description "Indicates number of up/down transitions";
}
leaf up-time {
type yang:date-and-time;
config false;
description "Policy up time in seconds";
}
leaf down-time {
type yang:date-and-time;
config false;
description "Policy down time in seconds";
}
}
grouping policy-properties {
description
"SR policy properties";
uses policy-properties_state;
uses binding-sid-properties;
uses forwarding-counters;
}
grouping candidate-path-type {
description "Candidate path type grouping";
choice type {
description
"Type of candidate paths";
case explicit {
description "Candidate path with explicitly defined set/s of segment-lists";
uses explicit-path-properties;
}
case dynamic {
description "Candidate path with dynamic computed segment-lists";
uses dynamic-path-properties;
}
}
}
grouping candidate-paths {
description "SR policy candidate path grouping";
container candidate-paths {
description "SR policy candidate path(s) ";
list candidate-path {
key "protocol-origin originator discriminator";
description "SR policy Candidate path(s) list entry";
leaf protocol-origin {
type sr-policy-types:protocol-origin-type;
description
"Instantiation mechanism used to create the candidate path";
}
leaf originator {
type string;
description
"Identifier (concatenation of ASN and node-address) of the node
that signalled/instantiated the candidate path on headend";
}
leaf discriminator {
type uint32;
description "Candidate path distinguisher";
}
leaf name {
type string;
description "Candidate path name";
}
leaf preference {
type uint32 {
range "1..65535";
}
description "Candidate path preference";
}
leaf description {
type string;
description "Candidate path description";
}
container binding-sid {
if-feature capability-candidate-path-binding-sid;
description
"Binding segment ID";
uses binding-sid_config;
}
uses candidate-path-type;
uses candidate-path_state;
uses cpath-cmn-properties;
}
}
}
grouping policies {
description "SR policy grouping";
container policies {
description "SR Policy container";
list policy {
key "color endpoint";
unique "name";
description "SR Policy properties";
leaf color {
type uint32 {
range "1..4294967295";
}
description "Color associated with the policy";
}
leaf endpoint {
type inet:ip-address;
description "Policy end point IP address";
}
leaf name {
type string {
length "1..59";
}
description "SR policy name";
}
leaf description {
type string;
description "Description of the policy";
}
leaf admin-state {
type sr-policy-types:policy-admin-state;
default 'UP';
description
"SR policy administrative state, true for
enabled, false for disabled";
}
leaf priority {
type uint8;
default 128;
description "Priority considered when policy is recomputed due to topology changes";
}
uses policy-properties;
uses candidate-paths;
}
}
}
grouping explicit-binding-sid-rules {
description
"Grouping for explicit binding sid rules";
list explicit-binding-sid-rules {
key "index";
description
"Explicit binding sid rules applicable for all policies";
leaf index {
type uint32;
description "Explicit binding SID rules list index";
}
leaf rule {
type sr-policy-types:explicit-binding-sid-rule-type;
description "Explicit binding sid rule";
}
}
}
augment "/rt:routing" {
description
"This augments routing-instance configuration with segment-routing sr-policy.";
container segment-routing {
description "Main segment routing container";
container sr-policy {
description "SR policy main container";
uses policy-attributes;
uses policies;
}
}
}
/* Notifications */
notification sr-policy-oper-state-change-event {
description
"Notification event when the operational state of the SR policy changes";
leaf policy-name-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:name";
}
description "Reference to sr-policy name";
}
leaf policy-color-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:color";
}
description "Reference to sr-policy color";
}
leaf policy-endpoint-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:endpoint";
}
description "Reference to sr-policy endpoint";
}
leaf policy-new-oper-state {
type sr-policy-types:policy-oper-state;
description "New operational state of the SR policy";
}
leaf policy-down-reason {
type identityref {
base sr-policy-types:policy-down-reason;
}
description "Down reason if the SR policy's new operational state is down";
}
}
notification sr-policy-candidate-path-change-event {
description
"Notification event when candidate path changes for SR policy";
leaf policy-name-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:name";
}
description "Reference to sr-policy name";
}
leaf policy-color-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:color";
}
description "Reference to sr-policy color";
}
leaf policy-endpoint-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:endpoint";
}
description "Reference to sr-policy endpoint";
}
leaf existing-preference {
type uint32;
description "Existing candidate path preference";
}
leaf new-preference {
type uint32;
description "New candidate path preference";
}
}
notification sr-policy-binding-sid-unavailable-event {
description
"Notification event when the binding sid of sr-policy is unavailable";
leaf policy-name-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:name";
}
description "Reference to sr-policy name";
}
leaf policy-color-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:color";
}
description "Reference to sr-policy color";
}
leaf policy-endpoint-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:endpoint";
}
description "Reference to sr-policy endpoint";
}
leaf policy-binding-sid-value-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:binding-sid/sr-policy:value";
}
description "Reference to sr-policy binding-sid value";
}
leaf reason {
type identityref {
base sr-policy-types:binding-sid-unavailable-reason;
}
description
"Reason why the binding sid is unavailable";
}
}
notification sr-policy-candidate-path-binding-sid-mismatch-event {
description
"Notification event when binding sid of requested candidate path
is different from the binding sid of the existing candidate path";
leaf policy-color-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:color";
}
description "Reference to sr-policy color";
}
leaf policy-endpoint-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:endpoint";
}
description "Reference to sr-policy endpoint";
}
leaf existing-candidate-path-protocol-origin-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:candidate-paths/sr-policy:candidate-path/sr-policy:protocol-origin";
}
description "Reference to existing candidate path protocol origin";
}
leaf existing-candidate-path-preference-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:candidate-paths/sr-policy:candidate-path/sr-policy:preference";
}
description "Reference to existing candidate path preference";
}
leaf existing-candidate-path-binding-sid-dataplane-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:candidate-paths/sr-policy:candidate-path/sr-policy:binding-sid/sr-policy:dataplane";
}
description "Reference to existing candidate path binding sid dataplane type";
}
leaf existing-candidate-path-binding-sid-value-ref {
type leafref {
path "/rt:routing/sr-policy:segment-routing/sr-policy:sr-policy/sr-policy:policies/sr-policy:policy/sr-policy:candidate-paths/sr-policy:candidate-path/sr-policy:binding-sid/sr-policy:value";
}
description "Reference to existing candidate path binding sid value";
}
leaf conflicting-candidate-path-protocol-origin {
type uint8;
description "Conflicting candidate path protocol origin";
}
leaf conflicting-candidate-path-preference {
type uint32;
description "Conflicting candidate path preference";
}
leaf conflicting-candidate-path-binding-sid-dataplane {
type sr-policy-types:dataplane-type;
description "Conflicting candidate path binding sid dataplane type";
}
leaf conflicting-candidate-path-binding-sid-value {
type sr-policy-types:sid-value-type;
description "Conflicting candidate path binding sid value";
}
}
/* Features */
feature capability-candidate-path-binding-sid {
description
"This feature enables the capability of specifying binding-sid
for a candidate path.";
}
} // module