-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[yang] Change swss-event, dhcp-relay-event leafref to string #13326
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 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
3 changes: 1 addition & 2 deletions
3
src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -38,11 +38,11 @@ module sonic-events-swss { | |
| The name of the flapping i/f and status are the only params."; | ||
|
|
||
| leaf ifname { | ||
| type leafref { | ||
| path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; | ||
| type string { | ||
| pattern 'Ethernet[0-9]{1,2}'; | ||
|
||
| } | ||
| description "Interface name"; | ||
| } | ||
| } | ||
|
|
||
| leaf status { | ||
| type stypes:admin_status; | ||
|
|
@@ -60,8 +60,8 @@ module sonic-events-swss { | |
| The name of the i/f facing the storm is the only param."; | ||
|
|
||
| leaf ifname { | ||
| type leafref { | ||
| path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; | ||
| type string { | ||
| pattern 'Ethernet[0-9]{1,2}'; | ||
| } | ||
| description "Interface name"; | ||
| } | ||
|
|
||
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.
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.
There is use case like
Ethernet124not covered by this pattern.PortChannel may be a valid use case if there is PortChannel in Vlan. #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.
Changed pattern.
I checked with Kelly, for this event it should just be Ethernets, PortChannel is used for sending out 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 explain more about the disadvantage of using leafref PORT_LIST? The pattern string is not future proof.
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 initially had it as a leafref, but we can't use it for our use case, because we are getting events as a json format such as
"stdout_lines": [
"2023-01-10 01:02:45,053 [INFO] CURRENT JSON_DATA: {"sonic-events-swss:sonic-events-swss":{",
" "sonic-events-swss:if-state": {",
" "ifname": "Ethernet8",",
" "status": "down",",
" "timestamp": "2023-01-10T01:02:30.349203Z"",
" }",
"}}",
In order to use a leafref I would need a reference such as the following as part of my json, which is not possible
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"2023-01-10 01:02:45,056 [INFO] Exception thrown: Leafref "/sonic-port:sonic-port/sonic-port:PORT/sonic-port:PORT_LIST/sonic-port:name" of value "Ethernet8" points to a non-existing leaf."