module bgp-types { yang-version 1; namespace "urn:opendaylight:params:xml:ns:yang:bgp-types"; prefix "bgp-t"; import ietf-inet-types { prefix inet; revision-date 2013-07-15; } import network-concepts { prefix netc; revision-date 2013-11-25; } organization "Cisco Systems, Inc."; contact "Dana Kutenicsova "; description "This module contains the base concepts contained in RFC4271 and RFC4760. 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 "RFC6514 Extended communities"; reference "https://tools.ietf.org/html/rfc6514"; } revision "2013-09-19" { description "Initial revision."; reference "RFC4271, RFC4760"; } typedef bgp-origin { reference "http://tools.ietf.org/html/rfc4271#section-5"; description "Values of BGP Origin Path Attribute."; type enumeration { enum igp { value 0; } enum egp { value 1; } enum incomplete { value 2; } } } typedef bgp-id { description "BGP identifier"; type inet:ipv4-address-no-zone; } identity address-family { reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2"; } identity ipv4-address-family { base address-family; } identity ipv6-address-family { base address-family; } identity subsequent-address-family { reference "http://tools.ietf.org/html/rfc4760#section-6"; } identity unicast-subsequent-address-family { reference "http://tools.ietf.org/html/rfc4760#section-6"; base subsequent-address-family; } identity mpls-labeled-vpn-subsequent-address-family { reference "http://tools.ietf.org/html/rfc4760#section-6"; base subsequent-address-family; } typedef cluster-identifier { reference "http://tools.ietf.org/html/rfc4456#section-8"; type inet:ipv4-address-no-zone; } typedef short-as-number { type inet:as-number { range 0..65535; } } typedef route-distinguisher { reference "https://tools.ietf.org/html/rfc4364#section-4.2"; type union { type rd-two-octet-as; type rd-ipv4; type rd-as; } } typedef rd-two-octet-as { type string { /* 2B AS : 4B number */ pattern '0:' + '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|' + '[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|' + '65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])' + ':' + '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|' + '[1-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9]|' + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|' + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-3][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|' + '4[0-1][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|42[0-8][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|' + '429[0-3][0-9][0-9][0-9][0-9][0-9][0-9]|4294[0-8][0-9][0-9][0-9][0-9][0-9]|' + '42949[0-5][0-9][0-9][0-9][0-9]|429496[0-6][0-9][0-9][0-9]|4294967[0-1][0-9][0-9]|' + '42949672[0-8][0-9]|429496729[0-5])'; } } typedef rd-ipv4 { type string { /* IPv4 : 2B number */ pattern '((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))' + ':' + '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|' + '[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|' + '65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])'; } } typedef rd-as { type string { /* 4B AS : 2B number */ pattern '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|' + '[1-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9]|' + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|' + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-3][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|' + '4[0-1][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|42[0-8][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|' + '429[0-3][0-9][0-9][0-9][0-9][0-9][0-9]|4294[0-8][0-9][0-9][0-9][0-9][0-9]|' + '42949[0-5][0-9][0-9][0-9][0-9]|429496[0-6][0-9][0-9][0-9]|4294967[0-1][0-9][0-9]|' + '42949672[0-8][0-9]|429496729[0-5])' + ':' + '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|' + '[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|' + '65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])'; } } typedef encapsulation-tunnel-type { reference "http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#tunnel-types"; type enumeration { enum l2tpv3-over-ip { value 1; } enum gre { value 2; } enum transmit-tunnel-endpoint { value 3; } enum ipsec-tunnel-mode { value 4; } enum ip-in-ip-ipsec-transport-mode { value 5; } enum mpls-in-ip-tunnel-ipsec-transport-mode { value 6; } enum ip-in-ip { value 7; } enum vxlan { value 8; } enum nvgre { value 9; } enum mpls { value 10; } enum mpls-in-gre { value 11; } enum vxlan-gpe { value 12; } enum mpls-in-udp { value 13; } enum ipv6-tunnel { value 14; } } } grouping bgp-aggregator { reference "http://tools.ietf.org/html/rfc4271#section-5.1.7"; description "BGP Path Attribute AGGREGATOR."; leaf as-number { // We are acting as a NEW speaker, so only four bytes are allowed type inet:as-number; } leaf network-address { type inet:ipv4-address-no-zone; } } grouping community { reference "https://tools.ietf.org/html/rfc1997"; description "Community Path Attribute"; leaf as-number { type inet:as-number; } leaf semantics { type uint16; } } grouping route-ipv4-extended-community { reference "http://tools.ietf.org/html/rfc4360"; leaf global-administrator { type inet:ipv4-address-no-zone; } leaf local-administrator { type uint16; } } grouping link-bandwidth-extended-community { reference "https://tools.ietf.org/html/draft-ietf-idr-link-bandwidth-06#section-2"; description "The Link Bandwidth extended community is optional non-transitive"; leaf bandwidth { description "Bandwidth of the link"; mandatory true; type netc:bandwidth; units "bytes per second"; } } grouping as-4-spec-common { container as-4-specific-common { leaf as-number { description "Carries a 4-octet Autonomous System (AS) number"; reference "https://tools.ietf.org/html/rfc5668#section-2"; mandatory true; type inet:as-number; } leaf local-administrator { type uint16; mandatory true; } } } grouping encapsulation-extended-community { reference "https://tools.ietf.org/html/rfc5512#section-4.5"; description "BGP Encapsulation extended community"; leaf tunnel-type { description "Tunnel type specifying the encapsulation protocol"; mandatory true; type encapsulation-tunnel-type; } } grouping inet4-specific-extended-community-common { container inet4-specific-extended-community-common { leaf global-administrator { type inet:ipv4-address-no-zone; } leaf local-administrator { type binary { length "2"; } } } } grouping source-as-4-extended-community-grouping { reference "https://tools.ietf.org/html/rfc6514#section-6"; leaf global-administrator { description "Carries a 4-octet Autonomous System (AS) number"; reference "https://tools.ietf.org/html/rfc5668#section-2"; mandatory true; type inet:as-number; } } grouping source-as-extended-community-grouping { reference "https://tools.ietf.org/html/rfc6514#section-6"; leaf global-administrator { type bgp-t:short-as-number; } } grouping route-target { description "Marker grouping for Route Target extended communities."; } grouping route-target-constrain-default-route-grouping { container route-target-constrain-default-route { uses route-target; presence "The presence of this container indicates that the routes is a default route target"; } } grouping route-target-extended-community-grouping { container route-target-extended-community { description "Type 0x00 / Subtype 0x02"; reference "http://tools.ietf.org/html/rfc4360#section-4"; uses route-target; leaf global-administrator { type short-as-number; } leaf local-administrator { type binary { length "4"; } } } } grouping route-target-ipv4-grouping { container route-target-ipv4 { description "Type 0x01 / Subtype 0x02"; reference "http://tools.ietf.org/html/rfc4360#section-4"; uses route-target; uses route-ipv4-extended-community; } } grouping as-4-route-target-extended-community-grouping { container as-4-route-target-extended-community { description "Type 0x02 / Subtype 0x02"; reference "https://tools.ietf.org/html/rfc5668"; uses route-target; uses as-4-spec-common; } } grouping extended-community { leaf transitive { type boolean; } choice extended-community { case as-specific-extended-community-case { container as-specific-extended-community { leaf global-administrator { type short-as-number; } leaf local-administrator { type binary { length "4"; } } } } case inet4-specific-extended-community-case { container inet4-specific-extended-community { uses inet4-specific-extended-community-common; leaf global-administrator { status deprecated; type inet:ipv4-address-no-zone; } leaf local-administrator { status deprecated; type binary { length "2"; } } } } case opaque-extended-community-case { container opaque-extended-community { leaf value { type binary { length "6"; } } } } case route-target-extended-community-case { uses route-target-extended-community-grouping; } case route-target-ipv4-case { uses route-target-ipv4-grouping; } case as-4-route-target-extended-community-case { uses as-4-route-target-extended-community-grouping; } case route-origin-extended-community-case { container route-origin-extended-community { leaf global-administrator { type short-as-number; } leaf local-administrator { type binary { length "4"; } } } } case route-origin-ipv4-case { container route-origin-ipv4 { reference "http://tools.ietf.org/html/rfc4360#section-5"; uses route-ipv4-extended-community; } } case link-bandwidth-case { container link-bandwidth-extended-community { uses link-bandwidth-extended-community; } } case as-4-generic-spec-extended-community-case { container as-4-generic-spec-extended-community { reference "https://www.ietf.org/archive/id/draft-ietf-idr-as4octet-extcomm-generic-subtype-08.txt"; uses as-4-spec-common; } } case as-4-route-origin-extended-community-case { container as-4-route-origin-extended-community { reference "https://tools.ietf.org/html/rfc5668"; uses as-4-spec-common; } } case encapsulation-case { container encapsulation-extended-community { uses encapsulation-extended-community; } } case vrf-route-import-extended-community-case { reference "https://tools.ietf.org/html/rfc6514#section-7"; container vrf-route-import-extended-community { uses inet4-specific-extended-community-common; } } case source-as-4-extended-community-case { container source-as-4-extended-community { uses source-as-4-extended-community-grouping; } } case source-as-extended-community-case { container source-as-extended-community { uses source-as-extended-community-grouping; } } } } grouping next-hop { choice c-next-hop { default empty-next-hop-case; case ipv4-next-hop-case { container ipv4-next-hop { reference "http://tools.ietf.org/html/rfc4271#section-5.1.3"; leaf global { type inet:ipv4-address-no-zone; mandatory true; } } } case ipv6-next-hop-case { container ipv6-next-hop { reference "http://tools.ietf.org/html/rfc4760#section-3"; leaf global { type inet:ipv6-address-no-zone; mandatory true; } leaf link-local { type inet:ipv6-address-no-zone; } } } case empty-next-hop-case { leaf empty-next-hop { type empty; } } } } grouping as-path-segment { reference "http://tools.ietf.org/html/rfc4271#section-5.1.2"; leaf-list as-sequence { type inet:as-number; ordered-by user; max-elements "255"; } leaf-list as-set { type inet:as-number; } } grouping route-distinguisher-grouping { leaf route-distinguisher { type route-distinguisher; mandatory true; } } grouping orig-route-ip-grouping { leaf orig-route-ip { type inet:ip-address-no-zone; mandatory true; } } }