[yang]: AAA login pattern (#9805)

Signed-off-by: Gang Lv ganglv@microsoft.com

<!--
     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)
This commit is contained in:
ganglv 2022-03-07 13:05:46 +08:00 committed by GitHub
parent b2409be2f2
commit 2ef9d65525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

@ -6,6 +6,10 @@
"desc": "Configure a wrong type in AAA table.", "desc": "Configure a wrong type in AAA table.",
"eStrKey": "InvalidValue" "eStrKey": "InvalidValue"
}, },
"AAA_TEST_WRONG_LOGIN": {
"desc": "Configure a wrong type in AAA table.",
"eStr": ["Invalid login choice"]
},
"AAA_TEST_WRONG_FAILTHROUGH": { "AAA_TEST_WRONG_FAILTHROUGH": {
"desc": "Configure a wrong failthrough in AAA table.", "desc": "Configure a wrong failthrough in AAA table.",
"eStrKey": "Pattern", "eStrKey": "Pattern",

View File

@ -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": { "AAA_TEST_WRONG_FAILTHROUGH": {
"sonic-system-aaa:sonic-system-aaa": { "sonic-system-aaa:sonic-system-aaa": {
"sonic-system-aaa:AAA": { "sonic-system-aaa:AAA": {

View File

@ -30,8 +30,12 @@ module sonic-system-aaa {
} }
leaf login { leaf login {
type string; type string {
description "AAA authentication/authorization/accounting methods - local/tacacs+/disable"; 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"; default "local";
} }