Thank you for test. I'll cook the patch.

On Wed, Dec 12, 2012 at 07:18:10PM -0800, Shivaram Mysore wrote:
> Hello,
> 
> I tried the fix, I am now able to communicate via OF1.2 
> 
> I am using FlowForwarding.org/LINC switch
> 
> On the Ryu side:
> # bin/ryu-manager --verbose ryu/app/PacketTest.py 
> loading app ryu.controller.ofp_handler
> loading app ryu/app/PacketTest.py
> instantiating app ryu.controller.ofp_handler
> instantiating app ryu/app/PacketTest.py
> connected socket:<socket fileno=4 sock=127.0.0.1:6633 peer=127.0.0.1:52858>
> address:('127.0.0.1', 52858)
> unhandled event <ryu.controller.dispatcher.EventQueueCreate object at 
> 0xd39e10>
> hello ev <ryu.controller.ofp_event.EventOFPHello object at 0xd39f10>
> move onto config mode
> unhandled event <ryu.controller.dispatcher.EventDispatcherChange object at
> 0xd41090>
> 
> 
> 
> On the switch side:
> Connected to controller using OFP v{"localhost",6633,0,3}
> 03:11:45.065 [debug] Received message from the controller: features_request
> 
> 
> /Shivaram
> 
> 
> On Wed, Dec 12, 2012 at 6:41 PM, FUJITA Tomonori 
> <[email protected]
> > wrote:
> 
>     On Thu, 13 Dec 2012 11:34:36 +0900
>     Isaku Yamahata <[email protected]> wrote:
> 
>     > Hi. Does the following patch help? (it is totally untested yet).
> 
>     Hmm, if an application specifies the OF versions, then Ryu sends the
>     highest version of these specified versions. The version negotication
>     failure should not happen...
> 
>     >
>     
> ---------------------------------------------------------------------------
>     > diff --git a/ryu/controller/ofp_handler.py b/ryu/controller/
>     ofp_handler.py
>     > index 63f888a..92d7e01 100644
>     > --- a/ryu/controller/ofp_handler.py
>     > +++ b/ryu/controller/ofp_handler.py
>     > @@ -52,20 +52,35 @@ class OFPHandler(app_manager.RyuApp):
>     >
>     >          # TODO: check if received version is supported.
>     >          #       pre 1.0 is not supported
>     > -        if msg.version not in datapath.supported_ofp_version:
>     > -            # send the error
>     > -            error_msg = datapath.ofproto_parser.OFPErrorMsg(datapath)
>     > -            error_msg.type = datapath.ofproto.OFPET_HELLO_FAILED
>     > -            error_msg.code = datapath.ofproto.OFPHFC_INCOMPATIBLE
>     > -            error_msg.data = 'unsupported version 0x%x' % msg.version
>     > -            datapath.send_msg(error_msg)
>     > -            return
>     > -
>     > -        # should we again send HELLO with the version that the switch
>     > -        # supports?
>     > -        # msg.version != datapath.ofproto.OFP_VERSION:
>     > -
>     > -        datapath.set_version(msg.version)
>     > +        if hasattr(msg, 'elements'):
>     > +            # TODO: OFPHET_VERSIONBITMAP
>     > +            pass
>     > +        else:
>     > +            usable_versions = [version for version
>     > +                               in datapath.supported_ofp_version
>     > +                               if version <= msg.version]
>     > +            if not usable_versions:
>     > +                # send the error
>     > +                error_msg = datapath.ofproto_parser.OFPErrorMsg
>     (datapath)
>     > +                error_msg.type = datapath.ofproto.OFPET_HELLO_FAILED
>     > +                error_msg.code = datapath.ofproto.OFPHFC_INCOMPATIBLE
>     > +                error_msg.data = 'unsupported version 0x%x' %
>     msg.version
>     > +                datapath.send_msg(error_msg)
>     > +                return
>     > +            version = max(usable_versions)
>     > +            if version != max(msg.version,
>     ev.datapath.ofproto.OFP_VERSION):
>     > +                # What to do?
>     > +                # should we again send HELLO with this version again?
>     > +                error_msg = datapath.ofproto_parser.OFPErrorMsg
>     (datapath)
>     > +                error_msg.type = datapath.ofproto.OFPET_HELLO_FAILED
>     > +                error_msg.code = datapath.ofproto.OFPHFC_INCOMPATIBLE
>     > +                error_msg.data = 'no compatible version found: '
>     > +                'controller 0x%x switch 0x%x' % (
>     > +                    ev.datapath.ofproto.OFP_VERSION, msg.version)
>     > +                datapath.send_msg(error_msg)
>     > +                return
>     > +
>     > +        datapath.set_version(version)
>     >
>     >          # now send feature
>     >          features_reqeust = datapath.ofproto_parser.OFPFeaturesRequest
>     (datapath)
>     >
>     
> ---------------------------------------------------------------------------
>     >
>     > On Wed, Dec 12, 2012 at 05:47:10PM -0800, Shivaram Mysore wrote:
>     >> Thanks.  But, that did not help.  Here is the code
>     >>
>     >> import logging
>     >> import struct
>     >> import array
>     >>
>     >> from ryu.controller import handler
>     >> from ryu.controller import ofp_event
>     >> from ryu.ofproto import ofproto_v1_2
>     >> from ryu.ofproto import ofproto_v1_2_parser
>     >> from ryu.base import app_manager
>     >>
>     >> LOG = logging.getLogger('ryu.app.packettest')
>     >>
>     >> class PacketTest(app_manager.RyuApp):
>     >>     OFP_VERSIONS = [ofproto_v1_2.OFP_VERSION]
>     >>
>     >>     def __init__(self, *args, **kwargs):
>     >>         pass
>     >>
>     >>     @handler.set_ev_cls(ofp_event.EventOFPPacketIn,
>     handler.MAIN_DISPATCHER)
>     >>     def packet_in_handler(self, ev):
>     >>         msg = ev.msg
>     >>         dp = msg.datapath
>     >>         for f in msg.match.fields:
>     >>             if f.header == ofproto_v1_2.OXM_OF_IN_PORT:
>     >>                 in_port = f.value
>     >>
>     >>         actions = [dp.ofproto_parser.OFPActionOutput
>     (dp.ofproto.OFPP_ALL, 0)]
>     >>         out = dp.ofproto_parser.OFPPacketOut(
>     >>             datapath=dp, buffer_id=msg.buffer_id, in_port=in_port,
>     >>             actions=actions)
>     >>         LOG.debug("Sending message out %s", out)
>     >>         dp.send_msg(out)
>     >>
>     >>
>     >> On the switch side, I see:
>     >> Connection to controller closed because of {"localhost",6633,0,
>     >> {unsupported_version,4}}
>     >>
>     >>
>     >> On Wed, Dec 12, 2012 at 5:40 PM, FUJITA Tomonori <
>     [email protected]
>     >> > wrote:
>     >>
>     >>     class PacketTest(app_manager.RyuApp):
>     >>         OFP_VERSIONS = [ofproto_v1_2.OFP_VERSION]
>     >>
>     >>         def __init__(self, *args, **kwargs):
>     >>             pass
>     >>
>     >>
>     >>
>     >>
>     >
>     >>
>     
> ------------------------------------------------------------------------------
>     >> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>     >> Remotely access PCs and mobile devices and provide instant support
>     >> Improve your efficiency, and focus on delivering more value-add 
> services
>     >> Discover what IT Professionals Know. Rescue delivers
>     >> http://p.sf.net/sfu/logmein_12329d2d
>     >> _______________________________________________
>     >> Ryu-devel mailing list
>     >> [email protected]
>     >> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>     >
>     >
>     > --
>     > yamahata
>     >
>     >
>     
> ------------------------------------------------------------------------------
>     > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>     > Remotely access PCs and mobile devices and provide instant support
>     > Improve your efficiency, and focus on delivering more value-add services
>     > Discover what IT Professionals Know. Rescue delivers
>     > http://p.sf.net/sfu/logmein_12329d2d
>     > _______________________________________________
>     > Ryu-devel mailing list
>     > [email protected]
>     > https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 
> 
> 
> 

> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel


-- 
yamahata

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to