[pox-dev] Fwd: POX disconnected to OpenFlow switch

Hong Wayne wayne21205 at gmail.com
Wed Jul 24 00:57:05 PDT 2013


---------- Forwarded message ----------
From: Hong Wayne <wayne21205 at gmail.com>
Date: 2013/7/24
Subject: Re: [pox-dev] POX disconnected to OpenFlow switch
To: Murphy McCauley <murphy.mccauley at gmail.com>


Hello Murphy:


Thank you for replying.

In your suggestion, I can use core.callLater() to execute time consuming
program,

But in POX Wiki, The utility for Timer is almost same like callLater.

So I use Timer to trigger time consuming program(_handle_timer_temp) like
below:
Timer( float(self.interval), _handle_timer_temp, recurring=False,
args=(core.openflow, self.return_nu_rows, self.return_switch_info))

But still get disconnect form OF switch, did I have any wrong about
this opinion?

Can you give me more information or examples? Thanks for helping again.



2013/7/24 Murphy McCauley <murphy.mccauley at gmail.com>

> Ten seconds is much longer than you want to stall the main thread.  You
> should do time consuming computations in another thread.  If they need to
> communicate back to the main thread, there are a number of ways to do it...
> usually, it's sufficient to just call core.callLater() and pass the data as
> arguments when your time consuming computation finishes.
>
> -- Murphy
>
>
> On Jul 24, 2013, at 12:13 AM, Hong Wayne wrote:
>
> Sorry about that.
>
> POX command line:
> ./pox.py forwarding.l2_learning openflow.of_01 --address=ip_address
> --port=6633 samples.pretty_log log.level --packet=WARN myself_module
> --interval=2
>
> POX version: betta
>
> OF switch: Open vSwitch 1.9
>
> And the code in myself_module is done the things that execute algorithm
> and update database(Written in _handle_timer_temp callback function) which
> cost about ten seconds and myself_module will be triggered by
> _handle_ConnectionUp like below:
>
> class temp_class (object):
>
>   def __init__ (self, interval):
>
>     core.openflow.addListeners(self)
>     self.interval = interval
>     db = MySQLdb.connect(host="", user="", passwd="", db="")
>     cursor = db.cursor()#Create instance to access DB
>     cursor.execute("SELECT dpid, Dead, Maskbit, c_subnet_start,
> c_subnet_end, Load_balancing_algorithm  FROM Pica8_Switch_Info ")
>     self.return_nu_rows = cursor.rowcount
>     self.return_switch_info = cursor.fetchall()
>     db.close()
>
>   def _handle_ConnectionUp (self, event):
>
>     log.debug("Default Connection %s" % (event.connection,))
>
>     Timer(float(self.interval), _handle_timer_temp, recurring=False,
> args=(core.openflow, self.return_nu_rows, self.return_switch_info))
>
>
> def launch (interval): #User parameters
>   """
>   Starts modules
>   """
>   core.registerNew( Wayne_class, interval)
>
>
>
>
> 2013/7/24 Murphy McCauley <murphy.mccauley at gmail.com>
>
>> I don't think you've provided enough information for an explanation to be
>> offered.
>>
>> Please see the final question on the POX wiki's FAQ for guidance to help
>> us help you.
>>
>> -- Murphy
>>
>> On Jul 23, 2013, at 9:23 PM, Hong Wayne wrote:
>>
>> > Dear all:
>> >
>> >
>> > I faced a problem when OpenFlow switch connect to POX and some module I
>> modified triggered at this time(ConnectionUp event) and cost some times.
>> >
>> > When this module was executed completely, the POX command line appear
>> the messages like below:
>> >
>> > [openflow.of_01] already disconnected!
>> > [openflow.of_01] closed connection
>> > [openflow.of_01] disconnected
>> >
>> > So I want to ask why these error message happened? Whether POX run some
>> module I didn't notice?
>> >
>> > Thanks for helping.
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20130724/d2ef7bd1/attachment-0002.htm>


More information about the pox-dev mailing list