Ask Your Question


asked 2015-03-04 18:01:12 -0700

rolecram gravatar image

Hi guys: Two days ago I posted a question about how to delete a group of flows using REST API. The answer was: using cookie. An attribute of a JSON structure.

It was great!!!!

But, to delete a flow using the REST API you have to send an HTTP DELETE, there is not payload, you do not use a JSON structure.

So, How I can specify the cookie in a DELETE post?

Thank you in advance, marcelo

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2015-03-05 11:28:19 -0700

jamoluhrsen gravatar image

updated 2015-03-06 10:31:50 -0700


you can issue a DELETE with data, the same way you would with a POST. Not sure how you are sending your REST calls, but with curl you would just make the request DELETE (-X delete) and pass the flow data with --data-binary.

I have not tried this with OpenDaylight, but hoping it's as simple as that.

here is the python code. I took it from a library I've used for a different controller platform, trimmed it down for brevity and modified it a bit to hopefully work with OpenDaylight (Bearer header, for example), but I have not tried it. Hopefully you can get it to work:

import urllib2
from urllib2 import HTTPError

def genericREST(method,url,data,xAuthToken,debug=False):
    req = urllib2.Request(url, data)
        req.get_method=lambda: method
        if xAuthToken != None:

        response = urllib2.urlopen(req)
        return response
    except Exception as e:
        return "Error: %s"%e

def deleteREST(url,data,xAuthToken,debug=False):
    return genericREST("DELETE", url, data, xAuthToken, debug)
edit flag offensive delete publish link more


Hi jamoluhrsen: thank you for your response. But I think it is not as simple. If you have time, take a look to this article:!topic/floodlight-dev/CF7_Zwt-WVA Regards, marcelo

rolecram ( 2015-03-05 13:32:00 -0700 )edit

Thanks for the info Marcelo, looks like spec-wise it's not going to work. I do know that some REST utilities will allow it, so if you are not stuck with a tool that disallows it you might get it to work. I can dig up some python code I've used before that does this, if that would be helpful.

jamoluhrsen ( 2015-03-05 15:43:35 -0700 )edit

Jamo, i half remember that Michal gave you a different REST call to delete flows that in Operations table but not Config, i believe that could do it.

Chris O'Shea ( 2015-03-06 01:36:35 -0700 )edit

Jamo & Chris: Thanks a lot. Jamo, if you can, please send me the pyton code you mention. Regards, Marcelo

rolecram ( 2015-03-06 06:15:26 -0700 )edit

Thanks for the reminder Chris. Maybe not totally helpful, but here is the thread: I was trying to remove a flow that only existed in the operational store. That was with a POST.

jamoluhrsen ( 2015-03-06 10:35:33 -0700 )edit

answered 2015-03-05 06:25:46 -0700

Nuno gravatar image

updated 2015-03-08 17:49:34 -0700

I don't know about deleting the flow using cookie. I personally send a request like this which deletes the flow from table and from switch if you specify the node id, table id where the flow is and the flow id.

Something like this:

http://<controller-ip>:8181/restconf/config/opendaylight-inventory:nodes/node/<node id="">/table//flow/<flow id="">

Change the fields between '<>' to your values.

If you want to delete an entire table the procedure is the same and is something like this: http://<controller-ip>:8181/restconf/config/opendaylight-inventory:nodes/node/<node id="">/table/</node></controller-ip>


Regards, Nuno B.


edit flag offensive delete publish link more


Thank you Nuno for your response. But I need to delete a set of flows using the cookie attribute, so, how can I specify this attribute into the URL (perhaps using query parameters?)

rolecram ( 2015-03-05 09:37:44 -0700 )edit
Login/Signup to Answer

Question Tools



Asked: 2015-03-04 18:01:12 -0700

Seen: 1,224 times

Last updated: Mar 08 '15