From c1b5fcce1a734223fb4debffaa7613677d0da217 Mon Sep 17 00:00:00 2001 From: Feng Pan Date: Tue, 2 Apr 2024 08:26:09 +0000 Subject: [PATCH] Add yang models for bmp service. --- src/sonic-yang-models/doc/Configuration.md | 16 ++++++ src/sonic-yang-models/setup.py | 2 + .../tests/files/sample_config_db.json | 7 +++ .../tests/yang_model_tests/tests/bmp.json | 9 +++ .../yang_model_tests/tests_config/bmp.json | 24 ++++++++ .../yang-models/sonic-bmp.yang | 56 +++++++++++++++++++ 6 files changed, 114 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/bmp.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/bmp.json create mode 100644 src/sonic-yang-models/yang-models/sonic-bmp.yang diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 886277d26f7c..b65c9a81e8f4 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -33,6 +33,7 @@ Table of Contents * [Device neighbor metada](#device-neighbor-metada) * [DHCP_RELAY](#dhcp_relay) * [DHCP Server IPV4](#dhcp_server_ipv4) + * [BMP](#bmp) * [DSCP_TO_TC_MAP](#dscp_to_tc_map) * [FG_NHG](#fg_nhg) * [FG_NHG_MEMBER](#fg_nhg_member) @@ -1005,6 +1006,21 @@ instance is supported in SONiC. ``` +### BMP +BMP related configuration are defined in **bgp_neighbor_table**,**bgp_rib_in_table**, **bgp_rib_out_table** tables. + +``` +{ + "BMP": { + "table": { + "bgp_neighbor_table": "true", + "bgp_rib_in_table": "false", + "bgp_rib_out_table": "false" + } + } +} +``` + ### DHCP_SERVER_IPV4 IPV4 DHPC Server related configuration are defined in **DHCP_SERVER_IPV4**, **DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS**, **DHCP_SERVER_IPV4_RANGE**, **DHCP_SERVER_IPV4_PORT** tables. ``` diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 95f98bd53dd8..1398cbaaa33a 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -199,6 +199,7 @@ def run(self): './yang-models/sonic-system-port.yang', './yang-models/sonic-macsec.yang', './yang-models/sonic-bgp-sentinel.yang', + './yang-models/sonic-bmp.yang', './yang-models/sonic-smart-switch.yang',]), ('cvlyang-models', ['./cvlyang-models/sonic-acl.yang', './cvlyang-models/sonic-bgp-common.yang', @@ -274,6 +275,7 @@ def run(self): './cvlyang-models/sonic-static-route.yang', './cvlyang-models/sonic-system-port.yang', './cvlyang-models/sonic-macsec.yang', + './cvlyang-models/sonic-bmp.yang', './cvlyang-models/sonic-bgp-sentinel.yang']), ], zip_safe=False, diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 050f4433bac6..f6ea5c89af98 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1293,6 +1293,13 @@ "report_type": "periodic" } }, + "BMP": { + "table": { + "bgp_neighbor_table": "true", + "bgp_rib_in_table": "false", + "bgp_rib_out_table": "false" + } + }, "GNMI": { "certs": { "ca_crt": "/etc/sonic/credentials/dsmsroot.cer", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/bmp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/bmp.json new file mode 100644 index 000000000000..09883d4174c8 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/bmp.json @@ -0,0 +1,9 @@ +{ + "BMP_TABLE_WITH_VALID_CONFIG": { + "desc": "BMP TABLE WITH VALID CONFIG." + }, + "BMP_TABLE_WITH_INVALID_CONFIG": { + "desc": "BMP TABLE WITH INVALID CONFIG.", + "eStrKey": "Pattern" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/bmp.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bmp.json new file mode 100644 index 000000000000..cbc8dceead7e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bmp.json @@ -0,0 +1,24 @@ +{ + "BMP_TABLE_WITH_VALID_CONFIG": { + "sonic-bmp:sonic-bmp": { + "sonic-bmp:BMP": { + "table": { + "bgp_neighbor_table": "true", + "bgp_rib_in_table": "false", + "bgp_rib_out_table": "false" + } + } + } + }, + "BMP_TABLE_WITH_INVALID_CONFIG": { + "sonic-bmp:sonic-bmp": { + "sonic-bmp:BMP": { + "table": { + "bgp_neighbor_table": "up", + "bgp_rib_in_table": "false", + "bgp_rib_out_table": "false" + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-bmp.yang b/src/sonic-yang-models/yang-models/sonic-bmp.yang new file mode 100644 index 000000000000..70157f6c881e --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-bmp.yang @@ -0,0 +1,56 @@ +module sonic-bmp { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-bmp"; + prefix bmp; + + import sonic-types { + prefix stypes; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description "BMP YANG Module for SONiC OS"; + + revision 2024-03-20 { + description "First Revision"; + } + + container sonic-bmp { + + container BMP { + + description "BMP TABLE control part of config_db.json"; + + container table { + + leaf bgp_neighbor_table { + type stypes:boolean_type; + default "true"; + description "Flag for enabling/disabling bgp_neighbor_table dump."; + } + + leaf bgp_rib_in_table { + type stypes:boolean_type; + default "false"; + description "Flag for enabling/disabling bgp_rib_in_table dump."; + } + + leaf bgp_rib_out_table { + type stypes:boolean_type; + default "false"; + description "Flag for enabling/disabling bgp_rib_out_table dump."; + } + + } + + } + + } + +}