-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Yang model] add Restapi yang file #12287
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"RESTAPI_TABLE_WITH_INCORRECT_CERT": { | ||
"desc": "TABLE_WITH_INCORRECT_CERT failure.", | ||
"eStrKey": "Pattern" | ||
}, | ||
"RESTAPI_TABLE_WITH_VALID_CONFIG": { | ||
"desc": "TABLE WITH VALID CONFIG." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "RESTAPI TABLE WITH VALID CONFIG." Desc is helpful in case of test failures. Thx |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"RESTAPI_TABLE_WITH_INCORRECT_CERT": { | ||
"sonic-restapi:sonic-restapi": { | ||
"sonic-restapi:RESTAPI": { | ||
"certs": { | ||
"ca_crt": "abcd.config", | ||
"server_crt": "a/b/c", | ||
"server_key": "123", | ||
"client_crt_cname": "client" | ||
} | ||
} | ||
} | ||
}, | ||
"RESTAPI_TABLE_WITH_VALID_CONFIG": { | ||
"sonic-restapi:sonic-restapi": { | ||
"sonic-restapi:RESTAPI": { | ||
"certs": { | ||
"ca_crt": "/etc/sonic/credentials/ame_root.pem", | ||
"server_crt": "/etc/sonic/credentials/restapiserver.crt", | ||
"server_key": "/etc/sonic/credentials/restapiserver.key", | ||
"client_crt_cname": "client.sonic.net" | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module sonic-restapi { | ||
|
||
yang-version 1.1; | ||
|
||
namespace "http://github.com/Azure/sonic-restapi"; | ||
prefix restapi; | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description "RESTAPI YANG Module for SONiC OS"; | ||
|
||
revision 2022-10-05 { | ||
description "First Revision"; | ||
} | ||
|
||
container sonic-restapi { | ||
|
||
container RESTAPI { | ||
|
||
description "RESTAPI TABLE part of config_db.json"; | ||
|
||
container certs { | ||
|
||
leaf ca_crt { | ||
type string { | ||
pattern '(/[a-zA-Z0-9_-]+)*/([a-zA-Z0-9_-]+).pem'; | ||
} | ||
description "Local path for ca_crt."; | ||
} | ||
|
||
leaf server_crt { | ||
type string { | ||
pattern '(/[a-zA-Z0-9_-]+)*/([a-zA-Z0-9_-]+).crt'; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to limit the suffix as crt? Can we use xxx.cer or xxx.cert? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think for restapi, it is currently fixed to crt. We may not need to provide an extension support |
||
description "Local path for server_crt."; | ||
} | ||
|
||
leaf client_crt_cname { | ||
type string { | ||
pattern '(/[a-zA-Z0-9_-.]+)*/([a-zA-Z0-9_-.]+)./[a-z]{3}'; | ||
} | ||
description "Client cert name."; | ||
} | ||
|
||
leaf server_key { | ||
type string { | ||
pattern '(/[a-zA-Z0-9_-]+)*/([a-zA-Z0-9_-]+).key'; | ||
} | ||
description "Local path for server_key."; | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"eStr": ["server_crt"]
This way, Libyang error will be matched against only server_crt field.