Ask Your Question
0

REST API - Flows are replaced on switch [closed]

asked 2015-02-24 07:03:28 -0700

Nuno gravatar image

Hello. I'm trying to send a flow to the switches matching the ipv4 source and destination address. However, when i try to add a flow that allows packets from S1 to S2 and another from S1 to H1 it replaces me the first flow for the last one. On the xml request im changing the flow ID, so why is this happening ? Basically I'm trying to send a packet with a given source and destination IP to a port that i define according to the current topology.

The first XML request:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <flow xmlns="urn:opendaylight:flow:inventory"> <priority>10</priority> <flow-name>S1-S2</flow-name> <match> <ethernet-match> <ethernet-type> <type>2048</type> </ethernet-type> </ethernet-match> <ipv4-source>10.0.0.1/24</ipv4-source> <ipv4-destination>10.0.0.2/24</ipv4-destination> </match> <id>7</id> <table_id>0</table_id> <hard-timeout>0</hard-timeout> <idle-timeout>0</idle-timeout> <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> </flow>

The second XML request:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <flow xmlns="urn:opendaylight:flow:inventory"> <priority>10</priority> <flow-name>S1-H1</flow-name> <match> <ethernet-match> <ethernet-type> <type>2048</type> </ethernet-type> </ethernet-match> <ipv4-source>10.0.0.2/24</ipv4-source> <ipv4-destination>10.0.0.1/24</ipv4-destination> </match> <id>6</id> <table_id>0</table_id> <hard-timeout>0</hard-timeout> <idle-timeout>0</idle-timeout> <instructions> <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>

I'm using mininet and ODL HeliumSr2, both with OF13. Another question, to use <ipv4-source>10.0.0.2/24</ipv4-source> is the same as <ipv4-source>10.0.0.0/24</ipv4-source> ? If yes, how can i match a specific IP, because if i simply use <ipv4-source>10.0.0.2</ipv4-source> the controller throws an exception.

Regards, Nuno B.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Nuno
close date 2015-02-26 09:36:59

Comments

Hello Nuno Could you please let me know the whole CURL command that you used to add a flow? I am trying to do the same, with the command: curl -u usr/pwd -H "Accept: application/xml" -d "body of the new flow entry" The body of the new flow entry is very similar to yours Thanks Kavita

kjain ( 2015-04-29 10:21:08 -0700 )edit

I'm using postman not the command curl. It has to be with a CURL command or postman serves you as well ?

Nuno ( 2015-04-30 03:54:42 -0700 )edit

Thanks Nuno for your response. No, it does not have to be CURL. it is just that I am familiar with CURL, therefore, decided to use it. Seems that postman is better than CURL. I can certainly learn postman. Will try and let you know. Thanks again Kavita

kjain ( 2015-04-30 05:03:54 -0700 )edit

See if this will be handy to you. It was created by myself, I've use it. It's simple but I think that's what you need. It is a collection that contains some REST requests to add, retrieve and delete information. https://www.getpostman.com/collections/544ecfc02660e4324141

Nuno ( 2015-05-01 07:20:17 -0700 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-02-24 11:03:20 -0700

Moderators

Hi Nuno,

I believe ODL will also push the flows to their netmask IE 10.0.0.1/24 and 10.0.0.2/24 are both 10.0.0.0/24. This is cause the the /24 is telling the controller (and the switch) we only care about the first 24 bits of the address. If you only want to single address then you need tell ODL to match on all 32bit of the address like 10.0.0.1/32 and 10.0.0.2/32,

Another example to get the idea across say you want address 10.0.0.1-10.0.0.7 to u can use 10.0.0.0/29 for address 10.1.1.129-255 then you can use 10.1.1.128/25

edit flag offensive delete publish link more

Comments

I just did that 10 minutes ago. And yes it was exactly what was happening. Thank you for the tip too.

Nuno ( 2015-02-24 11:05:58 -0700 )edit

Question Tools

Follow
2 followers

Stats

Asked: 2015-02-24 07:03:28 -0700

Seen: 341 times

Last updated: Feb 24 '15