[pox-dev] Send packet_out problem

Chanthan Hel hel.chanthan65 at gmail.com
Thu Apr 10 23:07:39 PDT 2014


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:
    # 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:
      # 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)

## 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*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20140411/8b99803f/attachment-0002.htm>


More information about the pox-dev mailing list