[yang] Change swss-event, dhcp-relay-event leafref to string#13326
[yang] Change swss-event, dhcp-relay-event leafref to string#13326qiluo-msft merged 4 commits intosonic-net:masterfrom
Conversation
| path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; | ||
| } | ||
| type string { | ||
| pattern 'Ethernet[0-9]{1,2}'; |
There was a problem hiding this comment.
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.
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.
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."
| type leafref { | ||
| path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; | ||
| type string { | ||
| pattern 'Ethernet[0-9]{1,2}'; |
…et#13326) Why I did it Do not require leafref as part of yang. Only need string to compare whether string received from event matches what is possible for ifname. How I did it How to verify it Run UT
|
Cherry-pick PR to 202211: #16113 |
…et#13326) Why I did it Do not require leafref as part of yang. Only need string to compare whether string received from event matches what is possible for ifname. How I did it How to verify it Run UT
* [yang] Change swss-event, dhcp-relay-event leafref to string (#13326) Why I did it Do not require leafref as part of yang. Only need string to compare whether string received from event matches what is possible for ifname. How I did it How to verify it Run UT * Add fix to monit_regex.json for catching mem_usage and cpu_usage (#14954) Why I did it Current regex not able to capture logs, modify regex to capture syslog messages Work item tracking Microsoft ADO (number only): 13366345 How I did it Code change How to verify it sonic-mgmt test case * Update usage leaf in sonic-events-host yang models (#15805) #### Why I did it event yang models for usage currently use int as type for usage leaf, needs to be of type decimal64 ##### Work item tracking - Microsoft ADO **(number only)**:17747466 #### How I did it Update yang models and UT #### How to verify it UT
Why I did it
Do not require leafref as part of yang. Only need string to compare whether string received from event matches what is possible for ifname.
How I did it
How to verify it
Run UT
Which release branch to backport (provide reason below if selected)
Description for the changelog
Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)