Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when adding flow entry #108

Open
schneider8357 opened this issue Aug 22, 2020 · 0 comments
Open

Error when adding flow entry #108

schneider8357 opened this issue Aug 22, 2020 · 0 comments

Comments

@schneider8357
Copy link

schneider8357 commented Aug 22, 2020

Hello,

I got an error upon adding a new flow entry via ofctl_rest, using different docker images for ryu (latarc/ryu and osrg/ryu):

Error traceback

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/eventlet/wsgi.py", line 573, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/wsgi.py", line 236, in __call__
    return super(wsgify_hack, self).__call__(environ, start_response)
  File "/usr/local/lib/python3.8/site-packages/webob/dec.py", line 129, in __call__
    resp = self.call_func(req, *args, **kw)
  File "/usr/local/lib/python3.8/site-packages/webob/dec.py", line 193, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/wsgi.py", line 290, in __call__
    return controller(req)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/wsgi.py", line 160, in __call__
    return getattr(self, action)(req, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/ofctl_rest.py", line 276, in wrapper
    method(self, req, dp, ofctl, body, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/ofctl_rest.py", line 436, in mod_flow_entry
    ofctl.mod_flow_entry(dp, flow, mod_cmd)
  File "/usr/local/lib/python3.8/site-packages/ryu/lib/ofctl_v1_4.py", line 847, in mod_flow_entry
    ofctl_utils.send_msg(dp, flow_mod, LOG)
  File "/usr/local/lib/python3.8/site-packages/ryu/lib/ofctl_utils.py", line 242, in send_msg
    dp.send_msg(msg)
  File "/usr/local/lib/python3.8/site-packages/ryu/controller/controller.py", line 438, in send_msg
    msg.serialize()
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_parser.py", line 270, in serialize
    self._serialize_body()
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_v1_4_parser.py", line 4433, in _serialize_body
    inst.serialize(self.buf, offset)
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_v1_4_parser.py", line 4600, in serialize
    a.serialize(buf, action_offset)
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_v1_4_parser.py", line 4709, in serialize
    msg_pack_into(ofproto.OFP_ACTION_OUTPUT_PACK_STR, buf,
  File "/usr/local/lib/python3.8/site-packages/ryu/lib/pack_utils.py", line 25, in msg_pack_into
    struct.pack_into(fmt, buf, offset, *args)
struct.error: required argument is not an integer

When debugging with curl, I found out that the problem was in the port field of the actions of the flow entry, as shown below:

No zero padding on osrg/ryu gives me a HTTP 200.
With zero padding on osrg/ryu gives me a HTTP 200.
No zero padding on latarc/ryu gives me a HTTP 200.
With zero padding on latarc/ryu gives me a HTTP 400 and an error.

  • I'm running Ryu using docker containers, and the docker host OS is Ubuntu 20.04.1 LTS.
  • Ryu Manager command (on both containers): ryu-manager --observe-links ryu.app.ofctl_rest ryu.app.rest_topology
  • The Python version on the latarc/ryu container is 3.8.5, while osrg/ryu uses Python 2.7.12 so it could also be related to the python version.

The curl commands and respective output are as follow:

Not zero padded port value on v4.31

curl -v -d '{ "dpid": "1", "idle_timeout": 30, "hard_timeout": 30,  "instructions": [  { "type": "APPLY_ACTIONS", "actions": [ { "max_len": 65535, "port": "3", "type": "OUTPUT" } ] } ] }' http://172.17.0.4:8080/stats/flowentry/add
*   Trying 172.17.0.4:8080...
* TCP_NODELAY set
* Connected to 172.17.0.4 (172.17.0.4) port 8080 (#0)
> POST /stats/flowentry/add HTTP/1.1
> Host: 172.17.0.4:8080
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 174
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 174 out of 174 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Date: Sat, 22 Aug 2020 04:49:14 GMT
< 
* Connection #0 to host 172.17.0.4 left intact

Zero padded port value on v4.31

curl -v -d '{ "dpid": "1", "idle_timeout": 30, "hard_timeout": 30,  "instructions": [  { "type": "APPLY_ACTIONS", "actions": [ { "max_len": 65535, "port": "000003", "type": "OUTPUT" } ] } ] }' http://172.17.0.4:8080/stats/flowentry/add
*   Trying 172.17.0.4:8080...
* TCP_NODELAY set
* Connected to 172.17.0.4 (172.17.0.4) port 8080 (#0)
> POST /stats/flowentry/add HTTP/1.1
> Host: 172.17.0.4:8080
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 179
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 179 out of 179 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Date: Sat, 22 Aug 2020 04:49:19 GMT
< 
* Connection #0 to host 172.17.0.4 left intact

Not zero padded port value on v4.34

curl -v -d '{ "dpid": "1", "idle_timeout": 30, "hard_timeout": 30,  "instructions": [  { "type": "APPLY_ACTIONS", "actions": [ { "max_len": 65535, "port": "3", "type": "OUTPUT" } ] } ] }' http://172.17.0.3:8080/stats/flowentry/add   
*   Trying 172.17.0.3:8080...
* TCP_NODELAY set
* Connected to 172.17.0.3 (172.17.0.3) port 8080 (#0)
> POST /stats/flowentry/add HTTP/1.1
> Host: 172.17.0.3:8080
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 174
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 174 out of 174 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Date: Sat, 22 Aug 2020 04:53:59 GMT
< 
* Connection #0 to host 172.17.0.3 left intact

Zero padded port value on v4.34 with traceback

curl -v -d '{ "dpid": "1", "idle_timeout": 30, "hard_timeout": 30,  "instructions": [  { "type": "APPLY_ACTIONS", "actions": [ { "max_len": 65535, "port": "000003", "type": "OUTPUT" } ] } ] }' http://172.17.0.3:8080/stats/flowentry/add
*   Trying 172.17.0.3:8080...
* TCP_NODELAY set
* Connected to 172.17.0.3 (172.17.0.3) port 8080 (#0)
> POST /stats/flowentry/add HTTP/1.1
> Host: 172.17.0.3:8080
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 179
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 179 out of 179 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Content-Length: 2309
< Date: Sat, 22 Aug 2020 04:53:38 GMT
< Connection: close
< 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/eventlet/wsgi.py", line 573, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/wsgi.py", line 236, in __call__
    return super(wsgify_hack, self).__call__(environ, start_response)
  File "/usr/local/lib/python3.8/site-packages/webob/dec.py", line 129, in __call__
    resp = self.call_func(req, *args, **kw)
  File "/usr/local/lib/python3.8/site-packages/webob/dec.py", line 193, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/wsgi.py", line 290, in __call__
    return controller(req)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/wsgi.py", line 160, in __call__
    return getattr(self, action)(req, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/ofctl_rest.py", line 276, in wrapper
    method(self, req, dp, ofctl, body, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ryu/app/ofctl_rest.py", line 436, in mod_flow_entry
    ofctl.mod_flow_entry(dp, flow, mod_cmd)
  File "/usr/local/lib/python3.8/site-packages/ryu/lib/ofctl_v1_4.py", line 847, in mod_flow_entry
    ofctl_utils.send_msg(dp, flow_mod, LOG)
  File "/usr/local/lib/python3.8/site-packages/ryu/lib/ofctl_utils.py", line 242, in send_msg
    dp.send_msg(msg)
  File "/usr/local/lib/python3.8/site-packages/ryu/controller/controller.py", line 438, in send_msg
    msg.serialize()
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_parser.py", line 270, in serialize
    self._serialize_body()
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_v1_4_parser.py", line 4433, in _serialize_body
    inst.serialize(self.buf, offset)
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_v1_4_parser.py", line 4600, in serialize
    a.serialize(buf, action_offset)
  File "/usr/local/lib/python3.8/site-packages/ryu/ofproto/ofproto_v1_4_parser.py", line 4709, in serialize
    msg_pack_into(ofproto.OFP_ACTION_OUTPUT_PACK_STR, buf,
  File "/usr/local/lib/python3.8/site-packages/ryu/lib/pack_utils.py", line 25, in msg_pack_into
    struct.pack_into(fmt, buf, offset, *args)
struct.error: required argument is not an integer
* Closing connection 0

I am not certain if this is intended behavior, but I'm still reporting this as an issue, mainly because legacy code using this format may break upon updating Ryu to a newer version and maybe it is preferred to maximize compatibility.

Regards,
Lucas Schneider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant