From eea379c49fe052f4c4eb3c9201d459295143ba62 Mon Sep 17 00:00:00 2001 From: akshayajddn Date: Mon, 29 Jun 2015 00:14:00 +0530 Subject: [PATCH 1/5] Added a generic functionality to find out egress port This test case takes lb_port as input. Since the test case tries to send data back to lb_port +1, the test case fails and switch generates dumps. ["Unconfigured port received"], this is because if I supply lb_port (say 102), 103 may/may not be a valid port of the configuration. The fixes done by me will eliminate this issue. More details explained in comments. --- tests/load.py | 52 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/tests/load.py b/tests/load.py index 7f9bcb10d..51e335594 100644 --- a/tests/load.py +++ b/tests/load.py @@ -46,10 +46,14 @@ class LoadBarrier(base_tests.SimpleProtocol): def runTest(self): # Set up flow to send from port 1 to port 2 and copy to CPU # Test parameter gives LB port base (assumes consecutive) + + ##-- dictionary containing the ingress port to egress port mapping + ingress_to_egress_port_dict = self.create_dict() + lb_port = test_param_get('lb_port', default=1) barrier_count = test_param_get('barrier_count', default=10) - + egress_port = ingress_to_egress_port_dict[lb_port] # Set controller to filter packet ins self.controller.filter_packet_in = True self.controller.pkt_in_filter_limit = 10 @@ -59,7 +63,7 @@ def runTest(self): match.wildcards &= ~ofp.OFPFW_IN_PORT match.in_port = lb_port act = ofp.action.output() - act.port = lb_port + 1 + act.port = egress_port request = ofp.message.flow_add() request.match = match @@ -75,17 +79,17 @@ def runTest(self): self.controller.message_send(request) do_barrier(self.controller) - # Create packet out and send to port lb_port + 1 + # Create packet out and send to egress_port msg = ofp.message.packet_out() msg.in_port = lb_port msg.data = str(pkt) msg.buffer_id = 0xffffffff act = ofp.action.output() - act.port = lb_port + 1 + act.port = egress_port msg.actions.append(act) logging.info("Sleeping before starting storm") time.sleep(1) # Root causing issue with fast disconnects - logging.info("Sending packet out to %d" % (lb_port + 1)) + logging.info("Sending packet out to %d" % (egress_port)) self.controller.message_send(msg) for idx in range(0, barrier_count): @@ -96,6 +100,42 @@ def runTest(self): # Clear the flow table when done logging.debug("Deleting all flows from switch") delete_all_flows(self.controller) + + def create_dict(self): + """ + Some Openflow test cases such as LoadBarrier works on a general assumption + that if packet is ingressing through port with ifindex x at the switch, + then the packet egresses through x+1 from the switch. What if x+1 + is not a part of openflow configuration, we are bound to face issues + pertaining to port configuration. So we need to find an appropriate + egress port corresponding to the ingress port, which is nothing but any + of the ports that are part of the openflow configuration. + + This function simply takes the ingress port list, shuffles it and prepares + an egress port list. Then it prepares a dictionary in which key is a port + in ingress_port_list and its corresponding values is an element in the + egress_port_list. Now this dictionary is returned to whichever test case + which uses it. + """ + + ##-- fetching the list of ports + ingress_port_list = config["port_map"].keys() + + ##-- calculating no of ports + no_of_ports = len(ingress_port_list) + + ##-- if no of ports are 4 then + ##-- rearranged_index_list is [1,2,3,0] + ##-- Index is shifted to one position right in a circular manner + rearranged_index_list = [(index+1)%no_of_ports for index in range(no_of_ports)] + + ##-- Shuffling the list as per the index list formed above + egress_port_list = [ingress_port_list[index] for index in rearranged_index_list] + + ##-- mapping ingress to egress ports + ingress_to_egress_port_dict = {k:v for k,v in zip(ingress_port_list,egress_port_list)} + + return ingress_to_egress_port_dict class PacketInLoad(base_tests.SimpleDataPlane): """ @@ -287,7 +327,7 @@ def runTest(self): self.checkBarrier() # Trigger a flood of flow-removed messages - delete_all_flows(self.controller, send_barrier=False) + delete_all_flows(self.controller) count = 0 while True: From 090165c399eade1737f8c12aba2b20dd40518ac5 Mon Sep 17 00:00:00 2001 From: akshayajddn Date: Mon, 29 Jun 2015 00:15:18 +0530 Subject: [PATCH 2/5] Revert "Added a generic functionality to find out egress port" This reverts commit eea379c49fe052f4c4eb3c9201d459295143ba62. --- tests/load.py | 52 ++++++--------------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/tests/load.py b/tests/load.py index 51e335594..7f9bcb10d 100644 --- a/tests/load.py +++ b/tests/load.py @@ -46,14 +46,10 @@ class LoadBarrier(base_tests.SimpleProtocol): def runTest(self): # Set up flow to send from port 1 to port 2 and copy to CPU # Test parameter gives LB port base (assumes consecutive) - - ##-- dictionary containing the ingress port to egress port mapping - ingress_to_egress_port_dict = self.create_dict() - lb_port = test_param_get('lb_port', default=1) barrier_count = test_param_get('barrier_count', default=10) - egress_port = ingress_to_egress_port_dict[lb_port] + # Set controller to filter packet ins self.controller.filter_packet_in = True self.controller.pkt_in_filter_limit = 10 @@ -63,7 +59,7 @@ def runTest(self): match.wildcards &= ~ofp.OFPFW_IN_PORT match.in_port = lb_port act = ofp.action.output() - act.port = egress_port + act.port = lb_port + 1 request = ofp.message.flow_add() request.match = match @@ -79,17 +75,17 @@ def runTest(self): self.controller.message_send(request) do_barrier(self.controller) - # Create packet out and send to egress_port + # Create packet out and send to port lb_port + 1 msg = ofp.message.packet_out() msg.in_port = lb_port msg.data = str(pkt) msg.buffer_id = 0xffffffff act = ofp.action.output() - act.port = egress_port + act.port = lb_port + 1 msg.actions.append(act) logging.info("Sleeping before starting storm") time.sleep(1) # Root causing issue with fast disconnects - logging.info("Sending packet out to %d" % (egress_port)) + logging.info("Sending packet out to %d" % (lb_port + 1)) self.controller.message_send(msg) for idx in range(0, barrier_count): @@ -100,42 +96,6 @@ def runTest(self): # Clear the flow table when done logging.debug("Deleting all flows from switch") delete_all_flows(self.controller) - - def create_dict(self): - """ - Some Openflow test cases such as LoadBarrier works on a general assumption - that if packet is ingressing through port with ifindex x at the switch, - then the packet egresses through x+1 from the switch. What if x+1 - is not a part of openflow configuration, we are bound to face issues - pertaining to port configuration. So we need to find an appropriate - egress port corresponding to the ingress port, which is nothing but any - of the ports that are part of the openflow configuration. - - This function simply takes the ingress port list, shuffles it and prepares - an egress port list. Then it prepares a dictionary in which key is a port - in ingress_port_list and its corresponding values is an element in the - egress_port_list. Now this dictionary is returned to whichever test case - which uses it. - """ - - ##-- fetching the list of ports - ingress_port_list = config["port_map"].keys() - - ##-- calculating no of ports - no_of_ports = len(ingress_port_list) - - ##-- if no of ports are 4 then - ##-- rearranged_index_list is [1,2,3,0] - ##-- Index is shifted to one position right in a circular manner - rearranged_index_list = [(index+1)%no_of_ports for index in range(no_of_ports)] - - ##-- Shuffling the list as per the index list formed above - egress_port_list = [ingress_port_list[index] for index in rearranged_index_list] - - ##-- mapping ingress to egress ports - ingress_to_egress_port_dict = {k:v for k,v in zip(ingress_port_list,egress_port_list)} - - return ingress_to_egress_port_dict class PacketInLoad(base_tests.SimpleDataPlane): """ @@ -327,7 +287,7 @@ def runTest(self): self.checkBarrier() # Trigger a flood of flow-removed messages - delete_all_flows(self.controller) + delete_all_flows(self.controller, send_barrier=False) count = 0 while True: From 8c03821975f4a7e0a426c2afd03ecaae3460076e Mon Sep 17 00:00:00 2001 From: akshayajddn Date: Mon, 29 Jun 2015 00:27:05 +0530 Subject: [PATCH 3/5] Added a helper function to find out egress port This test case lb_port as input. This lb_port (provided by the user) acts as an ingress port at the switch. However the test case tries to send the packet back to the controller through lb_port+1 which is not always true. Say I supplied lb_port 102, but 103 may/may not be a part of an openflow configuration. The fixes shown takes care of this issue. --- tests/load.py | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/tests/load.py b/tests/load.py index 7f9bcb10d..22678ddb1 100644 --- a/tests/load.py +++ b/tests/load.py @@ -46,10 +46,14 @@ class LoadBarrier(base_tests.SimpleProtocol): def runTest(self): # Set up flow to send from port 1 to port 2 and copy to CPU # Test parameter gives LB port base (assumes consecutive) + + ##-- dictionary containing the ingress port to egress port mapping + ingress_to_egress_port_dict = self.create_dict() + lb_port = test_param_get('lb_port', default=1) barrier_count = test_param_get('barrier_count', default=10) - + egress_port = ingress_to_egress_port_dict[lb_port] # Set controller to filter packet ins self.controller.filter_packet_in = True self.controller.pkt_in_filter_limit = 10 @@ -59,7 +63,7 @@ def runTest(self): match.wildcards &= ~ofp.OFPFW_IN_PORT match.in_port = lb_port act = ofp.action.output() - act.port = lb_port + 1 + act.port = egress_port request = ofp.message.flow_add() request.match = match @@ -81,11 +85,11 @@ def runTest(self): msg.data = str(pkt) msg.buffer_id = 0xffffffff act = ofp.action.output() - act.port = lb_port + 1 + act.port = egress_port msg.actions.append(act) logging.info("Sleeping before starting storm") time.sleep(1) # Root causing issue with fast disconnects - logging.info("Sending packet out to %d" % (lb_port + 1)) + logging.info("Sending packet out to %d" % (egress_port)) self.controller.message_send(msg) for idx in range(0, barrier_count): @@ -95,7 +99,41 @@ def runTest(self): # Clear the flow table when done logging.debug("Deleting all flows from switch") - delete_all_flows(self.controller) + delete_all_flows(self.controller, send_barrier=False) + + def create_dict(self): + """ + Openflow test case LoadBarrier works on a general assumption that if + packet is ingressing through port with ifindex x at the controller, + then the packet egresses through x+1 from the controller. What if x+1 + is not a part of openflow configuration, So we need to find an appropriate + egress port corresponding to the ingress port, which is nothing but any + of the ports that are part of the openflow configuration. + + This function simply takes the ingress port list, shuffles it and prepares + an egress port list. Then it prepares a dictionary in which key is a port + in ingress_port_list and its corresponding values is an element in the + egress_port_list. Now this dictionary is returned to the function which calls it. + """ + + ##-- fetching the list of ports + ingress_port_list = config["port_map"].keys() + + ##-- calculating no of ports + no_of_ports = len(ingress_port_list) + + ##-- if no of ports are 4 then + ##-- rearranged_index_list is [1,2,3,0] + ##-- Index is shifted to one position right in a circular manner + rearranged_index_list = [(index+1)%no_of_ports for index in range(no_of_ports)] + + ##-- Shuffling the list as per the index list formed above + egress_port_list = [ingress_port_list[index] for index in rearranged_index_list] + + ##-- mapping ingress to egress ports + ingress_to_egress_port_dict = {k:v for k,v in zip(ingress_port_list,egress_port_list)} + + return ingress_to_egress_port_dict class PacketInLoad(base_tests.SimpleDataPlane): """ @@ -287,7 +325,7 @@ def runTest(self): self.checkBarrier() # Trigger a flood of flow-removed messages - delete_all_flows(self.controller, send_barrier=False) + delete_all_flows(self.controller) count = 0 while True: From 3c19394362270af1e21d809472347e3876b8a45b Mon Sep 17 00:00:00 2001 From: akshayajddn Date: Mon, 29 Jun 2015 00:31:10 +0530 Subject: [PATCH 4/5] Revert "Added a helper function to find out egress port" This reverts commit 8c03821975f4a7e0a426c2afd03ecaae3460076e. --- tests/load.py | 50 ++++++-------------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/tests/load.py b/tests/load.py index 22678ddb1..7f9bcb10d 100644 --- a/tests/load.py +++ b/tests/load.py @@ -46,14 +46,10 @@ class LoadBarrier(base_tests.SimpleProtocol): def runTest(self): # Set up flow to send from port 1 to port 2 and copy to CPU # Test parameter gives LB port base (assumes consecutive) - - ##-- dictionary containing the ingress port to egress port mapping - ingress_to_egress_port_dict = self.create_dict() - lb_port = test_param_get('lb_port', default=1) barrier_count = test_param_get('barrier_count', default=10) - egress_port = ingress_to_egress_port_dict[lb_port] + # Set controller to filter packet ins self.controller.filter_packet_in = True self.controller.pkt_in_filter_limit = 10 @@ -63,7 +59,7 @@ def runTest(self): match.wildcards &= ~ofp.OFPFW_IN_PORT match.in_port = lb_port act = ofp.action.output() - act.port = egress_port + act.port = lb_port + 1 request = ofp.message.flow_add() request.match = match @@ -85,11 +81,11 @@ def runTest(self): msg.data = str(pkt) msg.buffer_id = 0xffffffff act = ofp.action.output() - act.port = egress_port + act.port = lb_port + 1 msg.actions.append(act) logging.info("Sleeping before starting storm") time.sleep(1) # Root causing issue with fast disconnects - logging.info("Sending packet out to %d" % (egress_port)) + logging.info("Sending packet out to %d" % (lb_port + 1)) self.controller.message_send(msg) for idx in range(0, barrier_count): @@ -99,41 +95,7 @@ def runTest(self): # Clear the flow table when done logging.debug("Deleting all flows from switch") - delete_all_flows(self.controller, send_barrier=False) - - def create_dict(self): - """ - Openflow test case LoadBarrier works on a general assumption that if - packet is ingressing through port with ifindex x at the controller, - then the packet egresses through x+1 from the controller. What if x+1 - is not a part of openflow configuration, So we need to find an appropriate - egress port corresponding to the ingress port, which is nothing but any - of the ports that are part of the openflow configuration. - - This function simply takes the ingress port list, shuffles it and prepares - an egress port list. Then it prepares a dictionary in which key is a port - in ingress_port_list and its corresponding values is an element in the - egress_port_list. Now this dictionary is returned to the function which calls it. - """ - - ##-- fetching the list of ports - ingress_port_list = config["port_map"].keys() - - ##-- calculating no of ports - no_of_ports = len(ingress_port_list) - - ##-- if no of ports are 4 then - ##-- rearranged_index_list is [1,2,3,0] - ##-- Index is shifted to one position right in a circular manner - rearranged_index_list = [(index+1)%no_of_ports for index in range(no_of_ports)] - - ##-- Shuffling the list as per the index list formed above - egress_port_list = [ingress_port_list[index] for index in rearranged_index_list] - - ##-- mapping ingress to egress ports - ingress_to_egress_port_dict = {k:v for k,v in zip(ingress_port_list,egress_port_list)} - - return ingress_to_egress_port_dict + delete_all_flows(self.controller) class PacketInLoad(base_tests.SimpleDataPlane): """ @@ -325,7 +287,7 @@ def runTest(self): self.checkBarrier() # Trigger a flood of flow-removed messages - delete_all_flows(self.controller) + delete_all_flows(self.controller, send_barrier=False) count = 0 while True: From b1ad29be6bbe01f71135cdeaf04ca2453875114f Mon Sep 17 00:00:00 2001 From: akshayajddn Date: Mon, 29 Jun 2015 00:42:46 +0530 Subject: [PATCH 5/5] Added a helper function to find out egress port This test case takes lb_port as input. This lb_port (provided by the user) acts as an ingress port at the switch. However the test case tries to send the packet to the controller through port lb_port+1, which is a serious bug here, because say 102 is my lb_port, then 103 may/may not be a part of an openflow configuration. The fixes done by me will take care of this issue. --- tests/load.py | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/tests/load.py b/tests/load.py index 7f9bcb10d..84a13a2ba 100644 --- a/tests/load.py +++ b/tests/load.py @@ -46,10 +46,14 @@ class LoadBarrier(base_tests.SimpleProtocol): def runTest(self): # Set up flow to send from port 1 to port 2 and copy to CPU # Test parameter gives LB port base (assumes consecutive) + + ##-- dictionary containing the ingress port to egress port mapping + ingress_to_egress_port_dict = self.create_dict() + lb_port = test_param_get('lb_port', default=1) barrier_count = test_param_get('barrier_count', default=10) - + egress_port = ingress_to_egress_port_dict[lb_port] # Set controller to filter packet ins self.controller.filter_packet_in = True self.controller.pkt_in_filter_limit = 10 @@ -59,7 +63,7 @@ def runTest(self): match.wildcards &= ~ofp.OFPFW_IN_PORT match.in_port = lb_port act = ofp.action.output() - act.port = lb_port + 1 + act.port = egress_port request = ofp.message.flow_add() request.match = match @@ -81,11 +85,11 @@ def runTest(self): msg.data = str(pkt) msg.buffer_id = 0xffffffff act = ofp.action.output() - act.port = lb_port + 1 + act.port = egress_port msg.actions.append(act) logging.info("Sleeping before starting storm") time.sleep(1) # Root causing issue with fast disconnects - logging.info("Sending packet out to %d" % (lb_port + 1)) + logging.info("Sending packet out to %d" % (egress_port)) self.controller.message_send(msg) for idx in range(0, barrier_count): @@ -96,6 +100,40 @@ def runTest(self): # Clear the flow table when done logging.debug("Deleting all flows from switch") delete_all_flows(self.controller) + + def create_dict(self): + """ + Openflow test case LoadBarrier works on a general assumption that if + packet is ingressing through port with ifindex x at the controller, + then the packet egresses through x+1 from the controller. What if x+1 + is not a part of openflow configuration, So we need to find an appropriate + egress port corresponding to the ingress port, which is nothing but any + of the ports that are part of the openflow configuration. + + This function simply takes the ingress port list, shuffles it and prepares + an egress port list. Then it prepares a dictionary in which key is a port + in ingress_port_list and its corresponding values is an element in the + egress_port_list. Now this dictionary is returned to the function which calls it. + """ + + ##-- fetching the list of ports + ingress_port_list = config["port_map"].keys() + + ##-- calculating no of ports + no_of_ports = len(ingress_port_list) + + ##-- if no of ports are 4 then + ##-- rearranged_index_list is [1,2,3,0] + ##-- Index is shifted to one position right in a circular manner + rearranged_index_list = [(index+1)%no_of_ports for index in range(no_of_ports)] + + ##-- Shuffling the list as per the index list formed above + egress_port_list = [ingress_port_list[index] for index in rearranged_index_list] + + ##-- mapping ingress to egress ports + ingress_to_egress_port_dict = {k:v for k,v in zip(ingress_port_list,egress_port_list)} + + return ingress_to_egress_port_dict class PacketInLoad(base_tests.SimpleDataPlane): """