Skip to content

Commit 017ba13

Browse files
authored
Adding Cisco-8000 Specific Packet Formatting in everflow_policer_test.py (sonic-net#21137)
Co-authored-by: mmananja <mmananja@users.noreply.github.com>
1 parent afeda60 commit 017ba13

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

ansible/roles/test/files/acstests/everflow_policer_test.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,17 @@ def checkMirroredFlow(self):
242242
inner_frame=bytes(payload),
243243
ip_id=0,
244244
sgt_other=0x4)
245+
elif self.asic_type in ["cisco-8000"]:
246+
exp_pkt = testutils.ipv4_erspan_pkt(eth_src=self.router_mac,
247+
ip_src=self.session_src_ip,
248+
ip_dst=self.session_dst_ip,
249+
ip_dscp=self.session_dscp,
250+
ip_ttl=self.session_ttl-1,
251+
inner_frame=bytes(payload),
252+
ip_id=0,
253+
version=1)
254+
255+
exp_pkt['ERSPAN II'].ver = 1
245256
else:
246257
exp_pkt['GRE'].proto = 0x88be
247258

@@ -255,7 +266,10 @@ def checkMirroredFlow(self):
255266
if self.asic_type in ["marvell-prestera", "marvell"]:
256267
masked_exp_pkt.set_do_not_care_scapy(scapy.IP, "id")
257268
masked_exp_pkt.set_do_not_care_scapy(scapy.GRE, "seqnum_present")
258-
269+
if self.asic_type in ["cisco-8000"]:
270+
erspan_bit_offset = 42
271+
masked_exp_pkt.set_do_not_care(erspan_bit_offset * 8 + 19, 2) # Mask the encap value
272+
masked_exp_pkt.set_do_not_care(erspan_bit_offset * 8 + 22, 10) # Mask the session_id
259273
if exp_pkt.haslayer(scapy.ERSPAN_III):
260274
masked_exp_pkt.set_do_not_care_scapy(scapy.ERSPAN_III, "span_id")
261275
masked_exp_pkt.set_do_not_care_scapy(scapy.ERSPAN_III, "timestamp")
@@ -279,6 +293,10 @@ def match_payload(pkt):
279293
pkt = scapy.Ether(pkt[8:])
280294
elif self.asic_type == "barefoot":
281295
pkt = scapy.Ether(pkt).load
296+
elif self.asic_type == "cisco-8000":
297+
pkt = scapy.Ether(pkt)[scapy.GRE].payload
298+
pkt = bytes(pkt)
299+
pkt = scapy.Ether(pkt[8:]) # Mask the ERSPAN II header
282300
else:
283301
pkt = scapy.Ether(pkt)[scapy.GRE].payload
284302

tests/common/plugins/conditional_mark/tests_mark_conditions.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,11 +2180,11 @@ everflow/test_everflow_testbed.py::TestEverflowV4IngressAclIngressMirror::test_e
21802180

21812181
everflow/test_everflow_testbed.py::TestEverflowV4IngressAclIngressMirror::test_everflow_dscp_with_policer:
21822182
skip:
2183-
reason: "Skipping test since mirror with policer is not supported on Cisco 8000 platforms and Broadcom DNX platforms."
2183+
reason: "Skipping test since mirror with policer is not supported on Cisco 8122 platforms and Broadcom DNX platforms."
21842184
conditions_logical_operator: "OR"
21852185
conditions:
2186-
- "asic_type in ['cisco-8000']"
21872186
- "asic_subtype in ['broadcom-dnx']"
2187+
- "platform in ['x86_64-8122_64eh_o-r0', 'x86_64-8122_64ehf_o-r0']"
21882188

21892189
everflow/test_everflow_testbed.py::TestEverflowV4IngressAclIngressMirror::test_everflow_dscp_with_policer[erspan_ipv4-cli-downstream-default]:
21902190
skip:

0 commit comments

Comments
 (0)