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) request = message.flow_mod() request.table_id = 0 request.priority = 0 request.cookie = 123456 act = action.action_output() act.max_len = max_len act.port = ofp.OFPP_CONTROLLER inst_packet_in = instruction.instruction_apply_actions() #apply inst_packet_in.actions.add(act) request.instructions.add(inst_packet_in) rv = self.controller.message_send(request) 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) self.assertEqual(response.cookie, request.cookie, "cookie is not equal") #print(response.cookie) #print(request.cookie) #clear the msg response, _ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) while response != None: response, _ = self.controller.poll(ofp.OFPT_PACKET_IN, 1)
def runTest(self): # Construct packet to send to dataplane # Send packet to dataplane, once to each port # Poll controller with expect message type packet in of_ports = testutils.clear_switch(self, basic_port_map.keys(), basic_logger) testutils.set_table_config(self, 0, ofp.OFPTC_TABLE_MISS_CONTROLLER, True) #_,miss_send_len = testutils.get_config_reply_verify(self) testutils.set_config_verify(self, max_len = ofp.OFPCML_NO_BUFFER) 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.packetin_verify(self, pkt, ofp.OFPCML_NO_BUFFER) 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, once to each port # Poll controller with expect message type packet in of_ports = testutils.clear_switch(self, basic_port_map.keys(), basic_logger) testutils.set_table_config(self, 0, ofp.OFPTC_TABLE_MISS_CONTROLLER, True) #_,miss_send_len = testutils.get_config_reply_verify(self) testutils.set_config_verify(self, max_len=ofp.OFPCML_NO_BUFFER) 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.packetin_verify(self, pkt, ofp.OFPCML_NO_BUFFER) 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): 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): 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) request = message.flow_mod() request.table_id = 0 request.priority = 0 request.cookie = 123456 act = action.action_output() act.max_len = max_len act.port = ofp.OFPP_CONTROLLER inst_packet_in = instruction.instruction_apply_actions()#apply inst_packet_in.actions.add(act) request.instructions.add(inst_packet_in) rv = self.controller.message_send(request) 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) self.assertEqual(response.cookie, request.cookie, "cookie is not equal") #print(response.cookie) #print(request.cookie) #clear the msg response,_ = self.controller.poll(ofp.OFPT_PACKET_IN, 1) while response != None: response,_ = self.controller.poll(ofp.OFPT_PACKET_IN, 1)
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): max_len = (DEFAULT_MISS_SEND_LEN + 14739) % ofp.OFPCML_MAX + 1 testutils.set_config_verify(self, max_len = max_len) testutils.set_config_verify(self, max_len = DEFAULT_MISS_SEND_LEN)
def runTest(self): max_len = (DEFAULT_MISS_SEND_LEN + 14739) % ofp.OFPCML_MAX + 1 testutils.set_config_verify(self, max_len=max_len) testutils.set_config_verify(self, max_len=DEFAULT_MISS_SEND_LEN)