All Downloads are FREE. Search and download functionalities are using the official Maven repository.

[email protected] Maven / Gradle / Ivy

There is a newer version: 0.22.6
Show newest version
module bgp-linkstate {
    yang-version 1;
    namespace "urn:opendaylight:params:xml:ns:yang:bgp-linkstate";
    prefix "bgp-ls";

    import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
    import ietf-routing-types { prefix rt-types; }
    import bgp-message { prefix bgp-msg; revision-date 2020-01-20; }
    import bgp-multiprotocol { prefix bgp-mp; revision-date 2018-03-29; }
    import bgp-rib { prefix bgp-rib; revision-date 2018-03-29; }
    import bgp-types { prefix bgp-t; revision-date 2020-01-20; }
    import network-concepts { prefix netc; revision-date 2013-11-25; }
    import rsvp { prefix rsvp; revision-date 2015-08-20; }
    import bgp-segment-routing { prefix bgp-sr; revision-date 2020-01-20; }
    import bgp-epe { prefix bgp-epe; revision-date 2020-01-20; }
    import bmp-monitor { prefix bmp-mon; revision-date 2020-01-20; }

    organization "Cisco Systems, Inc.";
    contact "Dana Kutenicsova ";

    description
        "This module contains the base data model of a BGP message.
        It rolls up the definitions contained in RFC4271
        and RFC7752.

        Copyright (c)2013 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 2020-01-20 {
        description "Update to use -no-zone-adresses";
    }

    revision "2018-03-29" {
        description "Add support for add-path for all afi/safi.
            and Updated to include Performance Metric Extensions";
        reference "draft-ietf-idr-te-pm-bgp-17";
    }

    revision "2017-12-07" {
        description "Add support for add-path in base BGP NLRI.";
    }

    revision "2015-02-10" {
        description
            "Updated to include segment routing.";
    }

    revision "2013-11-25" {
        description
            "Updated to cover network-concepts.";
    }

    revision "2013-09-18" {
        description
            "Initial revision.";
        reference "draft-ietf-idr-ls-distribution-03";
    }

    identity linkstate-address-family {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2";

        base bgp-t:address-family;
    }

    identity linkstate-subsequent-address-family {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2";

        base bgp-t:subsequent-address-family;
    }

    typedef nlri-type {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2";
        type enumeration {
            enum node {
                value 1;
            }
            enum link {
                value 2;
            }
            enum ipv4-prefix {
                value 3;
            }
            enum ipv6-prefix {
                value 4;
            }
            enum ipv4-te-lsp {
                status deprecated;
                reference "http://tools.ietf.org/html/rfc7752#section-4.1";
                value 5;
            }
            enum ipv6-te-lsp {
                status deprecated;
                reference "http://tools.ietf.org/html/rfc7752#section-4.1";
                value 6;
            }
        }
    }

    typedef protocol-id {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2";
        type enumeration {
            enum isis-level1 {
                value 1;
            }
            enum isis-level2 {
                value 2;
            }
            enum ospf {
                value 3;
            }
            enum direct {
                value 4;
            }
            enum static {
                value 5;
            }
            enum ospf-v3 {
                value 6;
            }
            enum bgp-epe {
                reference "https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05#section-4";
                value 7;
            }
            enum rsvp-te {
                status deprecated;
                reference "http://tools.ietf.org/html/rfc7752#section-2.1";
                value 8; // rsvp-te protocol-id TBD by IANA
            }
            enum segment-routing {
                status deprecated;
                reference "http://tools.ietf.org/html/rfc7752#section-2.1";
                value 9; // segment-routing protocol-id TBD by IANA
            }
        }
    }

    typedef ospf-route-type {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.3.1";
        type enumeration {
            enum intra-area {
                value 1;
            }
            enum inter-area {
                value 2;
            }
            enum external1 {
                value 3;
            }
            enum external2 {
                value 4;
            }
            enum nssa1 {
                value 5;
            }
            enum nssa2 {
                value 6;
            }
        }
    }

    typedef identifier {
        type uint64;
    }

