<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Sounds about right.<div><br></div><div>If you're not altering the incoming packet at all, I think this is probably very close to:<div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; ">po = ofp_packet_out(data = event.data, action = ofp_action_output(port = out_port))</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; ">core.openflow.sendToDPID(dpid, po)</div><div><br></div><div>... where ...</div><div><br></div><div>"event" is the PacketIn event with the packet you want to resend</div><div>"dpid" is the DPID of the destination switch</div><div>"out_port" is the port on "dpid" you want to send out of</div><div><br></div><div>-- Murphy</div><div><br></div><div><div>On Jul 8, 2013, at 9:29 PM, Small, Christopher wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<pre style="white-space: pre-wrap; ">A little background on what Kavit is trying to do here is to build a tunneling mechanism through the controller for a (very small!) number of packets between hosts connected on two different OF switches connected to the same controller. </pre>
<pre style="white-space: pre-wrap; ">The application is essentially just a learning switch except:</pre>
<pre style="white-space: pre-wrap; ">1) It builds a global L2 table spanning all connected switches that includes DPID as well as MAC and port for all learned MAC addresses </pre>
<pre style="white-space: pre-wrap; ">2) When a Multicast DNS packet is sent as a Packetin to the controller the controller sends the received packet as a PacketOut to a different switch based upon a DB lookup of "paired" source and dest MACs. It uses the global L2 table to find the DPID of the dest MAC. </pre>
<pre style="white-space: pre-wrap; ">I took a quick look at the <span class="nc" style="color: rgb(68, 85, 136); font-weight: bold; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255); ">ofp_packet_out</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255); "> class in </span>pox/openflow/libopenflow_01.py and it looks like probably the easiest way to do this is to use the ofp_packet_out to build a new packet and then pack the data from the Packetin into the new PacketOut. </pre>
<pre style="white-space: pre-wrap; ">What Kavit is currently doing is sending the packet received by the controller back out directly using sendToDPID.</pre>
<div>--Chris Small</div>
<pre style="white-space: pre-wrap; "><br></pre>
<pre style="white-space: pre-wrap; ">======</pre>
<pre style="white-space: pre-wrap; "><br></pre>
<pre style="white-space: pre-wrap; ">I think sendToDPID() just doesn't do what you think it does. It is for sending OpenFlow commands to a switch -- the same as connection.send(), except it looks up the connection for you based on DPID. I believe you're trying to use it to send a packet out of some port on a switch. There's an obvious piece of information missing here -- sendToDPID takes a DPID, but how would it know which port you want to send the packet out of?
What you need to do is create an ofp_packet_out() which has an output action to the appropriate port and the data you want to send as the 'data' attribute. This is similar to the flood() function in l2_learning which is in your source. There are even closer examples in other modules (e.g., misc.dhcpd). Then send *that* using sendToDPID(), or in your case -- just use connection.send().
-- Murphy
On Jul 5, 2013, at 12:52 PM, Kavit Shah wrote:
><i> Command line with log, my code and screen shot of the wireshrak are attached in the text and png files.
</i>><i>
</i>><i> I am using HP Pro curve switch, i think it supports OF 1.0 spec.
</i>><i>
</i>><i>
</i>><i> #####################################
</i>><i> #####################################
</i>><i>
</i>><i> Important part of my code in the attached file
</i>><i>
</i>><i> #####################################
</i>><i> #####################################
</i>><i>
</i>><i> Questions:
</i>><i>
</i>><i> 1) sendToDPID function is not working the way I expect it to work. According to me if that function works I should see packet out in wireshark.
</i>><i>
</i>><i> 2) Am I extracting dpid of the switch correctly ?
</i>><i>
</i>><i> 3) What is the reason for getting an error while switch connects to the POX controller ?
</i>><i>
</i>><i> ERROR:openflow.of_01:[00-16-b9-ce-2f-40|800 1] OpenFlow Error:
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: header:
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: version: 1
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: type: 1 (OFPT_ERROR)
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: length: 20
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: xid: 7
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: type: OFPET_BAD_REQUEST (1)
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: code: OFPBRC_BAD_TYPE (1)
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: datalen: 8
</i>><i> [00-16-b9-ce-2f-40|800 1] Error: 0000: 01 12 00 08 00 00 00 07 ........
</i>><i>
</i>><i>
</i>><i> <sendToDPID_question.txt><sendToDPID_wireshark.png>_______________________________________________
</i>><i> mininet-discuss mailing list
</i>><i> <a href="http://lists.noxrepo.org/listinfo.cgi/pox-dev-noxrepo.org">mininet-discuss at lists.stanford.edu</a>
</i>><i> <a href="https://mailman.stanford.edu/mailman/listinfo/mininet-discuss">https://mailman.stanford.edu/mailman/listinfo/mininet-discuss</a>
</i></pre>
<div><br>
</div>
</div>
</blockquote></div><br></div></div></body></html>