0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 12:48:43 +00:00

yang/bgp_yang: smaller version of bgp yang from draft draft-ietf-idr-bgp-model-17 in process. For more info please read read_me.txt

This commit is contained in:
Katerina Kubecova 2024-04-23 12:20:11 +02:00
parent 1a06773cf7
commit e8a325313e
6 changed files with 577 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,575 @@
module bgp_yang_our_version {
yang-version 1.1;
namespace "bgp_yang_our_version";
prefix bgp;
import ietf-inet-types {
prefix inet;
reference
"RFC 6991: Common YANG Data Types.";
}
import ietf-yang-types {
prefix yang;
reference
"RFC 6991: Common YANG Data Types.";
}
import iana-bgp-types {
prefix bt;
reference
"RFC XXXX: YANG Model for Border Gateway Protocol (BGP-4).";
}
import ietf-routing {
prefix rt;
reference
"RFC 8022: A YANG Data Model for Routing Management.";
}
grouping bgp {
description
"Top-level configuration for the BGP router.";
container global {
leaf identifier {
type uint32;
description
"BGP Identifier of the router - an unsigned 32-bit,
non-zero integer that should be unique within an AS.
The value of the BGP Identifier for a BGP speaker is
determined upon startup and is the same for every local
interface and BGP peer.";
reference
"RFC 6286: AS-Wide Unique BGP ID for BGP-4. Section 2.1";
}
}
container neighbors {
description
"Configuration for BGP neighbors.";
list neighbor {
key "name";
description
"List of BGP neighbors configured on the local system,
uniquely identified by remote IPv[46] address.";
leaf name {
type string;
description
"String ID of the neighbor. Default value is remote-address. Remote-addres itself can not be used as a key, because it is not always unique";
}
leaf remote-address {
type inet:ip-address;
description
"The remote IP address of this entry's BGP peer.";
}
leaf local-address {
type inet:ip-address;
config false;
description
"The local IP address of this entry's BGP connection.";
}
leaf local-port {
type inet:port-number;
config false;
description
"The local port for the TCP connection between
the BGP peers.";
}
leaf remote-port {
type inet:port-number;
config false;
description
"The remote port for the TCP connection
between the BGP peers. Note that the
objects local-addr, local-port, remote-addr, and
remote-port provide the appropriate
reference to the standard MIB TCP
connection table.";
}
leaf peer-restarting {
type boolean;
config false;
description
"This flag indicates whether the remote neighbor is
currently in the process of restarting, and hence
received routes are currently stale.";
}
leaf session-state {
type enumeration {
enum idle {
description
"Neighbor is down, and in the Idle state of the
FSM.";
}
enum connect {
description
"Neighbor is down, and the session is waiting for
the underlying transport session to be
established.";
}
enum active {
description
"Neighbor is down, and the local system is awaiting
a connection from the remote peer.";
}
enum opensent {
description
"Neighbor is in the process of being established.
The local system has sent an OPEN message.";
}
enum openconfirm {
description
"Neighbor is in the process of being established.
The local system is awaiting a NOTIFICATION or
KEEPALIVE message.";
}
enum established {
description
"Neighbor is up - the BGP session with the peer is
established.";
}
}
}
}
leaf last-established {
type yang:date-and-time;
config false;
description
"This timestamp indicates the time that the BGP session
last transitioned in or out of the Established state.
The value is the timestamp in seconds relative to the
Unix Epoch (Jan 1, 1970 00:00:00 UTC).
The BGP session uptime can be computed by clients as
the difference between this value and the current time
in UTC (assuming the session is in the Established
state, per the session-state leaf).";
reference
"RFC 4271: A Border Gateway Protocol 4 (BGP-4),
Section 8.";
}
container statistics {
config false;
description
"Statistics per neighbor.";
leaf established-transitions {
type yang:zero-based-counter32;
description
"Number of transitions to the Established state for
the neighbor session. This value is analogous to the
bgpPeerFsmEstablishedTransitions object from the
standard BGP-4 MIB";
reference
"RFC 4273: Definitions of Managed Objects for
BGP-4, bgpPeerFsmEstablishedTransitions,
RFC 4271: A Border Gateway Protocol 4 (BGP-4),
Section 8.";
}
container messages {
description
"Counters for BGP messages sent and received from the
neighbor";
leaf total-received {
type yang:zero-based-counter32;
description
"Total number of BGP messages received from this
neighbor";
reference
"RFC 4273: Definitions of Managed Objects for
BGP-4, bgpPeerInTotalMessages.";
}
leaf total-sent {
type yang:zero-based-counter32;
description
"Total number of BGP messages sent do this
neighbor";
reference
"RFC 4273: Definitions of Managed Objects for
BGP-4, bgpPeerOutTotalMessages.";
}
leaf updates-received {
type yang:zero-based-counter32;
description
"Number of BGP UPDATE messages received from this
neighbor.";
reference
"RFC 4273: Definitions of Managed Objects for
BGP-4, bgpPeerInUpdates.";
}
leaf updates-sent {
type yang:zero-based-counter32;
description
"Number of BGP UPDATE messages sent to this
neighbor";
reference
"RFC 4273: Definitions of Managed Objects for
BGP-4, bgpPeerOutUpdates.";
}
}
}
}
uses rib;
}
//todo: CAPABILITIES
grouping neighbor-group-timers {
description
"Config parameters related to timers associated with the BGP
peer";
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: A Border Gateway Protocol 4 (BGP-4),
Section 8.2.2.";
}
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: A Border Gateway Protocol 4 (BGP-4), Section 4.2,
RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 10.";
}
leaf negotiated-hold-time {
type uint16;
config false;
description
"The negotiated hold-time for the BGP session";
reference
"RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2,
RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 10.";
}
leaf keepalive {
type uint16 {
range "0..21845";
}
units "seconds";
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. A reasonable maximum value for this
timer would be one-third of the configured hold-time.
In the absence of explicit configuration of the keepalive
value, operationally it SHOULD have a value of one-third of
the negotiated hold-time.
If the value of this object is zero (0), no periodic
KEEPALIVE messages are sent to the peer after the BGP
connection has been established.
The actual time interval for the KEEPALIVE messages is
indicated by operational value of keepalive.";
reference
"RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.4,
RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 10.";
}
}
grouping graceful-restart-config {
description
"Configuration parameters relating to BGP graceful restart.";
leaf enabled {
type boolean;
default "false";
description
"Enable or disable the graceful-restart capability.";
}
leaf restart-time {
type bt:graceful-restart-time-type;
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.";
reference
"RFC 4724: Graceful Restart Mechanism for BGP.";
}
leaf stale-routes-time {
type uint32;
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 referred to as the
Selection_Deferral_Timer in RFC4724";
reference
"RFC 4724: Graceful Restart Mechanism for BGP.";
}
}
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 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 a shorter length.";
}
leaf enable-aigp {
type boolean;
default "false";
description
"Flag to enable sending / receiving accumulated IGP
attribute in routing updates";
reference
"RFC 7311: AIGP Metric Attribute for BGP.";
}
leaf enable-med {
type boolean;
default "false";
description
"Flag to enable sending/receiving of MED metric attribute
in routing updates.";
}
}
}
grouping rib {
description
"Grouping for rib.";
container rib {
container afi-safis {
config false;
description
"Enclosing container for address family list.";
list afi-safi {
key "name";
description
"List of afi-safi types.";
leaf name {
type identityref {
base bt:afi-safi-type;
}
description
"AFI,SAFI name.";
}
container ipv4-unicast {
when "../name = 'bt:ipv4-unicast'" {
description
"Include this container for IPv4 unicast RIB.";
}
description
"Routing tables for IPv4 unicast -- active when the
afi-safi name is ipv4-unicast.";
container loc-rib {
config false;
description
"Container for the IPv4 Unicast BGP Loc-RIB data.";
container routes {
description
"Enclosing container for list of routes in the
routing table.";
list route {
key "prefix origin path-id";
description
"List of routes in the table, keyed by the route
prefix, the route origin, and path-id. The route
origin can be either the neighbor address from
which the route was learned, or the source
protocol that injected the route. The path-id
distinguishes routes for the same prefix
received from a neighbor (e.g., if add-paths is
enabled).";
leaf prefix {
type inet:ipv4-prefix;
description
"The IPv4 prefix corresponding to the route.";
}
uses bgp-loc-rib-common-keys;
uses bgp-common-route-annotations-state;
uses rib-ext-route-annotations;
}
}
}
}
container ipv6-unicast {
when "../name = 'bt:ipv6-unicast'" {
description
"Include this container for IPv6 unicast RIB.";
}
description
"Routing tables for IPv6 unicast -- active when the
afi-safi name is ipv6-unicast.";
container loc-rib {
config false;
description
"Container for the IPv6 BGP Loc-RIB data.";
container routes {
description
"Enclosing container for list of routes in the
routing table.";
list route {
key "prefix origin path-id";
description
"List of routes in the table, keyed by the route
prefix, the route origin, and path-id. The route
origin can be either the neighbor address from
which the route was learned, or the source
protocol that injected the route. The path-id
distinguishes routes for the same prefix
received from a neighbor (e.g., if add-paths is
enabled).";
leaf prefix {
type inet:ipv6-prefix;
description
"The IPv6 prefix corresponding to the route.";
}
uses bgp-loc-rib-common-keys;
uses bgp-common-route-annotations-state;
uses rib-ext-route-annotations;
}
}
}
}
}
}
}
}
grouping bgp-loc-rib-common-keys {
description
"Common references used in keys for IPv4 and IPv6
Loc-RIB entries.";
leaf origin {
type union {
type inet:ip-address;
type identityref {
base rt:routing-protocol;
}
}
description
"Indicates the origin of the route. If the route is learned
from a neighbor, this value is the neighbor address. If
the route was injected or redistributed from another
protocol, the origin indicates the source protocol for the
route.";
}
leaf path-id {
type uint32;
description
"If the route is learned from a neighbor, the path-id
corresponds to the path-id for the route in the
corresponding adj-rib-in-post table. If the route is
injected from another protocol, or the neighbor does not
support BGP add-paths, the path-id should be set
to zero, also the default value.
However, YANG does not allow default values to be set
for parameters that form the key, so a default value
cannot be set here.";
}
}
grouping bgp-common-route-annotations-state {
description
"Data definitions for flags and other information attached
to routes in both LOC-RIB and Adj-RIB";
leaf last-modified {
type yang:timeticks;
description
"Timestamp when this path was last modified.
The value is the timestamp in seconds relative to
the Unix Epoch (Jan 1, 1970 00:00:00 UTC).";
}
}
grouping rib-ext-route-annotations {
description
"Extended annotations for routes in the routing tables";
leaf reject-reason {
type union {
type identityref {
base bgp-not-selected-bestpath;
}
type identityref {
base bgp-not-selected-policy;
}
}
description
"Indicates the reason the route is not used, either due to
policy filtering or bestpath selection";
}
}
identity bgp-not-selected-bestpath {
description
"Base identity for indicating reason a route was was not
selected by BGP route selection algorithm";
reference
"RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 9.1.";
}
identity bgp-not-selected-policy {
description
"Base identity for reason code for routes that are rejected
due to policy";
}
identity rejected-import-policy {
base bgp-not-selected-policy;
description
"Route was rejected after applying import policies.";
}
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
This is bgp YANG in process. Files bgp_yang_v2.odt, bgp_route_yang.odt and bgp_proto_yang.odt compare bird strures and draft draft-ietf-idr-bgp-model-17 yang. They contain possible structs where to find some of variables from yang.
There is smaller yang created from draft which bird can fulfill in file bgp_yang_our_version.yang. Some of groupings there are without usage, becouse they are part of other, hard to implement ones. File color_copied_yang.odt tracks what is in bgp_yang_our_version.yang yet.