Skip to content

Commit 07cd4ff

Browse files
authoredMay 14, 2024
[YANG] Align to authentication check with load_minigraph to cover more scenarios (#18908)
#### Why I did it This will cover more cases for those only have authentication enabled with tacacs but not authorization enabled. Also, make it algin with the check in load_minigraph #### How I did it Change to authentication #### How to verify it unit test
1 parent fd4c71f commit 07cd4ff

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed
 

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"eStrKey": "Pattern",
1616
"eStr": ["false|true|False|True"]
1717
},
18-
"AAA_AUTHORIZATION_TEST": {
19-
"desc": "Configure an authorization type in AAA table."
18+
"AAA_AUTHENTICATION_TEST": {
19+
"desc": "Configure an authentication type in AAA table."
2020
},
21-
"AAA_AUTHORIZATION_TEST_TACACS_WITHOUT_TACPLUS": {
22-
"desc": "Configure tacacs in authorization type in AAA table without TACPLUS table.",
23-
"eStr": ["Authorization with 'tacacs+' is not allowed when passkey not exists."]
21+
"AAA_AUTHENTICATION_TEST_TACACS_WITHOUT_TACPLUS": {
22+
"desc": "Configure tacacs in authentication type in AAA table without TACPLUS table.",
23+
"eStr": ["Authentication with 'tacacs+' is not allowed when passkey not exists."]
2424
},
2525
"AAA_ACCOUNTING_TEST": {
2626
"desc": "Configure an accounting type in AAA table."

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"sonic-system-aaa:AAA": {
55
"AAA_LIST": [{
66
"type": "authentication",
7-
"login": "tacacs+,local",
7+
"login": "local",
88
"failthrough": "True",
99
"fallback": "True",
1010
"trace": "True",
@@ -45,11 +45,11 @@
4545
}
4646
},
4747

48-
"AAA_AUTHORIZATION_TEST": {
48+
"AAA_AUTHENTICATION_TEST": {
4949
"sonic-system-aaa:sonic-system-aaa": {
5050
"sonic-system-aaa:AAA": {
5151
"AAA_LIST": [{
52-
"type": "authorization",
52+
"type": "authentication",
5353
"login": "tacacs+"
5454
}]
5555
}
@@ -64,11 +64,11 @@
6464
}
6565
},
6666

67-
"AAA_AUTHORIZATION_TEST_TACACS_WITHOUT_TACPLUS": {
67+
"AAA_AUTHENTICATION_TEST_TACACS_WITHOUT_TACPLUS": {
6868
"sonic-system-aaa:sonic-system-aaa": {
6969
"sonic-system-aaa:AAA": {
7070
"AAA_LIST": [{
71-
"type": "authorization",
71+
"type": "authentication",
7272
"login": "tacacs+"
7373
}]
7474
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ module sonic-system-aaa {
4343
default "local";
4444
}
4545

46-
must 'not(./type = "authorization" and contains(./login, "tacacs+") and not(/tacacs:sonic-system-tacacs/tacacs:TACPLUS/tacacs:global/tacacs:passkey))' {
47-
error-message "Authorization with 'tacacs+' is not allowed when passkey not exists.";
46+
must 'not(./type = "authentication" and contains(./login, "tacacs+") and not(/tacacs:sonic-system-tacacs/tacacs:TACPLUS/tacacs:global/tacacs:passkey))' {
47+
error-message "Authentication with 'tacacs+' is not allowed when passkey not exists.";
4848
}
4949

5050
leaf failthrough {

0 commit comments

Comments
 (0)