Hi,

When working with example

    https://osrg.github.io/ryu-book/en/html/rest_qos.html


and starting ryu-manager with "--observe-links" causes the "KeyError" in 
rest_qos.py because ethertype 88cc is not handled. The error comes from 
to_rest function, which in this test I have modified with few print 
statements...

         if key in Match._CONVERT:
             print (key,value)
             conv = Match._CONVERT[key]
             conv = dict((value, key) for key, value in conv.items())
             print (value,conv)
crash-->    match.setdefault(key, conv[value])
         else:
             match.setdefault(key, value)

The code obvisously should also check that ether type actually exists in 
'conv', and if not do something sensible for unknown ones. Any quick fixes?


# PYTHONPATH=. ./bin/ryu-manager --observe-links ryu.app.rest_qos 
ryu.app.qos_simple_switch_13 ryu.app.rest_conf_switch 
ryu.app.gui_topology.gui_topology ryu.app.ofctl_rest
lzma module is not available
Registered VCS backend: git
Registered VCS backend: hg
Registered VCS backend: svn
Registered VCS backend: bzr
loading app ryu.app.rest_qos
loading app ryu.app.qos_simple_switch_13
loading app ryu.app.rest_conf_switch
loading app ryu.app.gui_topology.gui_topology
loading app ryu.app.ofctl_rest
loading app ryu.controller.ofp_handler
loading app ryu.app.rest_topology
loading app ryu.app.ws_topology
loading app ryu.app.rest_qos
loading app ryu.controller.ofp_handler
instantiating app None of Switches
creating context switches
instantiating app None of DPSet
creating context dpset
instantiating app None of ConfSwitchSet
creating context conf_switch
creating context wsgi
instantiating app ryu.app.rest_conf_switch of ConfSwitchAPI
instantiating app ryu.controller.ofp_handler of OFPHandler
instantiating app ryu.app.rest_qos of RestQoSAPI
instantiating app ryu.app.ws_topology of WebSocketTopology
instantiating app ryu.app.rest_topology of TopologyAPI
instantiating app ryu.app.qos_simple_switch_13 of SimpleSwitch13
instantiating app ryu.app.ofctl_rest of RestStatsApi
instantiating app ryu.app.gui_topology.gui_topology of GUIServerApp
(4481) wsgi starting up on http://0.0.0.0:8080
[QoS][INFO] dpid=0000000000000001: Join qos switch.
(4481) accepted ('127.0.0.1', 40110)
('dl_type', 35020)
(35020, {2048: 'IPv4', 34525: 'IPv6', 2054: 'ARP'})
Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 481, 
in handle_one_response
     result = self.application(self.environ, start_response)
   File "..../ryu/ryu/app/wsgi.py", line 236, in __call__
     return super(wsgify_hack, self).__call__(environ, start_response)
   File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in 
__call__
     resp = self.call_func(req, *args, **self.kwargs)
   File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in 
call_func
     return self.func(req, *args, **kwargs)
   File "..../ryu/ryu/app/wsgi.py", line 290, in __call__
     return controller(req)
   File "..../ryu/ryu/app/wsgi.py", line 160, in __call__
     return getattr(self, action)(req, **kwargs)
   File "..../ryu/ryu/app/rest_qos.py", line 458, in get_qos
     'get_qos', self.waiters)
   File "..../ryu/ryu/app/rest_qos.py", line 526, in _access_switch
     msg = function(rest, vid, waiters)
   File "..../ryu/ryu/app/rest_qos.py", line 636, in _rest_command
     key, value = func(*args, **kwargs)
   File "..../ryu/ryu/app/rest_qos.py", line 799, in get_qos
     rule = self._to_rest_rule(flow_stat)
   File "..../ryu/ryu/app/rest_qos.py", line 939, in _to_rest_rule
     rule.update(Match.to_rest(flow))
   File "..../ryu/ryu/app/rest_qos.py", line 1099, in to_rest
     match.setdefault(key, conv[value])
KeyError: 35020
127.0.0.1 - - [19/Apr/2017 10:11:04] "GET /qos/rules/0000000000000001 
HTTP/1.1" 500 1627 0.035013

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to