diff --git a/files/build_templates/monit_regex.json b/files/build_templates/monit_regex.json index e7384a5434..201636c3a3 100644 --- a/files/build_templates/monit_regex.json +++ b/files/build_templates/monit_regex.json @@ -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" ] } ] diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json index f99b279e39..a4f17ae9e8 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json @@ -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.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json index dec47231eb..7762ec17db 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json @@ -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.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json index 70d7786b71..335d836280 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json @@ -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", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json index 98ee755b51..8868636983 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json @@ -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" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json index 62ce9c35c2..90ca2b7df1 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json @@ -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", diff --git a/src/sonic-yang-models/yang-models/sonic-events-common.yang b/src/sonic-yang-models/yang-models/sonic-events-common.yang index 822a6eefaf..d6789a6ffe 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-common.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-common.yang @@ -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"; } diff --git a/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang b/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang index 1c85a55347..4b83c14b4e 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang @@ -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,3}'; } description "Name of the i/f discarding"; - } + } uses evtcmn:sonic-events-cmn; } diff --git a/src/sonic-yang-models/yang-models/sonic-events-swss.yang b/src/sonic-yang-models/yang-models/sonic-events-swss.yang index 33a3999364..a6246faefa 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-swss.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-swss.yang @@ -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,3}'; } 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"; }