Thanks so much Murphy,<div>Chanthan <br><br>On Friday, April 11, 2014, Murphy McCauley <<a href="mailto:murphy.mccauley@gmail.com">murphy.mccauley@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
See "Working with Addresses" in the manual. Ethernet addresses in POX are of class EthAddr, not strings. You should compare against EthAddr("00:00:00:00:00:01").<br>
<br>
Some other comments inline.<br>
<br>
On Apr 10, 2014, at 11:07 PM, Chanthan Hel <<a href="javascript:;" onclick="_e(event, 'cvml', 'hel.chanthan65@gmail.com')">hel.chanthan65@gmail.com</a>> wrote:<br>
<br>
> 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>
<br>
It should never be -1. Ever. If it is ever -1, it's a bug.<br>
<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>
<br>
This logic appears backwards.<br>
<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>
This above function is redundant.<br>
po = of.ofp_packet_out(data = event.ofp) should do it.<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>
><br>
> 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>
> Please give me some suggestion<br>
> Chanhan<br>
><br>
> --<br>
> Mr. Chanthan Hel<br>
> Electrical engineering, Faculty of Engineering,<br>
> Chulalongkorn University (CU)<br>
><br>
> *Phone: +66 81 456 84 27*<br>
><br>
<br>
</blockquote></div><br><br>-- <br>Mr. Chanthan Hel<br>Electrical engineering, Faculty of Engineering,<br>Chulalongkorn University (CU)<br><br>*Phone: +66 81 456 84 27*<br><br><br>