From 6cefab0624789e53a12a9defa694e222605c2d4a Mon Sep 17 00:00:00 2001 From: Rupesh Kumar Date: Wed, 1 Feb 2023 01:56:27 -0800 Subject: [PATCH] [Yang-models] Modify mirror yang model src_port to match CONFIG_DB --- .../tests/files/sample_config_db.json | 6 +- .../tests/mirror_session.json | 8 --- .../tests_config/mirror_session.json | 64 +------------------ .../yang-models/sonic-mirror-session.yang | 11 +--- 4 files changed, 7 insertions(+), 82 deletions(-) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index dffe59f522d9..bb87f97c7af7 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1933,11 +1933,7 @@ "direction": "RX", "type": "SPAN", "dst_port": "Ethernet2", - "src_port": [ - "Ethernet3", - "Ethernet4" - ] - + "src_port": "Ethernet3,Ethernet4" } }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json b/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json index c54ca3d9595a..0affa83c40a9 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json @@ -72,10 +72,6 @@ "MIRROR_ERSPAN_ENTRY_VALID_SRC_PORTCHANNEL": { "desc": "Configuring ERSPAN entry with valid source portchannel" }, - "MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": { - "desc": "Configuring ERSPAN entry with invalid source port", - "eStrKey" : "InvalidValue" - }, "MIRROR_SPAN_ENTRY_WITH_VALID_VALUES": { "desc": "Configuring SPAN entry with valid source and destination ports" }, @@ -90,10 +86,6 @@ "MIRROR_SPAN_ENTRY_VALID_DST_PORT_CPU": { "desc": "Configuring SPAN entry with valid destination port CPU" }, - "MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": { - "desc": "Configuring SPAN entry with invalid destination ports", - "eStrKey" : "InvalidValue" - }, "MIRROR_SPAN_ENTRY_INVALID_DIRECTION": { "desc": "Configuring SPAN entry with invalid direction", "eStrKey": "InvalidValue" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json index 5e820b5f5fdf..93a5afcdc76a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json @@ -316,9 +316,7 @@ "gre_type": "0x1234", "dscp": "10", "ttl": "63", - "src_port": [ - "Ethernet0" - ] + "src_port": "Ethernet0" } ] } @@ -346,29 +344,7 @@ "gre_type": "0x1234", "dscp": "10", "ttl": "63", - "src_port": [ - "PortChannel5" - ] - } - ] - } - } - }, - "MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": { - "sonic-mirror-session:sonic-mirror-session": { - "MIRROR_SESSION": { - "MIRROR_SESSION_LIST": [ - { - "name": "erspan", - "type": "ERSPAN", - "dst_ip": "11.1.1.1", - "src_ip": "10.1.1.1", - "gre_type": "0x1234", - "dscp": "10", - "ttl": "63", - "src_port": [ - "Ethernet0" - ] + "src_port": "PortChannel5" } ] } @@ -415,10 +391,7 @@ "name": "span", "type": "SPAN", "dst_port": "Ethernet0", - "src_port": [ - "Ethernet4", - "Ethernet8" - ], + "src_port": "Ethernet4,Ethernet8", "direction": "RX" } ] @@ -479,37 +452,6 @@ } } }, - "MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth0", - "description": "Ethernet0", - "lanes": "1", - "mtu": 9000, - "name": "Ethernet0", - "speed": 25000 - } - ] - } - }, - "sonic-mirror-session:sonic-mirror-session": { - "MIRROR_SESSION": { - "MIRROR_SESSION_LIST": [ - { - "name": "span", - "type": "SPAN", - "dst_port": "Ethernet0", - "src_port": [ - "Ethernet4" - ] - } - ] - } - } - }, "MIRROR_SPAN_ENTRY_INVALID_DIRECTION": { "sonic-port:sonic-port": { "sonic-port:PORT": { diff --git a/src/sonic-yang-models/yang-models/sonic-mirror-session.yang b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang index 98e0e9dfac8d..ec1fc5841571 100644 --- a/src/sonic-yang-models/yang-models/sonic-mirror-session.yang +++ b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang @@ -154,14 +154,9 @@ module sonic-mirror-session { "Destination port configuration for port mirroring(SPAN)."; } - leaf-list src_port { - 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"; - } + leaf src_port { + type string { + length 1..256; } description "Source port configuration for mirroring. Can be configured for both SPAN/ERSPAN.