Hi, I have been trying to send a Flow Mod Message to the Openflow stack which sets a masked IP address. However, on the OF side no mask is present in the received message. How do I go about correctly setting the mask for this field?
Code: def add_flow(self, datapath, in_port, dst, priority, actions, match, inst, cookie=0): ofproto = datapath.ofproto ofproto_par = datapath.ofproto_parser mod = datapath.ofproto_parser.OFPFlowMod( datapath=datapath, cookie=cookie, cookie_mask=0, table_id=0, command=ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0, priority=priority, buffer_id=0xffffffff, out_port=0, out_group=0, flags=ofproto.OFPFF_CHECK_OVERLAP, match=match, instructions=inst) datapath.send_msg(mod) # Send Flow Mod Once an Echo Reply has been received @set_ev_cls(ofp_event.EventOFPEchoReply, MAIN_DISPATCHER) def rxEchoReply(self, ev): datapath = ev.msg.datapath ################ # Start tests self.createFlows(datapath) time.sleep(1) raw_input("Press Enter to delete") self.deleteFlows(datapath) # End tests ################ self.async_get(datapath) def createFlows(self, datapath): ofp = datapath.ofproto ofproto_par = datapath.ofproto_parser type_ = datapath.ofproto.OXM_OF_IPV4_SRC value = iptoint('192.168.2.1') f1 = ofproto_par.OFPMatchField.make(type_,value) actions = [ofproto_par.OFPActionSetField(f1), ofproto_par.OFPActionOutput(1,1600)] inst = [ofproto_par.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS, actions)] dst = "ab:cd:ef:12:34:56" pri = 1 match = ofproto_par.OFPMatch() match.set_dl_type(0x800) match.set_ipv4_src(value) self.add_flow(datapath, 1, dst, pri, actions, match, inst, cookie=0xdead) type_ = datapath.ofproto.OXM_OF_IPV4_SRC value = iptoint('192.169.2.1') mask = self.get_ip_mask_from_prefix_length(32) f1 = ofproto_par.OFPMatchField.make(type_,value) actions = [ofproto_par.OFPActionSetField(f1), ofproto_par.OFPActionOutput(1,1600)] inst = [ofproto_par.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS, actions)] dst = "ab:cd:ef:12:34:56" pri = 1 match = ofproto_par.OFPMatch() match.set_dl_type(0x800) match.set_ipv4_src_masked(value, mask) self.add_flow(datapath, 1, dst, pri, actions, match, inst, cookie=0xbeef) def deleteFlows(self, datapath): ofp = datapath.ofproto ofproto_par = datapath.ofproto_parser type_ = datapath.ofproto.OXM_OF_IPV4_SRC_W mask = self.get_ip_mask_from_prefix_length(32) ip = iptoint('192.168.2.1') f1 = ofproto_par.MTIPV4Src.make(type_,ip,mask) actions = [ofproto_par.OFPActionSetField(f1), ofproto_par.OFPActionOutput(1,1600)] inst = [ofproto_par.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS, actions)] dst = "ab:cd:ef:12:34:56" pri = 1 match = ofproto_par.OFPMatch() match.set_dl_type(0x800) match.set_ipv4_src_masked(ip, mask) self.delete_flow(datapath, 1, dst, pri, actions, match, inst, cookie=0xdead) I have done some debugging on the Openflow side and I can see that the incoming message has the correct match field data set (192.168.2.1), but the mask field is 0 (and the oxm header flag is also 0). Any help you can offer is much appreciated. Thanks, Adam Humphreys Reception : +44 (0)28 9072 5000 Fax : +44 (0)28 9072 5001 www.asidua.com Registered in Northern Ireland No. 043987 Office Locations: Belfast Birmingham Dublin We only send and receive email on the basis of the term set out at www.asidua.com/portal/email-disclaimer Please consider the impact on the environment before printing this e-mail ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel