module bgp-flowspec { yang-version 1; namespace "urn:opendaylight:params:xml:ns:yang:bgp-flowspec"; prefix "bgp-fs"; import ietf-inet-types { prefix inet; revision-date 2013-07-15; } 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 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 flow specification. It rolls up the definitions contained in RFC5575. 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 2020-01-20 { description "Update to use -no-zone-adresses"; } revision "2018-03-29" { description "Add support for add-path for all afi/safi."; } revision "2017-12-07" { description "Add support for add-path in base BGP NLRI."; } revision "2015-08-07" { description "IPv6 support"; reference "https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-06"; } revision "2015-01-14" { description "Initial revision."; reference "http://tools.ietf.org/html/rfc5575"; } identity flowspec-subsequent-address-family { description "SAFI 133 for dissemination of unicast flow specification rules."; reference "http://tools.ietf.org/html/rfc5575#section-11"; base bgp-t:subsequent-address-family; } identity flowspec-l3vpn-subsequent-address-family { description "SAFI 134 for dissemination of L3VPN flow specification rules"; reference "http://tools.ietf.org/html/rfc5575#section-11"; base bgp-t:subsequent-address-family; } typedef fragment { reference "http://tools.ietf.org/html/rfc5575#section-4"; type bits { bit last { position 4; } bit first { position 5; } bit is-a { position 6; } bit do-not { position 7; } } } typedef dscp { reference "https://tools.ietf.org/html/rfc2474#section-3"; type uint8 { range "0..63"; } } typedef numeric-operand { reference "http://tools.ietf.org/html/rfc5575#section-4"; type bits { bit end-of-list { position 0; } bit and-bit { position 1; } bit less-than { position 5; } bit greater-than { position 6; } bit equals { position 7; } } } typedef bitmask-operand { reference "http://tools.ietf.org/html/rfc5575#section-4"; type bits { bit end-of-list { position 0; } bit and-bit { position 1; } bit not { position 6; } bit match { position 7; } } } grouping numeric-two-byte-value { reference "http://tools.ietf.org/html/rfc5575#section-4"; leaf op { type numeric-operand; } leaf value { type uint16; } } grouping numeric-one-byte-value { reference "http://tools.ietf.org/html/rfc5575#section-4"; leaf op { type numeric-operand; } leaf value { type uint8; } } grouping bitmask-two-byte-value { reference "http://tools.ietf.org/html/rfc5575#section-4"; leaf op { type bitmask-operand; } leaf value { type uint16; } } grouping dscp-value { reference "http://tools.ietf.org/html/rfc5575#section-4"; leaf op { type numeric-operand; } leaf value { type dscp; } } grouping fragment-value { reference "http://tools.ietf.org/html/rfc5575#section-4"; leaf op { type bitmask-operand; } leaf value { type fragment; } } grouping flowspec-destination { reference "http://tools.ietf.org/html/rfc5575#section-4"; list flowspec { choice flowspec-type { case port-case { list ports { uses numeric-two-byte-value; } } case destination-port-case { list destination-ports { uses numeric-two-byte-value; } } case source-port-case { list source-ports { uses numeric-two-byte-value; } } case icmp-type-case { list types { uses numeric-one-byte-value; } } case icmp-code-case { list codes { uses numeric-one-byte-value; } } case tcp-flags-case { list tcp-flags { uses bitmask-two-byte-value; } } case packet-length-case { list packet-lengths { uses numeric-two-byte-value; } } case dscp-case { list dscps { uses dscp-value; } } case fragment-case { list fragments { uses fragment-value; } } } } } grouping flowspec-destination-group-ipv4 { reference "http://tools.ietf.org/html/rfc5575#section-4"; uses flowspec-destination { augment "flowspec/flowspec-type" { case destination-prefix-case { leaf destination-prefix { type inet:ipv4-prefix; } } case source-prefix-case { leaf source-prefix { type inet:ipv4-prefix; } } case protocol-ip-case { list protocol-ips { uses numeric-one-byte-value; } } } } } grouping flow-label-value { reference "https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-06#section-3"; leaf op { type numeric-operand; } leaf value { type uint32; } } grouping flowspec-destination-group-ipv6 { reference "https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-06#section-3.1"; uses flowspec-destination { augment "flowspec/flowspec-type" { case destination-ipv6-prefix-case { leaf destination-prefix { type inet:ipv6-prefix; } } case source-ipv6-prefix-case { leaf source-prefix { type inet:ipv6-prefix; } } case next-header-case { list next-headers { uses numeric-one-byte-value; } } case flow-label-case { list flow-label { uses flow-label-value; } } } } } grouping flowspec-destination-ipv4 { container destination-flowspec-ipv4 { uses flowspec-destination-group-ipv4; uses bgp-msg:path-id-grouping; } } grouping flowspec-destination-ipv6 { container destination-flowspec-ipv6 { uses flowspec-destination-group-ipv6; uses bgp-msg:path-id-grouping; } } grouping flowspec-l3vpn-destination-ipv4 { container destination-flowspec-l3vpn-ipv4 { uses bgp-t:route-distinguisher-grouping; uses flowspec-destination-group-ipv4; uses bgp-msg:path-id-grouping; } } grouping flowspec-l3vpn-destination-ipv6 { container destination-flowspec-l3vpn-ipv6 { uses bgp-t:route-distinguisher-grouping; uses flowspec-destination-group-ipv6; 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-flowspec-case { uses flowspec-destination-ipv4; } case destination-flowspec-ipv6-case { uses flowspec-destination-ipv6; } case destination-flowspec-l3vpn-ipv4-case { uses flowspec-l3vpn-destination-ipv4; } case destination-flowspec-l3vpn-ipv6-case { uses flowspec-l3vpn-destination-ipv6; } } augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type" { case destination-flowspec-case { uses flowspec-destination-ipv4; } case destination-flowspec-ipv6-case { uses flowspec-destination-ipv6; } case destination-flowspec-l3vpn-ipv4-case { uses flowspec-l3vpn-destination-ipv4; } case destination-flowspec-l3vpn-ipv6-case { uses flowspec-l3vpn-destination-ipv6; } } grouping traffic-rate-extended-community { container traffic-rate-extended-community { leaf informative-as { type bgp-t:short-as-number; } leaf local-administrator { type netc:bandwidth; } } } grouping traffic-action-extended-community { container traffic-action-extended-community { leaf sample { type boolean; default false; } leaf terminal-action { type boolean; default false; } } } grouping redirect-extended-community { container redirect-extended-community { leaf global-administrator { type bgp-t:short-as-number; } leaf local-administrator { type binary { length "4"; } } } } grouping redirect-ipv4-extended-community { reference "http://tools.ietf.org/html/rfc7674"; container redirect-ipv4 { uses bgp-t:route-ipv4-extended-community; } } grouping redirect-ipv6-extended-community { container redirect-ipv6 { leaf global-administrator { type inet:ipv6-address-no-zone; } leaf local-administrator { type uint16; } } } grouping redirect-as4-extended-community { reference "http://tools.ietf.org/html/rfc7674"; container redirect-as4 { leaf global-administrator { type inet:as-number; } leaf local-administrator { type uint16; } } } grouping traffic-marking-extended-community { container traffic-marking-extended-community { leaf global-administrator { type dscp; } } } grouping redirect-ip-nh-extended-community { reference "https://tools.ietf.org/html/draft-ietf-idr-flowspec-redirect-ip-02"; container redirect-ip-nh-extended-community { leaf next-hop-address { type inet:ip-address-no-zone; } leaf copy { type boolean; } } } grouping bgp-rib-route { uses bgp-rib:route { augment "attributes/extended-communities/extended-community" { case traffic-rate-extended-community-case { uses traffic-rate-extended-community; } case traffic-action-extended-community-case { uses traffic-action-extended-community; } case redirect-extended-community-case { uses redirect-extended-community; } case traffic-marking-extended-community-case { uses traffic-marking-extended-community; } case redirect-ipv4-extended-community-case { uses redirect-ipv4-extended-community; } case redirect-ipv6-extended-community-case { uses redirect-ipv6-extended-community; } case redirect-as4-extended-community-case { uses redirect-as4-extended-community; } case redirect-ip-nh-extended-community-case { uses redirect-ip-nh-extended-community; } } } } grouping flowspec-ipv4-route-list { uses flowspec-destination-group-ipv4; uses bgp-rib-route; } grouping flowspec-ipv4-route { list flowspec-route { key "route-key path-id"; uses flowspec-ipv4-route-list; } } grouping flowspec-l3vpn-ipv4-route { list flowspec-l3vpn-route { key "route-key path-id"; uses flowspec-ipv4-route-list; uses bgp-t:route-distinguisher-grouping; } } grouping flowspec-ipv6-route-list { uses flowspec-destination-group-ipv6; uses bgp-rib-route; } grouping flowspec-ipv6-route { list flowspec-route { key "route-key path-id"; uses flowspec-ipv6-route-list; } } grouping flowspec-l3vpn-ipv6-route { list flowspec-l3vpn-route { key "route-key path-id"; uses flowspec-ipv6-route-list; uses bgp-t:route-distinguisher-grouping; } } grouping flowspec-routes { container flowspec-routes { uses flowspec-ipv4-route; } } grouping flowspec-ipv6-routes { container flowspec-ipv6-routes { uses flowspec-ipv6-route; } } grouping flowspec-l3vpn-ipv4-routes { container flowspec-l3vpn-ipv4-routes { uses flowspec-l3vpn-ipv4-route; } } grouping flowspec-l3vpn-ipv6-routes { container flowspec-l3vpn-ipv6-routes { uses flowspec-l3vpn-ipv6-route; } } augment "/bgp-msg:update/bgp-msg:attributes/bgp-msg:extended-communities/bgp-msg:extended-community" { reference "https://tools.ietf.org/html/rfc5575#section-7"; case traffic-rate-extended-community-case { uses traffic-rate-extended-community; } case traffic-action-extended-community-case { uses traffic-action-extended-community; } case redirect-extended-community-case { uses redirect-extended-community; } case traffic-marking-extended-community-case { uses traffic-marking-extended-community; } case redirect-ipv4-extended-community-case { uses redirect-ipv4-extended-community; } case redirect-ipv6-extended-community-case { uses redirect-ipv6-extended-community; } case redirect-as4-extended-community-case { uses redirect-as4-extended-community; } case redirect-ip-nh-extended-community-case { uses redirect-ip-nh-extended-community; } } augment "/bgp-rib:application-rib/bgp-rib:tables/bgp-rib:routes" { case flowspec-routes-case { uses flowspec-routes; } case flowspec-ipv6-routes-case { uses flowspec-ipv6-routes; } case flowspec-l3vpn-ipv4-routes-case { uses flowspec-l3vpn-ipv4-routes; } case flowspec-l3vpn-ipv6-routes-case { uses flowspec-l3vpn-ipv6-routes; } } augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:loc-rib/bgp-rib:tables/bgp-rib:routes" { case flowspec-routes-case { uses flowspec-routes; } case flowspec-ipv6-routes-case { uses flowspec-ipv6-routes; } case flowspec-l3vpn-ipv4-routes-case { uses flowspec-l3vpn-ipv4-routes; } case flowspec-l3vpn-ipv6-routes-case { uses flowspec-l3vpn-ipv6-routes; } } augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-in/bgp-rib:tables/bgp-rib:routes" { case flowspec-routes-case { uses flowspec-routes; } case flowspec-ipv6-routes-case { uses flowspec-ipv6-routes; } case flowspec-l3vpn-ipv4-routes-case { uses flowspec-l3vpn-ipv4-routes; } case flowspec-l3vpn-ipv6-routes-case { uses flowspec-l3vpn-ipv6-routes; } } augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:effective-rib-in/bgp-rib:tables/bgp-rib:routes" { case flowspec-routes-case { uses flowspec-routes; } case flowspec-ipv6-routes-case { uses flowspec-ipv6-routes; } case flowspec-l3vpn-ipv4-routes-case { uses flowspec-l3vpn-ipv4-routes; } case flowspec-l3vpn-ipv6-routes-case { uses flowspec-l3vpn-ipv6-routes; } } augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-out/bgp-rib:tables/bgp-rib:routes" { case flowspec-routes-case { uses flowspec-routes; } case flowspec-ipv6-routes-case { uses flowspec-ipv6-routes; } case flowspec-l3vpn-ipv4-routes-case { uses flowspec-l3vpn-ipv4-routes; } case flowspec-l3vpn-ipv6-routes-case { uses flowspec-l3vpn-ipv6-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 flowspec-routes-case { uses flowspec-routes; } case flowspec-ipv6-routes-case { uses flowspec-ipv6-routes; } case flowspec-l3vpn-ipv4-routes-case { uses flowspec-l3vpn-ipv4-routes; } case flowspec-l3vpn-ipv6-routes-case { uses flowspec-l3vpn-ipv6-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 flowspec-routes-case { uses flowspec-routes; } case flowspec-ipv6-routes-case { uses flowspec-ipv6-routes; } case flowspec-l3vpn-ipv4-routes-case { uses flowspec-l3vpn-ipv4-routes; } case flowspec-l3vpn-ipv6-routes-case { uses flowspec-l3vpn-ipv6-routes; } } }