I am using the below function inside my simple_switch.py to populate the
flows to the switches.
* def populate_of_flow(self,datapath,msg,src,dst):*
* ofproto = datapath.ofproto*
* dpid = datapath.id <http://datapath.id>*
* self.mac_to_port.setdefault(dpid, {})*
* # learn a mac address to avoid FLOOD next time.*
* self.mac_to_port[dpid][src] = msg.in_port*
* if dst in self.mac_to_port[dpid]:*
* out_port = self.mac_to_port[dpid][dst]*
* else:*
* out_port = ofproto.OFPP_FLOOD*
* actions = [datapath.ofproto_parser.OFPActionOutput(out_port)]*
* fe_key = format_dpid_str(dpid_to_str(datapath.id
<http://datapath.id>)) + str(msg.in_port)*
* fe_list = self.g.vertices.index.lookup(switch_dpid_port=fe_key)*
* for fe in fe_list:*
* #print('flow entries for switch {} has output port {} action
{}'.format(fe.switch_dpid,fe.actionOutputPort,fe.actions))*
* outport = fe.actionOutputPort*
* actions = [datapath.ofproto_parser.OFPActionOutput(outport)]*
* # install a flow to avoid packet_in next time*
* if out_port != ofproto.OFPP_FLOOD:*
* self.add_flow(datapath, msg.in_port, dst, actions)*
* print('msg.buffer_id {}'.format(msg.buffer_id))*
* out = datapath.ofproto_parser.OFPPacketOut(*
* datapath=datapath, buffer_id=msg.buffer_id,
in_port=msg.in_port,*
* actions=actions)*
* datapath.send_msg(out)*
As you can see above,it requires the *"msg.buffer_id.".*Now this "*msg"*
comes from the PACKET_IN event which is passed on to the event handler.I
would like to know if there is a more generic API
that I can use to populate the flows given that I know the path and want to
preprogram the flows.
Regards,
Karthik
------------------------------------------------------------------------------
Slashdot TV. Video for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel