Skip to content

Commit 2ef9d65

Browse files
authored
[yang]: AAA login pattern (#9805)
Signed-off-by: Gang Lv [email protected] <!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md ** Make sure all your commits include a signature generated with `git commit -s` ** If this is a bug fix, make sure your description includes "fixes #xxxx", or "closes #xxxx" or "resolves #xxxx" Please provide the following information: --> #### Why I did it end2end test is blocked by Yang model for AAA login pattern. #### How I did it Add pattern to AAA yang models. #### How to verify it Run UT for sonc-yang-models. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 #### Description for the changelog <!-- Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> Fix #9713 #### A picture of a cute animal (not mandatory but encouraged)
1 parent b2409be commit 2ef9d65

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"desc": "Configure a wrong type in AAA table.",
77
"eStrKey": "InvalidValue"
88
},
9+
"AAA_TEST_WRONG_LOGIN": {
10+
"desc": "Configure a wrong type in AAA table.",
11+
"eStr": ["Invalid login choice"]
12+
},
913
"AAA_TEST_WRONG_FAILTHROUGH": {
1014
"desc": "Configure a wrong failthrough in AAA table.",
1115
"eStrKey": "Pattern",

src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
}
2525
},
2626

27+
"AAA_TEST_WRONG_LOGIN": {
28+
"sonic-system-aaa:sonic-system-aaa": {
29+
"sonic-system-aaa:AAA": {
30+
"AAA_LIST": [{
31+
"login": "locallll"
32+
}]
33+
}
34+
}
35+
},
36+
2737
"AAA_TEST_WRONG_FAILTHROUGH": {
2838
"sonic-system-aaa:sonic-system-aaa": {
2939
"sonic-system-aaa:AAA": {

src/sonic-yang-models/yang-models/sonic-system-aaa.yang

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ module sonic-system-aaa {
3030
}
3131

3232
leaf login {
33-
type string;
34-
description "AAA authentication/authorization/accounting methods - local/tacacs+/disable";
33+
type string {
34+
pattern '((tacacs\+|local|radius|default),)*(tacacs\+|local|radius|default)' {
35+
error-message "Invalid login choice";
36+
}
37+
}
38+
description "AAA authentication/authorization/accounting methods - radius/tacacs+/local/default";
3539
default "local";
3640
}
3741

0 commit comments

Comments
 (0)