<div dir="ltr">Dear all,<br>I want to send the packet out of the switch port and I write the code.<br><br># Method for just sending a packet to any port (broadcast by default)<br>def send_packet (event,dst_port):<br> msg = of.ofp_packet_out(in_port=event.ofp.in_port)<br>
if event.ofp.buffer_id != -1 and event.ofp.buffer_id is not None:<br> # We got a buffer ID from the switch; use that<br> msg.buffer_id = event.ofp.buffer_id<br> else:<br> # No buffer ID from switch -- we got the raw data<br>
if event.ofp.data:<br> # No raw_data specified -- nothing to send!<br> return<br> msg.data = event.ofp.data<br> msg.actions.append(of.ofp_action_output(port = dst_port))<br> event.connection.send(msg)<br>
<br>## Create packet flow<br>def _handle_PacketIn (event):<br> packet = event.parsed<br> if packet.src == "00:00:00:00:00:01":<br> send_packet(event, 2)<br> else:<br> send_packet(event, 3)<br><br>def launch ():<br>
core.openflow.addListenerByName("PacketIn", _handle_PacketIn)<br clear="all"><div><br></div><div>When packet arrive at switch although it have mac address "00:00:00:00:00:01" , it always go to the else condition<br>
" else:<br> send_packet(event, 3)" <br></div><div>Please give me some suggestion<br></div><div>Chanhan<br></div><div><br></div><div>-- <br>Mr. Chanthan Hel<br>Electrical engineering, Faculty of Engineering,<br>
Chulalongkorn University (CU)<br><br>*Phone: +66 81 456 84 27*<br><br>
</div></div>