Ejemplo n.º 1
0
    def startup(self):
        try:
            _setup_logging()

            # pre-startup
            ca.launch()  # Default OpenFlow launch

            # launch components
            loadPrettyLog()
            of_01.launch(port=8888)
            core.registerNew(_Controller, nal=self)

            # post-startup
            core.goUp()

            # forever loop for messaging.
            while True:
                time.sleep(5)
        except:
            core.quit()
Ejemplo n.º 2
0
	def startup(self):
		try:
			_setup_logging()

			# pre-startup
			ca.launch() # Default OpenFlow launch
			
			# launch components
			loadPrettyLog()
			of_01.launch(port = 8888)
			core.registerNew(_Controller, nal = self)

			# post-startup
			core.goUp()
			
			# forever loop for messaging.
			while True:
				time.sleep(5)
		except:
			core.quit()
Ejemplo n.º 3
0
    def __init__(self,
                 name=None,
                 address="127.0.0.1",
                 port=6653,
                 keepalive=False,
                 *args,
                 **kwargs):
        """
    Initialize attributes, register specific connection Arbiter if needed and
    set up listening of OpenFlow events.

    :param name: name used to register component ito ``pox.core``
    :type name: str
    :param address: socket address (default: 127.0.0.1)
    :type address: str
    :param port: socket port (default: 6633)
    :type port: int
    :return: None
    """
        name = name if name is not None else self.name
        super(AbstractOFControllerAdapter, self).__init__(*args, **kwargs)
        # Set an OpenFlow nexus as a source of OpenFlow events
        self.openflow = OpenFlowBridge()
        self.controller_address = (address, port)
        # Initiate our specific connection Arbiter
        arbiter = ExtendedOFConnectionArbiter.activate()
        # Register our OpenFlow event source
        arbiter.add_connection_listener(self.controller_address, self.openflow)
        # Launch OpenFlow connection handler if not started before with given name
        # launch() return the registered openflow module which is a coop Task
        log.debug(
            "Setup OF interface and initiate handler object for connection: "
            "(%s, %i)" % (address, port))
        from pox.openflow.of_01 import launch
        of = launch(name=name, address=address, port=port)
        # Start listening for OpenFlow connections
        of.start()
        self.task_name = name if name else "of_01"
        of.name = self.task_name
        # register OpenFlow event listeners
        self.openflow.addListeners(self)
        log.debug("%s adapter: Start listening incoming OF connections..." %
                  self.name)
        # initiate keepalive if needed
        if keepalive:
            log.debug(
                "Initiate keepalive functionality - Echo Request interval: %ss, "
                "timeout: %ss" % (self._interval, self._switch_timeout))
            Timer(self._interval,
                  self._handle_keepalive_handler,
                  recurring=True,
                  args=(self.openflow, ))
Ejemplo n.º 4
0
def loadOpenFlow():
    import pox.openflow.of_01 as of_01
    of_01.launch(port=8888)
def loadOpenFlow():
	import pox.openflow.of_01 as of_01
	of_01.launch(port = 8888)