Ask Your Question
0

Convert this specific OpenFlow flow to REST flow

asked 2015-07-01 02:46:23 -0700

Edu gravatar image

updated 2015-07-01 02:47:19 -0700

I have been installating these flows with a Java application to the last release of the REST api (localhost:8080/controller/nb/v2/flowprogrammer/default/node/OF/00:00:00:00:00:00:00:01/)

<list>
    <flowConfig>
        <installInHw>true</installInHw>
        <name>FlowInsert1</name>
        <node>
            <id>00:00:00:00:00:00:00:01</id>
            <type>OF</type>
        </node>
        <ingressPort>1</ingressPort>
        <priority>999</priority>
        <actions>OUTPUT=2</actions>
    </flowConfig>
</list>

However, now I need to use the new REST api for Helium ( http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1 ). Can anybody help me to translate it to this new release please? I think that it is something like this, but it do not work:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
    <strict>false</strict>
    <flow-name>FlowInsert1</flow-name>
    <id>1</id>
    <table_id>0</table_id>
    <priority>999</priority>
    <instructions>
        <instruction>
            <order>0</order>
            <apply-actions>
                <action>
                    <order>0</order>
                    <output-action>
                        <output-node-connector>2</output-node-connector>
                    </output-action>
                </action>
            </apply-actions>
        </instruction>
    </instructions>
    <match>
        <in-port>1</in-port>
    </match>
</flow>
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2015-07-01 07:05:05 -0700

runamuck gravatar image

Looks like you have the wrong URL for your PUT.

First off, verify you have the correct node ID.

Second, you will need to use "flow-node-inventory:table" instead of "table"

Step one: go to:

http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/

Enter username: admin, password: admin

At the top of the XML you'll see:

<nodes xmlns="urn:opendaylight:inventory">
    <node>
        <id>openflow:49213347348856</id>
        <description xmlns="urn:opendaylight:flow:inventory">None</description>
        <serial-number xmlns="urn:opendaylight:flow:inventory">None</serial-number>
        <table xmlns="urn:opendaylight:flow:inventory">

Use your openflow ID (Mine is "openflow:49213347348856") in your PUT command: It will be different than the one I use here.

Be sure to use the correct headers in your PUT.

Accept: application/xml
Content-Type: application/xml 
Authorization: Basic YWRtaW46YWRtaW4=

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

A GET to the same URL should show your flow.

edit flag offensive delete publish link more
0

answered 2015-07-01 07:21:05 -0700

Edu gravatar image

Thanks runamuck.

I had chek my node, it is the 1:

<nodes>
  <node>
     <id>openflow:1</id>
     <serial-number>None</serial-number>
     <switch-features>
         <max_tables>254</max_tables>
         <max_buffers>256</max_buffers>
         <x:capabilities>x:flow-feature-capability-flow-stats</x:capabilities>
         <x:capabilities>x:flow-feature-capability-port-stats</x:capabilities>        (...)         <x:capabilities>x:flow-feature-capability-queue-stats</x:capabilities><x:capabilities>x:flow-feature-capability-table-stats</x:capabilities></switch-features><description>None</description><hardware>Open vSwitch</hardware><manufacturer>Nicira, Inc.</manufacturer><software>2.0.2</software>

About your second point, why the "flow-node-inventory:table" instead of "table" if in the end to end flow in the wiki says:

With PostMan:
    Set headers:
        Content-Type: application/xml
        Accept: application/xml
        Authentication
    Use URL: http://<controller IP>:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1
    PUT
    Use Body: (...)

Thank you very much!

edit flag offensive delete publish link more

Comments

I just tried it (changed the NODE ID) and it worked for me, so the syntax looks good. Does it work? If not, did you add the authorization to your PUT? Authorization: Basic YWRtaW46YWRtaW4=

runamuck ( 2015-07-01 07:32:59 -0700 )edit

Thanks runamuck, it works well to install the flow in the config API, but then the flow do not cross to the operational api, so the ovs do not see the flow. I have explained well here: https://ask.opendaylight.org/question/4199/problem-crossing-from-config-to-operational-api/

Edu ( 2015-07-02 00:54:27 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-07-01 02:46:23 -0700

Seen: 254 times

Last updated: Jul 01 '15