Skip to content

Commit 2bd8de0

Browse files
Gfrom2016ashutosh-agrawal
authored andcommitted
Remove policer for MIRROR_SESSION creation on TH5 platform (sonic-net#19463)
What is the motivation for this PR? Fix generic_config_updater/test_monitor_config.py::test_monitor_config_tc1_suite failure on 202412 due to policer not supported for MIRROR_SESSION creation on TH5 platform as Broadcom clarified it in CS00012412189: [TH5-512]Error log "Platform does not support SAI_MIRROR_SESSION_ATTR_POLICER". How did you do it? Check the platform before building and verifying monitor session config, remove the policer if platform startwith "x86_64-arista_7060x6_64pe". How did you verify/test it? Run generic_config_updater/test_monitor_config.py::test_monitor_config_tc1_suite locally on 7060x6 and it passed. generic_config_updater/test_monitor_config.py::test_monitor_config_tc1_suite PASSED [100%]
1 parent 159dae8 commit 2bd8de0

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

tests/generic_config_updater/test_monitor_config.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
MONITOR_CONFIG_POLICER = "policer_dscp"
2222

2323

24+
def is_policer_supported(duthost):
25+
"""
26+
Return True if policer is supported in MIRROR_SESSION creation on this platform, otherwise return False.
27+
"""
28+
platform = duthost.facts.get('platform', '')
29+
if platform.startswith("x86_64-arista_7060x6_64pe"):
30+
return False
31+
return True
32+
33+
2434
@pytest.fixture(scope='module')
2535
def get_valid_acl_ports(rand_selected_front_end_dut, enum_rand_one_frontend_asic_index):
2636
""" Get valid acl ports that could be added to ACL table
@@ -137,8 +147,11 @@ def verify_monitor_config(duthost, ip_netns_namespace_prefix):
137147

138148
mirror_session = duthost.shell("{} show mirror_session {}".format(ip_netns_namespace_prefix,
139149
MONITOR_CONFIG_MIRROR_SESSION))
140-
expect_res_success(duthost, mirror_session, [
141-
MONITOR_CONFIG_MIRROR_SESSION, MONITOR_CONFIG_POLICER], [])
150+
if is_policer_supported(duthost):
151+
expect_res_success(duthost, mirror_session, [
152+
MONITOR_CONFIG_MIRROR_SESSION, MONITOR_CONFIG_POLICER], [])
153+
else:
154+
expect_res_success(duthost, mirror_session, [MONITOR_CONFIG_MIRROR_SESSION], [])
142155

143156

144157
def verify_no_monitor_config(duthost, ip_netns_namespace_prefix):
@@ -169,6 +182,17 @@ def monitor_config_add_config(duthost, enum_rand_one_frontend_asic_index, get_va
169182

170183
namespace = duthost.get_namespace_from_asic_id(enum_rand_one_frontend_asic_index)
171184

185+
# Build basic monitor session config
186+
mirror_session = {
187+
"dscp": "5",
188+
"dst_ip": "2.2.2.2",
189+
"src_ip": "1.1.1.1",
190+
"ttl": "32",
191+
"type": "ERSPAN"
192+
}
193+
if is_policer_supported(duthost):
194+
mirror_session["policer"] = MONITOR_CONFIG_POLICER
195+
172196
json_patch = [
173197
{
174198
"op": "add",
@@ -195,14 +219,7 @@ def monitor_config_add_config(duthost, enum_rand_one_frontend_asic_index, get_va
195219
"op": "add",
196220
"path": "/MIRROR_SESSION",
197221
"value": {
198-
"{}".format(MONITOR_CONFIG_MIRROR_SESSION): {
199-
"dscp": "5",
200-
"dst_ip": "2.2.2.2",
201-
"policer": "{}".format(MONITOR_CONFIG_POLICER),
202-
"src_ip": "1.1.1.1",
203-
"ttl": "32",
204-
"type": "ERSPAN"
205-
}
222+
"{}".format(MONITOR_CONFIG_MIRROR_SESSION): mirror_session
206223
}
207224
},
208225
{

0 commit comments

Comments
 (0)