From 09d7806f42f5cc5458903c98618bd185c1559e5d Mon Sep 17 00:00:00 2001 From: vdhingra Date: Fri, 17 Jan 2020 04:36:10 -0800 Subject: [PATCH] bgpd: yang defination Yang files for bgpd to use northbound APIs Co-authored-by: Santosh P K Co-authored-by: vishaldhingra Signed-off-by: vishaldhingra --- yang/frr-bgp-bmp.yang | 179 ++++ yang/frr-bgp-common-multiprotocol.yang | 260 ++++++ yang/frr-bgp-common-structure.yang | 784 ++++++++++++++++++ yang/frr-bgp-common.yang | 1047 ++++++++++++++++++++++++ yang/frr-bgp-neighbor.yang | 112 +++ yang/frr-bgp-peer-group.yang | 70 ++ yang/frr-bgp-rpki.yang | 178 ++++ yang/frr-bgp-types.yang | 123 +++ yang/frr-bgp.yang | 689 ++++++++++++++++ yang/ietf/ietf-bgp-types.yang | 525 ++++++++++++ 10 files changed, 3967 insertions(+) create mode 100644 yang/frr-bgp-bmp.yang create mode 100644 yang/frr-bgp-common-multiprotocol.yang create mode 100644 yang/frr-bgp-common-structure.yang create mode 100644 yang/frr-bgp-common.yang create mode 100644 yang/frr-bgp-neighbor.yang create mode 100644 yang/frr-bgp-peer-group.yang create mode 100644 yang/frr-bgp-rpki.yang create mode 100644 yang/frr-bgp-types.yang create mode 100644 yang/frr-bgp.yang create mode 100644 yang/ietf/ietf-bgp-types.yang diff --git a/yang/frr-bgp-bmp.yang b/yang/frr-bgp-bmp.yang new file mode 100644 index 000000000000..f541225c2703 --- /dev/null +++ b/yang/frr-bgp-bmp.yang @@ -0,0 +1,179 @@ +submodule frr-bgp-bmp { + yang-version "1.1"; + + belongs-to frr-bgp { + prefix "bgp"; + } + + import ietf-inet-types { + prefix inet; + } + + import frr-bgp-types { + prefix frr-bt; + } + + include frr-bgp-common-multiprotocol; + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + grouping bmp-incoming-session { + container incoming-session { + list session-list { + key "address tcp-port"; + + leaf address { + type inet:ip-address; + description + "IPv4 address to listen on"; + } + leaf tcp-port { + type uint32; + } + } + } + } + + + grouping bmp-outgoing-session { + container outgoing-session { + list session-list { + key "hostname tcp-port"; + leaf hostname { + type string; + } + leaf tcp-port { + type uint32; + } + leaf min-retry-time { + type uint32 { + range "100..86400000"; + } + units "miliseconds"; + default 30000; + description + "Minimum connection retry interval"; + } + leaf max-retry-time { + type uint32 { + range "100..86400000"; + } + units "miliseconds"; + default 720000; + description + "Maximum connection retry interval"; + } + } + } + } + + grouping bmp-afi-safis { + container afi-safis { + description + "List of address-families associated with the BGP + instance"; + list afi-safi { + key "afi-safi-name"; + description + "AFI,SAFI configuration available for the + neighbour or group"; + uses mp-afi-safi-config; + uses mp-all-afi-safi-list-contents; + } + } + } + + grouping bmp-afi-safi-common-config { + container common-config { + + leaf pre-policy { + type boolean; + default false; + description + "Send state before policy and filter processing."; + } + leaf post-policy { + type boolean; + default false; + description + "Send state after policy and filter processing"; + } + + } + } + + grouping global-bmp-config { + description + "Structural grouping used to include filter + configuration and state for BMP"; + container bmp-config { + description + "BMP related parameters"; + list target-list { + key "target-name"; + + leaf target-name { + type string; + description + "Targets group name"; + } + uses bmp-incoming-session; + uses bmp-outgoing-session; + + leaf mirror { + type boolean; + default "false"; + description + "When set to 'TRUE' it send BMP route mirroring messages"; + } + + leaf stats-time { + type uint32 { + range "100..86400000"; + } + units "miliseconds"; + description + "Interval to send BMP Stats"; + } + + leaf ipv4-access-list { + type frr-bt:access-list-ref; + description + "Access list to restrict BMP sessions"; + } + + leaf ipv6-access-list { + type frr-bt:access-list-ref; + description + "Access list to restrict BMP sessions"; + } + + uses bmp-afi-safis; + } + + leaf mirror-buffer-limit { + type uint32 { + range "0..4294967294"; + } + units "Bytes"; + description + "Maximum memory used for buffered mirroring messages."; + } + } + } +} diff --git a/yang/frr-bgp-common-multiprotocol.yang b/yang/frr-bgp-common-multiprotocol.yang new file mode 100644 index 000000000000..9847a5b930e5 --- /dev/null +++ b/yang/frr-bgp-common-multiprotocol.yang @@ -0,0 +1,260 @@ +submodule frr-bgp-common-multiprotocol { + yang-version "1.1"; + + belongs-to frr-bgp { + prefix "bgp"; + } + + import ietf-bgp-types { + prefix bt; + } + + include frr-bgp-common; + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + identity ipv4-multicast { + base bt:afi-safi-type; + description + "IPv4 unicast (AFI,SAFI = 1,129)"; + } + + identity ipv6-multicast { + base bt:afi-safi-type; + description + "IPv6 unicast (AFI,SAFI = 2,129)"; + } + + identity ipv4-flowspec { + base bt:afi-safi-type; + description + "IPv4 unicast (AFI,SAFI = 1,133)"; + } + + + identity ipv6-flowspec { + base bt:afi-safi-type; + description + "IPv4 unicast (AFI,SAFI = 2,133)"; + } + + grouping mp-afi-safi-config { + description + "Configuration parameters used for all BGP AFI-SAFIs"; + leaf afi-safi-name { + type identityref { + base "bt:afi-safi-type"; + } + description "AFI,SAFI"; + } + } + + grouping mp-all-afi-safi-list-contents { + description + "A common grouping used for contents of the list that is used + for AFI-SAFI entries"; + + container ipv4-unicast { + when "../afi-safi-name = 'bt:ipv4-unicast'" { + description + "Include this container for IPv4 Unicast specific + configuration"; + } + + description + "IPv4 unicast configuration options"; + + // placeholder for IPv4 unicast specific configuration + } + + container ipv6-unicast { + when "../afi-safi-name = 'bt:ipv6-unicast'" { + description + "Include this container for IPv6 Unicast specific + configuration"; + } + + description + "IPv6 unicast configuration options"; + + // placeholder for IPv6 unicast specific configuration + // options + } + + container ipv4-labeled-unicast { + when "../afi-safi-name = 'bt:ipv4-labeled-unicast'" { + description + "Include this container for IPv4 Labeled Unicast specific + configuration"; + } + + description + "IPv4 Labeled Unicast configuration options"; + + // placeholder for IPv4 Labeled Unicast specific config + // options + } + + container ipv6-labeled-unicast { + when "../afi-safi-name = 'bt:ipv6-labeled-unicast'" { + description + "Include this container for IPv6 Labeled Unicast specific + configuration"; + } + + description + "IPv6 Labeled Unicast configuration options"; + + // placeholder for IPv6 Labeled Unicast specific config + // options. + } + + container l3vpn-ipv4-unicast { + when "../afi-safi-name = 'bt:l3vpn-ipv4-unicast'" { + description + "Include this container for IPv4 Unicast L3VPN specific + configuration"; + } + + description + "Unicast IPv4 L3VPN configuration options"; + + // placeholder for IPv4 Unicast L3VPN specific config options. + } + + container l3vpn-ipv6-unicast { + when "../afi-safi-name = 'bt:l3vpn-ipv6-unicast'" { + description + "Include this container for unicast IPv6 L3VPN specific + configuration"; + } + + description + "Unicast IPv6 L3VPN configuration options"; + + // placeholder for IPv6 Unicast L3VPN specific configuration + // options + } + + container l3vpn-ipv4-multicast { + when "../afi-safi-name = 'bt:l3vpn-ipv4-multicast'" { + description + "Include this container for multicast IPv6 L3VPN specific + configuration"; + } + + description + "Multicast IPv4 L3VPN configuration options"; + + // placeholder for IPv4 Multicast L3VPN specific configuration + // options + } + + container l3vpn-ipv6-multicast { + when "../afi-safi-name = 'bt:l3vpn-ipv6-multicast'" { + description + "Include this container for multicast IPv6 L3VPN specific + configuration"; + } + description + "Multicast IPv6 L3VPN configuration options"; + + // placeholder for IPv6 Multicast L3VPN specific configuration + // options + } + + container l2vpn-vpls { + when "../afi-safi-name = 'bt:l2vpn-vpls'" { + description + "Include this container for BGP-signalled VPLS specific + configuration"; + } + + description + "BGP-signalled VPLS configuration options"; + + // placeholder for BGP-signalled VPLS specific configuration + // options + } + + container l2vpn-evpn { + when "../afi-safi-name = 'bt:l2vpn-evpn'" { + description + "Include this container for BGP EVPN specific + configuration"; + } + + description + "BGP EVPN configuration options"; + + // placeholder for BGP EVPN specific configuration options + } + + container ipv4-multicast { + when "../afi-safi-name = 'ipv4-multicast'" { + description + "Include this container for IPv4 Unicast specific + configuration"; + } + + description + "IPv4 unicast configuration options"; + + // placeholder for IPv4 unicast specific configuration + } + + container ipv6-multicast { + when "../afi-safi-name = 'ipv6-multicast'" { + description + "Include this container for IPv6 Unicast specific + configuration"; + } + + description + "IPv6 unicast configuration options"; + + // placeholder for IPv6 unicast specific configuration + } + + container ipv4-flowspec { + when "../afi-safi-name = 'ipv4-flowspec'" { + description + "Include this container for IPv4 flowspec specific + configuration"; + } + + description + "IPv4 unicast configuration options"; + + // placeholder for IPv4 unicast specific configuration + } + + container ipv6-flowspec { + when "../afi-safi-name = 'ipv6-flowspec'" { + description + "Include this container for IPv6 flowspec specific + configuration"; + } + + description + "IPv6 unicast configuration options"; + + // placeholder for IPv6 unicast specific configuration + } + } +} diff --git a/yang/frr-bgp-common-structure.yang b/yang/frr-bgp-common-structure.yang new file mode 100644 index 000000000000..af51f7160728 --- /dev/null +++ b/yang/frr-bgp-common-structure.yang @@ -0,0 +1,784 @@ +submodule frr-bgp-common-structure { + yang-version "1.1"; + + belongs-to frr-bgp { + prefix "bgp"; + } + + import ietf-inet-types { + prefix inet; + } + + import frr-interface { + prefix frr-interface; + } + + import ietf-bgp-types { + prefix bt; + } + + import frr-bgp-types { + prefix frr-bt; + } + + include frr-bgp-common; + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + grouping structure-neighbor-group-ebgp-multihop { + description + "Structural grouping used to include eBGP multi-hop + configuration and state for both BGP neighbors and peer + groups"; + + container ebgp-multihop { + description + "eBGP multi-hop parameters for the BGPgroup"; + + choice hop-count { + case default-hop-count { + leaf enabled { + type boolean; + default "false"; + description + "When enabled the referenced group or neighbors are + permitted to be indirectly connected - including cases + where the TTL can be decremented between the BGP peers"; + } + } + case max-hop-count { + leaf multihop-ttl { + type uint8 { + range "1..255"; + } + description + "Time-to-live value to use when packets are sent to the + referenced group or neighbors and ebgp-multihop is + enabled"; + } + } + } + + leaf disable-connected-check { + type boolean; + default "false"; + description + "When set to 'TRUE' it enforces EBGP neighbors perform multihop."; + } + } + } + + grouping neighbor-local-as-options { + container local-as { + leaf local-as { + type inet:as-number; + mandatory true; + description + "The local autonomous system number that is to be used when + establishing sessions with the remote peer or peer group, if + this differs from the global BGP router autonomous system + number."; + } + leaf no-prepend { + when "../local-as != 0"; + type boolean; + default "false"; + description + "Do not prepend local-as to updates from ebgp peers. When + set to 'true' it will not prepend local-as to updates. When + set to 'false' it will prepend local-as to updates."; + } + leaf no-replace-as { + when "../no-prepend != 0"; + type boolean; + default "false"; + description + "Do not prepend local-as to updates from ibgp peers."; + } + } + } + + grouping neighbor-bfd-options { + container bfd-options { + leaf enable { + type boolean; + description + "BFD support"; + } + leaf detect-multiplier { + when "../enable = 'true'"; + type uint8 { + range 2..255; + } + default "3"; + description + "detect multiplier"; + } + leaf required-min-rx { + when "../enable = 'true'"; + type uint16 { + range 50..60000; + } + default "300"; + units "miliseconds"; + description + "Required min receive interval"; + } + leaf desired-min-tx { + when "../enable = 'true'"; + type uint16 { + range 50..60000; + } + default "300"; + units "miliseconds"; + description + "Desired min transmit interval"; + } + leaf session-type { + when "../enable = 'true'"; + type frr-bt:bfd-session-type; + default "not-configured"; + description + "BFD session type"; + } + leaf check-cp-failure { + when "../enable = 'true'"; + type boolean; + default "false"; + description + "Link dataplane status with BGP controlplane"; + } + } + } + grouping neighbor-remote-as { + container neighbor-remote-as { + + leaf remote-as-type { + type frr-bt:as-type; + mandatory true; + description + "Remote AS type"; + } + + leaf remote-as { + when "../remote-as-type = 'as-specified'"; + type inet:as-number; + description + "The remote autonomous system number received in + the BGP OPEN message."; + reference + "RFC 4271, Section 4.2."; + } + } + } + + grouping neighbor-update-source { + description + "Source of routing updates"; + container update-source { + description + "Source of routing updates config"; + choice source { + case ip-based { + leaf ip { + type inet:ip-address; + description + "IPv4 address/IPv6 address."; + } + } + case interface-based { + leaf interface { + type frr-interface:interface-ref; + description + "The local Interface"; + } + } + } + } + } + + grouping structure-neighbor-group-add-paths { + description + "Structural grouping used to include ADD-PATHs configuration + and state for both BGP neighbors and peer groups"; + + container add-paths { + description + "Parameters relating to the advertisement and receipt of + multiple paths for a single NLRI (add-paths)"; + reference + "RFC 7911: ADD-PATH."; + leaf path-type { + type frr-bt:add-path-type; + default "none"; + description + "Enable ability to receive multiple path advertisements for + an NLRI from the neighbor or group"; + } + } + } + + grouping structure-neighbor-group-as-path-options { + description + "Structural grouping used to include AS_PATH manipulation + configuration and state for both BGP neighbors and peer + groups"; + + container as-path-options { + description + "AS_PATH manipulation parameters for the BGP neighbor or + group"; + + choice allowas-in { + case occurence-based { + leaf allow-own-as { + type uint8 { + range "1..10"; + } + description + "Specify the number of occurrences of the local BGP + speaker's AS that can occur within the AS_PATH before it + is rejected."; + } + } + case origin-based { + leaf allow-own-origin-as { + type boolean; + default "false"; + description + "When set to 'TRUE' Only accept my AS in the as-path + if the route was originated in my AS"; + } + } + } + + leaf replace-peer-as { + type boolean; + default "false"; + description + "Replace occurrences of the peer's AS in the AS_PATH with + the local autonomous system number. This is same as override + ASN cli."; + } + + } + } + + + grouping structure-neighbor-group-capability-options { + description + "Structural grouping used to include capability + configuration and state for both BGP neighbors and peer + groups"; + + container capability-options { + description + "Capability manipulation parameters for the BGP neighbor or + group"; + + leaf dynamic-capability { + type boolean; + default "false"; + description + "When set to 'TRUE' it advertises dynamic capability to this + neighbor"; + } + leaf strict-capability { + type boolean; + default "false"; + description + "Strict capability negotiation match. When set to 'TRUE' it + strictly compares remote capabilities and local capabilities. + if capabilities are different, send Unsupported Capability error + then reset connection"; + } + leaf extended-nexthop-capability { + type boolean; + default "false"; + description + "When set to 'TRUE' it advertises extended next-hop capability + to the peer."; + } + leaf no-capability-negotiate { + type boolean; + default "false"; + description + "When set to 'TRUE' it suppress sending Capability Negotiation + as OPEN message optional parameter to the peer."; + } + leaf override-capability { + type boolean; + default "false"; + description + "When set to 'TRUE' it Overrides the result of Capability Negotiation + with local configuration. Ignore remote peer’s capability value."; + } + } + } + + grouping structure-neighbor-default-originate-options { + description + "Structural grouping used to include default-originate + configuration and state for both BGP neighbors and peer + groups"; + + container default-originate-options { + description + "Capability manipulation parameters for the BGP neighbor or + group"; + + leaf send-default-route { + type boolean; + default "false"; + description + "If set to true, send the default-route to the neighbour(s)"; + } + leaf rmap-policy-export { + type frr-bt:rmap-ref; + description + "Route-map to specify criteria to originate default"; + } + } + } + + grouping structure-neighbor-prefix-limit { + container prefix-limit { + description + "Parameters relating to the prefix limit for the AFI-SAFI"; + leaf max-prefixes { + type uint32; + mandatory true; + description + "Maximum number of prefixes that will be accepted from the + neighbour"; + } + choice options { + case warning { + leaf warning-only { + type boolean; + default "false"; + description + "When set to 'TRUE' only give warning message when limit + is exceeded"; + } + } + case restart { + leaf restart-timer { + type uint32; + units "minutes"; + description + "Time interval in seconds after which the BGP session is + re-established after being torn down due to exceeding the + max-prefix limit."; + } + } + case threshold { + leaf shutdown-threshold-pct { + type bt:percentage; + description + "Threshold on number of prefixes that can be received from + a neighbour before generation of warning messages or log + entries. Expressed as a percentage of max-prefixes"; + } + } + case threshold-restart { + leaf tr-shutdown-threshold-pct { + type bt:percentage; + description + "Threshold on number of prefixes that can be received from + a neighbour before generation of warning messages or log + entries. Expressed as a percentage of max-prefixes"; + } + + leaf tr-restart-timer { + type uint32; + units "minutes"; + description + "Time interval in seconds after which the BGP session is + re-established after being torn down due to exceeding the + max-prefix limit."; + } + } + case threshold-warning { + leaf tw-shutdown-threshold-pct { + type bt:percentage; + description + "Threshold on number of prefixes that can be received from + a neighbour before generation of warning messages or log + entries. Expressed as a percentage of max-prefixes"; + } + leaf tw-warning-only { + type boolean; + default "false"; + description + "When set to 'TRUE' only give warning message when limit + is exceeded"; + } + } + } + } + } + + grouping structure-neighbor-nexthop-self { + container nexthop-self { + description + "Parameters relating to the nexthop-self for the AFI-SAFI"; + leaf next-hop-self { + type boolean; + default "false"; + description + "When set to 'TRUE' an announced route’s nexthop as being + equivalent to the address of the bgp router if it is + learned via eBGP"; + } + leaf next-hop-self-force { + type boolean; + default "false"; + description + "When set to 'TRUE' an announced route’s nexthop as being + equivalent to the address of the bgp router if it is + learned via eBGP"; + } + } + } + + + grouping structure-neighbor-private-as { + container private-as { + description + "Parameters relating to the private-as for the AFI-SAFI"; + leaf remove-private-as-all { + type boolean; + default "false"; + description + "When set to 'TRUE' it removes private ASNs in outbound + updates.It applies to all AS numbers"; + } + leaf remove-private-as-all-replace { + type boolean; + default "false"; + description + "When set to 'TRUE' Remove private ASNs in outbound updates. + It applies to all AS numbers. It replaces private ASNs with + our ASN in outbound updates"; + } + leaf remove-private-as { + type boolean; + default "false"; + description + "When set to 'TRUE' it removes private ASNs in outbound + updates.It applies to all AS numbers"; + } + leaf remove-private-as-replace { + type boolean; + default "false"; + description + "When set to 'TRUE' Remove private ASNs in outbound updates. + It applies to all AS numbers. It replaces private ASNs with + our ASN in outbound updates"; + } + } + } + + + grouping structure-neighbor-weight { + container weight { + description + "Parameters relating to the weight for the AFI-SAFI"; + leaf weight-attribute { + type uint16 { + range "0..65535"; + } + description + "Set default weight for routes from this neighbor."; + } + } + } + + grouping structure-neighbor-route-reflector { + container route-reflector { + description + "Parameters relating to the route-reflector for the AFI-SAFI"; + + leaf route-reflector-client { + type boolean; + default "false"; + description + "Configure a neighbor as route reflector client"; + } + } + } + + grouping structure-neighbor-route-server { + container route-server { + description + "Parameters relating to the route-server for the AFI-SAFI"; + + leaf route-server-client { + type boolean; + default "false"; + description + "Configure a neighbor as route server client"; + } + } + } + + grouping structure-neighbor-send-community { + container send-community { + description + "Parameters relating to the send-community for the AFI-SAFI"; + leaf send-community { + type boolean; + default "true"; + description + "Send standard community attribute to this neighbor"; + } + leaf send-ext-community { + type boolean; + default "true"; + description + "Send extended community attribute to this neighbor"; + } + leaf send-large-community { + type boolean; + default "false"; + description + "Send large community attribute to this neighbor"; + } + } + } + + grouping structure-neighbor-group-admin-shutdown { + description + "Structural grouping used to include admin-shutdown + configuration and state for both BGP neighbors and peer + groups"; + + container admin-shutdown { + description + "BGP Administrative Shutdown Communication"; + + leaf enable { + type boolean; + mandatory true; + description + "When set to 'TRUE', it enables the bgp shutdown communication"; + } + + leaf message { + type string; + description + "Shutdown message"; + reference + "draft-ietf-idr-shutdown-06"; + } + } + } + + grouping structure-neighbor-group-graceful-restart { + description + "Structural grouping used to include graceful-restart + configuration and state for both BGP neighbors and peer + groups"; + + container graceful-restart { + description + "BGP Graceful restart feature"; + choice mode { + case graceful-restart-mode { + leaf enable { + type boolean; + default "false"; + description + "Enable or disable the graceful-restart capability. + When set to 'TRUE' it enables the graceful-restart + it will enable graceful restart and helper both at peer + peer level. When set to 'false' it will disable both + graceful restart and helper mode. The peer will inherit + global configuration."; + } + } + case graceful-restart-helper-mode { + leaf graceful-restart-helper { + type boolean; + default "false"; + description + "When set to 'TRUE' it enables helper mode for the peer + When set to 'FALSE' it disables the helper mode. The + peer will inherit global configuration."; + } + } + case graceful-restart-disable-mode { + leaf graceful-restart-disable { + type boolean; + default "false"; + description + "When set to 'TRUE' it disables the graceful-restart + and helper Mode. When set to 'FALSE' it inherit + global configuration"; + } + } + } + } + } + + + grouping structure-neighbor-group-soft-reconfiguration { + description + "Structural grouping used to include soft-reconfiguration + configuration and state for both BGP neighbors and peer + groups"; + + leaf soft-reconfiguration { + type boolean; + default "false"; + description + "Allow inbound soft reconfiguration for this neighbor."; + } + } + + + grouping structure-neighbor-group-attr-unchanged { + description + "Structural grouping used to include graceful-restart + configuration and state for both BGP neighbors and peer + groups"; + + container attr-unchanged { + description + "BGP attribute is propagated unchanged to this neighbor"; + + choice attr-type { + case as-path { + leaf as-path-unchanged { + type boolean; + default "false"; + description + "When set to 'TRUE' as-path attribute is propagated unchanged."; + } + } + case next-hop { + leaf next-hop-unchanged { + type boolean; + default "false"; + description + "When set to 'TRUE' next-hop attribute is propagated unchanged."; + } + } + case med { + leaf med-unchanged { + type boolean; + default "false"; + description + "When set to 'TRUE' as-path attribute is propagated unchanged."; + } + } + } + } + } + + + grouping structure-neighbor-group-orf-capability { + description + "Structural grouping used to include orf + configuration and state for both BGP neighbors and peer + groups"; + + container orf-capability { + + choice orf-update { + case send { + leaf orf-send { + type boolean; + default false; + description + "When set to 'TRUE' it advertises the orf capability"; + } + } + case recieve { + leaf orf-recieve { + type boolean; + default false; + description + "When set to 'TRUE' it recieves the orf capability"; + } + } + case both { + leaf orf-both { + type boolean; + default false; + description + "When set to 'TRUE' it advertises/recieves the orf capability"; + } + } + } + } + } + + grouping structure-neighbor-config-timers { + description + "Structural grouping used to include per neighbor timers + configuration and state for both BGP neighbors and peer + groups"; + + container timers { + leaf advertise-time { + type uint16 { + range "0..600"; + } + units "seconds"; + description + "Minimum interval between sending BGP routing updates."; + } + + leaf connect-time { + type uint16 { + range "1..65535"; + } + units "seconds"; + description + "BGP connect timer"; + } + uses neighbor-timers; + } + } + + + grouping structure-neighbor-group-filter-config { + description + "Structural grouping used to include filter + configuration and state for both BGP neighbors and peer + groups"; + + container filter-config { + description + "BGP attribute is propagated unchanged to this neighbor"; + + uses rmap-policy-import; + uses rmap-policy-export; + uses plist-policy-import; + uses plist-policy-export; + uses access-list-policy-import; + uses access-list-policy-export; + uses as-path-filter-list-polict-import; + uses as-path-filter-list-polict-export; + uses unsupress-map-policy-import; + uses unsupress-map-policy-export; + } + } +} diff --git a/yang/frr-bgp-common.yang b/yang/frr-bgp-common.yang new file mode 100644 index 000000000000..1a396b09d840 --- /dev/null +++ b/yang/frr-bgp-common.yang @@ -0,0 +1,1047 @@ +submodule frr-bgp-common { + yang-version "1.1"; + + belongs-to frr-bgp { + prefix "bgp"; + } + + import ietf-bgp-types { + prefix bt; + } + + import ietf-inet-types { + prefix inet; + } + + import frr-bgp-types { + prefix frr-bt; + } + + import frr-route-types { + prefix frr-rt-type; + } + + import frr-vrf { + prefix frr-vrf; + } + + import ietf-routing-types { + prefix rt-types; + } + + import frr-interface { + prefix frr-interface; + } + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + + grouping rmap-policy-import { + leaf rmap-import { + type frr-bt:rmap-ref; + } + } + grouping rmap-policy-export { + leaf rmap-export { + type frr-bt:rmap-ref; + } + } + grouping unsupress-map-policy-import { + leaf unsupress-map-import { + type frr-bt:rmap-ref; + } + } + grouping unsupress-map-policy-export { + leaf unsupress-map-export { + type frr-bt:rmap-ref; + } + } + grouping plist-policy-import { + leaf plist-import { + type frr-bt:plist-ref; + } + } + grouping plist-policy-export { + leaf plist-export { + type frr-bt:plist-ref; + } + } + grouping access-list-policy-import { + leaf access-list-import { + type frr-bt:access-list-ref; + } + } + grouping access-list-policy-export { + leaf access-list-export { + type frr-bt:access-list-ref; + } + } + grouping as-path-filter-list-polict-import { + leaf as-path-filter-list-import { + type frr-bt:as-path-filter-ref; + } + } + grouping as-path-filter-list-polict-export { + leaf as-path-filter-list-export { + type frr-bt:as-path-filter-ref; + } + } + + grouping route-selection-options { + description + "Configuration and state relating to route selection options"; + container route-selection-options { + description + "Parameters relating to options for route selection"; + leaf always-compare-med { + type boolean; + default "false"; + description + "Compare multi-exit discriminator (MED) value from + different ASes when selecting the best route. The + default behavior is to only compare MEDs for paths + received from the same AS."; + } + leaf deterministic-med { + type boolean; + default "false"; + description + "Compare multi-ext discriminator (MED) value from + Same ASes when selecting the best route."; + } + leaf confed-med { + type boolean; + default false; + description + "Compare multi-ext discriminator (MED) value from + different Sub ASes when selecting the best route."; + } + leaf missing-as-worst-med { + type boolean; + default false; + description + "Misssing multi-ext discriminator (MED) value is + considered as value of infinity, making the path + least desirable when selecting the best route."; + } + leaf aspath-confed { + type boolean; + default false; + description + "Compare path lengths including confederation sets + and sequences in selecting a route"; + } + leaf ignore-as-path-length { + type boolean; + default "false"; + description + "Ignore the AS path length when selecting the best path. + The default is to use the AS path length and prefer paths + with shorter length."; + } + leaf external-compare-router-id { + type boolean; + default "true"; + description + "When comparing similar routes received from external BGP + peers, use the router-id as a criterion to select the + active path."; + } + leaf allow-multiple-as { + type boolean; + default "false"; + description + "Allow multi-path to use paths from different neighboring + ASes. The default is to only consider multiple paths + from the same neighboring AS."; + } + leaf multi-path-as-set { + when "../allow-multiple-as = 'true'"; + type boolean; + default false; + description + "multi-path with AS-SET, When set to 'true' it adds AS set + information for aggregate routes, When set to 'false' it + prevents AS set generation."; + } + } + } + grouping med-config { + description + "Configuration relating to MED"; + container med-config { + leaf enable-med { + type boolean; + default false; + description + "Flag to enable receiving of MED metric attribute + in routing updates."; + } + + leaf max-med-admin { + type uint32 { + range "0..4294967295"; + } + default 4294967294; + description + "Tells the router to announce routes with this MED value + This MED value is applicable for indefinate time"; + } + + leaf max-med-onstart-up-time { + type uint32 { + range "5..86400"; + } + units "seconds"; + description + "Tells the router to announce routes with MED value, + This MED value is applicable for this duration during + startup"; + } + + leaf max-med-onstart-up-value { + when "../max-med-onstart-up-time != 0"; + type uint32 { + range "0..4294967295"; + } + default 4294967294; + description + "Tells the router to announce routes with this MED value + This MED value is applicable for onstart up time"; + } + } + } + grouping route-reflector-config { + description + "grouping used to include route reflector + configuration for BGP global"; + container route-reflector { + description + "Route reflector parameters for the BGP global"; + leaf route-reflector-cluster-id { + type bt:rr-cluster-id-type; + description + "Route Reflector cluster id to use when local router is + configured as a route reflector. Commonly set at the + group level, but allows a different cluster id to be set + for each neighbor."; + reference + "RFC 4456: BGP Route Reflection: An Alternative to + Full Mesh."; + } + leaf no-client-reflect { + type boolean; + default "false"; + description + "When set to 'true', this disables route redistribution + by the Route Reflector. It is set 'true' when the client is + fully meshed to prevent sending of redundant route + advertisements."; + reference + "TODO: Add reference when IETF writes a draft describing + this."; + } + leaf allow-outbound-policy { + type boolean; + default "false"; + description + "When set to 'true', this allow RR to modify the attributes of the + reflected IBGP routes as per the out route-map. It is set 'False' + RR will not modify the attributes of the reflected IBGP routes as + per the out route-map rules."; + } + } + } + grouping global-bgp-config { + leaf no-ipv4-unicast-active { + type boolean; + default "false"; + description + "When set to 'true' it will deactive the ipv4-unicast address family + which is activated by default. When set to 'false' it will activate + the ipv4-unicast address family."; + } + leaf ebgp-multihop-connected-route-check { + type boolean; + default "false"; + description + "When set to 'true' it will disable checking if nexthop is connected + on ebgp sessions. When set to 'false' it will enable checking if + nexthop is connected on ebgp sessions."; + } + leaf no-fast-external-failover { + type boolean; + default "false"; + description + "It's an interface tracking mechanism. When set to 'true' don't + immediately reset session if a link to a directly connected + external peer goes down. When set to 'false' it will immediately + reset session if a link to a directly connected external peer goes down"; + } + leaf local-pref { + type uint32; + description + "BGP local preference attribute sent to internal peers to + indicate the degree of preference for externally learned + routes. The route with the highest local preference + value is preferred."; + reference + "RFC 4271: Section 5.1.5."; + } + leaf default-shutdown { + type boolean; + default "false"; + description + "Apply administrative shutdown to newly configured peers"; + } + leaf ebgp-requires-policy { + type boolean; + default "false"; + description + "When set to 'true' BGP speaker requires in and out policy + for eBGP peers (RFC8212)"; + } + leaf subgroup-pkt-queue-size { + type uint32 { + range "20..100"; + } + default 40; + description + "Subgroup packet queue size"; + } + } + + grouping global-neighbor-config { + container global-neighbor-config { + leaf dynamic-neighbors-limit { + type uint32 { + range "1..5000"; + } + description + "Maximum number of BGP Dynamic Neighbors that can be created"; + } + leaf log-neighbor-changes { + type boolean; + default "false"; + description + "When set to 'true' BGP will start logging neighbor up/down and reset reason + When set to 'false' BGP will stop logging neighbor up/down and reset reason."; + } + + container packet-quanta-config { + leaf wpkt-quanta { + type uint32 { + range "1..64"; + } + description + "How many packets to write to peer socket per run"; + } + leaf rpkt-quanta { + type uint32 { + range "1..10"; + } + description + "How many packets to read from peer socket per I/O cycle"; + } + } + } + } + + grouping global-update-group-config { + container global-update-group-config { + leaf subgroup-pkt-queue-size { + type uint32 { + range "20..100"; + } + default 40; + description + "Subgroup packet queue size"; + } + leaf coalesce-time { + type uint32 { + range "0..4294967295"; + } + units "miliseconds"; + default 1000; + description + "Configures the Subgroup coalesce timer"; + } + } + } + + grouping global-static-route-config { + + leaf import-check { + type boolean; + default "false"; + description + "When set to 'true' bgp creates entries for network statements + if a matching prefix exists in the rib. When set to 'false' bgp + creates entries for networks that the router cannot reach."; + } + } + + grouping neighbor-timers { + + leaf hold-time { + type uint16 { + range "0 | 3..65535"; + } + units "seconds"; + default "90"; + description + "Time interval (in seconds) for the HoldTimer established + with the peer. When read as operational data (ro), the + value of this object is calculated by this BGP speaker, + using the smaller of the values in hold-time that was + configured (rw) in the running datastore and the Hold Time + received in the OPEN message. + + This value must be at least three seconds + if it is not zero (0). + + If the Hold Timer has not been established + with the peer this object MUST have a value + of zero (0). + + If the configured value of hold-time object was + a value of (0), then when read this object MUST have a + value of (0) also."; + reference + "RFC 4271, Section 4.2. + RFC 4271, Section 10."; + } + + leaf keepalive { + type uint16 { + range "0..21845"; + } + units "seconds"; + default "30"; + description + "When used as a configuration (rw) value, this Time interval + (in seconds) for the KeepAlive timer configured for this BGP + speaker with this peer. The value of this object will only + determine the KEEPALIVE messages' frequency relative to + the value specified in configured value for hold-time. + + If the value of this object is zero (0), no periodical + KEEPALIVE messages are sent to the peer after the BGP + connection has been established. The suggested value for + this timer is 30 seconds.; + + The actual time interval for the KEEPALIVE messages is + indicated by operational value of keepalive. That value + of this object is calculated by this BGP speaker such that, + when compared with hold-time, it has the same proportion + that keepalive has, compared with hold-time. A + reasonable maximum value for this timer would be one third + of that of hold-time."; + reference + "RFC 4271, Section 4.4. + RFC 4271, Section 10."; + } + } + grouping global-config-timers { + container global-config-timers { + leaf rmap-delay-time { + type uint16 { + range "0..600"; + } + units "seconds"; + default 5; + description + "Time to wait before processing route-map changes"; + } + + leaf update-delay-time { + type uint16 { + range "0..3600"; + } + units "seconds"; + description + "Time to force initial delay for best-path and updates"; + } + + leaf establish-wait-time { + when "../update-delay-time != 0"; + type uint16 { + range "1..3600"; + } + units "seconds"; + description + "Time to force initial delay for updates"; + } + + leaf connect-retry-interval { + type uint16 { + range "1..max"; + } + units "seconds"; + default "120"; + description + "Time interval (in seconds) for the ConnectRetryTimer. The + suggested value for this timer is 120 seconds."; + reference + "RFC 4271, Section 8.2.2. This is the value used + to initialize the 'ConnectRetryTimer'."; + } + + uses neighbor-timers; + } + } + + grouping graceful-restart-config { + description + "Configuration parameters relating to BGP graceful restart."; + + choice mode { + case graceful-restart-mode { + leaf enabled { + type boolean; + default "false"; + description + "Enable or disable the graceful-restart capability. When set to 'true' + it will enable graceful restart and helper both globally. When set + to 'false' it will enable the default behaviour global helper mode."; + } + } + + case graceful-restart-disable-mode { + leaf graceful-restart-disable { + type boolean; + default "false"; + description + "When set to 'true' it will disable graceful restart and helper both + globally. when set to 'false' it will enable the default behaviour + global helper mode."; + } + } + } + + leaf preserve_fw_entry { + type boolean; + default "false"; + description + "Sets F-bit indication that fib is preserved while doing Graceful Restart. + When set to 'true' Zebra would preserve the FIB entry on the restarting + node."; + } + + leaf restart-time { + type uint16 { + range 1..3600; + } + units "seconds"; + default 120; + description + "Estimated time (in seconds) for the local BGP speaker to + restart a session. This value is advertise in the graceful + restart BGP capability. This is a 12-bit value, referred to + as Restart Time in RFC4724. Per RFC4724, the suggested + default value is <= the hold-time value. This timer is + applicable for helper node"; + reference + "RFC 4724: Graceful Restart Mechanism for BGP."; + } + leaf stale-routes-time { + type uint16 { + range 1..3600; + } + units "seconds"; + default 360; + description + "An upper-bound on the time that stale routes will be + retained by a router after a session is restarted. If an + End-of-RIB (EOR) marker is received prior to this timer + expiring stale-routes will be flushed upon its receipt - if + no EOR is received, then when this timer expires stale paths + will be purged. This timer is applicable for restarting node."; + reference + "RFC 4724: Graceful Restart Mechanism for BGP."; + } + leaf selection-deferral-time { + type uint16 { + range 0..3600; + } + default 360; + units "seconds"; + description + "An upper-bound on the time that restarting router defers + the route selection process after restart."; + reference + "RFC 4724: Graceful Restart Mechanism for BGP."; + } + leaf rib-stale-time { + type uint16 { + range 1..3600; + } + units "seconds"; + default 500; + description + "An upper-bound on the time that helper router holds the + stale routes in Zebra, When this timer gets expired Zebra + removes the stale routes."; + } + } + + grouping global-group-use-multiple-paths { + description + "Common grouping used for both global and groups which provides + configuration and state parameters relating to use of multiple + paths"; + + container use-multiple-paths { + description + "Parameters related to the use of multiple paths for the + same NLRI"; + + container ebgp { + description + "Multi-Path parameters for eBGP"; + + leaf maximum-paths { + type uint32; + default 1; + description + "Maximum number of parallel paths to consider when using + BGP multi-path. The default is use a single path."; + } + } + + container ibgp { + description + "Multi-Path parameters for iBGP"; + + leaf maximum-paths { + type uint32; + default 1; + description + "Maximum number of parallel paths to consider when using + iBGP multi-path. The default is to use a single path"; + } + + leaf cluster-length-list { + type boolean; + when "../maximum-paths != 0"; + default "false"; + description + "When set to 'true' route with the shortest cluster-list + length is used. The cluster-list reflects the iBGP + reflection path the route has taken. It's the part + of route selection algo"; + } + } + } + } + + grouping global-redistribute { + + description "list of route redistribution per AFI"; + + list redistribution-list { + key "route-type route-instance"; + + leaf route-type { + type frr-rt-type:frr-route-types; + description + "Protocol route type"; + } + + leaf route-instance { + type uint16 { + range 0..65535; + } + description + "Protocol Instance"; + } + + leaf metric { + type uint32 { + range 0..4294967295; + } + description + "Metric for redistributed routes"; + } + + leaf rmap-policy-import { + type frr-bt:rmap-ref; + description + "Route-map to be applied for redistributed routes into the bgp."; + } + } + } + + grouping mp-afi-safi-static-route-config { + + leaf label-index { + type rt-types:mpls-label; + description "Label index to associate with the prefix"; + } + + leaf rmap-policy-export { + type frr-bt:rmap-ref; + description + "Route-map to modify the attributes for Routes going out + via BGP updates."; + } + } + + grouping mp-afi-safi-agg-route-config { + + leaf as-set { + type boolean; + default "false"; + description + "When set to 'true' AS set path information is generated + for aggregate address. When set to 'false' AS set path + information is not generated."; + } + + leaf summary-only { + type boolean; + default "false"; + description + "When set to 'true' it advertise only the aggregate route + and suppress the advertisement of all the component routes. + When set to false all more-specific routes summarized + by the aggregate route are advertised"; + } + + leaf rmap-policy-export { + type frr-bt:rmap-ref; + description + "Apply route map to aggregate network"; + } + } + + grouping admin-distance { + container admin-distance { + description + "Administrative distance (or preference) assigned to + routes received from different sources + (external, internal, and local)."; + leaf external { + type uint8 { + range "1..255"; + } + description + "Administrative distance for routes learned from + external BGP (eBGP)."; + } + leaf internal { + type uint8 { + range "1..255"; + } + description + "Administrative distance for routes learned from + internal BGP (iBGP)."; + } + + leaf local { + type uint8 { + range "1..255"; + } + description + "Administrative distance for routes learned from + local."; + } + } + } + + grouping distance-per-route-config { + leaf distance { + type uint8 { + range "1..255"; + } + mandatory true; + description + "Administrative distance for route"; + } + leaf access-list-policy-export { + type frr-bt:access-list-ref; + description + "access-list policy applied on routes going from BGP to Zebra"; + } + } + + grouping route-flap-damping { + container route-flap-damping { + description "dampening feature"; + + leaf enable { + type boolean; + default false; + description + "Enable route flap damping."; + } + + leaf reach-decay { + when "../enable = 'true'"; + type uint8 { + range "1..45"; + } + default "15"; + units "seconds"; + description + "This value specifies the time desired for the instability + metric value to reach one-half of its current value when + the route is reachable. This half-life value determines + the rate at which the metric value is decayed. A smaller + half-life value makes a suppressed route reusable sooner + than a larger value.The accumulated penalty will be reduced + to half after this duration"; + } + + leaf reuse-above { + when "../enable = 'true'"; + type uint16 { + range "1..20000"; + } + default "750"; + description + "This is the value of the instability metric at which a + suppressed route becomes unsuppressed if it is reachable + but currently suppressed. The value assigned to + reuse-below must be less than suppress-above."; + } + + leaf suppress-above { + when "../enable = 'true'"; + type uint16 { + range "1..20000"; + } + default "2000"; + description + "This is the value of the instability metric at which + route suppression takes place. A route is not installed + in the forwarding information base (FIB), or announced + even if it is reachable during the period that it is + suppressed."; + } + + leaf unreach-decay { + when "../enable = 'true'"; + type uint8 { + range "1..255"; + } + default "60"; + units "seconds"; + description + "This value acts the same as reach-decay except that it + specifies the rate at which the instability metric is + decayed when a route is unreachable. It should have a + value greater than or equal to reach-decay."; + } + } + } + + + grouping flow-spec-config { + container flow-spec-config { + description "flow spec feature"; + + leaf interface { + type frr-interface:interface-ref; + description + "The local Interface"; + } + + } + } + + grouping global-graceful-shutdown { + description + "Structural grouping used to include graceful-shutdown + configuration and state for both BGP neighbors and peer + groups"; + + container graceful-shutdown { + description + "BGP Graceful shutdown feature"; + + leaf enable { + type boolean; + default "false"; + description + "enable graceful-shutdown feature"; + } + } + } + + grouping global-filter-config { + description + "Structural grouping used to include filter + configuration and state for BGP RIB table"; + container filter-config { + description + "BGP table to RIB route download filter"; + + uses rmap-policy-export; + } + } + + grouping route-distinguisher-params { + description "Route distinguisher value as per RFC4364"; + leaf rd { + type rt-types:route-distinguisher; + description "Route distinguisher value as per RFC4364"; + } + } + + grouping vpn-label-params { + description + "label value for VRF"; + + choice label-allocation-mode { + case manual { + leaf label-index { + type rt-types:mpls-label; + description "Label index to associate with the prefix"; + } + } + case auto { + leaf label-auto { + type boolean; + description + "Automatically assign a label"; + } + } + } + } + + grouping vpn-nexthop-params { + description + "Specify next hop to use for VRF advertised prefixes"; + + leaf nexthop { + type inet:ip-address; + description + "nexthop IP address"; + } + } + + grouping vpn-route-target-params { + description + "Route Target value"; + + leaf redirect_rt { + type rt-types:route-target; + description + "Flow-spec redirect type route target"; + } + + choice rt-direction { + case import-export { + leaf import-rt { + type rt-types:route-target; + description + "For routes leaked from vpn to current address-family: match any"; + } + leaf export-rt { + type rt-types:route-target; + description + "For routes leaked from current address-family to vpn: set"; + } + } + case both { + leaf rt { + type rt-types:route-target; + description + "both import: match any and export: set"; + } + } + } + } + + grouping vpn-import-params { + description + "vpn route leaking parameters"; + leaf import-vpn { + type boolean; + default "false"; + description + "Import routes from default instance VPN RIB"; + } + leaf export-vpn { + type boolean; + default "false"; + description + "Export routes to default instance VPN RIB"; + } + + list import-vrf-list { + key "vrf"; + description + "List of VRFs to import routes from"; + leaf vrf { + type frr-vrf:vrf-ref; + description + "routing instance"; + } + } + + uses rmap-policy-import; + uses rmap-policy-export; + } + + grouping global-afi-safi-vpn-config { + container vpn-config { + uses route-distinguisher-params; + uses vpn-label-params; + uses vpn-nexthop-params; + uses vpn-import-params; + uses vpn-route-target-params; + } + } + + grouping global-afi-safi-vpn-static-route { + container vpn-static-route { + list static-route { + key "rd"; + description + "A list of rd"; + + uses route-distinguisher-params; + + list prefix-list { + key "prefix"; + description + "A list of prefix"; + leaf prefix { + type inet:ip-prefix; + description + "IP destination prefix."; + } + leaf label-index { + type rt-types:mpls-label; + mandatory true; + description "Label index to associate with the prefix"; + } + + leaf rmap-policy-export { + type frr-bt:rmap-ref; + description + "Route-map to modify the attributes for Routes going out + via BGP updates."; + } + } + } + } + } +} diff --git a/yang/frr-bgp-neighbor.yang b/yang/frr-bgp-neighbor.yang new file mode 100644 index 000000000000..c522008203e8 --- /dev/null +++ b/yang/frr-bgp-neighbor.yang @@ -0,0 +1,112 @@ +submodule frr-bgp-neighbor { + yang-version "1.1"; + + belongs-to frr-bgp { + prefix "bgp"; + } + + include frr-bgp-common-structure; + include frr-bgp-common-multiprotocol; + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + grouping neighbor-group-config { + container neighbor-group-config { + + leaf password { + type string { + length "1..254"; + } + description + "Actual password."; + } + + leaf ttl-security { + type uint8; + description + "BGP Time To Live (TTL) security check."; + reference + "RFC 5082: The Genaralized TTL Security Mechanism + (GTSM), + RFC 7454: BGP Operations and Security."; + } + + leaf solo { + type boolean; + default "false"; + description + "Solo peer - part of its own update group"; + } + + leaf enforce-first-as { + type boolean; + default "false"; + description + "When set to 'TRUE' it will enforce the first AS for EBGP routes"; + } + + leaf description { + type string; + description + "An optional textual description (intended primarily for use + with a peer or group"; + } + + leaf passive-mode { + type boolean; + default "false"; + description + "Don't send open messages to this neighbor."; + } + + uses structure-neighbor-group-capability-options; + uses neighbor-update-source; + uses neighbor-remote-as; + uses structure-neighbor-group-ebgp-multihop; + uses neighbor-local-as-options; + uses neighbor-bfd-options; + uses structure-neighbor-group-admin-shutdown; + uses structure-neighbor-group-graceful-restart; + uses structure-neighbor-config-timers; + + container afi-safis { + description + "List of address-families associated with the BGP + instance"; + list afi-safi { + key "afi-safi-name"; + description + "AFI,SAFI configuration available for the + neighbour or group"; + + uses mp-afi-safi-config; + + leaf enabled { + type boolean; + default false; + description + "This leaf indicates whether the IPv4 Unicast AFI,SAFI is + enabled for the neighbour or group"; + } + + uses mp-all-afi-safi-list-contents; + } + } + } + } +} diff --git a/yang/frr-bgp-peer-group.yang b/yang/frr-bgp-peer-group.yang new file mode 100644 index 000000000000..1c79d368c2c8 --- /dev/null +++ b/yang/frr-bgp-peer-group.yang @@ -0,0 +1,70 @@ +submodule frr-bgp-peer-group { + yang-version "1.1"; + + belongs-to frr-bgp { + prefix "bgp"; + } + + import ietf-inet-types { + prefix inet; + } + + include frr-bgp-common-structure; + include frr-bgp-neighbor; + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + grouping bgp-peer-group-base { + description + "Parameters related to a BGP group."; + + leaf peer-group-name { + type string; + description + "Name of the BGP peer-group"; + } + + leaf-list ipv4-listen-range { + type inet:ipv4-address; + description + "Configure BGP dynamic neighbors listen range"; + } + + leaf-list ipv6-listen-range { + type inet:ipv6-address; + description + "Configure BGP dynamic neighbors listen range"; + } + + uses neighbor-group-config; + + } + grouping bgp-peer-group-list { + description + "The list of BGP peer groups."; + + list peer-group { + key "peer-group-name"; + description + "List of BGP peer-groups configured on the local system - + uniquely identified by peer-group name"; + + uses bgp-peer-group-base; + } + } +} diff --git a/yang/frr-bgp-rpki.yang b/yang/frr-bgp-rpki.yang new file mode 100644 index 000000000000..9f45263c9405 --- /dev/null +++ b/yang/frr-bgp-rpki.yang @@ -0,0 +1,178 @@ +module frr-bgp-rpki { + yang-version "1.1"; + namespace "http://frrouting.org/yang/frr-bgp-rpki"; + + prefix frr-bgp-rpki; + + import ietf-inet-types { + prefix inet; + } + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp rpki information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + grouping bgp-rpki-timers { + + container rpki-timers { + + description "RPKI timers config"; + + leaf polling-time { + type uint32 { + range "1..86400"; + } + default 3600; + units "seconds"; + description + "Set the number of seconds the router waits until the + router asks the cache again for updated data."; + } + + leaf expire-time { + type uint32 { + range "600..172800"; + } + default 7200; + units "seconds"; + description + "Set the expire interval."; + } + + leaf retry-time { + type uint16 { + range "1..7200"; + } + default 600; + units "seconds"; + description + "Set the retry interval."; + } + } + } + + typedef transport-type { + type enumeration { + enum "TCP" { + value 1; + description + "Connection to server is TCP based"; + } + enum "SSH" { + value 2; + description + "Connection to server is SSH based"; + } + } + } + + grouping bgp-rpki-cache-server { + container rpki-cache-server { + description + "Add a cache server to the socket."; + list cache-list { + key "preference"; + + leaf preference { + type uint8 { + range "1..255"; + } + description + "Preference of the cache server"; + } + + leaf cache-type { + mandatory true; + type transport-type; + description + "Specifies a transport method for the RPKI cache."; + } + + choice server { + case ip-address { + leaf ip-address { + type inet:ip-address; + mandatory true; + } + } + case host-name { + leaf ip-host-address { + type inet:host; + mandatory true; + } + } + } + + container transport { + container tcp { + when "../../cache-type = 'TCP'"; + description + "TCP server details"; + leaf tcp-port { + type uint32; + } + } + container ssh { + when "../../cache-type = 'SSH'"; + description + "ssh login details"; + leaf ssh-port { + type uint32; + description "ssh port on which session gets opened."; + } + leaf user-name { + type string; + description + "SSH username to establish an SSH connection to the + cache server."; + } + leaf private-key { + type string; + description + "Local path that includes the private key file of the router."; + } + leaf public-key { + type string; + description + "Local path that includes the public key file of the router."; + } + leaf server-public-ley { + type string; + description + "Server public key."; + } + } + } + } + } + } + + container bgp-rpki { + description + "RPKI configuration parameters."; + + leaf enable { + type boolean; + mandatory true; + description + "When set to 'TRUE' it enables the RPKI"; + } + + uses bgp-rpki-timers; + uses bgp-rpki-cache-server; + + } +} diff --git a/yang/frr-bgp-types.yang b/yang/frr-bgp-types.yang new file mode 100644 index 000000000000..9ed8c4f88521 --- /dev/null +++ b/yang/frr-bgp-types.yang @@ -0,0 +1,123 @@ +module frr-bgp-types { + yang-version "1.1"; + namespace "http://frrouting.org/yang/bgp-types"; + + prefix frr-bt; + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + /* Policy types to be removed later, once policy Yang finalized */ + typedef rmap-ref { + type string; + } + + typedef plist-ref { + type string; + } + + typedef access-list-ref { + type string; + } + + typedef as-path-filter-ref { + type string; + } + + typedef bgp-instance-type { + type enumeration { + enum "default" { + value 1; + description + "bgp instance default"; + } + + enum "vrf" { + value 2; + description + "bgp instance vrf"; + } + + enum "view" { + value 3; + description + "bgp instance view"; + } + } + } + + + typedef as-type { + type enumeration { + enum "as-specified" { + value 1; + description + "AS has explicitly specified value"; + } + enum "internel" { + value 2; + description + "Internal BGP peer."; + } + enum "externel" { + value 3; + description + "Externel BGP peer"; + } + } + } + + typedef add-path-type { + type enumeration { + enum "all" { + value 1; + description + "To advertise all paths to a neighbor"; + } + enum "per-as" { + value 2; + description + "To advertise the bestpath per each neighboring AS"; + } + enum "none" { + value 3; + description + "Add path feature is disabled"; + } + } + } + typedef bfd-session-type { + type enumeration { + enum "single-hop" { + value 1; + description + "Single hop session"; + } + enum "multi-hop" { + value 2; + description + "Multiple hop session"; + } + enum "not-configured" { + value 3; + description + "Not Configured"; + } + } + } +} + diff --git a/yang/frr-bgp.yang b/yang/frr-bgp.yang new file mode 100644 index 000000000000..091718bc51ed --- /dev/null +++ b/yang/frr-bgp.yang @@ -0,0 +1,689 @@ +module frr-bgp { + yang-version "1.1"; + namespace "http://frrouting.org/yang/bgp"; + + prefix frr-bgp; + + import frr-routing { + prefix "frr-rt"; + } + + import ietf-inet-types { + prefix inet; + } + + import ietf-routing-types { + prefix rt-types; + } + + import frr-interface { + prefix frr-interface; + } + + import frr-bgp-types { + prefix frr-bt; + } + + + include frr-bgp-common-structure; + include frr-bgp-common; + include frr-bgp-common-multiprotocol; + include frr-bgp-neighbor; + include frr-bgp-peer-group; + include frr-bgp-bmp; + + organization + "Free Range Routing"; + + contact + "FRR Users List: + FRR Development List: "; + + description + "This module defines a model for managing FRR bgp information. + This YANG module augments the ietf-routing with additional + nexthop information"; + + revision 2019-12-03 { + description + "Initial revision."; + } + + /* + * Identity + */ + identity bgp { + base frr-rt:routing-protocol; + description + "BGP protocol."; + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol" { + container bgp { + when "../frr-rt:type = 'frr-rt:bgp'" { + description + "BGP protocol augmentation of ietf-routing module + control-plane-protocol."; + } + description + "Support for a 'static' pseudo-protocol instance + consists of a list of routes."; + container bgp { + description + "Top-level configuration for the BGP router"; + container global { + presence "Enables global configuration of BGP"; + description + "Global configuration for the BGP router"; + leaf local_as { + type inet:as-number; + mandatory true; + description + "Local autonomous system number of the router. Uses + the 32-bit as-number type from the model in RFC 6991."; + } + + leaf instance-type { + type frr-bt:bgp-instance-type; + mandatory true; + description + "BGP instance type"; + } + + uses frr-rt:router-id; + + container confederation { + description + "Configuration options specifying parameters when the + local router is within an autonomous system which is + part of a BGP confederation."; + + leaf identifier { + type inet:as-number; + description + "Confederation identifier for the autonomous system."; + } + + leaf-list member-as { + type inet:as-number; + description + "Remote autonomous systems that are to be treated + as part of the local confederation."; + } + } + + uses med-config; + uses route-reflector-config; + uses route-selection-options; + uses global-neighbor-config; + + container graceful-restart { + description + "Parameters relating the graceful restart mechanism for + BGP"; + uses graceful-restart-config; + } + uses global-update-group-config; + uses global-config-timers; + uses global-bgp-config; + uses global-static-route-config; + uses global-graceful-shutdown; + uses global-bmp-config; + + container afi-safis { + description + "List of address-families associated with the BGP + instance"; + list afi-safi { + key "afi-safi-name"; + description + "AFI,SAFI configuration available for the + neighbour or group"; + + uses mp-afi-safi-config; + uses mp-all-afi-safi-list-contents; + } + } + } + container neighbors { + description + "Configuration for BGP neighbors"; + + list neighbor { + key "remote-address"; + description + "List of BGP neighbors configured on the local system, + uniquely identified by remote IPv[46] address"; + leaf remote-address { + type inet:ip-address; + description + "The remote IP address of this entry's BGP peer."; + } + + leaf local-interface { + type frr-interface:interface-ref; + description + "The local interface for the TCP connection between + the BGP peers."; + } + + leaf local-port { + type inet:port-number { + range "0..65535"; + } + description + "The local port for the TCP connection between + the BGP peers."; + } + leaf peer-group { + type leafref { + path "../../../peer-groups/peer-group/peer-group-name"; + } + description + "The peer-group with which this neighbor is associated"; + } + uses neighbor-group-config; + + } + list unnumbered-neighbor { + key "interface"; + description + "List of BGP neighbors configured on the local system, + uniquely identified by interfaces."; + leaf interface { + type frr-interface:interface-ref; + description + "The local interface of this entry's BGP peer."; + } + leaf v6only { + type boolean; + default "false"; + description + "When set to 'TRUE' it will create a neighbor with v6 + link local only."; + } + leaf peer-group { + type leafref { + path "../../../peer-groups/peer-group/peer-group-name"; + } + description + "The peer-group with which this neighbor is associated"; + } + + uses neighbor-group-config; + + } + } + container peer-groups { + description + "Configuration for BGP peer-groups."; + + uses bgp-peer-group-list; + } + } + } + } + + + grouping mp-afi-unicast-common { + uses global-group-use-multiple-paths; + uses global-redistribute; + uses admin-distance; + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/ipv4-unicast" { + + list static-route { + key "prefix"; + description + "A list of static rotues"; + leaf prefix { + type inet:ipv4-prefix; + description + "IPv4 destination prefix."; + } + leaf backdoor { + type boolean; + default "false"; + description + "Specify a BGP backdoor route"; + } + + uses mp-afi-safi-static-route-config; + } + + list aggregate-route { + key "prefix"; + description + "A list of aggregated rotues"; + leaf prefix { + type inet:ipv4-prefix; + description + "IPv4 destination prefix."; + } + uses mp-afi-safi-agg-route-config; + } + + list admin-distance-route { + key "prefix"; + description + "A list of routes with a particular admin distance"; + leaf prefix { + type inet:ipv4-prefix; + description + "IPv4 destination prefix."; + } + uses distance-per-route-config; + } + + uses route-flap-damping; + uses mp-afi-unicast-common; + uses global-filter-config; + uses global-afi-safi-vpn-config; + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/ipv6-unicast" { + + list static-route { + key "prefix"; + description + "A list of static rotues"; + leaf prefix { + type inet:ipv6-prefix; + description + "IPv6 destination prefix."; + } + + leaf backdoor { + type boolean; + default "false"; + description + "Specify a BGP backdoor route"; + } + uses mp-afi-safi-static-route-config; + } + + list aggregate-route { + key "prefix"; + description + "A list of aggregated rotues"; + leaf prefix { + type inet:ipv4-prefix; + description + "IPv4 destination prefix."; + } + uses mp-afi-safi-agg-route-config; + } + + list admin-distance-route { + key "prefix"; + description + "A list of routes with a particular admin distance"; + leaf prefix { + type inet:ipv6-prefix; + description + "IPv6 destination prefix."; + } + uses distance-per-route-config; + } + + uses mp-afi-unicast-common; + uses global-filter-config; + uses global-afi-safi-vpn-config; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/ipv6-labeled-unicast" { + + uses global-group-use-multiple-paths; + + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/ipv4-multicast" { + + list static-route { + key "prefix"; + description + "A list of static rotues"; + leaf prefix { + type rt-types:ipv4-multicast-group-address; + description + "IPv4 multicast destination prefix."; + } + + leaf backdoor { + type boolean; + default "false"; + description + "Specify a BGP backdoor route"; + } + uses mp-afi-safi-static-route-config; + } + + list aggregate-route { + key "prefix"; + description + "A list of aggregated rotues"; + leaf prefix { + type rt-types:ipv4-multicast-group-address; + description + "IPv4 multicast destination prefix."; + } + uses mp-afi-safi-agg-route-config; + } + + list admin-distance-route { + key "prefix"; + description + "A list of routes with a particular admin distance"; + leaf prefix { + type rt-types:ipv4-multicast-group-address; + description + "IPv4 multicast destination prefix."; + } + } + + uses admin-distance; + uses route-flap-damping; + uses global-filter-config; + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/ipv6-multicast" { + + list static-route { + key "prefix"; + description + "A list of static rotues"; + leaf prefix { + type rt-types:ipv6-multicast-group-address; + description + "IPv4 multicast destination prefix."; + } + leaf backdoor { + type boolean; + default "false"; + description + "Specify a BGP backdoor route"; + } + uses mp-afi-safi-static-route-config; + } + + list aggregate-route { + key "prefix"; + description + "A list of aggregated rotues"; + leaf prefix { + type rt-types:ipv6-multicast-group-address; + description + "IPv6 multicast destination prefix."; + } + uses mp-afi-safi-agg-route-config; + } + + list admin-distance-route { + key "prefix"; + description + "A list of routes with a particular admin distance"; + leaf prefix { + type rt-types:ipv6-multicast-group-address; + description + "IPv6 multicast destination prefix."; + } + } + + uses admin-distance; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/ipv4-flowspec" { + + uses flow-spec-config; + + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/l3vpn-ipv4-unicast" { + + uses global-afi-safi-vpn-static-route; + + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/afi-safis" + + "/afi-safi/l3vpn-ipv6-unicast" { + + uses global-afi-safi-vpn-static-route; + + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/bmp-config" + + "/target-list/afi-safis/afi-safi/ipv4-unicast" { + + uses bmp-afi-safi-common-config; + + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/bmp-config" + + "/target-list/afi-safis/afi-safi/ipv4-multicast" { + + uses bmp-afi-safi-common-config; + + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/bmp-config" + + "/target-list/afi-safis/afi-safi/ipv6-unicast" { + + uses bmp-afi-safi-common-config; + + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/global/bmp-config" + + "/target-list/afi-safis/afi-safi/ipv6-multicast" { + + uses bmp-afi-safi-common-config; + + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv4-unicast" { + + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-weight; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-group-orf-capability; + uses structure-neighbor-group-filter-config; + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv6-unicast" { + + leaf nexthop-local-unchanged { + type boolean; + default "false"; + description + "Configure treatment of outgoing link-local nexthop attribute. + When set to 'TRUE' it leaves link-local nexthop unchanged + for this peer"; + } + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-group-orf-capability; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-weight; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv4-multicast" { + + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-group-orf-capability; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-weight; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv6-multicast" { + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-group-orf-capability; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-weight; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv4-labeled-unicast" { + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-group-orf-capability; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-weight; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv6-labeled-unicast" { + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-group-orf-capability; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-weight; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/l3vpn-ipv4-unicast" { + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-weight; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/l3vpn-ipv6-unicast" { + uses structure-neighbor-group-add-paths; + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-prefix-limit; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-private-as; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-send-community; + uses structure-neighbor-group-soft-reconfiguration; + uses structure-neighbor-weight; + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/l2vpn-evpn" { + uses structure-neighbor-group-as-path-options; + uses structure-neighbor-group-attr-unchanged; + uses structure-neighbor-nexthop-self; + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-group-soft-reconfiguration; + } + + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv4-flowspec" { + + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-group-soft-reconfiguration; + } + + augment "/frr-rt:routing/frr-rt:control-plane-protocols/" + + "frr-rt:control-plane-protocol/bgp/bgp/neighbors/neighbor" + + "/neighbor-group-config/afi-safis/afi-safi/ipv6-flowspec" { + uses structure-neighbor-route-reflector; + uses structure-neighbor-route-server; + uses structure-neighbor-group-soft-reconfiguration; + } +} diff --git a/yang/ietf/ietf-bgp-types.yang b/yang/ietf/ietf-bgp-types.yang new file mode 100644 index 000000000000..a24fb11e9d25 --- /dev/null +++ b/yang/ietf/ietf-bgp-types.yang @@ -0,0 +1,525 @@ +module ietf-bgp-types { + yang-version "1.1"; + namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-types"; + + prefix "bt"; + + import ietf-inet-types { + prefix inet; + } + + // meta + organization + "IETF IDR Working Group"; + + contact + "WG Web: + WG List: + + Authors: Mahesh Jethanandani (mjethanandani at gmail.com), + Keyur Patel (keyur at arrcus.com), + Susan Hares (shares at ndzh.com), + Jeffrey Haas (jhaas at pfrc.org)."; + description + "This module contains general data definitions for use in BGP + policy. It can be imported by modules that make use of BGP + attributes"; + + revision "2019-10-03" { + description + "Initial Version"; + reference + "RFC XXX, BGP Model for Service Provider Network."; + } + + identity bgp-capability { + description "Base identity for a BGP capability"; + } + + identity mp-bgp { + base bgp-capability; + description + "Multi-protocol extensions to BGP"; + reference + "RFC 4760"; + } + + identity route-refresh { + base bgp-capability; + description + "The BGP route-refresh functionality"; + reference + "RFC2918"; + } + + identity asn32 { + base bgp-capability; + description + "4-byte (32-bit) AS number functionality"; + reference + "RFC6793"; + } + + identity graceful-restart { + base bgp-capability; + description + "Graceful restart functionality"; + reference + "RFC4724"; + } + + identity add-paths { + base bgp-capability; + description + "BGP add-paths"; + reference + "RFC 7911."; + } + + identity afi-safi-type { + description + "Base identity type for AFI,SAFI tuples for BGP-4"; + reference + "RFC4760 - multi-protocol extensions for BGP-4"; + } + + identity ipv4-unicast { + base afi-safi-type; + description + "IPv4 unicast (AFI,SAFI = 1,1)"; + reference + "RFC4760"; + } + + identity ipv6-unicast { + base afi-safi-type; + description + "IPv6 unicast (AFI,SAFI = 2,1)"; + reference + "RFC4760"; + } + + identity ipv4-labeled-unicast { + base afi-safi-type; + description + "Labeled IPv4 unicast (AFI,SAFI = 1,4)"; + reference + "RFC3107"; + } + + identity ipv6-labeled-unicast { + base afi-safi-type; + description + "Labeled IPv6 unicast (AFI,SAFI = 2,4)"; + reference + "RFC3107"; + } + + identity l3vpn-ipv4-unicast { + base afi-safi-type; + description + "Unicast IPv4 MPLS L3VPN (AFI,SAFI = 1,128)"; + reference + "RFC4364"; + } + + identity l3vpn-ipv6-unicast { + base afi-safi-type; + description + "Unicast IPv6 MPLS L3VPN (AFI,SAFI = 2,128)"; + reference + "RFC4659"; + } + + identity l3vpn-ipv4-multicast { + base afi-safi-type; + description + "Multicast IPv4 MPLS L3VPN (AFI,SAFI = 1,129)"; + reference + "RFC6514"; + } + + identity l3vpn-ipv6-multicast { + base afi-safi-type; + description + "Multicast IPv6 MPLS L3VPN (AFI,SAFI = 2,129)"; + reference + "RFC6514"; + } + + identity l2vpn-vpls { + base afi-safi-type; + description + "BGP-signalled VPLS (AFI,SAFI = 25,65)"; + reference + "RFC4761"; + } + + identity l2vpn-evpn { + base afi-safi-type; + description + "BGP MPLS Based Ethernet VPN (AFI,SAFI = 25,70)"; + } + + identity bgp-well-known-std-community { + description + "Base identity for reserved communities within the standard + community space defined by RFC1997. These communities must + fall within the range 0xFFFF0000 to 0xFFFFFFFF"; + reference + "RFC 1997: BGP Communities Attribute."; + } + + identity no-export { + base bgp-well-known-std-community; + description + "Do not export NLRI received carrying this community outside + the bounds of this autonomous system, or this confederation if + the local autonomous system is a confederation member AS. This + community has a value of 0xFFFFFF01."; + reference + "RFC 1997: BGP Communities Attribute."; + } + + identity no-advertise { + base bgp-well-known-std-community; + description + "All NLRI received carrying this community must not be + advertised to other BGP peers. This community has a value of + 0xFFFFFF02."; + reference + "RFC 1997: BGP Communities Attribute."; + } + + identity no-export-subconfed { + base bgp-well-known-std-community; + description + "All NLRI received carrying this community must not be + advertised to external BGP peers - including over confederation + sub-AS boundaries. This community has a value of 0xFFFFFF03."; + reference + "RFC 1997: BGP Communities Attribute."; + } + + identity no-peer { + base bgp-well-known-std-community; + description + "An autonomous system receiving NLRI tagged with this community + is advised not to re-advertise the NLRI to external bi-lateral + peer autonomous systems. An AS may also filter received NLRI + from bilateral peer sessions when they are tagged with this + community value"; + reference + "RFC 3765: NOPEER Community for BGP."; + } + identity as-path-segment-type { + description + "Base AS Path Segment Type. In [BGP-4], the path segment type + is a 1-octet field with the following values defined."; + reference + "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.3."; + } + + identity as-set { + base as-path-segment-type; + description + "Unordered set of autonomous systems that a route in the UPDATE + message has traversed."; + reference + "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.3."; + } + + identity as-sequence { + base as-path-segment-type; + description + "Ordered set of autonomous systems that a route in the UPDATE + message has traversed."; + reference + "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.3."; + } + + identity as-confed-sequence { + base as-path-segment-type; + description + "Ordered set of Member Autonomous Systems in the local + confederation that the UPDATE message has traversed."; + reference + "RFC 5065, Autonomous System Configuration for BGP."; + } + + identity as-confed-set { + base as-path-segment-type; + description + "Unordered set of Member Autonomous Systems in the local + confederation that the UPDATE message has traversed."; + reference + "RFC 5065, Autonomous System Configuration for BGP."; + } + + /* + * Features. + */ + feature send-communities { + description + "Enable the propogation of communities."; + } + + feature ttl-security { + description + "BGP Time To Live (TTL) security check support."; + reference + "RFC 5082, The Generalized TTL Security Mechanism (GTSM)"; + } + + feature bfd { + description + "Support for BFD detection of BGP neighbor reachability."; + reference + "RFC 5880, Bidirectional Forward Detection (BFD), + RFC 5881, Bidirectional Forward Detection for IPv4 and IPv6 + (Single Hop). + RFC 5883, Bidirectional Forwarding Detection (BFD) for Multihop + Paths"; + } + + typedef bgp-session-direction { + type enumeration { + enum INBOUND { + description + "Refers to all NLRI received from the BGP peer"; + } + enum OUTBOUND { + description + "Refers to all NLRI advertised to the BGP peer"; + } + } + description + "Type to describe the direction of NLRI transmission"; + } + + typedef bgp-well-known-community-type { + type identityref { + base bgp-well-known-std-community; + } + description + "Type definition for well-known IETF community attribute + values"; + reference + "IANA Border Gateway Protocol (BGP) Well Known Communities"; + } + + typedef bgp-std-community-type { + // TODO: further refine restrictions and allowed patterns + // 4-octet value: + // 2 octets + // 2 octets + type union { + type uint32 { + // per RFC 1997, 0x00000000 - 0x0000FFFF and 0xFFFF0000 - + // 0xFFFFFFFF are reserved + range "65536..4294901759"; // 0x00010000..0xFFFEFFFF + } + type string { + pattern '([0-9]+:[0-9]+)'; + } + } + description + "Type definition for standard community attributes"; + reference + "RFC 1997 - BGP Communities Attribute"; + } + + typedef bgp-ext-community-type { + // TODO: needs more work to make this more precise given the + // variability of extended community attribute specifications + // 8-octet value: + // 2 octects + // 6 octets + + type union { + type string { + // Type 1: 2-octet global and 4-octet local + // (AS number) (Integer) + pattern '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' + + '[1-9][0-9]{1,4}|[0-9]):' + + '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' + + '[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])'; + } + type string { + // Type 2: 4-octet global and 2-octet local + // (ipv4-address) (integer) + 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]):' + + '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' + + '[1-9][0-9]{1,4}|[0-9])'; + } + type string { + // route-target with Type 1 + // route-target:(ASN):(local-part) + pattern 'route\-target:(6[0-5][0-5][0-3][0-5]|' + + '[1-5][0-9]{4}|[1-9][0-9]{1,4}|[0-9]):' + + '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' + + '[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])'; + } + type string { + // route-target with Type 2 + // route-target:(IPv4):(local-part) + pattern 'route\-target:' + + '(([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]):' + + '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' + + '[1-9][0-9]{1,4}|[0-9])'; + } + type string { + // route-origin with Type 1 + pattern 'route\-origin:(6[0-5][0-5][0-3][0-5]|' + + '[1-5][0-9]{4}|[1-9][0-9]{1,4}|[0-9]):' + + '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' + + '[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])'; + } + type string { + // route-origin with Type 2 + pattern 'route\-origin:' + + '(([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]):' + + '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' + + '[1-9][0-9]{1,4}|[0-9])'; + } + } + description + "Type definition for extended community attributes"; + reference + "RFC 4360 - BGP Extended Communities Attribute"; + } + + typedef bgp-community-regexp-type { + // TODO: needs more work to decide what format these regexps can + // take. + type string; + description + "Type definition for communities specified as regular + expression patterns"; + } + + typedef bgp-origin-attr-type { + type enumeration { + enum igp { + description "Origin of the NLRI is internal"; + } + enum egp { + description "Origin of the NLRI is EGP"; + } + enum incomplete { + description "Origin of the NLRI is neither IGP or EGP"; + } + } + description + "Type definition for standard BGP origin attribute"; + reference + "RFC 4271 - A Border Gateway Protocol 4 (BGP-4), Sec 4.3"; + } + + typedef peer-type { + type enumeration { + enum internal { + description + "internal (iBGP) peer"; + } + enum external { + description + "external (eBGP) peer"; + } + enum confederation { + description + "Confederation as peer"; + } + } + description + "Labels a peer or peer group as explicitly internal, + external or confederation."; + } + + identity REMOVE_PRIVATE_AS_OPTION { + description + "Base identity for options for removing private autonomous + system numbers from the AS_PATH attribute"; + } + + identity PRIVATE_AS_REMOVE_ALL { + base REMOVE_PRIVATE_AS_OPTION; + description + "Strip all private autonomous system numbers from the AS_PATH. + This action is performed regardless of the other content of the + AS_PATH attribute, and for all instances of private AS numbers + within that attribute."; + } + + identity PRIVATE_AS_REPLACE_ALL { + base REMOVE_PRIVATE_AS_OPTION; + description + "Replace all instances of private autonomous system numbers in + the AS_PATH with the local BGP speaker's autonomous system + number. This action is performed regardless of the other + content of the AS_PATH attribute, and for all instances of + private AS number within that attribute."; + } + + typedef remove-private-as-option { + type identityref { + base REMOVE_PRIVATE_AS_OPTION; + } + description + "Set of options for configuring how private AS path numbers + are removed from advertisements"; + } + + typedef percentage { + type uint8 { + range "0..100"; + } + description + "Integer indicating a percentage value"; + } + + typedef rr-cluster-id-type { + type union { + type uint32; + type inet:ipv4-address; + } + description + "Union type for route reflector cluster ids: + option 1: 4-byte number + option 2: IP address"; + } + + typedef community-type { + type bits { + bit standard { + position 0; + description + "Send only standard communities."; + reference + "RFC 1997: BGP Communities Attribute."; + } + bit extended { + description + "Send only extended communities."; + reference + "RFC 4360: BGP Extended Communities Attribute."; + } + bit large { + description + "Send only large communities."; + reference + "RFC 8092: BGP Large Communities Attribute."; + } + } + description + "Type describing variations of community attributes. + The community types can be combined and a value of 0 + implies 'none'"; + } +}