On Thu, May 16, 2013 at 03:23:21PM +0530, nitish nagesh wrote:
> Thank you.
>
> I wrote a simple script to send packet out on receiving packet_in but i am
> unable to figure out why i am getting this error.
>
> Here is the function for handling packet_in and sending packet_out:
>
> @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
> def _packet_in_handler(self, ev):
> msg = ev.msg
> datapath = msg.datapath
> ofproto = datapath.ofproto
> self.logger.debug('Received packet-in message')
>
> dst, src, _eth_type = struct.unpack_from('!6s6sH', buffer(msg.data),
> 0)
>
> dpid = datapath.id
> in_port = ofproto.OFPP_LOCAL
> out_port = ofproto.OFPP_FLOOD
>
> buffer_id = 0xffffffff
> data = 'Message'
>
> ofparser = datapath.ofproto_parser
> actions = ofparser.OFPActionOutput(out_port, 0)
actions = [ofparser.OFPActionOutput(out_port, 0)]
actions should be a list of action. Not an action.
thanks,
> m = ofparser.OFPPacketOut(datapath, buffer_id, in_port,
> actions, data)
> datapath.send_msg(m)
>
>
> On receiving a packet_in i get the following error:
>
> Traceback (most recent call last):
> File "/usr/lib/pymodules/python2.7/gevent/greenlet.py", line 405, in run
> result = self._run(*self.args, **self.kwargs)
> File "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/base/
> app_manager.py", line 106, in _event_loop
> handler(ev)
> File "/home/openflow/ryu/ryu-master/role_msg_pin.py", line 92, in
> _packet_in_handler
> datapath.send_msg(m)
> File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> /controller.py", line 216, in send_msg
> msg.serialize()
> File "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/ofproto/
> ofproto_parser.py", line 119, in serialize
> self._serialize_body()
> File "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/ofproto/
> ofproto_v1_3_parser.py", line 1432, in _serialize_body
> for a in self.actions:
> TypeError: 'OFPActionOutput' object is not iterable
> <Greenlet at 0x98480ac: <bound method SndRcvRoleMsg._event_loop of
> <role_msg_pin.SndRcvRoleMsg object at 0x984a38c>>> failed with TypeError
>
>
> My python knowledge is very basic. Can you please help me in correcting this
> problem?
>
> Regards,
> Nitish
>
>
>
>
> On Tue, May 14, 2013 at 3:20 PM, Isaku Yamahata <[email protected]>
> wrote:
>
> OFPPacketIn of OF1.3 is different from OF1.0's. A method written
> for OF1.0 needs to be modified for OF1.3.
> Match fields need to be searched for OXM_OF_IN_PORT.
>
> For example, please refer to
> ryu/tests/integrated/test_request_reply_v12.py
> _verify_packet_in()
>
> thanks,
>
> On Tue, May 14, 2013 at 02:09:58PM +0530, nitish nagesh wrote:
> > Hi All,
> >
> > I am trying to write a simple Ryu controller app which on receiving
> a
> > packet_in would reply back with a packet out with action=FLOOD. I found
> the
> > function provided in the simple_switch.py already does this. I have used
> the
> > same function as-is in my app (which handles other events as well, hence
> i
> > could not directly take simple_switch.py script). I am using 1.3 OF
> version. I
> > see the following error on controller console when a packet in message
> arrives:
> >
> > EVENT ofp_event->SndRcvRoleMsg EventOFPPacketIn
> > Traceback (most recent call last):
> > File "/usr/lib/pymodules/python2.7/gevent/greenlet.py", line 405, in
> run
> > result = self._run(*self.args, **self.kwargs)
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/base
> /
> > app_manager.py", line 106, in _event_loop
> > handler(ev)
> > File "/home/openflow/ryu/ryu-master/role_msg_pin.py", line 71, in
> > _packet_in_handler
> > msg.in_port)
> > AttributeError: 'OFPPacketIn' object has no attribute 'in_port'
> > <Greenlet at 0xa62a0ec: <bound method SndRcvRoleMsg._event_loop of
> > <role_msg_pin.SndRcvRoleMsg object at 0xa62c36c>>> failed with
> AttributeError
> >
> > After browsing the code a bit, i could see that OFPPacketIn class really
> does
> > not have 'in_port' as attribute. Not sure what is wrong. Can someone
> please
> > help?
> >
> > Thanks,
> > Nitish
> >
> >
>
> >
>
> ------------------------------------------------------------------------------
> > AlienVault Unified Security Management (USM) platform delivers complete
> > security visibility with the essential security capabilities. Easily and
> > efficiently configure, manage, and operate all of your security controls
> > from a single console and one unified framework. Download a free trial.
> > http://p.sf.net/sfu/alienvault_d2d
> > _______________________________________________
> > Ryu-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
>
> --
> yamahata
>
>
--
yamahata
------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel