Skip to content

Commit

Permalink
Auto-prettify 72d0a27 (#274)
Browse files Browse the repository at this point in the history
Co-authored-by: Yi-Tseng <Yi-Tseng@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and Yi-Tseng authored Jun 11, 2021
1 parent 72d0a27 commit 47c9c6b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
8 changes: 3 additions & 5 deletions ptf/tests/ptf/fabric.ptf/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,27 +1048,25 @@ def doRunTest(self, action, post_ingress):
add_acl_rule(eth_type=ETH_TYPE_IPV4, post_ingress=post_ingress)
pkt = testutils.simple_udp_packet()
self.runIPv4UnicastTest(
pkt,
next_hop_mac=HOST2_MAC,
verify_pkt=(action == "copy")
pkt, next_hop_mac=HOST2_MAC, verify_pkt=(action == "copy")
)

# only "copy_to_cpu_post_ingress" action will include the change from next
# control block, "punt_to_cpu_post_ingress" will skip the next control block
# so the mac address will not be changed.
if post_ingress and action=="copy":
if post_ingress and action == "copy":
pkt = pkt_route(pkt, HOST2_MAC)

self.verify_packet_in(pkt, self.port1)


def runTest(self):
print()
for action in ["punt", "copy"]:
for post_ingress in [False, True]:
print(f"Testing action={action}, post_ingress={post_ingress}...")
self.doRunTest(action, post_ingress)


class FabricGtpUnicastEcmpBasedOnTeid(FabricTest):
"""
This test case verifies if the GTP encapsulated traffic
Expand Down
50 changes: 30 additions & 20 deletions ptf/tests/ptf/fabric_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,9 @@ def add_forwarding_mpls_entry(self, label, next_id):
[("next_id", next_id_)],
)

def add_forwarding_acl_punt_to_cpu(self, eth_type=None, priority=DEFAULT_PRIORITY, post_ingress=False):
def add_forwarding_acl_punt_to_cpu(
self, eth_type=None, priority=DEFAULT_PRIORITY, post_ingress=False
):
eth_type_ = stringify(eth_type, 2)
eth_type_mask_ = stringify(0xFFFF, 2)
action = "acl.punt_to_cpu_post_ingress" if post_ingress else "acl.punt_to_cpu"
Expand Down Expand Up @@ -1208,10 +1210,14 @@ def write_clone_group(self, clone_id, ports, update_type, store=True):
return req, self.write_request(req, store=store)

def add_clone_group(self, clone_id, ports, store=True):
self.write_clone_group(clone_id, ports, p4runtime_pb2.Update.INSERT, store=store)
self.write_clone_group(
clone_id, ports, p4runtime_pb2.Update.INSERT, store=store
)

def delete_clone_group(self, clone_id, ports, store=True):
self.write_clone_group(clone_id, ports, p4runtime_pb2.Update.DELETE, store=store)
self.write_clone_group(
clone_id, ports, p4runtime_pb2.Update.DELETE, store=store
)

def add_next_hashed_group_member(self, action_name, params):
mbr_id = self.get_next_mbr_id()
Expand Down Expand Up @@ -2783,23 +2789,27 @@ def set_up_report_flow(
):
def set_up_report_flow_internal(bmd_type, mirror_type, report_type):
self.set_up_report_flow_with_report_type_and_bmd_type(
src_mac,
mon_mac,
src_ip,
mon_ip,
mon_port,
report_type,
bmd_type,
switch_id,
mirror_type,
mon_label,
)
set_up_report_flow_internal(BRIDGED_MD_TYPE_INT_INGRESS_DROP,
MIRROR_TYPE_INVALID, INT_REPORT_TYPE_DROP)
set_up_report_flow_internal(BRIDGED_MD_TYPE_EGRESS_MIRROR,
MIRROR_TYPE_INT_REPORT, INT_REPORT_TYPE_DROP)
set_up_report_flow_internal(BRIDGED_MD_TYPE_EGRESS_MIRROR,
MIRROR_TYPE_INT_REPORT, INT_REPORT_TYPE_LOCAL)
src_mac,
mon_mac,
src_ip,
mon_ip,
mon_port,
report_type,
bmd_type,
switch_id,
mirror_type,
mon_label,
)

set_up_report_flow_internal(
BRIDGED_MD_TYPE_INT_INGRESS_DROP, MIRROR_TYPE_INVALID, INT_REPORT_TYPE_DROP
)
set_up_report_flow_internal(
BRIDGED_MD_TYPE_EGRESS_MIRROR, MIRROR_TYPE_INT_REPORT, INT_REPORT_TYPE_DROP
)
set_up_report_flow_internal(
BRIDGED_MD_TYPE_EGRESS_MIRROR, MIRROR_TYPE_INT_REPORT, INT_REPORT_TYPE_LOCAL
)

def set_up_report_mirror_flow(self, pipe_id, mirror_id, port):
self.add_clone_group(mirror_id, [port])
Expand Down

0 comments on commit 47c9c6b

Please sign in to comment.