module openconfig-bgp { yang-version "1.1"; // namespace namespace "http://openconfig.net/yang/bgp"; prefix "bgp"; // import some basic inet types import ietf-inet-types { prefix inet; } import openconfig-bgp-multiprotocol { prefix bgp-mp; } import openconfig-routing-policy { prefix rpol; } import openconfig-bgp-types { prefix bgp-types; } import openconfig-bgp-operational { prefix bgp-op; } import openconfig-extensions { prefix oc-ext; } // meta organization "OpenConfig working group"; contact "OpenConfig working group netopenconfig@googlegroups.com"; description "This module describes a YANG model for BGP protocol configuration.It is a limited subset of all of the configuration parameters available in the variety of vendor implementations, hence it is expected that it would be augmented with vendor- specific configuration data as needed. Additional modules or submodules to handle other aspects of BGP configuration, including policy, VRFs, VPNs, and additional address families are also expected. This model supports the following BGP configuration level hierarchy: BGP | +-> [ global BGP configuration ] +-> AFI / SAFI global +-> peer group +-> [ peer group config ] +-> AFI / SAFI [ per-AFI overrides ] +-> neighbor +-> [ neighbor config ] +-> [ optional pointer to peer-group ] +-> AFI / SAFI [ per-AFI overrides ]"; oc-ext:openconfig-version "1.1.0"; revision "2015-10-09" { description "Initial OpenConfig public release"; reference "1.1.0"; } revision "2015-05-15" { description "Refactored BGP module"; reference "Pre-release"; } grouping bgp-global_config { description "Global configuration options for the BGP router."; leaf 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 router-id { type inet:ipv4-address; description "Router id of the router, expressed as an 32-bit value, IPv4 address."; } } grouping bgp-default-route-distance_config { description "Configuration options relating to the administrative distance (or preference) assigned to routes received from different sources (external, internal, and local)."; leaf external-route-distance { type uint8 { range "1..255"; } description "Administrative distance for routes learned from external BGP (eBGP)."; } leaf internal-route-distance { type uint8 { range "1..255"; } description "Administrative distance for routes learned from internal BGP (iBGP)."; } } grouping bgp-confederation_config { description "Configuration options specifying parameters when the local router is within an autonomous system which is part of a BGP confederation."; leaf enabled { type boolean; description "When this leaf is set to true it indicates that the local-AS 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."; } } grouping bgp-neighbor_config { description "Neighbor level configuration items."; leaf peer-as { type inet:as-number; description "AS number of the peer."; } leaf local-as { type inet:as-number; 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 peer-type { type bgp-types:peer-type; description "Explicitly designate the peer or peer group as internal (iBGP) or external (eBGP)."; } leaf auth-password { type string; description "Configures an MD5 authentication password for use with neighboring devices."; } leaf remove-private-as { // could also make this a container with a flag to enable // remove-private and separate option. here, option implies // remove-private is enabled. type bgp-types:remove-private-as-option; description "Remove private AS numbers from updates sent to peers."; } leaf route-flap-damping { type boolean; default false; description "Enable route flap damping."; } leaf send-community { type bgp-types:community-type; default "NONE"; description "Specify which types of community should be sent to the neighbor or group. The default is to not send the community attribute"; } leaf description { type string; description "An optional textual description (intended primarily for use with a peer or group"; } } grouping bgp-neighbor-timers_config { description "Config parameters related to timers associated with the BGP peer"; leaf connect-retry { type decimal64 { fraction-digits 2; } default 30; description "Time interval in seconds between attempts to establish a session with the peer."; } leaf hold-time { type decimal64 { fraction-digits 2; } default 90; description "Time interval in seconds that a BGP session will be considered active in the absence of keepalive or other messages from the peer. The hold-time is typically set to 3x the keepalive-interval."; reference "RFC 4271 - A Border Gateway Protocol 4, Sec. 10"; } leaf keepalive-interval { type decimal64 { fraction-digits 2; } default 30; description "Time interval in seconds between transmission of keepalive messages to the neighbor. Typically set to 1/3 the hold-time."; } leaf minimum-advertisement-interval { type decimal64 { fraction-digits 2; } default 30; description "Minimum time which must elapse between subsequent UPDATE messages relating to a common set of NLRI being transmitted to a peer. This timer is referred to as MinRouteAdvertisementIntervalTimer by RFC 4721 and serves to reduce the number of UPDATE messages transmitted when a particular set of NLRI exhibit instability."; reference "RFC 4271 - A Border Gateway Protocol 4, Sec 9.2.1.1"; } } grouping bgp-neighbor-transport_config { description "Configuration parameters relating to the transport protocol used by the BGP session to the peer"; leaf tcp-mss { type uint16; description "Sets the max segment size for BGP TCP sessions."; } leaf mtu-discovery { type boolean; default false; description "Turns path mtu discovery for BGP TCP sessions on (true) or off (false)"; } leaf passive-mode { type boolean; default false; description "Wait for peers to issue requests to open a BGP session, rather than initiating sessions from the local router."; } leaf local-address { type union { type inet:ip-address; type string; } //TODO: the string should be converted to a leafref type //to point to an interface when YANG 1.1 is available with //leafrefs in union types. description "Set the local IP (either IPv4 or IPv6) address to use for the session when sending BGP update messages. This may be expressed as either an IP address or reference to the name of an interface."; } } grouping bgp-neighbor-error-handling_config { description "Configuration parameters relating to enhanced error handling behaviours for BGP"; leaf treat-as-withdraw { type boolean; default "false"; description "Specify whether erroneous UPDATE messages for which the NLRI can be extracted are treated as though the NLRI is withdrawn - avoiding session reset"; reference "https://tools.ietf.org/html/rfc7606"; } } grouping bgp-neighbor-logging-options_config { description "Configuration parameters specifying the logging behaviour for BGP sessions to the peer"; leaf log-neighbor-state-changes { type boolean; default "true"; description "Configure logging of peer state changes. Default is to enable logging of peer state changes."; } } grouping bgp-neighbor-multihop_config { description "Configuration parameters specifying the multihop behaviour for BGP sessions to the peer"; 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"; } leaf multihop-ttl { type uint8; description "Time-to-live value to use when packets are sent to the referenced group or neighbors and ebgp-multihop is enabled"; } } grouping bgp-neighbor-route-reflector_config { description "Configuration parameters determining whether the behaviour of the local system when acting as a route-reflector"; leaf route-reflector-cluster-id { type bgp-types: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."; } leaf route-reflector-client { type boolean; default "false"; description "Configure the neighbor as a route reflector client."; } } grouping bgp-neighbor-as-path-options_config { description "Configuration parameters allowing manipulation of the AS_PATH attribute"; leaf allow-own-as { type uint8; default 0; description "Specify the number of occurrences of the local BGP speaker's AS that can occur within the AS_PATH before it is rejected."; } 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"; } } grouping bgp-neighbor-add-paths_config { description "Configuration parameters specfying whether the local system will send or receive multiple paths using ADD_PATHS"; leaf receive { type boolean; default false; description "Enable ability to receive multiple path advertisements for an NLRI from the neighbor or group"; } leaf send-max { type uint8; description "The maximum number of paths to advertise to neighbors for a single NLRI"; } } grouping bgp-neighbor-peer-group_config { description "Configuration parameters indicating whether the specified peer is to be considered as part of a peer-group - and therefore inherit its configuration"; leaf peer-group { type leafref { path "/bgp:bgp/bgp:peer-groups/bgp:peer-group/bgp:peer-group-name"; require-instance true; } description "The peer-group with which this neighbor is associated"; } } grouping bgp-graceful-restart { description "Configures BGP graceful restart, which is a negotiated option that indicates that a BGP speaker is able to retain forwarding state when a BGP session restarts"; reference "RFC 4724: Graceful Restart Mechanism for BGP"; container graceful-restart { description "Parameters relating the graceful restart mechanism for BGP"; container config { description "Configuration parameters relating to graceful-restart"; uses bgp-neighbor-graceful-restart_config; } container state { config false; description "State information associated with graceful-restart"; uses bgp-neighbor-graceful-restart_config; } } } grouping bgp-neighbor-graceful-restart_config { description "Configuration parameters relating to BGP graceful restart."; leaf enabled { type boolean; description "Enable or disable the graceful-restart capability."; } leaf restart-time { type uint16 { range 0..4096; } 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."; } leaf stale-routes-time { type decimal64 { fraction-digits 2; } description "An upper-bound on the time thate 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 referred to as the Selection_Deferral_Timer in RFC4724"; } leaf helper-only { type boolean; description "Enable graceful-restart in helper mode only. When this leaf is set, the local system does not retain forwarding its own state during a restart, but supports procedures for the receiving speaker, as defined in RFC4724."; } } // ************************************************************ // * configuration context containers * // ************************************************************ grouping bgp-global-base { description "Global configuration parameters for the BGP router"; container config { description "Configuration parameters relating to the global BGP router"; uses bgp-global_config; /* Presence is added as a workaround for BUG-6069 and it lacks of presence meaning therefore is left empty. */ presence ""; } container state { config false; description "State information relating to the global BGP router"; uses bgp-global_config; uses bgp-op:bgp-global_state; } uses bgp-mp:bgp-route-selection-options; container default-route-distance { description "Administrative distance (or preference) assigned to routes received from different sources (external, internal, and local)."; container config { description "Configuration parameters relating to the default route distance"; uses bgp-default-route-distance_config; } container state { config false; description "State information relating to the default route distance"; uses bgp-default-route-distance_config; } } container confederation { description "Parameters indicating whether the local system acts as part of a BGP confederation"; container config { description "Configuration parameters relating to BGP confederations"; uses bgp-confederation_config; } container state { config false; description "State information relating to the BGP confederations"; uses bgp-confederation_config; } } uses bgp-mp:bgp-use-multiple-paths; uses bgp-graceful-restart; container afi-safis { description "Address family specific configuration"; uses bgp-mp:bgp-common-afi-safi-list; } } grouping bgp-neighbors { description "BGP neighbors configured on the local system"; list neighbor { key "neighbor-address"; description "List of BGP neighbors configured on the local system, uniquely identified by peer IPv[46] address"; leaf neighbor-address { // FIXME: BUG-4625: DTO generation cannot handle this case in Binding Spec v1 // type leafref { // path "../config/neighbor-address"; // } type inet:ip-address; description "Reference to the address of the BGP neighbor used as a key in the neighbor list"; } uses bgp-neighbor-group; } } grouping bgp-peer-group { description "BGP peer-groups configured on the local system"; list peer-group { key "peer-group-name"; description "List of BGP peer-groups configured on the local system - uniquely identified by peer-group name"; leaf peer-group-name { // FIXME: BUG-4625: DTO generation cannot handle this case in Binding Spec v1 // type leafref { // path "../config/peer-group-name"; // } type string; description "Reference to the name of the BGP peer-group used as a key in the peer-group list"; } uses bgp-neighbor-group; } } grouping bgp-neighbor-group { description "Parameters related to a BGP neighbor or group"; container config { description "Configuration parameters relating to the BGP neighbor or group"; uses bgp-neighbor_config; } container state { config false; description "State information relating to the BGP neighbor or group"; uses bgp-neighbor_config; } container timers { description "Timers related to a BGP neighbor or group"; container config { description "Configuration parameters relating to timers used for the BGP neighbor or group"; uses bgp-neighbor-timers_config; } container state { config false; description "State information relating to the timers used for the BGP neighbor or group"; uses bgp-neighbor-timers_config; } } container transport { description "Transport session parameters for the BGP neighbor or group"; container config { description "Configuration parameters relating to the transport session(s) used for the BGP neighbor or group"; uses bgp-neighbor-transport_config; } container state { config false; description "State information relating to the transport session(s) used for the BGP neighbor or group"; uses bgp-neighbor-transport_config; } } container error-handling { description "Error handling parameters used for the BGP neighbor or group"; container config { description "Configuration parameters enabling or modifying the behavior or enhanced error handling mechanisms for the BGP neighbor or group"; uses bgp-neighbor-error-handling_config; } container state { config false; description "State information relating to enhanced error handling mechanisms for the BGP neighbor or group"; uses bgp-neighbor-error-handling_config; } } container logging-options { description "Logging options for events related to the BGP neighbor or group"; container config { description "Configuration parameters enabling or modifying logging for events relating to the BGP neighbor or group"; uses bgp-neighbor-logging-options_config; } container state { config false; description "State information relating to logging for the BGP neighbor or group"; uses bgp-neighbor-logging-options_config; } } container ebgp-multihop { description "eBGP multi-hop parameters for the BGP neighbor or group"; container config { description "Configuration parameters relating to eBGP multihop for the BGP neighbor or group"; uses bgp-neighbor-multihop_config; } container state { config false; description "State information for eBGP multihop, for the BGP neighbor or group"; uses bgp-neighbor-multihop_config; } } container route-reflector { description "Route reflector parameters for the BGP neighbor or group"; container config { description "Configuraton parameters relating to route reflection for the BGP neighbor or group"; uses bgp-neighbor-route-reflector_config; } container state { config false; description "State information relating to route reflection for the BGP neighbor or group"; uses bgp-neighbor-route-reflector_config; } } container as-path-options { description "AS_PATH manipulation parameters for the BGP neighbor or group"; container config { description "Configuration parameters relating to AS_PATH manipulation for the BGP peer or group"; uses bgp-neighbor-as-path-options_config; } container state { config false; description "State information relating to the AS_PATH manipulation mechanisms for the BGP peer or group"; uses bgp-neighbor-as-path-options_config; } } container add-paths { description "Parameters relating to the advertisement and receipt of multiple paths for a single NLRI (add-paths)"; container config { description "Configuration parameters relating to ADD_PATHS"; uses bgp-neighbor-add-paths_config; } container state { config false; description "State information associated with ADD_PATHS"; uses bgp-neighbor-add-paths_config; } } container afi-safis { description "Per-address-family configuration parameters associated with the neighbor or group"; uses bgp-mp:bgp-common-afi-safi-list; } uses bgp-graceful-restart; uses rpol:apply-policy-group; } grouping bgp-neighbor-neighbor-address_config { description "Configuration options relating to the BGP neighbor address"; leaf neighbor-address { type inet:ip-address; description "Address of the BGP peer, either in IPv4 or IPv6"; } } grouping bgp-peer-group-peer-group-name_config { description "Configuration options relating to the BGP peer-group name"; leaf peer-group-name { type string; description "Name of the BGP peer-group"; } } // add peer-group pointer only for the neighbor list augment /bgp/neighbors/neighbor/config { description "Augmentation to allow association of a neighbor with a peer-group"; uses bgp-neighbor-peer-group_config; } augment /bgp/neighbors/neighbor/state { description "Augmentation to reflect the association of a neighbor with a peer-group"; uses bgp-neighbor-peer-group_config; } augment /bgp/peer-groups/peer-group { description "Augmentation to add multipath configuration to a peer-group"; uses bgp-mp:bgp-use-multiple-paths; } augment /bgp/neighbors/neighbor { description "Augmentation to add the multipath configuration to a neighbor"; uses bgp-mp:bgp-use-multiple-paths-neighbor; } augment /bgp/peer-groups/peer-group/afi-safis/afi-safi { description "Augmentation to add multipath configuration to a peer-group on a per-AFI-SAFI basis"; uses bgp-mp:bgp-use-multiple-paths; } augment /bgp/neighbors/neighbor/afi-safis/afi-safi { description "Augmentation to add multipath configuration to a neighbor on a per-AFI-SAFI basis"; uses bgp-mp:bgp-use-multiple-paths-neighbor; } augment /bgp/global/afi-safis/afi-safi { description "Augmentation to add global instance specific AFI-SAFI configuration information"; uses bgp-mp:bgp-global-afi-safi; uses bgp-mp:bgp-use-multiple-paths; } augment /bgp/peer-groups/peer-group/afi-safis/afi-safi { description "Augmentation that adds peer-group instance specific AFI-SAFI configuration information"; uses bgp-mp:bgp-group-afi-safi; } augment /bgp/neighbors/neighbor/config { description "Augmentation adding the neighbor address to the neighbor configuration container"; uses bgp-neighbor-neighbor-address_config; } augment /bgp/neighbors/neighbor/state { description "Augmentation adding the neighbor address to the neighbor state container"; uses bgp-neighbor-neighbor-address_config; } augment /bgp/peer-groups/peer-group/config { description "Augmentation adding the peer-group name to the peer-group configuration container"; uses bgp-peer-group-peer-group-name_config; } augment /bgp/peer-groups/peer-group/state { description "Augmentation adding the peer-group name to the peer-group state container"; uses bgp-peer-group-peer-group-name_config; } // ************************************************************ // * Augmentations to add state * // * (rjs: cleaner to have these in the base module to avoid * // needing to specify which module - e.g. augment of * // /bgp:bgp/bgp:neighbors/bgp:neighbor...) * // ************************************************************ augment /bgp/neighbors/neighbor/state { description "Augmentation to add operational state related to a particular BGP neighbor"; uses bgp-op:bgp-neighbor_state; } augment /bgp/neighbors/bgp:neighbor/state { description "Augmentation to add operational state related to a particular BGP neighbor"; container messages { description "Counters for BGP messages sent and received from the neighbor"; container sent { description "Counters relating to BGP messages sent to the neighbor"; uses bgp-op:bgp-neighbor-message-counters-sent_state; } container received { description "Counters for BGP messages received from the neighbor"; uses bgp-op:bgp-neighbor-message-counters-received_state; } } container queues { description "Counters related to queued messages associated with the BGP neighbor"; uses bgp-op:bgp-neighbor-queue-counters_state; } } augment /bgp:bgp/bgp:neighbors/neighbor/timers/state { description "Augmentation to add the operational state of timers associated with the BGP neighbor"; uses bgp-op:bgp-neighbor-timers_state; } augment /bgp/neighbors/neighbor/transport/state { description "Augmentation to add the operational state of the transport session associated with the BGP neighbor"; uses bgp-op:bgp-neighbor-transport_state; } augment /bgp/neighbors/neighbor/error-handling/state { description "Augmentation to add the operational state of the error handling associated with the BGP neighbor"; uses bgp-op:bgp-neighbor-error-handling_state; } augment /bgp/neighbors/neighbor/graceful-restart/state { description "Augmentation to add the operational state of graceful-restart associated with a BGP neighbor"; uses bgp-op:bgp-afi-safi-graceful-restart_state; } augment /bgp/peer-groups/peer-group/state { description "Augmentation to add the operational state and counters relating to a BGP peer-group"; uses bgp-op:bgp-peer-group_state; } augment /bgp/global/afi-safis/afi-safi/state { description "Augmentation to add operational state and counters on a per-AFI-SAFI basis to the global BGP router"; uses bgp-op:bgp-global-afi-safi_state; } augment /bgp/neighbors/neighbor/afi-safis/afi-safi/state { description "Augmentation to add per-AFI-SAFI operational state and counters to the BGP neighbor"; uses bgp-op:bgp-neighbor-afi-safi_state; } augment "/bgp/neighbors/neighbor/afi-safis/afi-safi/" + "graceful-restart/state" { description "Augmentation to add per-AFI-SAFI operational state for BGP graceful-restart"; uses bgp-op:bgp-neighbor-afi-safi-graceful-restart_state; } grouping bgp-top { description "Top-level grouping for the BGP model data"; container bgp { presence "Container for BGP protocol hierarchy"; description "Top-level configuration and state for the BGP router"; container global { description "Global configuration for the BGP router"; uses bgp-global-base; uses rpol:apply-policy-group; } container neighbors { description "Configuration for BGP neighbors"; uses bgp-neighbors; } container peer-groups { description "Configuration for BGP peer-groups"; uses bgp-peer-group; } } } // ************************************************************ // * module structure containers * // ************************************************************ uses bgp-top; }