


Format of Request to ODL to fetch statistics

asked 2015-03-23 11:56:38 -0700

Nuno gravatar image

Hello. I'm trying to get statistics of a port using Rest API in opendaylight.

Currently I'm using this Rest URL


However, since this is a post I don't know the format of the request to specify the port I want to get statistics.

I've tried

{ "id" : "openflow:2"} and { "node" : "openflow:2"} and many other combinations.

I can't find a place where there's an example showing the request format. Can someone give me some hints where I can find an example or tell me the json request format ?

Regards, Nuno B.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2015-03-26 05:17:13 -0700

Vishal Thapar gravatar image

I normally use the following for port with node-connector-id as openflow:1:2

curl -i -u admin:admin -X GET http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:2/opendaylight-port-statistics:flow-capable-node-connector-statistics/

I am not sure if it is possible to get port statistics from the way you are trying to. If there is, I too would love to find out.

edit flag offensive delete publish link more


Do you know the frequency ODL provides us that data ? Because I want to know the current transmission rate on a port and there's no way to obtain that (that I'm aware of) without getting the current transmission value and subtract to the previous one to get it. However if the information that ODL provides me is only updated internally every 2 or more secs I can't calculate that unless I know the time they update that value. Do you know the frequency it is updated or a way to obtain the current transmission rate on a port/interface ?

Nuno ( 2015-03-31 12:05:37 -0700 )edit

I'l have to check code to be sure but it is definitely more than 2 secs. As per `` it is 15 secs. Too short a duration will not perform at scale very well. Depending on switch, you could consider other SB plugins.

Vishal Thapar ( 2015-04-01 01:32:03 -0700 )edit

I'm also using ovsdb. Do you the update rate they are using? seems faster than openflow But I'm not sure

Nuno ( 2015-04-01 02:50:33 -0700 )edit

Haven't looked at OVSDB code so not sure, but if update in port stats on OVS triggers OVSDB Southbound event [row change] then I expect it to be as fast as stat update frequency on OVS. I recall some mails on ovsdb-dev last year on this, I think default is 5 secs.

Vishal Thapar ( 2015-04-01 03:03:31 -0700 )edit

Here's the link: `` I think minimum you can go is one second [can't recall where I read that].

Vishal Thapar ( 2015-04-01 03:06:33 -0700 )edit

answered 2015-03-26 01:55:06 -0700

Maros gravatar image

updated 2015-03-26 02:10:19 -0700


Could you try this format ?

{ "input": { "node" : "/opendaylight-inventory:nodes/node[id="{node-id}"] }}

The type for node leaf is instance identifier so I think the entire path to required node should be there. {node-id} should be replaced with id of required node (probably openflow:2 in your case).


edit flag offensive delete publish link more


Didn't work mate :s

Nuno ( 2015-03-31 12:02:23 -0700 )edit

With what result ? same as before ?

Maros ( 2015-04-07 07:33:31 -0700 )edit

400 Bad Request. Here is my url and content on the rest request ( )

Nuno ( 2015-04-07 07:58:27 -0700 )edit

Nuno, the URI in your pastebin has "operations" instead of "operational". just fyi.

jamoluhrsen ( 2015-04-07 09:15:25 -0700 )edit

You are right, thanks jamoluhrsen. I changed it and the response is now 405 Method Not Allowed.

Nuno ( 2015-04-07 09:37:14 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-03-23 11:56:38 -0700

Seen: 1,437 times

Last updated: Mar 26 '15