Hi,
> but when I run the app, I get the following error and I don't know how
> to solve it.
It does not exist ip_proto in the msg.match.
Please perform the check by using the if Statements or try Statements.
ipproto = None
if 'ip_proto' in msg.match:
ipproto = msg.match['ip_proto']
Thanks,
On 2016年05月17日 02:23, Aidin Kelki wrote:
>
> Hi everyone,
>
> I am new in Ryu and I am working on a piece of code to actually get the
> statistic of packets.
>
> @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
> def _packet_in_handler(self, ev):
> msg = ev.msg
> datapath = msg.datapath
> in_port = msg.match['in_port']
>
> pkt = packet.Packet(msg.data)
> eth = pkt.get_protocols(ethernet.ethernet)[0]
> ipp = pkt.get_protocol(ipv4.ipv4)
>
> #print pkt
> ipproto = msg.match['ip_proto']
> pktstate = msg.match['state']
> dst = eth.dst
> src = eth.src
> ethtype = eth.ethertype
> print msg
>
> but when I run the app, I get the following error and I don't know how
> to solve it.
>
> hub: uncaught exception: Traceback (most recent call last):
> File "/home/mininet/ryu/ryu/lib/hub.py", line 52, in _launch
> func(*args, **kwargs)
> File "/home/mininet/ryu/ryu/base/app_manager.py", line 287, in
> _event_loop
> handler(ev)
> File "/home/mininet/ryu/ryu/app/multi.py", line 101, in
> _packet_in_handler
> ipproto = msg.match['ip_proto']
> File "/home/mininet/ryu/ryu/ofproto/ofproto_v1_3_parser.py", line
> 841, in __getitem__
> return dict(self._fields2)[key]
> KeyError: 'ip_proto'
>
> I appreciate it if you can help me with this. Thank you so much.
>
>
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel