[pox-dev] Where is the corresponding source code for the following Object.

kofi adu kofiadubb at yahoo.com
Sat Apr 26 09:41:17 PDT 2014


Hello murphy

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:

:there is an error in your program-syntax error: (msg). do you know how i can fix that?

	msg = nx.nx_flow_mod()
        msg.data = event.ofp
        msg.table_id = 0
        msg.priority = 3323
        msg.idle_timeout = OFP_FLOW_PERMANENT
        msg.hard_timeout = OFP_FLOW_PERMANENT
        msg.flags = 1
        msg = of.ofp_match()
        msg.match.in_port = 3
        msg.match.dl_src = (EthAddr("b1:fe:aa:6e:76:5c")) #Host1 Mac address
        msg.match.dl_dst = (EthAddr("0")) # No dst Mac address.
        msg.match.dl_type = pkt.ethernet.IP_TYPE
        msg.match.nw_src = (IPAddr("192.168.20.1") #Host1 IP address 
        msg.match.nw_dst = (IPAddr("192.168.48.0"), 24)# 
        msg.match.nw_proto = pkt.ipv4.UDP_PROTOCOL
        msg.match.tp_dst = 5004
        msg.actions.append(of.ofp_action_output(port = 4)) # packet forward to the StreamingServer (output port)
        event.connection.send(msg)
        
        log.debug("Installing %s.%i -> %s.%i AND %s.%i -> %s.%i" %
            (packet.dst, dst_port, packet.src, event.ofp.in_port,
             packet.src, event.ofp.in_port, packet.dst, dst_port))



thanks 
kofi

On Wednesday, April 16, 2014 8:52 PM, Murphy McCauley <murphy.mccauley at gmail.com> wrote:
 
On Apr 16, 2014, at 3:27 AM, Shiyao Ma <i at introo.me> wrote:



Hi.
>
>I am following https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L121
>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.
>

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".

Also, I'd like to know the relevant class for the connection object. https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L86
>

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".


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:
import inspect
print inspect.getsourcefile(type(connection)), inspect.getsourcelines(type(connection))[1]

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.


Hope that helps.
-- Murphy


Thanks and regards.
>
>-- 
>
>
>
>吾輩は猫である。ホームーページはhttp://introo.me。
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20140426/1ba1c97f/attachment-0002.htm>


More information about the pox-dev mailing list