Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

click to hide/show revision 1
initial version

Marcelo,

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.

Marcelo,

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)
    try:
        req.get_method=lambda: method
        if xAuthToken != None:
            req.add_header("Bearer",xAuthToken)

        req.add_header("Content-type","application/x-www-form-urlencoded")
        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)