From 7a9c05c1e71f0f8390c2f95fa37a602daa31bb27 Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Thu, 7 Sep 2023 07:31:18 +0800 Subject: [PATCH] [yang] Add Bmc to Device Neighbor Metadata element type list (#16188) (#16470) Bmc is a valid neighbor type in minigraph, however it was missing from the YANG model definition. Usually, the Bmc type device can be neighbor of BmcMgmtToRRouter. This PR is to introduce this type. Co-authored-by: Yaqiang Zhu --- .../tests/device_neighbor_metadata.json | 7 +++++ .../device_neighbor_metadata.json | 26 +++++++++++++++++++ .../sonic-device_neighbor_metadata.yang | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_neighbor_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_neighbor_metadata.json index 2943a53d1b..404856159a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_neighbor_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_neighbor_metadata.json @@ -9,6 +9,13 @@ "DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN": { "desc": "DEVICE_NEIGHBOR_METADATA correct value for Type field" }, + "DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN_BMC": { + "desc": "DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN pattern failure with IncorrectTypeBmc.", + "eStrKey" : "Pattern" + }, + "DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN_BMC": { + "desc": "DEVICE_NEIGHBOR_METADATA correct value for type field for Bmc" + }, "DEVICE_NEIGHBOR_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { "desc": "DEVICE_NEIGHBOR_METADATA value as not-provisioned for Type field" } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_neighbor_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_neighbor_metadata.json index ecc0c35d22..82faf0815f 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_neighbor_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_neighbor_metadata.json @@ -25,6 +25,32 @@ } } }, + "DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN_BMC": { + "sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": { + "sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": { + "DEVICE_NEIGHBOR_METADATA_LIST": [ + { + "name": "Ethernet116", + "hwsku": "DUMMY_BMC_SKU", + "type": "IncorrectTypeBmc" + } + ] + } + } + }, + "DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN_BMC": { + "sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": { + "sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": { + "DEVICE_NEIGHBOR_METADATA_LIST": [ + { + "name": "Ethernet116", + "hwsku": "DUMMY_BMC_SKU", + "type": "Bmc" + } + ] + } + } + }, "DEVICE_NEIGHBOR_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { "sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": { "sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": { diff --git a/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang index 0b8a5ad1ee..594c4a8c2c 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang @@ -83,7 +83,7 @@ module sonic-device_neighbor_metadata { leaf type { description "Network element type"; type string { - pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|Asic|Supervior|MgmtToRRouter|MgmtLeafRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|BmcMgmtToRRouter|Server|MiniPower|SmartCable|Ixia|not-provisioned"; + pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|Asic|Supervior|MgmtToRRouter|MgmtLeafRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|BmcMgmtToRRouter|Server|Bmc|MiniPower|SmartCable|Ixia|not-provisioned"; } }