Fix 202211 test_events to unblock PR checker (#16151)

* [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
This commit is contained in:
Zain Budhwani 2023-08-14 23:16:06 -07:00 committed by GitHub
parent bc1688c4b3
commit c3b25660ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 275 deletions

View File

@ -6,12 +6,12 @@
},
{
"tag": "memory-usage",
"regex": "mem usage of (\\d+\\.\\d+)% matches resource limit .mem usage>(\\d+\\.\\d+)%.",
"regex": ".*mem usage of (\\d+\\.\\d+)% matches resource limit .mem usage>(\\d+\\.\\d+)%.",
"params": [ "usage", "limit" ]
},
{
"tag": "cpu-usage",
"regex": "cpu user usage of (\\d+\\.\\d+)% matches resource limit .cpu user usage>(\\d+\\.\\d+)%.",
"regex": ".*cpu user usage of (\\d+\\.\\d+)% matches resource limit .cpu user usage>(\\d+\\.\\d+)%.",
"params": [ "usage", "limit" ]
}
]

View File

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

View File

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

View File

@ -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",
@ -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",
@ -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",

View File

@ -3,8 +3,8 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": -30,
"limit": 99,
"usage": "INCORRECT_USAGE",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
@ -13,7 +13,7 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": 32,
"usage": "2.0",
"limit": "INCORRECT_LIMIT",
"timestamp": "1985-04-12T23:20:50.52Z"
}
@ -23,8 +23,8 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "INCORRECT_TIMESTAMP"
}
}
@ -33,8 +33,8 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
@ -42,8 +42,8 @@
"SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_USAGE": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": -30,
"limit": 99,
"usage": "INCORRECT_USAGE",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
@ -51,7 +51,7 @@
"SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_LIMIT": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": 32,
"usage": "2.0",
"limit": "INCORRECT_LIMIT",
"timestamp": "1985-04-12T23:20:50.52Z"
}
@ -60,8 +60,8 @@
"SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_TIMESTAMP": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "INCORRECT_TIMESTAMP"
}
}
@ -69,8 +69,8 @@
"SONIC_EVENTS_HOST_MEMORY_USAGE_VALID": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
@ -78,8 +78,8 @@
"SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_USAGE": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": -30,
"limit": 99,
"usage": "INCORRECT_USAGE",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
@ -87,7 +87,7 @@
"SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_LIMIT": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": 32,
"usage": "2.0",
"limit": "INCORRECT_LIMIT",
"timestamp": "1985-04-12T23:20:50.52Z"
}
@ -96,8 +96,8 @@
"SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_TIMESTAMP": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "INCORRECT_TIMESTAMP"
}
}
@ -105,8 +105,8 @@
"SONIC_EVENTS_HOST_CPU_USAGE_VALID": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}

View File

@ -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",
@ -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",
@ -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",
@ -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",
@ -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",
@ -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",
@ -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",
@ -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",
@ -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",
@ -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",

View File

@ -30,19 +30,15 @@ module sonic-events-common {
grouping sonic-events-usage {
leaf usage {
type uint8 {
range "0..100" {
error-message "Incorrect val for %";
}
type decimal64 {
fraction-digits 1;
}
description "Percentage in use";
}
leaf limit {
type uint8 {
range "0..100" {
error-message "Incorrect val for %";
}
type decimal64 {
fraction-digits 1;
}
description "Percentage limit set";
}

View File

@ -40,13 +40,8 @@ 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,3}';
}
description "Name of the i/f discarding";
}

View File

@ -38,8 +38,8 @@ 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,3}';
}
description "Interface name";
}
@ -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";
}