Skip to content

Commit 6f9a3ab

Browse files
authored
Improve GNMI_CLIENT_CERT table to support multiple roles. (#23456)
Improve GNMI_CLIENT_CERT table to support multiple roles. #### Why I did it GNMI need support multiple roles. HLD: sonic-net/SONiC#1967 ##### Work item tracking - Microsoft ADO **(number only)**:31561802 #### How I did it Change GNMI_CLIENT_CERT table yang model. #### How to verify it Pass all test case. This PR depends on following PRs: sonic-net/sonic-gnmi#366 sonic-net/sonic-mgmt#17866 #### 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 - [ ] 202111 - [ ] 202205 - [ ] 202211 - [ ] 202305 #### Tested branch (Please provide the tested image version) <!-- - Please provide tested image version - e.g. - [x] 20201231.100 --> - [ ] <!-- image version 1 --> - [ ] <!-- image version 2 --> #### Description for the changelog Improve GNMI_CLIENT_CERT table to support multiple roles. <!-- Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU. --> #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md --> #### A picture of a cute animal (not mandatory but encouraged)
1 parent 1905d28 commit 6f9a3ab

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,10 +1265,14 @@
12651265
},
12661266
"GNMI_CLIENT_CERT": {
12671267
"testcert1": {
1268-
"role": "RW"
1268+
"role": [
1269+
"RW"
1270+
]
12691271
},
12701272
"testcert2": {
1271-
"role": "RO"
1273+
"role": [
1274+
"RO"
1275+
]
12721276
}
12731277
},
12741278
"TUNNEL": {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"GNMI_CLIENT_CERT_LIST_TABLE_WITH_MISSING_ROLE": {
1818
"desc": "CLIENT_CERT_LIST_TABLE_WITH_MISSING_ROLE failure.",
19-
"eStrKey": "Mandatory"
19+
"eStrKey": "MinElements"
2020
},
2121
"GNMI_CLIENT_CERT_LIST_TABLE_WITH_VALID_CONFIG": {
2222
"desc": "TABLE WITH VALID CONFIG."

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,15 @@
8080
"GNMI_CLIENT_CERT_LIST": [
8181
{
8282
"cert_cname": "testcert1",
83-
"role": "RW"
83+
"role": [
84+
"RW"
85+
]
8486
},
8587
{
8688
"cert_cname": "testcert2",
87-
"role": "RO"
89+
"role": [
90+
"RO"
91+
]
8892
}
8993
]
9094
}

src/sonic-yang-models/yang-models/sonic-gnmi.yang

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ module sonic-gnmi {
9292
"client cert common name";
9393
}
9494

95-
leaf role {
95+
leaf-list role {
9696
type string;
97-
mandatory true;
97+
min-elements 1;
9898
description
9999
"role of client cert common name";
100100
}

0 commit comments

Comments
 (0)