-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule sonic-restapi
updated
17 files
+5 −11 | Dockerfile | |
+5 −10 | Dockerfile.build | |
+1 −0 | Dockerfile.common.prod | |
+5 −11 | Dockerfile.test | |
+1 −1 | azurepipeline.yml | |
+2 −1 | build.sh | |
+32 −0 | copy.py | |
+1 −0 | copy.sh | |
+18 −0 | dependencies.conf | |
+212 −38 | go-server-server/go/default.go | |
+50 −3 | go-server-server/go/models.go | |
+25 −16 | go-server-server/go/persistent.go | |
+14 −0 | go-server-server/go/routers.go | |
+57 −0 | go-server-server/go/util.go | |
+78 −1 | sonic_api.yaml | |
+7 −0 | test/restapi_client.py | |
+607 −5 | test/test_restapi.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"RESTAPI_TABLE_WITH_INCORRECT_CERT": { | ||
"desc": "RESTAPI TABLE_WITH_INCORRECT_CERT failure.", | ||
"eStr": ["server_crt"] | ||
}, | ||
"RESTAPI_TABLE_WITH_VALID_CONFIG": { | ||
"desc": "RESTAPI TABLE WITH VALID CONFIG." | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
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."; | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 comment
The 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