From 8fb3fde794d049fd4ac61940d17b0b83ee0b240b Mon Sep 17 00:00:00 2001 From: zitingguo-ms Date: Thu, 20 Jun 2024 21:44:13 +0800 Subject: [PATCH] [YANG] Update device_metadata to add suppress-fib-pending field (#19329) Why I did it BGP pending FIB suppression is introduced in #12853, hence updating the YANG model. Work item tracking Microsoft ADO (number only): 28398135 How I did it Added a new field 'suppress-fib-pending' in the DEVICE_METADATA YANG model table. Added UT for YANG model changes. How to verify it Run PR tests. Apply empty.json file to verify: admin@str2-7050cx3-acs-02:~$ sudo config apply-patch empty.json Patch Applier: Patch application starting. Patch Applier: Patch: [] Patch Applier: Getting current config db. Patch Applier: Simulating the target full config after applying the patch. Patch Applier: Validating all JsonPatch operations are permitted on the specified fields Patch Applier: Validating target config does not have empty tables, since they do not show up in ConfigDb. Patch Applier: Sorting patch updates. Patch Applier: The patch was converted into 0 changes. Patch Applier: Applying 0 changes in order. Patch Applier: Verifying patch updates are reflected on ConfigDB. Patch Applier: Patch application completed. Patch applied successfully. admin@str2-7050cx3-acs-02:~$ Signed-off-by: zitingguo-ms zitingguo@microsoft.com --- .../tests/files/sample_config_db.json | 4 ++- .../tests/device_metadata.json | 10 +++++++ .../tests_config/device_metadata.json | 30 +++++++++++++++++++ .../yang-models/sonic-device_metadata.yang | 9 ++++++ 4 files changed, 52 insertions(+), 1 deletion(-) 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 95b60da764f2..4a743fda6bf1 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -364,7 +364,9 @@ "bgp_adv_lo_prefix_as_128": "true", "yang_config_validation": "disable", "rack_mgmt_map": "dummy_value", - "timezone": "Europe/Kiev" + "timezone": "Europe/Kiev", + "synchronous_mode": "enable", + "suppress-fib-pending": "disabled" } }, "VLAN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index 65288b8b2db8..104a32ac9b45 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -146,5 +146,15 @@ "DEVICE_METADATA_INVALID_CREATE_ONLY_CONFIG_DB_BUFFERS": { "desc": "Verifying invalid create_only_config_db_buffers value", "eStrKey": "InvalidValue" + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED": { + "desc": "Enable bgp-suppress-fib-pending" + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_DISABLED": { + "desc": "Disable bgp-suppress-fib-pending" + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { + "desc": "Enable bgp-suppress-fib-pending when synchronous mode is disabled", + "eStr": ["ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"] } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index b8053aa6ac66..27771f99820a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -386,5 +386,35 @@ } } } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "enable", + "suppress-fib-pending": "enabled" + } + } + } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_DISABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "disable", + "suppress-fib-pending": "disabled" + } + } + } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "disable", + "suppress-fib-pending": "enabled" + } + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 392bbf941f6f..8c68fe2fdaa8 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -230,6 +230,15 @@ module sonic-device_metadata { otherwise the maximum available buffers (which are read from SAI) will be created, regardless of the CONFIG_DB buffers configuration."; } + + leaf suppress-fib-pending { + type stypes:admin_mode; + default disabled; + description "Enable BGP suppress FIB pending feature. BGP will wait for route FIB installation before announcing routes"; + must "((current() = 'disabled') or (current() = 'enabled' and ../synchronous_mode = 'enable'))" { + error-message "ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"; + } + } } /* end of container localhost */ }