Skip to content

Commit

Permalink
Merge pull request opencomputeproject#4 from NStetskovych/cavium_ptf
Browse files Browse the repository at this point in the history
Added trap test cases
  • Loading branch information
garyachy authored Aug 11, 2016
2 parents bd3719a + 1446459 commit 1ce41fa
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/saithrift/tests/saiacl.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ def runTestFunc(self, action = 0, setup_acltbl=True, **kwargs):
self.verifyRouting(PKT, EXP_PKT, PORT_IN, PORT_OUT)
elif action == SAI_PACKET_ACTION_COPY:
self.verifyRouting(PKT, EXP_PKT, PORT_IN, PORT_OUT)
elif action == SAI_PACKET_ACTION_TRAP:
self.verifyNoRouting(PKT, EXP_PKT, PORT_IN, PORT_OUT)

def runTest(self):
print
Expand Down Expand Up @@ -350,6 +352,48 @@ def runTestFunc(self):
mac_dst = router_mac)
print "Destination MAC address copied to CPU"

###############################################################################################################
################################# testing TRAP action (SAI_ACL_STAGE_INGRESS) #################################
###############################################################################################################

@group('acl')
class testAclSrcIpTrap(sai_base_test.ThriftInterfaceDataPlane, aclTestBase):
def runTestFunc(self):
super(testAclSrcIpTrap, self).runTestFunc(stage = SAI_ACL_STAGE_INGRESS,
action = SAI_PACKET_ACTION_TRAP,
in_ports = [port_list[PORT_OUT], port_list[PORT_IN]],
ip_src = IP_SRC,
ip_src_mask = IP_MASK)
print "Source IPv4 address droped in port 1 and forwarded to CPU"

@group('acl')
class testAclDstIpTrap(sai_base_test.ThriftInterfaceDataPlane, aclTestBase):
def runTestFunc(self):
super(testAclDstIpTrap, self).runTestFunc(stage = SAI_ACL_STAGE_INGRESS,
action = SAI_PACKET_ACTION_TRAP,
in_ports = [port_list[PORT_OUT], port_list[PORT_IN]],
ip_dst = IP_DST,
ip_dst_mask = IP_MASK)
print "Destination IPv4 address droped in port 1 and forwarded to CPU"

@group('acl')
class testAclSrcMacTrap(sai_base_test.ThriftInterfaceDataPlane, aclTestBase):
def runTestFunc(self):
super(testAclSrcMacTrap, self).runTestFunc(stage = SAI_ACL_STAGE_INGRESS,
action = SAI_PACKET_ACTION_TRAP,
in_ports = [port_list[PORT_OUT], port_list[PORT_IN]],
mac_src = rewrite_mac1)
print "Source MAC address droped in port 1 and forwarded to CPU"

@group('acl')
class testAclDstMacTrap(sai_base_test.ThriftInterfaceDataPlane, aclTestBase):
def runTestFunc(self):
super(testAclDstMacTrap, self).runTestFunc(stage = SAI_ACL_STAGE_INGRESS,
action = SAI_PACKET_ACTION_TRAP,
in_ports = [port_list[PORT_OUT], port_list[PORT_IN]],
mac_dst = router_mac)
print "Destination MAC address droped in port 1 and forwarded to CPU"

###############################################################################################################
############################### testing REDIRECT action (SAI_ACL_STAGE_INGRESS) ###############################
###############################################################################################################
Expand Down

0 comments on commit 1ce41fa

Please sign in to comment.