Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Grp70No250: Sequential execution #91

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions tests/testgroup70.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,3 +1003,73 @@ def runTest(self):
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2)



class Grp70No250(base_tests.SimpleDataPlane):

"""Sequential execution : Verify sequential execution by tag VLAN and output action."""

def runTest(self):

logging = get_logger()
logging.info("Running Sequential execution Grp70No250 test")

of_ports = config["port_map"].keys()
of_ports.sort()
self.assertTrue(len(of_ports) > 2, "Not enough ports for test")

logging.info("Verify if switch supports the action -- Set the 802.1q VLAN id, if not skip the test")
sup_acts = sw_supported_actions(self)
if not(sup_acts & 1<<ofp.OFPAT_SET_VLAN_VID):
skip_message_emit(self, "Sequential execution test skipped")
return

#Clear switch state
rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")

logging.info("Install flow with two OFPAT_SET_VLAN_VID and two OFPAT_OUTPUT actions")
logging.info("Send packets matching that flow")
logging.info("Expecting both output packets has second VID")

# Insert a flow wildcard all with two VID and two output actions
egress_ports = [of_ports[1], of_ports[2]]
no_ports = set(of_ports).difference(egress_ports)
expect_vid = 10
len_wo_vid = 100
len_w_vid = 104
pkt = simple_tcp_packet(pktlen=len_wo_vid)
exp_pkt = simple_tcp_packet(pktlen=len_w_vid, dl_vlan_enable=True, dl_vlan=expect_vid,dl_vlan_pcp=0)
match = parse.packet_to_flow_match(pkt)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
match.wildcards=ofp.OFPFW_ALL
match.in_port = of_ports[0]

act_vlan_1 = action.action_set_vlan_vid()
act_vlan_1.vlan_vid = expect_vid+10

act_output_1 = action.action_output()
act_output_1.port = egress_ports[0]

act_vlan_2 = action.action_set_vlan_vid()
act_vlan_2.vlan_vid = expect_vid

act_output_2 = action.action_output()
act_output_2.port = egress_ports[1]

msg = message.flow_mod()
msg.command = ofp.OFPFC_ADD
msg.buffer_id = 0xffffffff
msg.match = match
msg.actions.add(act_vlan_1)
msg.actions.add(act_vlan_2)
msg.actions.add(act_output_1)
msg.actions.add(act_output_2)
rv = self.controller.message_send(msg)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")

self.dataplane.send(of_ports[0],str(pkt))

#Verify the packets from egress ports are tagged
receive_pkt_check(self.dataplane, exp_pkt, egress_ports, no_ports, self)