-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Yang model] add Restapi yang file (#12287)
* add Restapi Yang model
- Loading branch information
Showing
7 changed files
with
121 additions
and
1 deletion.
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."; | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |