Hello,
I want to get connection object to send the ofp_flow_mod object.
I already see the Communicating with a Datapath(Switch) section which in
POX Wiki.
And I also create a class to get the connection object which saved in
connections attribute.
But I'd want to know how to use the instance for My_class which created at
the component?
I tried it at the component I wrote like below.
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.recoco import Timer
import time
#----------------------------------------------------
class c_class (object):
def __init__(self):
self.connections = set()# Attribute
core.openflow.addListeners(self) #Add Listener
def _handle_ConnectionUp (self, event):
self.connections.add(event.connection)
#----------------------------------------------------
def launch():
c_object = c_class() #Get instance
msg = of.ofp_flow_mod()
msg.match.dl_type = 0x0800
msg.match.nw_src = "192.168.1.6"
msg.actions.append(of.ofp_action_output(port = 24))
c_objcet.connections.send(msg)
But I got the error message "NameError: global name 'c_objcet' is not
defined".
Can someone help me or give me an example?
Thanks.