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-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-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"; }