From a33330941c26a98927c57ed93beeddbe98281fd3 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Fri, 15 Mar 2024 10:02:21 +0800 Subject: [PATCH] Support dot in the additional information of the PFC watchdog event in the yang model (#18235) ### Why I did it Support dot (`.`) in the `additional_info` field in the PFC watchdog event in the yang model. The `additional_info` field was introduced to represent diagnosis information when a PFC storm is detected, which can include fragments. Signed-off-by: Stephen Sun ### How I did it #### How to verify it Unit test. --- .../yang_model_tests/tests/sonic-events-swss.json | 3 +++ .../tests_config/sonic-events-swss.json | 12 ++++++++++++ .../yang-models/sonic-events-swss.yang | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) 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 6592fd1013..56a05d1736 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 @@ -40,6 +40,9 @@ "SONIC_EVENTS_SWSS_PFC_STORM_VALID_WITH_ADDITIONAL_INFO": { "desc": "VALID IF_STATE EVENT." }, + "SONIC_EVENTS_SWSS_PFC_STORM_VALID_WITH_ADDITIONAL_INFO_FRAGMENT": { + "desc": "VALID IF_STATE EVENT." + }, "SONIC_EVENTS_SWSS_PFC_STORM_WITH_INVALID_ADDITIONAL_INFO_1": { "desc": "PFC_STORM_EVENT_INCORRECT_ADDITIONAL_INFO failure.", "eStrKey": "Pattern" 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 e56acc0a47..919468dcbc 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 @@ -113,6 +113,18 @@ } } }, + "SONIC_EVENTS_SWSS_PFC_STORM_VALID_WITH_ADDITIONAL_INFO_FRAGMENT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": 0, + "port_id": 0, + "additional_info": "info1:1.2|info2:3.25", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, "SONIC_EVENTS_SWSS_PFC_STORM_WITH_INVALID_ADDITIONAL_INFO_1": { "sonic-events-swss:sonic-events-swss": { "sonic-events-swss:pfc-storm": { 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 93c617776c..4092fe42d2 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-swss.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-swss.yang @@ -80,7 +80,7 @@ module sonic-events-swss { leaf additional_info { type string { - pattern '[-a-zA-Z0-9_]+:[-a-zA-Z0-9_]+(\|{1}[-a-zA-Z0-9_]+:[-a-zA-Z0-9_]+)*'; + pattern '[-a-zA-Z0-9_]+:[-a-zA-Z0-9_.]+(\|{1}[-a-zA-Z0-9_]+:[-a-zA-Z0-9_.]+)*'; } description "Additional information to investigate PFC storm"; }