<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div class="" style=""><span class="" style="">Hello murphy</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal" class=""><span class="" style=""><br class="" style=""></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal" class=""><span class="" style="">i have developed a pox controller in python IDLE. i tried to use RUN MODULE/ CHECK MODULE to check for syntax errors before i log it on my VM. i get this syntax:</span></div><div style="color: rgb(0, 0, 0); font-size:
16.363636016845703px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style=""><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16.363636016845703px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style="">:there is an error in your program-syntax error: (msg). do you know how i can fix that?</span></div><div style="color: rgb(0, 0, 0); font-size: 16.363636016845703px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal" class=""><span class="" style=""><br class="" style=""></span></div><div style="background-color: transparent" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>msg =
nx.nx_flow_mod()</div><div style="background-color: transparent" class=""> msg.data = event.ofp</div><div style="background-color: transparent" class=""> msg.table_id = 0</div><div style="background-color: transparent" class=""> msg.priority = 3323</div><div style="background-color: transparent" class=""> msg.idle_timeout = OFP_FLOW_PERMANENT</div><div style="background-color: transparent" class=""> msg.hard_timeout = OFP_FLOW_PERMANENT</div><div style="background-color: transparent" class=""> msg.flags = 1</div><div style="background-color: transparent" class=""> msg = of.ofp_match()</div><div style="background-color: transparent" class=""> msg.match.in_port = 3</div><div style="background-color: transparent" class="">
msg.match.dl_src = (EthAddr("b1:fe:aa:6e:76:5c")) #Host1 Mac address</div><div style="background-color: transparent" class=""> msg.match.dl_dst = (EthAddr("0")) # No dst Mac address.</div><div style="background-color: transparent" class=""> msg.match.dl_type = pkt.ethernet.IP_TYPE<span class="" style="white-space:pre"> </span></div><div style="background-color: transparent" class=""> msg.match.nw_src = (IPAddr("192.168.20.1") #Host1 IP address <span class="" style="white-space:pre"> </span></div><div style="background-color: transparent" class=""> msg.match.nw_dst = (IPAddr("192.168.48.0"), 24)# </div><div style="background-color: transparent" class=""> msg.match.nw_proto = pkt.ipv4.UDP_PROTOCOL</div><div style="background-color: transparent" class=""> msg.match.tp_dst =
5004<span class="" style="white-space:pre"> </span></div><div style="background-color: transparent" class=""> msg.actions.append(of.ofp_action_output(port = 4)) # packet forward to the StreamingServer (output port)<span class="" style="white-space:pre"> </span></div><div style="background-color: transparent" class=""> event.connection.send(msg)</div><div style="background-color: transparent" class=""> </div><div style="background-color: transparent" class=""> log.debug("Installing %s.%i -> %s.%i AND %s.%i -> %s.%i" %</div><div style="background-color: transparent" class=""> (packet.dst, dst_port, packet.src, event.ofp.in_port,</div><div style="background-color: transparent" class=""><span class="" style=""></span></div><div style="background-color: transparent" class="">
packet.src, event.ofp.in_port, packet.dst, dst_port))</div><div style="background-color: transparent" class=""><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16.363636016845703px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;" class=""><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16.363636016845703px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;" class=""><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16.363636016845703px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;" class="">thanks </div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16.363636016845703px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;" class="">kofi</div><div class="" style=""><br class="" style=""></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt" class=""> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt" class=""> <div dir="ltr" class="" style=""> <font size="2" face="Arial" class="" style=""> On Wednesday, April 16, 2014 8:52 PM, Murphy McCauley <murphy.mccauley@gmail.com> wrote:<br class="" style=""> </font> </div> <div class="" style=""><div id="yiv5884876632" class="" style=""><div class="" style="">On Apr 16, 2014, at 3:27 AM, Shiyao Ma <<a rel="nofollow" shape="rect" ymailto="mailto:i@introo.me" target="_blank" href="mailto:i@introo.me" class="" style="">i@introo.me</a>>
wrote:<br clear="none" class="" style=""><div class="" style=""><br clear="none" class="" style=""><blockquote type="cite" class="" style=""><div dir="ltr" class="" style=""><div class="" style=""><div class="" style=""><div class="" style=""><div class="" style="">Hi.<br clear="none" class="" style=""><br clear="none" class="" style=""></div>I am following <a rel="nofollow" shape="rect" target="_blank" href="https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L121" class="" style="">https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L121</a><br clear="none" class="" style="">
</div>I wonder where is the corresponding source for that event obj (The relevant class definition), so I can know what the event.attr stands for and how many attrs the event has.<br clear="none" class="" style=""></div></div></div></blockquote><div class="" style=""><br clear="none" class="" style=""></div><div class="" style="">This is a PacketIn event handler, so the event object is a PacketIn. You can either grep the codebase for "class PacketIn", or you can look up the PacketIn event in the POX manual. It's in a subsection called "PacketIn" under "OpenFlow Events: Responding to Switches".</div><div class="" style=""><br clear="none" class="" style=""></div><blockquote type="cite" class="" style=""><div dir="ltr" class="" style=""><div class="" style="">Also, I'd like to know the relevant class for the connection object. <a rel="nofollow" shape="rect" target="_blank"
href="https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L86" class="" style="">https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L86</a><br clear="none" class="" style=""></div></div></blockquote><div class="" style=""><br clear="none" class="" style=""></div><div class="" style="">The connection object is from a class called Connection. You can search the codebase for "class Connection", or you can look it up in the manual. It's in a subsection called "Connection Objects".</div><div class="" style=""><br clear="none" class="" style=""></div><div class="" style=""><br clear="none" class="" style=""></div><div class="" style="">For either or both of these, you could also use Python to find the answers for you. For example, to find the class of the connection, object, insert the following near line 86 of l2_learning:</div><div class="" style=""><div class="" style="">import inspect</div><div
class="" style="">print inspect.getsourcefile(type(connection)), inspect.getsourcelines(type(connection))[1]</div><div class="" style=""><br clear="none" class="" style=""></div><div class="" style="">Et voila, it'll print out the file and line number of the class. Or simply insert "help(connection)" to get the whole pydoc for it. Or save it to a global variable, run the POX "py" module, and then do "help(<global variable name>)" from the commandline.</div></div><div class="" style=""><br clear="none" class="" style=""></div><div class="" style=""><br clear="none" class="" style=""></div><div class="" style="">Hope that helps.</div><div class="" style=""><br clear="none" class="" style=""></div>-- Murphy</div><div class="" id="yiv5884876632yqtfd72020" style=""><div class="" style=""><br clear="none" class="" style=""><blockquote type="cite" class="" style=""><div dir="ltr" class="" style="">Thanks and regards.<br clear="none" class=""
style=""><div class="" style="">-- <br clear="none" class="" style=""><div dir="ltr" class="" style=""><div class="" style=""><br clear="none" class="" style=""></div><div class="" style="">吾輩は猫である。ホームーページは<a rel="nofollow" shape="rect" target="_blank" href="http://introo.me/" class="" style="">http://introo.me</a>。<br clear="none" class="" style=""></div></div>
</div></div>
</blockquote></div><br clear="none" class="" style=""></div></div></div><br class="" style=""><br class="" style=""></div> </div> </div> </div> </div></body></html>