-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Fix]: Allow empty object lists in high-frequency-telemetry YANG model #23917
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
Changes from all commits
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 |
|---|---|---|
| @@ -1,5 +1,21 @@ | ||
| { | ||
| "HIGH_FREQUENCY_TELEMETRY_VALID_CASE": { | ||
| "desc": "Valid high frequency telemetry configuration." | ||
| }, | ||
| "HIGH_FREQUENCY_TELEMETRY_INVALID_PORT": { | ||
| "desc": "Invalid port.", | ||
| "eStrKey": "Must" | ||
| }, | ||
| "HIGH_FREQUENCY_TELEMETRY_INVALID_STATS": { | ||
| "desc": "Invalid stats.", | ||
| "eStrKey": "Must" | ||
| }, | ||
| "HIGH_FREQUENCY_TELEMETRY_INVALID_DUMMY_TABLE1": { | ||
| "desc": "Invalid dummy table1.", | ||
| "eStrKey": "InvalidJSON" | ||
| }, | ||
| "HIGH_FREQUENCY_TELEMETRY_INVALID_DUMMY_TABLE2": { | ||
| "desc": "Invalid dummy table2.", | ||
| "eStrKey": "InvalidJSON" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,8 +93,6 @@ module sonic-high-frequency-telemetry { | |
| + " or ( ../group_name = 'QUEUE' and substring-before(current(), '|') = /bql:sonic-buffer-queue/bql:BUFFER_QUEUE/bql:BUFFER_QUEUE_LIST/bql:port and re-match(substring-after(current(), '|'), '[0-9]+') )"; | ||
| } | ||
|
|
||
| must "count(object_names) > 0"; | ||
|
Contributor
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.
Contributor
Author
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. Use min-elements for what? I removed this condition because I want to support no explicate fields in HFT_GROUP object. such as: |
||
|
|
||
| leaf-list object_counters { | ||
|
Contributor
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. please also include such config in sample_config_db.json
Contributor
Author
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. Done |
||
| type string; | ||
| must "( ../group_name = 'PORT' and re-match(current(), 'IF_IN_OCTETS|IF_IN_UCAST_PKTS|IF_IN_DISCARDS|IF_IN_ERRORS|IN_CURR_OCCUPANCY_BYTES|IF_OUT_OCTETS|IF_OUT_DISCARDS|IF_OUT_ERRORS|IF_OUT_UCAST_PKTS|OUT_CURR_OCCUPANCY_BYTES|TRIM_PACKETS') )" | ||
|
|
||
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.
could you add a test for empty object list? I don't think current YANG allowed empty list becasue there are still constraints here if group_name is PORT:
leaf-list object_names {
type string;
must "( ../group_name = 'PORT' and current() = /port:sonic-port/port:PORT/port:PORT_LIST/port:name )"
+ " or ( ../group_name = 'BUFFER_POOL' and current() = /bpl:sonic-buffer-pool/bpl:BUFFER_POOL/bpl:BUFFER_POOL_LIST/bpl:name )"
+ " or ( ../group_name = 'INGRESS_PRIORITY_GROUP' and substring-before(current(), '|') = /bpg:sonic-buffer-pg/bpg:BUFFER_PG/bpg:BUFFER_PG_LIST/bpg:port and re-match(substring-after(current(), '|'), '[0-9]+') )"
+ " or ( ../group_name = 'QUEUE' and substring-before(current(), '|') = /bql:sonic-buffer-queue/bql:BUFFER_QUEUE/bql:BUFFER_QUEUE_LIST/bql:port and re-match(substring-after(current(), '|'), '[0-9]+') )";
}
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.
https://github.com/sonic-net/sonic-buildimage/pull/23917/files#diff-e4744a17a9c8acd94344ef9dfdec05bee6b87ce5506dd69e790fba84e7b46eb5R145-R148
This test is for empty object list.
Uh oh!
There was an error while loading. Please reload this page.
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.
The test in the link still have elements in object_names
I mean empty object_names what ndm will generates. such as:
or
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.
It seems that our SONiC YANG parser doesn't support the structure like:
It will raise an error from Yang parser.
IMHO, its schema is defined by us, so we can define we only support a json without these fields.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hi @Pterosaur , right. That's what i am concerned. e.g. if NDM liquid provides "" for object_names and object_counters. Such config will still fail yang validation after we remove
must "count(object_names) > 0";.liquid is using "" for field value:
https://msazure.visualstudio.com/One/_git/Networking-Metadata?path=/src/data/Network/DeviceConfigTemplates/Sonic_HIGH_FREQUENCY_TELEMETRY_GROUP_Template.liquid&version=GBmaster&_a=contents
To support such field for NDM, should we remove the constraints? such as
I am not sure if "" applies to leaf-list. or we should pick [] instead for NDM
Uh oh!
There was an error while loading. Please reload this page.
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.
Gotch, I add two negative test cases, please check it. We need to update the NDM code later.