Comments (7)
After fixing ofp_flow_stats response message when I run delete all flows scenario introduced in this commit: 806e95a
I see such results:
- After adding two flows and before deleting them, ofp_flow_stats returns:
Openflow Protocol
Header
Version: 0x04
Type: Multipart reply (CSM) - OFPT_MULTIPART_REPLY (19)
Length: 240
Transaction ID: 4062250353
Multipart reply
Type: Individual flow statistics - OFPMP_FLOW (1)
Flags: 0x0000
.... .... .... ...0 = More replies to follow: Not set
Padding
Individual Flow Stats
Length: 112
Table ID: 0
Padding
Duration (sec): 0
Duration (nsec): 202135000
Priority: 1
Idle Timeout: 0
Hard Timeout: 0
Flags: 0x0000
0000 0000 0000 0... = Reserved: Not set
.... .... .... ...0 = Send flow removed message when flow expires or is deleted: Not set
.... .... .... ..0. = Check for overlapping entries first: Not set
.... .... .... .0.. = Reset flow packet and byte counts: Not set
Padding
Cookie: 0x0000000000000000
Packet count: 0
Byte count: 0
Match
Type: OpenFlow Extensible Match - OFPMT_OXM (0x0001)
Length: 23
OXM field
Class: Basic class for OpenFlow - OFPXMC_OPENFLOW_BASIC (0x8000)
0000 101. = Field: Ethernet frame type - OFPXMT_OFB_ETH_TYPE (0x05)
0 = Has mask: No
Length: 2
Value: 0800
OXM field
Class: Basic class for OpenFlow - OFPXMC_OPENFLOW_BASIC (0x8000)
0001 010. = Field: IP protocol - OFPXMT_OFB_IP_PROTO (0x0a)
0 = Has mask: No
Length: 1
Value: 06
OXM field
Class: Basic class for OpenFlow - OFPXMC_OPENFLOW_BASIC (0x8000)
0001 011. = Field: IPv4 source address - OFPXMT_OFB_IPV4_SRC (0x0b)
0 = Has mask: No
Length: 4
Value: 192.168.0.79 (192.168.0.79)
Padding
Instruction
Type: Applies the action(s) immediately - OFPIT_APPLY_ACTIONS (0x0004)
Length: 40
Padding
Action
Type: Set a header field using OXM TLV format - OFPAT_SET_FIELD (0x0019)
Length: 16
OXM field
Class: Basic class for OpenFlow - OFPXMC_OPENFLOW_BASIC (0x8000)
0001 110. = Field: TCP destination port - OFPXMT_OFB_TCP_DST (0x0e)
0 = Has mask: No
Length: 2
Value: 1f2b
Padding
Action
Type: Output to switch port - OFPAT_OUTPUT (0x0000)
Length: 16
Port: 2
Max Length: 65535
Padding
Individual Flow Stats
Length: 112
Table ID: 0
Padding
Duration (sec): 0
Duration (nsec): 405510000
Priority: 1
Idle Timeout: 0
Hard Timeout: 0
Flags: 0x0000
0000 0000 0000 0... = Reserved: Not set
.... .... .... ...0 = Send flow removed message when flow expires or is deleted: Not set
.... .... .... ..0. = Check for overlapping entries first: Not set
.... .... .... .0.. = Reset flow packet and byte counts: Not set
Padding
Cookie: 0x0000000000000000
Packet count: 0
Byte count: 0
Match
Type: OpenFlow Extensible Match - OFPMT_OXM (0x0001)
Length: 18
OXM field
Class: Basic class for OpenFlow - OFPXMC_OPENFLOW_BASIC (0x8000)
0000 101. = Field: Ethernet frame type - OFPXMT_OFB_ETH_TYPE (0x05)
0 = Has mask: No
Length: 2
Value: 0800
OXM field
Class: Basic class for OpenFlow - OFPXMC_OPENFLOW_BASIC (0x8000)
0001 011. = Field: IPv4 source address - OFPXMT_OFB_IPV4_SRC (0x0b)
0 = Has mask: No
Length: 4
Value: 192.168.0.68 (192.168.0.68)
Padding
Instruction
Type: Applies the action(s) immediately - OFPIT_APPLY_ACTIONS (0x0004)
Length: 40
Padding
Action
Type: Set a header field using OXM TLV format - OFPAT_SET_FIELD (0x0019)
Length: 16
OXM field
Class: Basic class for OpenFlow - OFPXMC_OPENFLOW_BASIC (0x8000)
0001 100. = Field: IPv4 destination address - OFPXMT_OFB_IPV4_DST (0x0c)
0 = Has mask: No
Length: 4
Value: 10.0.0.68 (10.0.0.68)
Padding
Action
Type: Output to switch port - OFPAT_OUTPUT (0x0000)
Length: 16
Port: 2
Max Length: 65535
Padding
Flow mod that deletes all flows:
Openflow Protocol
Header
Version: 0x04
Type: Flow mod (CSM) - OFPT_FLOW_MOD (14)
Length: 56
Transaction ID: 2153886217
Flow Mod
Cookie: 0x0000000000000000
Cookie Mask: 0x0000000000000000
Table ID: 255
Command: Delete all matching flows - OFPFC_DELETE (0x03)
Idle Timeout: 0
Hard Timeout: 0
Priority: 0
Buffer ID: 0xffffffff
Output Port: 4294967295
Output Group: 4294967295
Flags: 0x0000
0000 0000 0000 0... = Reserved: Not set
.... .... .... ...0 = Send flow removed message when flow expires or is deleted: Not set
.... .... .... ..0. = Check for overlapping entries first: Not set
.... .... .... .0.. = Reset flow packet and byte counts: Not set
Padding
Match
Type: OpenFlow Extensible Match - OFPMT_OXM (0x0001)
Length: 4
Padding
Flow stats response after deletion of all flows:
Openflow Protocol
Header
Version: 0x04
Type: Multipart reply (CSM) - OFPT_MULTIPART_REPLY (19)
Length: 16
Transaction ID: 1337138230
Multipart reply
Type: Individual flow statistics - OFPMP_FLOW (1)
Flags: 0x0000
.... .... .... ...0 = More replies to follow: Not set
Padding
@mihailtudoran Can you confirm that it behaves the same for your controller?
from linc-switch.
I still can't remove all flows with my controller, I think it is a problem on the match_field length:
The flow_mod my controller send have a match_field length of 8:
Openflow Protocol
Header
Flow Mod
Cookie: 0x0000000000000000
Cookie Mask: 0x0000000000000000
Table ID: 255
Command: Delete all matching flows - OFPFC_DELETE (0x03)
Idle Timeout: 0
Hard Timeout: 0
Priority: 32768
Buffer ID: 0xffffffff
Output Port: 4294967295
Output Group: 4294967295
Flags: 0x0000
Padding
Match
Type: OpenFlow Extensible Match - OFPMT_OXM (0x0001)
Length: 8
Padding
Your test scenario flow_mod have a match_field length of 4:
Openflow Protocol
Header
Flow Mod
Cookie: 0x0000000000000000
Cookie Mask: 0x0000000000000000
Table ID: 255
Command: Delete all matching flows - OFPFC_DELETE (0x03)
Idle Timeout: 0
Hard Timeout: 0
Priority: 0
Buffer ID: 0xffffffff
Output Port: 4294967295
Output Group: 4294967295
Flags: 0x0000
Padding
Match
Type: OpenFlow Extensible Match - OFPMT_OXM (0x0001)
Length: 4
Padding
According to OF1.3 spec the match_field length should be 8.
Regarding the flow_stats_request it works now.
from linc-switch.
You are right that total lenght of encoded ofp_match structure without any match fields will be 8 bytes, but the value of field length
in this structure will be 4 bytes.
According to OFP 1.3 and 1.3.1 specs:
/* Fields to match against flows */
struct ofp_match {
uint16_t type; /* One of OFPMT_* */
uint16_t length; /* Length of ofp_match (excluding padding) */
/* Followed by:
* - Exactly (length - 4) (possibly 0) bytes containing OXM TLVs, then
* - Exactly ((length + 7)/8*8 - length) (between 0 and 7) bytes of
* all-zero bytes
* In summary, ofp_match is padded as needed, to make its overall size
* a multiple of 8, to preserve alignement in structures using it.
*/
uint8_t oxm_fields[4]; /* OXMs start here - Make compiler happy */
};
OFP_ASSERT(sizeof(struct ofp_match) == 8);
According to spec field lenght
is calculated without padding. When match is empty lenght
value is 4 and we have:
* - Exactly (length - 4) (possibly 0) bytes containing OXM TLVs, then\
0 bytes of OXM TLVs (this is correct, we don't have any match fields)
and
* - Exactly ((length + 7)/8*8 - length) (between 0 and 7) bytes of
(4+7)/8 is rounded to 1, multiplied by 8 gives 8 and when lenght is substracted this gives us padding of size 4. Hence overall size of ofp_match is 8 bytes.
from linc-switch.
Correct, I fixed my flow_mod, now the messages are identical but I did not manage to remove the flows, the switch seems to ignore the command.
Sending the flow_mod from your controller ( of_controller_v4.erl ) is working correctly but sending the exact same flow_mod from my controller it doesn't work. With my controller I am able to insert new flows, this is not a connection issue.
How could I enable debugging mode on the switch ? It will help me a lot to see how the messages are processed this way I could identify the problem faster.
Thanks !
from linc-switch.
First of all you can increase loglevel by editing file rel/files/sys.config
and changing:
{lager_console_backend, info},
to
{lager_console_backend, debug},
You have to rebuild switch by running make
afterwards.
Please run LINC switch with console attached by: rel/linc/bin/linc console
As an effect you should see packets received by the switch like this:
13:25:07.796 [debug] Received message from the controller: {ofp_message,4,flow_mod,1905181425,{ofp_flow_mod,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,0,add,0,0,1,no_buffer,any,any,[],{ofp_match,[{ofp_field,openflow_basic,eth_type,false,<<8,0>>,undefined},{ofp_field,openflow_basic,ipv4_src,false,<<192,168,0,68>>,undefined}]},[{ofp_instruction_apply_actions,2,[{ofp_action_set_field,13,{ofp_field,openflow_basic,ipv4_dst,false,<<10,0,0,68>>,undefined}},{ofp_action_output,16,2,65535}]}]}}
13:25:07.997 [debug] Received message from the controller: {ofp_message,4,flow_mod,3105434037,{ofp_flow_mod,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,0,add,0,0,1,no_buffer,any,any,[],{ofp_match,[{ofp_field,openflow_basic,eth_type,false,<<8,0>>,undefined},{ofp_field,openflow_basic,ip_proto,false,<<6>>,undefined},{ofp_field,openflow_basic,ipv4_src,false,<<192,168,0,79>>,undefined}]},[{ofp_instruction_apply_actions,2,[{ofp_action_set_field,13,{ofp_field,openflow_basic,tcp_dst,false,<<31,43>>,undefined}},{ofp_action_output,16,2,65535}]}]}}
13:25:08.199 [debug] Received message from the controller: {ofp_message,4,multipart_request,4062250353,{ofp_flow_stats_request,[],all,any,any,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,{ofp_match,[]}}}
13:25:08.400 [debug] Received message from the controller: {ofp_message,4,flow_mod,2153886217,{ofp_flow_mod,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,all,delete,0,0,0,no_buffer,any,any,[],{ofp_match,[]},[]}}
above you have two flow mods, one flow stats request and final flow mod that deletes all flows.
Please make sure that switch does not report any errors when processing your OFP messages.
You can inspect flow tables installed on the switch by running from the console:
linc_us4_flow:get_flow_table(0, 0).
First zero indicates logical switch number, second zero indicates flow table number.
For example when you have two flow mods installed by my scenario(delete_all_flows)
from of_controller_v4.erl
you will see (before they are deleted of course :)
(linc@riesling)2> linc_us4_flow:get_flow_table(0,0).
[{flow_entry,{1,#Ref<0.0.0.613>},
1,
{ofp_match,[{ofp_field,openflow_basic,eth_type,false,
<<8,0>>,
undefined},
{ofp_field,openflow_basic,ip_proto,false,<<6>>,undefined},
{ofp_field,openflow_basic,ipv4_src,false,
<<192,168,0,79>>,
undefined}]},
<<0,0,0,0,0,0,0,0>>,
[],
{1369,222749,847996},
{infinity,0,0},
{infinity,0,0},
[{ofp_instruction_apply_actions,2,
[{ofp_action_set_field,13,
{ofp_field,openflow_basic,tcp_dst,false,
<<31,43>>,
undefined}},
{ofp_action_output,16,2,65535}]}]},
{flow_entry,{1,#Ref<0.0.0.610>},
1,
{ofp_match,[{ofp_field,openflow_basic,eth_type,false,
<<8,0>>,
undefined},
{ofp_field,openflow_basic,ipv4_src,false,
<<192,168,0,68>>,
undefined}]},
<<0,0,0,0,0,0,0,0>>,
[],
{1369,222749,647322},
{infinity,0,0},
{infinity,0,0},
[{ofp_instruction_apply_actions,2,
[{ofp_action_set_field,13,
{ofp_field,openflow_basic,ipv4_dst,false,
<<10,0,0,68>>,
undefined}},
{ofp_action_output,16,2,65535}]}]}]
After sending flow mod that deletes all flows you shall see empty list:
(linc@riesling)3> linc_us4_flow:get_flow_table(0,0).
[]
Last but not least thing is tracing. You can set up a dynamic tracer, to show you what functions are executed on the live environment.
We are interested with function linc_us4_flow:delete_matching_flows/7
. You can enable tracer by pasting this lines into LINC console:
dbg:tracer().
dbg:p(all,c).
dbg:tpl(linc_us4_flow, delete_matching_flows, x).
as an effect, when switch receives flow mod that should delete flows, you will see this function calls printed on the console.
Hope this can help you debug this issue.
from linc-switch.
I can confirm this issue is fixed. I identified a problem on my side, on the last padding ( match padding ).
Thank you!
from linc-switch.
Great news! I'm closing this issue then.
Thanks for your effort and feedback.
from linc-switch.
Related Issues (20)
- LINC-OE: Traffic is not going through due to some updates in LINC HOT 10
- linc:start/stop(switchId). not working... HOT 5
- LINC-Switch build fails on NFS (or other) file system without setuid/setcap permission HOT 1
- no function clause matching xmerl_lib:expand_element HOT 1
- Missing links in Linc OE documentation HOT 1
- CRASH REPORT Process <> with 0 neighbours exited with reason: call to undefined function application HOT 2
- Error while building: Unable to generate spec HOT 1
- Application version clash for goldrush HOT 3
- Using optical extensions in Mininet HOT 9
- Can the USB-to-RJ45 work well in the LINC-Switch in a PC? HOT 3
- LINC switch sent a malformed OpenFlow packet
- Do I need to set the ip_forward? HOT 2
- OTP release 18 does not match required regex R1[56]|17 HOT 4
- How can I monitor linc application by observer:start().
- problem with LINC integration with Mininet HOT 1
- Mininet with LINC
- Failed to compile in the erlang otp18
- linc config generator error
- ERROR: OTP release 22 does not match required regex R1[56]B|17 HOT 1
- Erlang Version Required Too Old
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linc-switch.