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

0

add flow using rest api in open daylight controller helium

asked 2015-03-13 06:09:50 -0700

anonymous user

Anonymous

please provide Request JSON/XML format with parameters and syntax for adding flow/adding meter in open day controller helium open flow (1.3) switches using Rest API.

Thanks, Neha Wadhawan

edit retag flag offensive close merge delete

Comments

Don't forget to use a userspace switch, otherwise meters won't work. OVS does not implement meters as you may check on their FAQ (https://github.com/openvswitch/ovs/blob/master/FAQ.md).

Nuno ( 2015-03-31 04:56:01 -0700 )edit

Np. If you want to add qos on openvswitch use queues. But you have to configure it using ovsdb and then associate the queues to the flows

Nuno ( 2015-03-31 07:29:15 -0700 )edit

5 answers

Sort by ยป oldest newest most voted
0

answered 2015-03-13 10:05:56 -0700

faizan gravatar image

updated 2015-03-14 07:16:55 -0700

Hi Neha Wadhawan

Refer these :

OpenDaylight OpenFlow Plugin:End to End Flows

OpenDaylight OpenFlow Plugin:End to End Flows:Example Flows

Regards,

Faizan

edit flag offensive delete publish link more

Comments

can you please look at this question and answer if possible? https://ask.opendaylight.org/question/2902/unable-to-add-flows-in-opendaylight-helium-using-rest-nor-using-dlux-ui/

pm.preetam ( 2015-03-14 17:05:03 -0700 )edit
0

answered 2015-03-17 02:40:12 -0700

heena gravatar image

updated 2015-03-17 04:03:19 -0700

Hi Faizan,openflow:1 node is up.

my Rest API URL is

http://10.19.10.211:8181/apidoc/explorer/index.html#!/sal-flow%282013-08-19%29/addflowpost_0

Request URL is

http://10.19.10.211:8181/restconf/operations/sal-flow:add-flow

in Response body m getting below error-

HTTP ERROR 500 Problem accessing /restconf/operations/sal-flow:add-flow. Reason: Server Error Caused by: java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191) at org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper.unwrap(SimpleNodeWrapper.java:80) at org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper.unwrap(SimpleNodeWrapper.java:19) at org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper.unwrap(CompositeNodeWrapper.java:107) at org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper.unwrap(CompositeNodeWrapper.java:26) at org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper.unwrap

please help.

Regards, Neha Wadhawan

edit flag offensive delete publish link more

Comments

Hi Neha, From above error it seems like youe controller is not running ( Server error 500 ) correctly. Did you http://10.19.10.211:8181/apidoc/explorer/index.html ( API doc ) running fine ?

faizan ( 2015-03-17 02:47:36 -0700 )edit

Also Request URL for PUT should be of config database not Operational. You will GET the flow from Opendation data store. Regards, Faizan

faizan ( 2015-03-17 02:51:31 -0700 )edit
0

answered 2015-03-17 04:02:46 -0700

heena gravatar image

Hi faizen, http://10.19.10.211:8181/apidoc/explorer/index.html is running fine m able to see all apis. and this link i got from above only http://10.19.10.211:8181/restconf/operations/sal-flow:add-flow what is think is that from API doc, flows will be created through this link. I am passing json format as request json in below format. { "flow": { "node": {"id":"00:00:18:84:0a:13:0b:98", "type":"OF"}, "priority": "100", "flow-name": "neha", "match": { "ethernet-match": { "ethernet-type": { "type": "2048" } }, "ipv4-destination": "10.0.10.2/24" }, "id": "1", "table_id": "0", "instructions": { "instruction": { "order": "0", "apply-actions": { "action": { "order": "0" } } } } }

edit flag offensive delete publish link more

Comments

Dear, the link for flow in examples in ApiDocs is under "opendaylight-inventory" not "sal-flow". Have a look into "opendaylight-inventory". And I am not sure what "sal-flow" Apis are for, havn't look into it. Hope you got what i am trying to say. Regards, Faizan

faizan ( 2015-03-17 04:39:10 -0700 )edit
0

answered 2015-03-17 04:34:52 -0700

heena gravatar image

updated 2015-03-17 04:38:42 -0700

Also i tried creating flows using CURL command. below is syntax which i have used.

curl --noproxy 10.19.10.211 -u admin:admin -H 'Content-Type: application/yang.data+xml' -X PUT -d ' <flow xmlns="urn:opendaylight:flow:inventory"> <priority>32</priority> <flow-name>neha</flow-name> <match> <ethernet-match> <ethernet-type> <type>2048</type> </ethernet-type> </ethernet-match> <ipv4-destination>10.0.10.2/24</ipv4-destination> </match> <id>1</id> <table_id>0</table_id> <instructions> <instruction> <order>0</order> <apply-actions> <action> <order>0</order> <dec-nw-ttl> </dec-nw-ttl></action> </apply-actions> </instruction> </instructions> </flow>' 'http://10.19.10.211:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1'

Its not returning any error or success but m able to see config data store enteries using below URL but flows are not visible in UI.

http://10.19.10.211:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1

Regards, Neha Wadhawan

edit flag offensive delete publish link more
0

answered 2015-03-25 03:20:06 -0700

heena gravatar image

updated 2015-03-31 00:23:32 -0700

@Nuno B thanks i am able to add flow using below curl command. curl --noproxy 10.19.10.225 -u admin:admin -H 'Content-Type: application/yang.data+xml' -X PUT -d ' <flow xmlns="urn:opendaylight:flow:inventory"> <priority>14865</priority> <flow-name>sampleFlow</flow-name> <idle-timeout>12000</idle-timeout> <match> <ethernet-match> <ethernet-type> <type>2048</type> </ethernet-type> </ethernet-match> </match> <id>9</id> <table_id>0</table_id> <instructions> <instruction> <order>6555</order> </instruction> <instruction> <order>0</order> <apply-actions> <action> <order>0</order> <output-action> <output-node-connector>1</output-node-connector> </output-action> </action> </apply-actions> </instruction> </instructions> </flow>' 'http://10.19.10.225:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:510715245500041/table/0/flow/9'

edit flag offensive delete publish link more

Comments

Yes @Nuno B you r right. I tried creating meter using OVS switch(created using mininet) it was not getting added into operational datastore then i tried with HP switch and it worked fine, i am able to create meter in switch and add flow with meter :) thanks for this link its really useful.

heena ( 2015-03-31 05:00:13 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
3 followers

Stats

Asked: 2015-03-13 06:09:50 -0700

Seen: 7,693 times

Last updated: Mar 31 '15