module bgp-segment-routing { yang-version 1; namespace "urn:opendaylight:params:xml:ns:yang:bgp-segment-routing"; prefix "bgp-sr"; import network-concepts { prefix netc; revision-date 2013-11-25; } import ietf-inet-types { prefix inet; revision-date 2013-07-15; } import ietf-routing-types { prefix rt-types; } import rsvp { prefix rsvp; revision-date 2015-08-20; } organization "Cisco Systems, Inc."; contact "Iveta Halanova "; description "This module contains the base data concepts contained in RFC9085 (Segment Routing), RFC9514 (SRv6) and RFC9351 (Flex-Algo). Copyright (c)2015 Cisco Systems, Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"; revision 2024-12-19 { description "Update to RFC9085 (SR), RFC9514 (SRv6) and RFC9351 (Flex-Algo)"; reference "https://www.iana.org/assignments/bgp-ls-parameters/bgp-ls-parameters.xhtml"; } revision 2020-01-20 { description "Update to use -no-zone-adresses"; } revision "2015-10-14" { description "Initial revision."; } // Common Definitions grouping sid-label-index { reference "https://tools.ietf.org/html/rfc9085#section-2.1.1"; choice sid-label-index { case label-case { leaf label { type netc:mpls-label; } } case sid-case { leaf sid { type uint32; } } } } typedef extended-admin-group { reference "http://tools.ietf.org/html/rfc7308#section-2.1"; type uint32; } typedef msd-type { reference "https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml#igp-msd-types"; type enumeration { enum base-mpls { value 1; } enum erld { value 2; } enum srh-max-sl { value 41; } enum srh-max-endpop { value 42; } enum srh-max-endcaps { value 44; } enum srh-max-end { value 45; } } } grouping msd-tlv { reference "https://tools.ietf.org/html/rfc8814#section-3 and section-4"; leaf type { type msd-type; } leaf value { type uint8; } } // Node Attributes typedef algorithm { reference "https://tools.ietf.org/html/rfc9085#section-2.1.2"; type enumeration { enum shortest-path-first { value 0; } enum strict-shortest-path-first { value 1; } } } typedef srms { reference "https://tools.ietf.org/html/rfc9085#section-2.1.5"; type uint8; } typedef weight { reference "https://tools.ietf.org/html/rfc9085#section-2.2.1"; type uint8; } grouping sr-capabilities-tlv { reference "https://tools.ietf.org/html/rfc9085#section-2.1.2"; leaf mpls-ipv4 { type boolean; } leaf mpls-ipv6 { type boolean; } list srgb { leaf range-size { type rt-types:uint24; } uses sid-label-index; } } grouping sr-algorithms-tlv { leaf-list algorithms { type algorithm; } } grouping sr-local-block-tlv { reference "https://tools.ietf.org/html/rfc9085#section-2.1.4"; list srlb { leaf range-size { type rt-types:uint24; } uses sid-label-index; } } grouping srms-tlv { reference "https://tools.ietf.org/html/rfc9085#section-2.1.5"; leaf preference { type srms; } } grouping srv6-capabilities-tlv { reference "https://tools.ietf.org/html/rfc9514#section3.1"; leaf o-flag { type boolean; } } // Flex Algo typedef flex-metric { reference "http://tools.ietf.org/html/rfc9351#section-5.1"; type enumeration { enum igp { value 0; } enum delay { value 1; } enum te { value 2; } } } typedef flex-algo-definition-flag { reference "http://tools.ietf.org/html/rfc9351#section-6.4"; type bits { bit inter-area { position 0; } } } typedef flex-algo { reference "http://tools.ietf.org/html/rfc9351"; type uint8 { range "128..255"; } } grouping unsupported-tlvs { reference "https://tools.ietf.org/html/rfc9351#section-3.6"; leaf protocol-id { type uint8; } leaf-list protocol-type { type uint16; } } grouping flex-algo-subtlv { reference "https://tools.ietf.org/html/rfc9351#section-3.1 to 3.6"; leaf-list exclude-any { type extended-admin-group; } leaf-list include-any { type extended-admin-group; } leaf-list include-all { type extended-admin-group; } leaf flags { type flex-algo-definition-flag; } leaf-list exclude-srlg { type rsvp:srlg-id; } container unsupported-tlv { uses unsupported-tlvs; } } grouping flex-algo-definitions { reference "https://tools.ietf.org/html/rfc9351#section-3"; list flex-algo-definition-tlv { leaf flex-algo { type flex-algo; } leaf metric-type { type flex-metric; } leaf calc-type { type uint8 { range "0..127"; } } leaf priority { type uint8; } container flex-algo-subtlvs { uses flex-algo-subtlv; } } } // Link Attributes grouping common-adj-flags { reference "https://tools.ietf.org/html/rfc9085#section-2 and https://tools.ietf.org/html/rfc9086#section-5"; leaf backup { type boolean; } leaf value { type boolean; } leaf local { type boolean; } leaf persistent { type boolean; } } grouping adj-flags { choice flags { case ospf-adj-flags-case { reference "https://tools.ietf.org/html/rfc8665#section-6 and https://tools.ietf.org/html/rfc8667#section-6"; container ospf-adj-flags { uses common-adj-flags; leaf set { type boolean; } } } case isis-adj-flags-case { reference "https://tools.ietf.org/html/rfc8667#section-2.2.1"; container isis-adj-flags { leaf address-family { type boolean; } uses common-adj-flags; leaf set { type boolean; } } } case epe-adj-flags-case { reference "https://tools.ietf.org/html/rfc9086#section-5"; container epe-adj-flags { uses common-adj-flags; } } } } grouping adj-sid-tlv { reference "https://tools.ietf.org/html/rfc9085#section-2.2.1"; uses adj-flags; leaf weight { type weight; } uses sid-label-index; } grouping lan-adj-sid-tlv { reference "https://tools.ietf.org/html/rfc9085#section-2.2.2"; uses adj-flags; leaf weight { type weight; } choice neighbor-type { case ospf-neighbor-case { leaf neighbor-id { type inet:ipv4-address-no-zone; } } case isis-neighbor-case { leaf iso-system-id { type netc:iso-system-identifier; } } } uses sid-label-index; } grouping epe-sid-tlv { reference "https://tools.ietf.org/html/rfc9086#section-5"; uses adj-flags; leaf weight { type weight; } uses sid-label-index; } // SRv6 typedef srv6-sid { reference "https://www.rfc-editor.org/rfc/rfc8986#section-3"; type binary { length 16; } } grouping srv6-flags { reference "https://tools.ietf.org/html/rfc9352#section-8.1 and rfc9513#section-9.1"; container flags { leaf backup { type boolean; } leaf set { type boolean; } leaf persistent { type boolean; } } } grouping srv6-sid-subtlvs { reference "https://tools.ietf.org/html/rfc9514#section-8"; container srv6-sid-structure { leaf locator-block-length { type uint8; } leaf locator-node-length { type uint8; } leaf function-length { type uint8; } leaf argument-length { type uint8; } } } grouping srv6-end-x-sid { reference "https://tools.ietf.org/html/rfc9514#section-4.1"; leaf endpoint-behavior { type uint16; } uses srv6-flags; leaf algo { type uint8; } leaf weight { type uint8; } leaf sid { type srv6-sid; } uses srv6-sid-subtlvs; } grouping srv6-lan-end-x-sid { reference "https://tools.ietf.org/html/rfc9514#section-4.2"; leaf endpoint-behavior { type uint16; } uses srv6-flags; leaf algo { type uint8; } leaf weight { type uint8; } choice neighbor-type { case ospfv3-neighbor-case { leaf neighbor-id { type inet:ipv4-address-no-zone; } } case isis-neighbor-case { leaf iso-system-id { type netc:iso-system-identifier; } } } leaf sid { type srv6-sid; } uses srv6-sid-subtlvs; } // Prefix Attributes grouping prefix-flags { reference "https://tools.ietf.org/html/rfc9085#section-2.3.1"; leaf no-php { type boolean; } leaf explicit-null { type boolean; } leaf value { type boolean; } leaf local { type boolean; } } grouping prefix-sid-tlv { reference "https://tools.ietf.org/html/rfc9085#section-2.3.1"; choice flags { case isis-prefix-flags-case { container isis-prefix-flags { reference "https://tools.ietf.org/html/rfc8667#section-2.2.1"; leaf re-advertisement { type boolean; } leaf node-sid { type boolean; } uses prefix-flags; } } case ospf-prefix-flags-case { container ospf-prefix-flags { reference "https://tools.ietf.org/html/rfc8665#section-5"; leaf mapping-server { type boolean; } uses prefix-flags; } } } leaf algorithm { type algorithm; } uses sid-label-index; } typedef flex-algo-prefix-flag { reference "http://tools.ietf.org/html/rfc9350#section-9"; type bits { bit external-metric { position 0; } } } grouping flex-algo-prefix-metric { reference "https://tools.ietf.org/html/rfc9351#section-4"; leaf flex-algo { type flex-algo; } leaf flags { type flex-algo-prefix-flag; } leaf metric { type uint32; } } grouping isis-range-flags { reference "https://tools.ietf.org/html/rfc8667#section-2.4.1"; leaf address-family { type boolean; } leaf mirror-context { type boolean; } leaf spread-tlv { type boolean; } leaf leaked-from-level-2 { type boolean; } leaf attached-flag { type boolean; } } grouping ospf-range-flags { reference "https://tools.ietf.org/html/rfc8665#section-4"; leaf inter-area { type boolean; } } grouping isis-attribute-flags { reference "http://tools.ietf.org/html/rfc7794#section-2.1"; leaf external-flag { type boolean; } leaf re-advertisement-flag { type boolean; } } grouping ospf-attribute-flags { reference "http://tools.ietf.org/html/rfc7684#section-2.1"; leaf attach-flag { type boolean; } } grouping ospfv3-attribute-flags { reference "http://tools.ietf.org/html/rfc8362#section-3.1"; leaf dn-flag { type boolean; } leaf propagate-flag { type boolean; } leaf local-address-flag { type boolean; } leaf no-unicast-flag { type boolean; } } grouping prefix-attribute-flags { reference "https://tools.ietf.org/html/rfc9085#section-2.3.2"; leaf node-flag { type boolean; } choice igp-attribute-flags { case isis-attribute-flags-case { uses isis-attribute-flags; } case ospf-attribute-flags-case { uses ospf-attribute-flags; } case ospfv3-attribute-flags-case { uses ospfv3-attribute-flags; } } } grouping range-tlv { reference "https://tools.ietf.org/html/rfc9085#section-2.3.5"; choice range-flags { case isis-range-flags-case { uses isis-range-flags; } case ospf-range-flags-case { uses ospf-range-flags; } } leaf range-size { type uint16; } container prefix-sid { uses prefix-sid-tlv; } } grouping srv6-locator { reference "https://tools.ietf.org/html/rfc9514#section-5.1"; container flags { leaf up-down { type boolean; } } leaf algo { type uint8; } leaf metric { type uint32; } } // NLRI grouping srv6-endpoint-behavior { reference "https://tools.ietf.org/html/rfc9514#section-7.1"; leaf endpoint-behavior { type uint16; } leaf algo { type uint8; } } grouping srv6-bgp-peer-node { reference "https://tools.ietf.org/html/rfc9514#section-7.2"; uses srv6-flags; leaf weight { type uint8; } leaf peer-as-number { description "Peer AS Number."; type inet:as-number; } leaf peer-bgp-id { description "Peer BGP Router Identifier."; type inet:ipv4-address-no-zone; } } grouping srv6-attributes { reference "https://tools.ietf.org/html/rfc9514#section-7"; container srv6-endpoint-behavior { uses srv6-endpoint-behavior; } container srv6-bgp-peer-node { uses srv6-bgp-peer-node; } uses srv6-sid-subtlvs; } }