Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_IFNAME": {
"desc": "DHCP_RELAY_DISCARD_EVENT_INCORRECT_IFNAME failure.",
"eStrKey": "InvalidValue",
"eStr": ["Eth"]
"eStrKey": "Pattern"
},
"SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_TIMESTAMP": {
"desc": "DHCP_RELAY_DISCARD_EVENT_INCORRECT_TIMESTAMP failure.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_IFNAME": {
"desc": "IF_STATE_EVENT_INCORRECT_IFNAME failure.",
"eStrKey": "LeafRef",
"eStr": ["Eth"]
"eStrKey": "Pattern"
},
"SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_STATUS": {
"desc": "IF_STATE_EVENT_INCORRECT_STATUS failure.",
Expand All @@ -17,8 +16,7 @@
},
"SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_IFNAME": {
"desc": "PFC_STORM_EVENT_INCORRECT_IFNAME failure.",
"eStrKey": "LeafRef",
"eStr": ["Eth"]
"eStrKey": "Pattern"
},
"SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_INDEX": {
"desc": "PFC_STORM_EVENT_INCORRECT_QUEUE_INDEX failure.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
{
"SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_IFNAME": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel10"
}
]
}
},
"sonic-events-dhcp-relay:sonic-events-dhcp-relay": {
"sonic-events-dhcp-relay:dhcp-relay-discard": {
"ifname": "Eth",
Expand All @@ -33,31 +8,6 @@
}
},
"SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_TIMESTAMP": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel10"
}
]
}
},
"sonic-events-dhcp-relay:sonic-events-dhcp-relay": {
"sonic-events-dhcp-relay:dhcp-relay-discard": {
"ifname": "Ethernet0",
Expand All @@ -66,31 +16,6 @@
}
},
"SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_VALID": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel10"
}
]
}
},
"sonic-events-dhcp-relay:sonic-events-dhcp-relay": {
"sonic-events-dhcp-relay:dhcp-relay-discard": {
"ifname": "Ethernet0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
{
"SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_IFNAME": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:if-state": {
"ifname": "Eth",
Expand All @@ -24,21 +9,6 @@
}
},
"SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_STATUS": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:if-state": {
"ifname": "Ethernet0",
Expand All @@ -48,21 +18,6 @@
}
},
"SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_TIMESTAMP": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:if-state": {
"ifname": "Ethernet0",
Expand All @@ -72,21 +27,6 @@
}
},
"SONIC_EVENTS_SWSS_IF_STATE_VALID": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:if-state": {
"ifname": "Ethernet0",
Expand All @@ -96,21 +36,6 @@
}
},
"SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_IFNAME": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:pfc-storm": {
"ifname": "Eth",
Expand All @@ -122,21 +47,6 @@
}
},
"SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_INDEX": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:pfc-storm": {
"ifname": "Ethernet0",
Expand All @@ -148,21 +58,6 @@
}
},
"SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_ID": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:pfc-storm": {
"ifname": "Ethernet0",
Expand All @@ -174,21 +69,6 @@
}
},
"SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_PORT_ID": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:pfc-storm": {
"ifname": "Ethernet0",
Expand All @@ -200,21 +80,6 @@
}
},
"SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_TIMESTAMP": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:pfc-storm": {
"ifname": "Ethernet0",
Expand All @@ -226,21 +91,6 @@
}
},
"SONIC_EVENTS_SWSS_PFC_STORM_VALID": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": 65,
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-events-swss:sonic-events-swss": {
"sonic-events-swss:pfc-storm": {
"ifname": "Ethernet0",
Expand Down
11 changes: 3 additions & 8 deletions src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,11 @@ module sonic-events-dhcp-relay {
name of the interface discarding.";

leaf ifname {
type union {
type leafref {
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
}
type leafref {
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
}
type string {
pattern 'Ethernet[0-9]{1,2}';
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ethernet

There is use case like Ethernet124 not covered by this pattern.
PortChannel may be a valid use case if there is PortChannel in Vlan. #Closed

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor Author

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." 

}
description "Name of the i/f discarding";
}
}

uses evtcmn:sonic-events-cmn;
}
Expand Down
10 changes: 5 additions & 5 deletions src/sonic-yang-models/yang-models/sonic-events-swss.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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}';
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ethernet

There is use case like Ethernet124 not covered by this pattern. #Closed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

}
description "Interface name";
}
}

leaf status {
type stypes:admin_status;
Expand All @@ -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";
}
Expand Down