Thanks for the quick update,

On Sat, 22 Mar 2014 20:16:55 +0800
Wei-Li Tang <[email protected]> wrote:

> The way to handle multiple connections from the same datapath I took
> is mostly the same as in dpset, but it's always good to reinstall
> the LDAP Packet-In flows even while switch tries to reconnect to us.
> 
> Signed-off-by: Wei-Li Tang <[email protected]>
> ---
>  ryu/topology/switches.py |   27 +++++++++++++++++++--------
>  1 file changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
> index fb3af8e..66c79b5 100644
> --- a/ryu/topology/switches.py
> +++ b/ryu/topology/switches.py
> @@ -471,12 +471,12 @@ class Switches(app_manager.RyuApp):
>  
>      def _register(self, dp):
>          assert dp.id is not None
> -        assert dp.id not in self.dps
>  
>          self.dps[dp.id] = dp
> -        self.port_state[dp.id] = PortState()
> -        for port in dp.ports.values():
> -            self.port_state[dp.id].add(port.port_no, port)
> +        if not dp.id in self.port_state:
> +            self.port_state[dp.id] = PortState()
> +            for port in dp.ports.values():
> +                self.port_state[dp.id].add(port.port_no, port)
>  
>      def _unregister(self, dp):
>          if dp.id in self.dps:
> @@ -526,10 +526,18 @@ class Switches(app_manager.RyuApp):
>          LOG.debug(dp)
>  
>          if ev.state == MAIN_DISPATCHER:
> +            dp_multiple_conns = False
> +            if dp.id in self.dps:
> +                LOG.warning('multiple connections from %s', 
> dpid_to_str(dp.id))
> +                dp_multiple_conns = True
> +
>              self._register(dp)
>              switch = self._get_switch(dp.id)
>              LOG.debug('register %s', switch)
> -            self.send_event_to_observers(event.EventSwitchEnter(switch))
> +
> +            # Do not send event while dp has multiple connections to 
> controller.

pep8 gives the following warning with the above line:

ryu/topology/switches.py:538:80: E501 line too long (80 > 79
characters)
            # Do not send event while dp has multiple connections to
            controller.

I fixed it and merged.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to