-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add YANG model and unit tests for sonic-telemetry #10840
Changes from 7 commits
db9e603
8ee9f9f
eeae234
39807aa
a828c39
68e0d50
e36dd16
78674f9
d53a8a8
ed4ebab
00f37c0
71f553e
b44ea93
97a1720
6768b03
f753be7
2e37406
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,17 @@ | ||
{ | ||
"TELEMETRY_TABLE_WITH_INCORRECT_CERT": { | ||
"desc": "TABLE_WITH_INCORRECT_CERT failure.", | ||
"eStrKey": "Pattern" | ||
}, | ||
"TELEMETRY_TABLE_WITH_INCORRECT_CLIENT_AUTH": { | ||
"desc": "TABLE_WITH_INCORRECT_CLIENT_AUTH failure", | ||
"eStrKey": "InvalidValue" | ||
}, | ||
"TELEMETRY_TABLE_WITH_INCORRECT_PORT": { | ||
"desc": "TABLE_WITH_INCORRECT_PORT failure.", | ||
"eStrKey": "InvalidValue" | ||
}, | ||
"TELEMETRY_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. 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. Fixed. |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"TELEMETRY_TABLE_WITH_INCORRECT_CERT": { | ||
"sonic-telemetry:sonic-telemetry": { | ||
"sonic-telemetry:TELEMETRY": { | ||
"certs": { | ||
"ca_crt": "abcd.config", | ||
"server_crt": "a/b/c", | ||
"server_key": "123" | ||
}, | ||
"gnmi": { | ||
"client_auth": "true", | ||
"log_level": "2", | ||
"port": "50051" | ||
} | ||
} | ||
} | ||
}, | ||
"TELEMETRY_TABLE_WITH_INCORRECT_CLIENT_AUTH": { | ||
"sonic-telemetry:sonic-telemetry": { | ||
"sonic-telemetry:TELEMETRY": { | ||
"certs": { | ||
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", | ||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer", | ||
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.
Mixing tabs/spaces. Prefer 4-space indentation. #Closed 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. Fixed. |
||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key" | ||
}, | ||
"gnmi": { | ||
"client_auth": "up", | ||
"log_level": "2", | ||
"port": "50051" | ||
} | ||
} | ||
} | ||
}, | ||
"TELEMETRY_TABLE_WITH_INCORRECT_PORT": { | ||
"sonic-telemetry:sonic-telemetry": { | ||
"sonic-telemetry:TELEMETRY": { | ||
"certs": { | ||
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", | ||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer", | ||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key" | ||
}, | ||
"gnmi": { | ||
"client_auth": "true", | ||
"log_level": "2", | ||
"port": "abc" | ||
} | ||
} | ||
} | ||
}, | ||
"TELEMETRY_TABLE_WITH_VALID_CONFIG": { | ||
"sonic-telemetry:sonic-telemetry": { | ||
"sonic-telemetry:TELEMETRY": { | ||
"certs": { | ||
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", | ||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer", | ||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key" | ||
}, | ||
"gnmi": { | ||
"client_auth": "true", | ||
"log_level": "2", | ||
"port": "50051" | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
module sonic-telemetry { | ||
|
||
yang-version 1.1; | ||
|
||
namespace "http://github.com/Azure/sonic-telemetry"; | ||
prefix telemetry; | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description "TELEMETRY YANG Module for SONiC OS"; | ||
|
||
revision 2022-05-13 { | ||
description "First Revision"; | ||
} | ||
|
||
container sonic-telemetry { | ||
|
||
container TELEMETRY { | ||
|
||
description "TELEMETRY TABLE part of config_db.json"; | ||
|
||
container certs { | ||
|
||
leaf ca_crt { | ||
type string { | ||
pattern '(/[a-zA-Z0-9_-]+)*/dsmsroot.cer'; | ||
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. 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. According to: All telemetry certs will have the exact path listed. Maybe it makes sense to enforce the entire path instead of just the file name and extension. 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. The file name must be dsmsroot.cer? Can we use other name like abc.cer? 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. Changed pattern to not include filename in the case that file name changes in the future. |
||
} | ||
description "Local path for ca_crt."; | ||
} | ||
|
||
leaf server_crt { | ||
type string { | ||
pattern '(/[a-zA-Z0-9_-]+)*/streamingtelemetryserver.cer'; | ||
} | ||
description "Local path for server_crt."; | ||
} | ||
|
||
leaf server_key { | ||
type string { | ||
pattern '(/[a-zA-Z0-9_-]+)*/streamingtelemetryserver.key'; | ||
} | ||
description "Local path for server_key."; | ||
} | ||
|
||
} | ||
|
||
container gnmi { | ||
|
||
leaf client_auth { | ||
type boolean; | ||
description "Flag for requiring client auth."; | ||
} | ||
|
||
leaf log_level { | ||
type uint8 { | ||
range 0..100; | ||
} | ||
description "Log level for gnmi."; | ||
} | ||
|
||
leaf port { | ||
type inet:port-number; | ||
description "Port gnmi runs on."; | ||
} | ||
|
||
} | ||
|
||
} | ||
} | ||
} |
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 not add unnecessary trailing blanks. #Closed
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.
Fixed.