From b621dafff77642db541553f5a2f8ec85e70ea695 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 10 Feb 2022 11:59:25 -0800 Subject: [PATCH] [yang] Adding not-provisioned to type field in DEVICE_METADATA table (#9951) #### Why I did it Fixing the issue https://github.com/Azure/sonic-buildimage/issues/9915 #### How I did it Added 'not-provisioned' as a supported value for type field in DEVICE_METADATA type. This value is set during initial ZTP bring up #### How to verify it Added UT to verify it. --- .../tests/yang_model_tests/tests/device_metadata.json | 3 +++ .../yang_model_tests/tests_config/device_metadata.json | 10 ++++++++++ .../yang-models/sonic-device_metadata.yang | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) 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 500a97e35d..8f4be4caff 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 @@ -36,6 +36,9 @@ "DEVICE_METADATA_TYPE_CORRECT_PATTERN": { "desc": "DEVICE_METADATA correct value for Type field" }, + "DEVICE_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { + "desc": "DEVICE_METADATA value as not-provisioned for Type field" + }, "DEVICE_METADATA_DEFAULT_SYNCHRONOUS_MODE": { "desc": "DEVICE_METADATA DEFAULT VALUE FOR SYNCHRONOUS MODE.", "eStrKey" : "Verify", 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 aaa2760c5f..7e0e87f574 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 @@ -54,6 +54,16 @@ } } }, + "DEVICE_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65002", + "type": "not-provisioned" + } + } + } + }, "DEVICE_METADATA_DEFAULT_SYNCHRONOUS_MODE": { "sonic-device_metadata:sonic-device_metadata": { "sonic-device_metadata:DEVICE_METADATA": { 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 2040a24789..eb87161c6b 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -88,7 +88,7 @@ module sonic-device_metadata { leaf type { type string { length 1..255; - pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|MgmtToRRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR"; + pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|MgmtToRRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|not-provisioned"; } }