Thanks so much Murphy, Chanthan On Friday, April 11, 2014, Murphy McCauley <murphy.mccau...@gmail.com> wrote:
> 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"). > > Some other comments inline. > > On Apr 10, 2014, at 11:07 PM, Chanthan Hel > <hel.chantha...@gmail.com<javascript:;>> > wrote: > > > Dear all, > > I want to send the packet out of the switch port and I write the code. > > > > # Method for just sending a packet to any port (broadcast by default) > > def send_packet (event,dst_port): > > msg = of.ofp_packet_out(in_port=event.ofp.in_port) > > if event.ofp.buffer_id != -1 and event.ofp.buffer_id is not None: > > It should never be -1. Ever. If it is ever -1, it's a bug. > > > # We got a buffer ID from the switch; use that > > msg.buffer_id = event.ofp.buffer_id > > else: > > # No buffer ID from switch -- we got the raw data > > if event.ofp.data: > > This logic appears backwards. > > > # No raw_data specified -- nothing to send! > > return > > msg.data = event.ofp.data > > msg.actions.append(of.ofp_action_output(port = dst_port)) > > event.connection.send(msg) > > This above function is redundant. > po = of.ofp_packet_out(data = event.ofp) should do it. > > > ## Create packet flow > > def _handle_PacketIn (event): > > packet = event.parsed > > if packet.src == "00:00:00:00:00:01": > > send_packet(event, 2) > > else: > > send_packet(event, 3) > > > > def launch (): > > core.openflow.addListenerByName("PacketIn", _handle_PacketIn) > > > > When packet arrive at switch although it have mac address > "00:00:00:00:00:01" , it always go to the else condition > > " else: > > send_packet(event, 3)" > > Please give me some suggestion > > Chanhan > > > > -- > > Mr. Chanthan Hel > > Electrical engineering, Faculty of Engineering, > > Chulalongkorn University (CU) > > > > *Phone: +66 81 456 84 27* > > > > -- Mr. Chanthan Hel Electrical engineering, Faculty of Engineering, Chulalongkorn University (CU) *Phone: +66 81 456 84 27*