diff --git a/release/models/bgp/.spec.yml b/release/models/bgp/.spec.yml index 56df45b32d..dff54b1c75 100644 --- a/release/models/bgp/.spec.yml +++ b/release/models/bgp/.spec.yml @@ -2,6 +2,8 @@ docs: - yang/bgp/openconfig-bgp-types.yang - yang/bgp/openconfig-bgp.yang + - yang/bgp/openconfig-bgp-bmp.yang build: - yang/bgp/openconfig-bgp.yang + - yang/bgp/openconfig-bgp-bmp.yang run-ci: true diff --git a/release/models/bgp/openconfig-bgp-bmp.yang b/release/models/bgp/openconfig-bgp-bmp.yang new file mode 100644 index 0000000000..9a8481e03a --- /dev/null +++ b/release/models/bgp/openconfig-bgp-bmp.yang @@ -0,0 +1,275 @@ +module openconfig-bgp-bmp { + + yang-version "1"; + namespace "http://openconfig.net/yang/bgp-bmp"; + prefix "oc-bgp-bmp"; + + import openconfig-bgp-types { prefix oc-bgp-types; } + import openconfig-network-instance { prefix oc-netinst; } + import openconfig-inet-types { prefix oc-inet; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-yang-types { prefix oc-yang; } + + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines configuration and operational state data for + BGP Monitoring Protocol (BMP) as defined in RFC 7854."; + + oc-ext:openconfig-version "0.1.0"; + + revision "2025-04-21" { + description "Initial revision"; + reference "0.1.0"; + } + + // Typedefs + typedef connection-mode-type { + type enumeration { + enum ACTIVE { + description "BMP client actively initiates connections to BMP servers"; + } + enum PASSIVE { + description "BMP client passively listens for connections from BMP servers"; + } + } + description "Type to define the connection mode for BMP sessions"; + } + + typedef route-monitoring-policy-type { + type enumeration { + enum ADJ_RIB_IN_PRE_POLICY; + enum ADJ_RIB_IN_POST_POLICY; + enum ADJ_RIB_OUT_PRE_POLICY; + enum ADJ_RIB_OUT_POST_POLICY; + enum LOC_RIB; + } + description "Type to define the specific RIB view to be monitored by BMP"; + } + + typedef connection-status-type { + type enumeration { + enum LISTENING; + enum CONNECTED; + enum CONNECTING; + enum DISCONNECTED; + enum CLEANUP; + enum HOLDDOWN; + } + description "Type to define the operational status of a BMP session"; + } + + // Groupings + grouping bmp-tcp-keepalive-config { + description "Configuration parameters for BMP TCP keepalive settings"; + leaf idle-time { + type uint32; + units "seconds"; + description "Time before sending a TCP keepalive probe when connection is idle"; + } + leaf probe-count { + type uint8; + description "Maximum number of TCP keepalive probes before declaring connection dead"; + } + leaf probe-interval { + type uint32; + units "seconds"; + description "Time between TCP keepalive probes"; + } + } + + grouping bmp-tcp-keepalive-top { + container tcp-keepalive { + description "Top-level container for BMP TCP keepalive"; + container config { uses bmp-tcp-keepalive-config; } + container state { + config false; + uses bmp-tcp-keepalive-config; + } + } + } + + grouping bmp-afi-safi-config { + leaf afi-safi-name { + type identityref { + base oc-bgp-types:AFI_SAFI_TYPE; + } + } + leaf enabled { + type boolean; + default false; + } + } + + grouping bmp-afi-safis-top { + container afi-safis { + list afi-safi { + key "afi-safi-name"; + leaf afi-safi-name { + type leafref { path "../config/afi-safi-name"; } + } + container config { uses bmp-afi-safi-config; } + container state { + config false; + uses bmp-afi-safi-config; + } + } + } + } + + grouping bmp-route-monitoring-config { + leaf policy-type { + type route-monitoring-policy-type; + } + leaf exclude-non-eligible { + type boolean; + default false; + when "../policy-type = 'ADJ_RIB_IN_POST_POLICY'"; + } + leaf exclude-non-feasible { + type boolean; + default false; + when "../policy-type = 'ADJ_RIB_IN_PRE_POLICY'"; + } + } + + grouping bmp-station-config { + leaf name { + type string; + description "Identifier for the BMP station"; + } + leaf station-address { + type oc-inet:ip-address; + mandatory true; + } + leaf station-port { + type oc-inet:port-number; + } + uses bmp-route-monitoring-config; + } + + grouping bmp-station-state { + leaf connection-status { type connection-status-type; } + leaf uptime { + type uint64; + units "seconds"; + } + leaf flap-count { type oc-yang:counter64; } + container message-counters { + leaf total { type oc-yang:counter64; } + leaf tx-statistics { type oc-yang:counter64; } + leaf route-monitoring { type oc-yang:counter64; } + leaf peer-monitoring { type oc-yang:counter64; } + leaf route-mirroring { type oc-yang:counter64; } + } + } + + grouping bmp-stations-top { + container stations { + list station { + key "name"; + leaf name { type leafref { path "../config/name"; } } + container config { uses bmp-station-config; } + container state { + config false; + uses bmp-station-config; + uses bmp-station-state; + } + uses bmp-afi-safis-top; + } + } + container station-groups { + list station-group { + key "name"; + leaf name { type string; } + container config { + leaf-list station-names { + type leafref { path "../../../stations/station/name"; } + } + } + container state { + config false; + leaf-list station-names { + type leafref { path "../../../stations/station/name"; } + } + } + } + } + } + + grouping bmp-global-config { + leaf enabled { + type boolean; + default false; + } + leaf connection-mode { + type connection-mode-type; + mandatory true; + } + leaf local-address { type oc-inet:ip-address; } + leaf local-port { + type oc-inet:port-number; + when "../connection-mode = 'PASSIVE'"; + } + leaf statistics-timeout { + type uint32; + units "seconds"; + } + } + + grouping bmp-top { + container bmp { + container config { uses bmp-global-config; } + container state { + config false; + uses bmp-global-config; + } + uses bmp-tcp-keepalive-top; + uses bmp-stations-top; + uses bmp-afi-safis-top; + } + } + + grouping bmp-neighbor-config { + leaf-list enabled-bm-views { type route-monitoring-policy-type; } + leaf monitoring-enabled { + type boolean; + default false; + } + } + + grouping bmp-neighbor-top { + container bmp { + container config { uses bmp-neighbor-config; } + container state { + config false; + uses bmp-neighbor-config; + } + uses bmp-afi-safis-top; + } +} + +// Augmentations + augment "/oc-netinst:network-instances/oc-netinst:network-instance/oc-netinst:protocols/oc-netinst:protocol/oc-netinst:bgp/oc-netinst:global" { + description + "Augments the global BGP configuration with BMP parameters"; + uses bmp-top; + } + + augment "/oc-netinst:network-instances/oc-netinst:network-instance/oc-netinst:protocols/oc-netinst:protocol/oc-netinst:bgp/oc-netinst:neighbors/oc-netinst:neighbor" { + description + "Augments BGP neighbor configuration with BMP parameters"; + uses bmp-neighbor-top; + } + + augment "/oc-netinst:network-instances/oc-netinst:network-instance/oc-netinst:protocols/oc-netinst:protocol/oc-netinst:bgp/oc-netinst:peer-groups/oc-netinst:peer-group" { + description + "Augments BGP peer-group configuration with BMP parameters"; + uses bmp-neighbor-top; + } + } +