diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json b/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json index dc3a60a24d..972b404b88 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json @@ -6,6 +6,10 @@ "desc": "Configure a wrong type in AAA table.", "eStrKey": "InvalidValue" }, + "AAA_TEST_WRONG_LOGIN": { + "desc": "Configure a wrong type in AAA table.", + "eStr": ["Invalid login choice"] + }, "AAA_TEST_WRONG_FAILTHROUGH": { "desc": "Configure a wrong failthrough in AAA table.", "eStrKey": "Pattern", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json index 5b05fc3330..fbf63f994c 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json @@ -24,6 +24,16 @@ } }, + "AAA_TEST_WRONG_LOGIN": { + "sonic-system-aaa:sonic-system-aaa": { + "sonic-system-aaa:AAA": { + "AAA_LIST": [{ + "login": "locallll" + }] + } + } + }, + "AAA_TEST_WRONG_FAILTHROUGH": { "sonic-system-aaa:sonic-system-aaa": { "sonic-system-aaa:AAA": { diff --git a/src/sonic-yang-models/yang-models/sonic-system-aaa.yang b/src/sonic-yang-models/yang-models/sonic-system-aaa.yang index 5df05d475d..c3a4421269 100644 --- a/src/sonic-yang-models/yang-models/sonic-system-aaa.yang +++ b/src/sonic-yang-models/yang-models/sonic-system-aaa.yang @@ -30,8 +30,12 @@ module sonic-system-aaa { } leaf login { - type string; - description "AAA authentication/authorization/accounting methods - local/tacacs+/disable"; + type string { + pattern '((tacacs\+|local|radius|default),)*(tacacs\+|local|radius|default)' { + error-message "Invalid login choice"; + } + } + description "AAA authentication/authorization/accounting methods - radius/tacacs+/local/default"; default "local"; }