    typedef domain-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        type uint32;
    }

    typedef area-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        type uint32;
    }

    typedef ipv4-interface-identifier {
        reference "http://tools.ietf.org/html/rfc5305#section-3.2";
        type inet:ipv4-address-no-zone;
    }

    typedef ipv6-interface-identifier {
        reference "http://tools.ietf.org/html/rfc6119#section-4.2";
        type inet:ipv6-address-no-zone;
    }

    typedef ospf-interface-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        type uint32;
    }

    typedef topology-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.5";
        type uint16 {
            range "0..4095";
        }
    }


    grouping isis-router-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        leaf iso-system-id {
            type netc:iso-system-identifier;
            mandatory true;
        }
    }

    grouping isis-lan-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        container is-is-router-identifier {
            uses isis-router-identifier;
        }
        leaf psn {
            type uint8 {
                range "1..255";
            }
            mandatory true;
        }
    }

    grouping ospf-router-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        leaf ospf-router-id {
            type uint32;
            mandatory true;
        }
    }

    grouping ospf-v2-lan-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        uses ospf-router-identifier;
        leaf ipv4-address {
            type ipv4-interface-identifier;
            mandatory true;
        }
    }

    grouping ospf-v3-lan-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.2.1.4";
        uses ospf-router-identifier;
        leaf lan-interface {
            type ospf-interface-identifier;
            mandatory true;
        }
    }

    grouping node-identifier {
        leaf as-number {
            type inet:as-number;
        }
        leaf area-id {
            type area-identifier;
        }
        leaf domain-id {
            type domain-identifier;
        }
        choice c-router-identifier {
            case isis-node-case {
                container isis-node {
                    uses isis-router-identifier;
                }
            }
            case isis-pseudonode-case {
                container isis-pseudonode {
                    uses isis-lan-identifier;
                }
            }
            case ospf-node-case {
                container ospf-node {
                    uses ospf-router-identifier;
                }
            }
            case ospf-pseudonode-case {
                container ospf-pseudonode {
                    uses ospf-v3-lan-identifier;
                }
            }
        }
    }

    grouping link-lr-identifiers {
        reference "http://tools.ietf.org/html/rfc5307";
        leaf link-local-identifier {
            type uint32;
        }
        leaf link-remote-identifier {
            type uint32;
        }
    }

    grouping prefix-identifiers {
        leaf multi-topology-id {
            type topology-identifier;
        }
        leaf ospf-route-type {
            when "../../protocol-id[ .='ospf' or .='ospf-v3' ]";
            type ospf-route-type;
        }
        leaf ip-reachability-information {
            type inet:ip-prefix;
        }
    }

    grouping link-identifier {
        uses link-lr-identifiers;
        leaf ipv4-interface-address {
            type ipv4-interface-identifier;
        }
        leaf ipv6-interface-address {
            type ipv6-interface-identifier;
        }
        leaf ipv4-neighbor-address {
            type ipv4-interface-identifier;
        }
        leaf ipv6-neighbor-address {
            type ipv6-interface-identifier;
        }
        leaf multi-topology-id {
            type topology-identifier;
        }
    }

    grouping linkstate {
        uses bgp-t:route-distinguisher-grouping {
            refine route-distinguisher {
                mandatory false;
            }
        }
        leaf protocol-id {
            type protocol-id;
            mandatory true;
        }
        leaf identifier {
            type identifier;
            mandatory true;
        }
        choice object-type {
            case node-case {
                container node-descriptors {
                    uses node-identifier;
                }
            }
            case link-case {
                container local-node-descriptors {
                    uses node-identifier;
                    uses bgp-epe:epe-node-descriptors;
                }
                container remote-node-descriptors {
                    uses node-identifier;
                    uses bgp-epe:epe-node-descriptors;
                }
                container link-descriptors {
                    uses link-identifier;
                }
            }
            case prefix-case {
                container advertising-node-descriptors {
                    uses node-identifier;
                }
                container prefix-descriptors {
                    uses prefix-identifiers;
                }
            }
            case te-lsp-case {
                choice address-family {
                    case ipv4-case {
                        leaf ipv4-tunnel-sender-address {
                            type inet:ipv4-address-no-zone;
                            mandatory true;
                        }
                        leaf ipv4-tunnel-endpoint-address {
                            type inet:ipv4-address-no-zone;
                            mandatory true;
                        }
                    }
                    case ipv6-case {
                        leaf ipv6-tunnel-sender-address {
                            type inet:ipv6-address-no-zone;
                            mandatory true;
                        }
                        leaf ipv6-tunnel-endpoint-address {
                            type inet:ipv6-address-no-zone;
                            mandatory true;
                        }
                    }
                }
                leaf tunnel-id {
                    type rsvp:tunnel-id;
                }
                leaf lsp-id {
                    type rsvp:lsp-id;
                }
            }
        }
    }

    grouping linkstate-destination {
        list c-linkstate-destination {
            uses linkstate;
            uses bgp-msg:path-id-grouping;
        }
    }

    augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type" {
        case destination-linkstate-case {
            container destination-linkstate {
                uses linkstate-destination;
            }
        }
    }

    augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type" {
        case destination-linkstate-case {
            container destination-linkstate {
                uses linkstate-destination;
            }
        }
    }

    typedef node-flag-bits {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.1.1";
        type bits {
            bit overload {
                position 0;
            }
            bit attached {
                position 1;
            }
            bit external {
                position 2;
            }
            bit abr {
                position 3;
            }
            bit router {
                position 4;
            }
            bit v6 {
                position 5;
            }
        }
    }

    typedef isis-area-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.1.2";
        type binary {
            length "1..20";
        }
    }

    typedef ipv4-router-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.1.4";
        type inet:ipv4-address-no-zone;
    }

    typedef ipv6-router-identifier {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.1.4";
        type inet:ipv6-address-no-zone;
    }

    grouping node-state {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.1";
        leaf-list topology-identifier {
            type topology-identifier;
        }
        leaf node-flags {
            type node-flag-bits;
        }
        leaf-list isis-area-id {
            type isis-area-identifier;
        }
        leaf dynamic-hostname {
            type string;
        }
        leaf ipv4-router-id {
            type ipv4-router-identifier;
        }
        leaf ipv6-router-id {
            type ipv6-router-identifier;
        }
        container sr-capabilities {
            uses bgp-sr:sr-capabilities-tlv;
        }
        container sr-algorithm {
            uses bgp-sr:sr-algorithms-tlv;
        }
    }

    typedef link-protection-type {
        reference "http://tools.ietf.org/html/rfc5307#section-1.2";
        type enumeration {
            enum extra-traffic {
                value 1;
            }
            enum unprotected {
                value 2;
            }
            enum shared {
                value 4;
            }
            enum dedicated-1to1 {
                value 8;
            }
            enum dedicated-1plus1 {
                value 16;
            }
            enum enhanced {
                value 32;
            }
        }
    }

    // linkstate
    typedef mpls-protocol-mask {
        reference "http://tools.ietf.org/html/rfc7752#section-3.3.2.2";
        type bits {
            bit ldp {
                position 0;
            }
            bit rsvpte {
                position 1;
            }
        }
    }

    typedef administrative-group {
        type uint32;
    }

    grouping unreserved-bandwidth {
        leaf priority {
            type uint8 {
                range "0..7";
            }
        }
        leaf bandwidth {
            type netc:bandwidth;
        }
    }

    typedef delay {
        description "This 24-bit typedef describes delay over a configurable
            interval in microseconds, encoded as an integer value. When set to
            the maximum value 16,777,215 (16.777215 sec), then the delay is at
            least that value, and it may be larger.";
        reference "https://tools.ietf.org/html/rfc7471#section-4.1.5";
        type rt-types:uint24;
        units microseconds;
    }

    typedef loss {
        description "This 24-bit typedef describes packet loss as a percentage
            of the total traffic sent over a configurable interval. The basic
            unit is 0.000003%, where (2^24 - 2) is 50.331642%. This value is
            the highest packet loss percentage that can be expressed.
            Therefore, measured values that are larger than the field maximum
            SHOULD be encoded as the maximum value.";
        reference "https://tools.ietf.org/html/rfc7471#section-4.4.5";
        type rt-types:uint24;
        units percent;
    }

    grouping linkstate-attribute {
        reference "http://tools.ietf.org/html/rfc7752#section-3.3.2";
        leaf local-ipv4-router-id {
            type ipv4-router-identifier;
        }
        leaf local-ipv6-router-id {
            type ipv6-router-identifier;
        }
        leaf remote-ipv4-router-id {
            type ipv4-router-identifier;
        }
        leaf remote-ipv6-router-id {
            type ipv6-router-identifier;
        }
        leaf mpls-protocol {
            type mpls-protocol-mask;
        }
        leaf te-metric {
            type netc:te-metric;
        }
        leaf metric {
            type netc:metric;
        }
        leaf-list shared-risk-link-groups {
            type rsvp:srlg-id;
        }
        leaf link-name {
            type string;
        }
        leaf max-link-bandwidth {
            type netc:bandwidth;
        }
        leaf max-reservable-bandwidth {
            type netc:bandwidth;
        }
        list unreserved-bandwidth {
            key "priority";
            uses unreserved-bandwidth;
        }
        leaf link-protection {
            type link-protection-type;
        }
        leaf admin-group {
            type administrative-group;
        }
        list sr-adj-ids {
            uses bgp-sr:adj-sid-tlv;
        }
        list sr-lan-adj-ids {
            uses bgp-sr:lan-adj-sid-tlv;
        }
        container peer-node-sid {
            description "The SID representing the peer of the BGP session.";
            reference "https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05#section-4.3";
            uses bgp-sr:epe-adj-sid-tlv;
        }
        container peer-adj-sid {
            description "The SID representing the peer of the BGP session.";
            reference "https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05#section-4.3";
            uses bgp-sr:epe-adj-sid-tlv;
        }
        list peer-set-sids {
            description "The SID representing the group the peer is part of.";
            reference "https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05#section-4.3";
            uses bgp-sr:epe-adj-sid-tlv;
        }
        // Performance Metric https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2
        leaf link-delay {
            description "Unidirectional Link Delay";
            reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.1";
            type delay;
        }
        container link-min-max-delay {
            description "Min/Max Unidirectional Link Delay";
            reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.2";
            leaf min-delay {
                type delay;
            }
            leaf max-delay {
                type delay;
            }
        }
        leaf delay-variation {
            description "Unidirectional Delay Variation";
            reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.3";
            type delay;
        }
        leaf link-loss {
            description "Unidirectional Link Loss";
            reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.4";
            type loss;
        }
        leaf residual-bandwidth {
            description "Unidirectional Residual Bandwidth";
            reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.5";
            type netc:bandwidth;
        }
        leaf available-bandwidth {
            description "Unidirectional Available Bandwidth";
            reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.6";
            type netc:bandwidth;
        }
        leaf utilized-bandwidth {
            description "Unidirectional Utilized Bandwidth";
            reference "https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-17#section-2.7";
            type netc:bandwidth;
        }
    }

    typedef route-tag {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.3.2";
        description "Carries original IGP TAGs of the prefix.";
        type binary {
            length "4";
        }
    }

    typedef extended-route-tag {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.3.3";
        description "Carries IS-IS Extended Route Tags of the prefix.";
        type binary {
            length "8";
        }
    }

    grouping igp-bits {
        reference "https://tools.ietf.org/html/rfc7752#section-3.3.3.1";
        leaf up-down {
            status deprecated;
            type bits {
                bit up-down {
                    position 0;
                }
            }
        }
        leaf is-is-up-down {
            type boolean;
        }
        leaf ospf-no-unicast {
            type boolean;
        }
        leaf ospf-local-address {
            type boolean;
        }
        leaf ospf-propagate-nssa {
            type boolean;
        }
    }

    grouping prefix-state {
        container igp-bits {
            uses igp-bits;
        }
        leaf-list route-tags {
            type route-tag;
        }
        leaf-list extended-tags {
            type extended-route-tag;
        }
        leaf prefix-metric {
            type netc:igp-metric;
        }
        leaf ospf-forwarding-address {
            type inet:ip-address-no-zone;
        }
        container sr-prefix {
            uses bgp-sr:prefix-sid-tlv;
        }
        container ipv6-sr-prefix {
            uses bgp-sr:ipv6-prefix-sid-tlv;
        }
        container sr-range {
            uses bgp-sr:range-tlv;
        }
        list sr-binding-sid-labels {
            uses bgp-sr:binding-sid-tlv;
        }
    }

    grouping linkstate-path-attribute {
        choice link-state-attribute {
            case node-attributes-case {
                container node-attributes {
                    uses node-state;
                }
            }
            case link-attributes-case {
                container link-attributes {
                    uses linkstate-attribute;
                }
            }
            case prefix-attributes-case {
                container prefix-attributes {
                    uses prefix-state;
                }
            }
            case te-lsp-attributes-case {
                status deprecated;
                description "LSP Object";
                reference "http://tools.ietf.org/html/rfc7752#section-2.2";
                container te-lsp-attributes {
                    uses rsvp:tspec-object;
                    uses rsvp:flow-spec-object;
                    uses rsvp:session-attribute-object;
                    uses rsvp:explicit-route-object;
                    uses rsvp:secondary-explicit-route-object;
                    uses rsvp:record-route-object;
                    uses rsvp:secondary-record-route-object;
                    uses rsvp:fast-reroute-object;
                    uses rsvp:detour-object;
                    uses rsvp:exclude-route-object;
                    uses rsvp:lsp-attributes-object;
                    uses rsvp:lsp-required-attributes-object;
                    uses rsvp:protection-object;
                    uses rsvp:association-object;
                    uses rsvp:primary-path-route-object;
                    uses rsvp:admin-status-object;
                    uses rsvp:bandwidth-object;
                    uses rsvp:metric-object;
                }
            }
        }
    }

    grouping linkstate-routes {
        container linkstate-routes {
            list linkstate-route {
                description
                    "Link-state information entry. Due to
                    the complexity of link-state information
                    and YANG limitations this is the top-level
                    object from contract perspective. It is
                    keyed by route-key, whose format is
                    internal to the implementation exposing
                    this information. As an explicit example
                    it can rely on information stored in the
                    entry's subtree, so the subtree MUST NOT
                    be modified by outside entities.
                    Augmentations can attach data, but must
                    be explicitly aware that such data, unlike
                    the data modeled directly here, does not
                    have any effects on keys, especially they
                    must not impact equality tests.";

                key "route-key path-id";

                uses linkstate;
                uses bgp-rib:route {
                    augment attributes {
                        uses linkstate-path-attribute;
                    }
                }
            }
        }
    }

    augment "/bgp-msg:update/bgp-msg:attributes" {
        uses linkstate-path-attribute;
    }

    augment "/bgp-rib:application-rib/bgp-rib:tables/bgp-rib:routes" {
        case linkstate-routes-case {
            uses linkstate-routes;
        }
    }

    augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:loc-rib/bgp-rib:tables/bgp-rib:routes" {
        case linkstate-routes-case {
            uses linkstate-routes;
        }
    }

    augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-in/bgp-rib:tables/bgp-rib:routes" {
        case linkstate-routes-case {
            uses linkstate-routes;
        }
    }

    augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:effective-rib-in/bgp-rib:tables/bgp-rib:routes" {
        case linkstate-routes-case {
            uses linkstate-routes;
        }
    }

    augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-out/bgp-rib:tables/bgp-rib:routes" {
        case linkstate-routes-case {
            uses linkstate-routes;
        }
    }

    augment "/bmp-mon:bmp-monitor/bmp-mon:monitor/bmp-mon:router/bmp-mon:peer/bmp-mon:pre-policy-rib/bmp-mon:tables/bmp-mon:routes" {
        case linkstate-routes-case {
            uses linkstate-routes;
        }
    }

    augment "/bmp-mon:bmp-monitor/bmp-mon:monitor/bmp-mon:router/bmp-mon:peer/bmp-mon:post-policy-rib/bmp-mon:tables/bmp-mon:routes" {
        case linkstate-routes-case {
            uses linkstate-routes;
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy