def runTest(self): of_ports = testutils.clear_switch(self, basic_port_map.keys(), basic_logger) for max_len in [ 0, 99, DEFAULT_MISS_SEND_LEN, ofp.OFPCML_MAX, ofp.OFPCML_NO_BUFFER ]: rc = testutils.delete_all_flows(self.controller, basic_logger) self.assertEqual(rc, 0, "Failed to delete all flows") testutils.set_config_verify(self, max_len=(max_len % ofp.OFPCML_MAX + 10)) if max_len == ofp.OFPCML_NO_BUFFER: testutils.set_config_verify(self, max_len=max_len) testutils.set_flow_miss_entry(self, ofp.OFPTC_TABLE_MISS_CONTROLLER, max_len, 0) for of_port in basic_port_map.keys(): basic_logger.info("PKT IN test, port " + str(of_port)) pkt = testutils.simple_tcp_packet() self.dataplane.send(of_port, str(pkt)) #@todo Check for unexpected messages? testutils.do_barrier(self.controller) testutils.packetin_verify(self, pkt, max_len) response, _ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) while response != None: response, _ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) testutils.set_config_verify(self, max_len=DEFAULT_MISS_SEND_LEN)
def runTest(self): # Construct packet to send to dataplane # Send packet to dataplane # Poll controller with expect message type packet in of_ports = testutils.clear_switch(self, basic_port_map.keys(), basic_logger) max_len = 40 testutils.set_flow_miss_entry(self, ofp.OFPTC_TABLE_MISS_CONTROLLER, max_len, 0) # These will get put into function outpkt = testutils.simple_tcp_packet() of_ports = basic_port_map.keys() of_ports.sort() #_,miss_send_len = testutils.get_config_reply_verify(self) #testutils.set_config_verify(self, max_len = 40) for dp_port in of_ports: (response, _) = self.controller.poll(ofp.OFPT_PACKET_IN, 2) for egr_port in of_ports: if egr_port != dp_port: break #_,max_len = testutils.get_config_reply_verify(self) self.dataplane.send(egr_port, str(outpkt)) testutils.do_barrier(self.controller) buffer_id = testutils.packetin_verify(self, outpkt, max_len) response, _ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) while response != None: response, _ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) msg = message.packet_out() msg.in_port = ofp.OFPP_CONTROLLER msg.buffer_id = buffer_id act = action.action_output() act.port = dp_port self.assertTrue(msg.actions.add(act), 'Could not add action to msg') basic_logger.info("PacketOut to: " + str(dp_port)) testutils.ofmsg_send(self, msg) (of_port, pkt, _) = self.dataplane.poll(timeout=3) self.assertTrue(pkt is not None, 'Packet not received') basic_logger.info("PacketOut: got pkt from " + str(of_port)) if of_port is not None: self.assertEqual(of_port, dp_port, "Unexpected receive port") self.assertEqual(str(outpkt), str(pkt), 'Response packet does not match send packet')
def runTest(self): # Construct packet to send to dataplane # Send packet to dataplane # Poll controller with expect message type packet in of_ports = testutils.clear_switch(self, basic_port_map.keys(), basic_logger) max_len = 40 testutils.set_flow_miss_entry(self, ofp.OFPTC_TABLE_MISS_CONTROLLER, max_len, 0) # These will get put into function outpkt = testutils.simple_tcp_packet() of_ports = basic_port_map.keys() of_ports.sort() #_,miss_send_len = testutils.get_config_reply_verify(self) #testutils.set_config_verify(self, max_len = 40) for dp_port in of_ports: (response, _) = self.controller.poll(ofp.OFPT_PACKET_IN, 2) for egr_port in of_ports: if egr_port != dp_port: break #_,max_len = testutils.get_config_reply_verify(self) self.dataplane.send(egr_port, str(outpkt)) testutils.do_barrier(self.controller) buffer_id = testutils.packetin_verify(self, outpkt, max_len) response,_ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) while response != None: response,_ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) msg = message.packet_out() msg.in_port = ofp.OFPP_CONTROLLER msg.buffer_id = buffer_id act = action.action_output() act.port = dp_port self.assertTrue(msg.actions.add(act), 'Could not add action to msg') basic_logger.info("PacketOut to: " + str(dp_port)) testutils.ofmsg_send(self, msg) (of_port, pkt, _) = self.dataplane.poll(timeout=3) self.assertTrue(pkt is not None, 'Packet not received') basic_logger.info("PacketOut: got pkt from " + str(of_port)) if of_port is not None: self.assertEqual(of_port, dp_port, "Unexpected receive port") self.assertEqual(str(outpkt), str(pkt), 'Response packet does not match send packet')
def runTest(self): of_ports = testutils.clear_switch(self, basic_port_map.keys(), basic_logger) for max_len in [0, 99, DEFAULT_MISS_SEND_LEN, ofp.OFPCML_MAX, ofp.OFPCML_NO_BUFFER]: rc = testutils.delete_all_flows(self.controller, basic_logger) self.assertEqual(rc, 0, "Failed to delete all flows") testutils.set_config_verify(self, max_len = (max_len % ofp.OFPCML_MAX + 10)) if max_len == ofp.OFPCML_NO_BUFFER: testutils.set_config_verify(self, max_len = max_len) testutils.set_flow_miss_entry(self, ofp.OFPTC_TABLE_MISS_CONTROLLER, max_len, 0) for of_port in basic_port_map.keys(): basic_logger.info("PKT IN test, port " + str(of_port)) pkt = testutils.simple_tcp_packet() self.dataplane.send(of_port, str(pkt)) #@todo Check for unexpected messages? testutils.do_barrier(self.controller) testutils.packetin_verify(self, pkt, max_len) response,_ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) while response != None: response,_ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) testutils.set_config_verify(self, max_len = DEFAULT_MISS_SEND_LEN)