From 6da6f6d44544a5320b690a4cc2a0d79dcfdb08a3 Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Fri, 1 Dec 2023 15:22:47 +0100 Subject: [PATCH] Add CoPP trap for DHCP L2 broadcasts --- dump/plugins/copp.py | 2 ++ tests/dump_input/copp_cfg.json | 2 +- tests/dump_tests/module_tests/copp_test.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dump/plugins/copp.py b/dump/plugins/copp.py index 3b63b15706..9903c69716 100644 --- a/dump/plugins/copp.py +++ b/dump/plugins/copp.py @@ -20,11 +20,13 @@ "arp_req": "SAI_HOSTIF_TRAP_TYPE_ARP_REQUEST", "arp_resp": "SAI_HOSTIF_TRAP_TYPE_ARP_RESPONSE", "dhcp": "SAI_HOSTIF_TRAP_TYPE_DHCP", + "dhcp_l2": "SAI_HOSTIF_TRAP_TYPE_DHCP_L2", "ospf": "SAI_HOSTIF_TRAP_TYPE_OSPF", "pim": "SAI_HOSTIF_TRAP_TYPE_PIM", "vrrp": "SAI_HOSTIF_TRAP_TYPE_VRRP", "bgp": "SAI_HOSTIF_TRAP_TYPE_BGP", "dhcpv6": "SAI_HOSTIF_TRAP_TYPE_DHCPV6", + "dhcpv6_l2": "SAI_HOSTIF_TRAP_TYPE_DHCPV6_L2", "ospfv6": "SAI_HOSTIF_TRAP_TYPE_OSPFV6", "vrrpv6": "SAI_HOSTIF_TRAP_TYPE_VRRPV6", "bgpv6": "SAI_HOSTIF_TRAP_TYPE_BGPV6", diff --git a/tests/dump_input/copp_cfg.json b/tests/dump_input/copp_cfg.json index cae5f4e8e0..a683104488 100644 --- a/tests/dump_input/copp_cfg.json +++ b/tests/dump_input/copp_cfg.json @@ -80,7 +80,7 @@ "trap_group": "queue4_group3" }, "dhcp": { - "trap_ids": "dhcp,dhcpv6", + "trap_ids": "dhcp,dhcp_l2,dhcpv6,dhcpv6_l2", "trap_group": "queue4_group3" }, "udld": { diff --git a/tests/dump_tests/module_tests/copp_test.py b/tests/dump_tests/module_tests/copp_test.py index 56ed3dc63c..c627dae299 100644 --- a/tests/dump_tests/module_tests/copp_test.py +++ b/tests/dump_tests/module_tests/copp_test.py @@ -209,6 +209,6 @@ def test_all_args(self, match_engine): params = {} m_copp = Copp(match_engine) returned = m_copp.get_all_args("") - expect = ["bgp", "bgpv6", "lacp", "arp_req", "arp_resp", "neigh_discovery", "lldp", "dhcp", "dhcpv6", "udld", "ip2me", "src_nat_miss", "dest_nat_miss", "sample_packet", "snmp", "bfd", "vrrpv6", "ospf", "ospfv6"] + expect = ["bgp", "bgpv6", "lacp", "arp_req", "arp_resp", "neigh_discovery", "lldp", "dhcp", "dhcp_l2", "dhcpv6", "dhcpv6_l2", "udld", "ip2me", "src_nat_miss", "dest_nat_miss", "sample_packet", "snmp", "bfd", "vrrpv6", "ospf", "ospfv6"] ddiff = DeepDiff(expect, returned, ignore_order=True) assert not ddiff, ddiff