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

How to push multiple flows to the controller at once

Hi everyone. This problem is driving me nuts: I have an external controller (out-of-band) conneted to a local hypervisor where running Open vSwitch with a vmbr0 bridge.

When I manually add the following flows to Open vSwitch, it works like expected and the switch redirects traffics like a charm:

ovs-ofctl add-flow vmbr0 priority=20000,ip,nw_dst=10.30.5.1,actions=NORMAL (
ovs-ofctl add-flow vmbr0 priority=15000,ip,nw_src=10.30.5.0/24,actions=strip_vlan,output:9

But I want to control the bridges from ODL but I haven't been able to figure out how to send these flows at once to the ODL controller by using postman because if I send the first one it gets stored at CONFIG but when I send the second, then the first one gets deleted and remains only the last one.

This is the way I am sending the flows to this URL: http://controller:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1

FLOW1:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<node xmlns="urn:opendaylight:inventory">
  <id>openflow:1</id>
  <table xmlns="urn:opendaylight:flow:inventory">
    <id>0</id>
    <flow>
    <priority>20000</priority>
    <flow-name>FLOW1</flow-name>
    <match>
        <ethernet-match>
            <ethernet-type>
                <type>2048</type>
            </ethernet-type>
        </ethernet-match>
        <ipv4-destination>10.30.5.1/32</ipv4-destination>
    </match>
    <id>1</id>
    <table_id>0</table_id>
    <instructions>
       <instruction>
           <order>0</order>
           <apply-actions>
               <action>
                   <output-action>
                       <output-node-connector>NORMAL</output-node-connector>
                   </output-action>
                   <order>0</order>
               </action>
           </apply-actions>
       </instruction>
    </instructions>
</flow>
  </table>
  <pass-through xmlns="urn:opendaylight:netconf-node-inventory"/>
</node>

FLOW2:

<?xml version="1.0"?>
<node xmlns="urn:opendaylight:inventory">
  <id>openflow:1</id>
  <table xmlns="urn:opendaylight:flow:inventory">
    <id>0</id>
    <flow>
      <id>2</id>
      <table_id>0</table_id>
      <instructions>
        <instruction>
          <order>0</order>
          <apply-actions>
            <action>
              <order>0</order>
              <strip-vlan-action/>
            </action>
          </apply-actions>
        </instruction>
      </instructions>
      <priority>15000</priority>
      <match>
        <ipv4-source>10.30.5.0/24</ipv4-source>
        <ethernet-match>
          <ethernet-type>
            <type>2048</type>
          </ethernet-type>
        </ethernet-match>
      </match>
      <flow-name>FLOW2</flow-name>
    </flow>
  </table>
  <pass-through xmlns="urn:opendaylight:netconf-node-inventory"/>
</node>

The first flow gets deleted from http://controller:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/

What am I doing wrong?

Thank you very much