Skip to content

Allowing wildcard client cert CNs in restapi's YANG model - #25450

Merged
qiluo-msft merged 1 commit into
sonic-net:masterfrom
mramezani95:mramezani/update_restapi_client_cert_cn_yang
Feb 12, 2026
Merged

qiluo-msft merged 1 commit into
sonic-net:masterfrom
mramezani95:mramezani/update_restapi_client_cert_cn_yang

Conversation

@mramezani95

@mramezani95 mramezani95 commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Why I did it

sonic-net/sonic-restapi#168 and sonic-net/sonic-restapi#175 add support for wildcard CN matching in sonic-gnmi. The pattern for client_crt_cname in restapi's YANG model needs to be updated accordingly (to allow for wildcard CNs).

Work item tracking
  • Microsoft ADO (number only): 36744821

How I did it

Modified the YANG model pattern for client_crt_cname so that each CN can start with *..

How to verify it

Run the updated restapi YANG tests.

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

  • master

Description for the changelog

Updating restapi's YANG model to allow wildcard CNs in the client_crt_cname field.

Link to config_db schema for YANG module changes

https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#restapi

Signed-off-by: Mahdi Ramezani <mramezani@microsoft.com>
Copilot AI review requested due to automatic review settings February 11, 2026 21:16
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the sonic-restapi YANG model to permit wildcard client certificate CN entries (e.g., *.example.com) to align with recent wildcard CN matching support in related components, and expands the YANG model test vectors accordingly.

Changes:

  • Update client_crt_cname YANG pattern to allow an optional *. prefix per CN entry.
  • Extend restapi YANG model test configs with additional valid/invalid wildcard CN cases.
  • Update the restapi YANG test expectations to match the new test vectors.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/sonic-yang-models/yang-models/sonic-restapi.yang Broadens client_crt_cname validation regex to accept *.-prefixed CNs.
src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json Adds new test configurations covering wildcard CN acceptance/rejection.
src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json Adds/renames test expectation entries for the new wildcard CN cases.

Comment thread src/sonic-yang-models/yang-models/sonic-restapi.yang
Comment thread src/sonic-yang-models/yang-models/sonic-restapi.yang
qiluo-msft
qiluo-msft approved these changes Feb 11, 2026
@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #25474

@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202511: #25475

FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Mar 6, 2026
Why I did it
sonic-net/sonic-restapi#168 and sonic-net/sonic-restapi#175 add support for wildcard CN matching in sonic-gnmi. The pattern for client_crt_cname in restapi's YANG model needs to be updated accordingly (to allow for wildcard CNs).

Work item tracking
Microsoft ADO (number only): 36744821
How I did it
Modified the YANG model pattern for client_crt_cname so that each CN can start with *..

Signed-off-by: Feng Pan <fenpan@microsoft.com>
dprital pushed a commit that referenced this pull request Mar 19, 2026
Why I did it
sonic-net/sonic-restapi#168 and sonic-net/sonic-restapi#175 add support for wildcard CN matching in sonic-gnmi. The pattern for client_crt_cname in restapi's YANG model needs to be updated accordingly (to allow for wildcard CNs).

Work item tracking
Microsoft ADO (number only): 36744821
How I did it
Modified the YANG model pattern for client_crt_cname so that each CN can start with *..

Signed-off-by: dprital <drorp@nvidia.com>
mhchann pushed a commit to mhchann/sonic-buildimage that referenced this pull request May 7, 2026
Why I did it
sonic-net/sonic-restapi#168 and sonic-net/sonic-restapi#175 add support for wildcard CN matching in sonic-gnmi. The pattern for client_crt_cname in restapi's YANG model needs to be updated accordingly (to allow for wildcard CNs).

Work item tracking
Microsoft ADO (number only): 36744821
How I did it
Modified the YANG model pattern for client_crt_cname so that each CN can start with *..

Signed-off-by: mhchann <mhchann082@gmail.com>
roger530-ho pushed a commit to roger530-ho/sonic-buildimage that referenced this pull request Jun 23, 2026
Why I did it
sonic-net/sonic-restapi#168 and sonic-net/sonic-restapi#175 add support for wildcard CN matching in sonic-gnmi. The pattern for client_crt_cname in restapi's YANG model needs to be updated accordingly (to allow for wildcard CNs).

Work item tracking
Microsoft ADO (number only): 36744821
How I did it
Modified the YANG model pattern for client_crt_cname so that each CN can start with *..
xdqi pushed a commit to canonical/sonic-buildimage that referenced this pull request Jul 6, 2026
Why I did it
sonic-net/sonic-restapi#168 and sonic-net/sonic-restapi#175 add support for wildcard CN matching in sonic-gnmi. The pattern for client_crt_cname in restapi's YANG model needs to be updated accordingly (to allow for wildcard CNs).

Work item tracking
Microsoft ADO (number only): 36744821
How I did it
Modified the YANG model pattern for client_crt_cname so that each CN can start with *..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants