kytos / mef_eline

Kytos NApp to create and manage point-to-point L2 circuits
https://napps.kytos.io/kytos/mef_eline
MIT License
3 stars 14 forks source link

Enabling an EVC produces 500 Internal Server Error #186

Closed italovalcy closed 4 years ago

italovalcy commented 4 years ago

After creating the EVC successfully, if you try to enable it, the REST API returns '500 Internal Server Error' .

Steps to reproduce:

  1. Create a EVC:
    prompt$ curl -X POST -H "Content-Type: application/json" -d '{
            "name": "VLAN_200_Test",
            "uni_a": {
                "interface_id": "00:00:00:00:00:00:00:fc:12",
                "tag": {
                    "tag_type": "VLAN",
                    "value": 200
                }
            },
            "uni_z": {
                "interface_id": "00:00:00:00:00:00:00:f7:2",
                "tag": {
                    "tag_type": "VLAN",
                    "value": 200
                }
            }
    }' http://localhost:8181/api/kytos/mef_eline/v2/evc/
    {"circuit_id":"861c600fc5524350bf4c91560954979f"}
  2. Enable it:
    prompt$ curl -X PATCH -H "Content-Type: application/json" -d '{
    "enable": true
    }' http://localhost:8181/api/kytos/mef_eline/v2/evc/861c600fc5524350bf4c91560954979f

Expected behavior:

The EVC gets enabled and OpenFlow flows installed on the switch

Actual behavior:

The rest API answer:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

At the server console:

2020-06-04 22:00:56,395 - INFO [kytos.napps.kytos/mef_eline] (Thread-7628) EVC 861c600fc5524350bf4c91560954979f was synced to the storehouse.
2020-06-04 22:00:56,395 - ERROR [kytos.core.controller] (Thread-7628) Exception on /api/kytos/mef_eline/v2/evc/861c600fc5524350bf4c91560954979f [PATCH]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "//var/lib/kytos/napps/kytos/mef_eline/main.py", line 206, in update
    evc.deploy()
  File "//var/lib/kytos/napps/../napps/kytos/mef_eline/models.py", line 464, in deploy
    self.enable()
TypeError: 'bool' object is not callable

Environment: kytos:2020.1b3 + kytos/mef_eline:2.3.1

italovalcy commented 4 years ago

Interesting fact is that even with the error above, the property of the EVC is changed to enabled (it should remain false, since due to the error it was not enabled). But the flows are not installed.