The per Flow Entry Counter " Received Bytes " and meter band modification

137 views
Skip to first unread message

Xin Xing

unread,
May 29, 2017, 10:50:07 PM5/29/17
to ofswitch13-users
Hello Luciano,

I am writing for inquiry the Counter of per Flow entry. In the Openflow1.3 white paper, it mentions that Counters of per Flow Entry contains 4 option: "Received Packets (optional)",  "Received Bytes (optional)", "Duration/seconds (Required)" and "Duration/nanoseconds (optional)". So my first question is could I extract these counters of per flow entry in ofswitch13 and how should I do.

The another question is related to meter band. Since I predefine a meter band, then I want to modification this meter, what should I do to modify it? 

Thank you for your time and help.

Best Wishes
Xin

Luciano Jerez Chaves

unread,
May 30, 2017, 11:05:42 AM5/30/17
to ofswitch13-users
Hi Xin,

If you want to query the switch for flow counters, you can use the “stats-flow” dpctl command within the DpctExecute () method to send a message to the switch, and wait for the replay on the proper Handler* (on this case, it would be the HandleMutipartReply). This is pretty similar to the situation described on this other thread: https://groups.google.com/forum/#!topic/ofswitch13-users/6semknjd8YI
When you get the answer, you’ll have to extract all information from the message manually. The struct ofl_msg_multipart_reply_flow will be used on this case. I know that this is not a easy task, but you can look on this file https://github.com/ljerezchaves/ofsoftswitch13/blob/ns3lib/oflib/ofl-messages.h to get more details about this (and many other) structure. 

For understanding how to explore the dpctl commands, there is a simplified documentation on this page: https://github.com/CPqD/ofsoftswitch13/wiki/Dpctl-Documentation. However, my experience says that the best way to understand all supported commands and its parameters is exploring the dpctl source code at https://github.com/ljerezchaves/ofsoftswitch13/blob/ns3lib/utilities/dpctl.h and https://github.com/ljerezchaves/ofsoftswitch13/blob/ns3lib/utilities/dpctl.c.

Finally, about the meter band: I believe that you can use the meter-mod command to update an existing meter entry (using the cmd=mod option instead of cmd=add). Again, I’m not completelly sure about the syntax and I’d go for the dpctl source code to get it right.

Cheers,
Luciano

--
You received this message because you are subscribed to the Google Groups "ofswitch13-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-use...@googlegroups.com.
To post to this group, send email to ofswitch...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ofswitch13-users/bf9be900-2624-469f-ad7a-e7a3a14577e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Xin Xing

unread,
May 30, 2017, 12:37:31 PM5/30/17
to ofswitch13-users
Hello Luciano,

I appreciate your time and help. Your reply and information shared are pretty important to me. 

Best wishes,
Xin

在 2017年5月30日星期二 UTC-5上午10:05:42,Luciano Jerez Chaves写道:

Xin Xing

unread,
May 31, 2017, 10:29:45 AM5/31/17
to ofswitch13-users
Hi Luciano,

May I ask you another question. In the ofswitch13 controller. For example, your QosController, it contains many function, one is called HandleConnectionrequest function. Based on my understanding, we use this function to automatically setup the flow rules for new coming TCP packets. But you have created another function call Handshakesuccessful, which configures each connected switch. This Handshakesuccessful only be written, but never be called. So what's the purpose of this function.  

Thank you for your time and help.

Best wishes
Xin

在 2017年5月30日星期二 UTC-5上午11:37:31,Xin Xing写道:

Luciano Jerez Chaves

unread,
May 31, 2017, 3:07:03 PM5/31/17
to ofswitch...@googlegroups.com
Hi Xin,

You are right about these functions. The HandleConnectionRequest is called every time a new TCP connection is stablished. This will install rules for this traffic flow on switches.
The HandshakeSuccessful is invoked after a successful handshake procedure between the controller and the remote switch. As you can see on the API documentation (http://www.lrc.ic.unicamp.br/ofswitch13/doc/html/classns3_1_1_o_f_switch13_controller.html#a490572bdfe3e73aa9386394178f1cc29), this HandshakeSuccessful is a protected virtual member function from the OFSwitch13Controller class that has been overwritten by the QoS controller. That’s why you are not finding the place where this method is invoked.

[]’s
--
Luciano Jerez Chaves
Assistant Professor at DCC/UFJF
PhD candidate at LRC/UNICAMP
http://www.lrc.ic.unicamp.br/~luciano

Xin Xing

unread,
May 31, 2017, 3:27:49 PM5/31/17
to ofswitch13-users
Hi Luciano,

Thank you very much for your time and help. Now, I am struggling with the controller design, so I have tons of questions about ofswitch13 controller.

Thank you for your patience and time again. :P

Best wishes,
Xin

在 2017年5月31日星期三 UTC-5下午2:07:03,Luciano Jerez Chaves写道:
To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-users+unsub...@googlegroups.com.

Xin Xing

unread,
Jun 4, 2017, 5:41:36 PM6/4/17
to ofswitch13-users
Hello Luciano,
For your Qoscontroller, you wrote the Handsharksuccessful funtion, and for the switch configuration option, you manually set each switch the in_port and out_port. So my question is for the switch port, could I make each switch in_port and out_port manually? Which rule should I follow to set the switch ports.

And another question is related to my previous question, for the stats-flow information. The reply should be a struct ofl_msg_multipart_reply_flow. When I dig in for more details, the valuable thing for me is the struct ofl_flow_stats which is a part belonged to ofl_msg_multipart_reply_flow. However, this struct doesn't contain the flow src_IP and dst_IP information. Or, these information are contained by the struct ofl_match_header, which is a part of ofl_flow_stats. Do I understand it correctly? 
The following is the correspond structure I mentioned above:
struct ofl_flow_stats {
uint8_t table_id; /* ID of table flow came from. */
uint32_t duration_sec; /* Time flow has been alive in secs. */
uint32_t duration_nsec; /* Time flow has been alive in nsecs
beyond duration_sec. */
uint16_t priority; /* Priority of the entry. Only meaningful
when this is not an exact-match entry. */
uint16_t idle_timeout; /* Number of seconds idle before
expiration. */
uint16_t hard_timeout; /* Number of seconds before expiration. */
uint16_t flags; /* One of OFPFF_*/
uint64_t cookie; /* Opaque controller-issued identifier. */
uint64_t packet_count; /* Number of packets in flow. */
uint64_t byte_count; /* Number of bytes in flow. */
struct ofl_match_header *match; /* Description of fields. */
size_t instructions_num;
struct ofl_instruction_header **instructions; /* Instruction set. */
};
struct ofl_msg_multipart_reply_flow {
struct ofl_msg_multipart_reply_header header; /* OFPMP_FLOW */
size_t stats_num;
struct ofl_flow_stats **stats;
};
Thank you for time and help.

Best wishes,
Xin 


在 2017年5月31日星期三 UTC-5下午2:07:03,Luciano Jerez Chaves写道:
To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-users+unsub...@googlegroups.com.

Luciano Jerez Chaves

unread,
Jun 5, 2017, 12:42:52 PM6/5/17
to ofswitch...@googlegroups.com
Hi :)

On 4 Jun 2017, at 18:41, Xin Xing <hannib...@gmail.com> wrote:

Hello Luciano,
For your Qoscontroller, you wrote the Handsharksuccessful funtion, and for the switch configuration option, you manually set each switch the in_port and out_port. So my question is for the switch port, could I make each switch in_port and out_port manually? Which rule should I follow to set the switch ports.

I’m not sure if I got your question, but I’ve manually set the in_port and out_port because I know, a priori, the port numbers for each connection. There’s no general rule for port numbers, because it dependes on the order you add ports to the switch on your simulation script. Every time a new port is added to the switch (using the AddSwitchPort ()), the port gets a new integer value, starting at 1. You can query the port object for its number (OFSwitch13Port::GetPortNo ()).


And another question is related to my previous question, for the stats-flow information. The reply should be a struct ofl_msg_multipart_reply_flow. When I dig in for more details, the valuable thing for me is the struct ofl_flow_stats which is a part belonged to ofl_msg_multipart_reply_flow. However, this struct doesn't contain the flow src_IP and dst_IP information. Or, these information are contained by the struct ofl_match_header, which is a part of ofl_flow_stats. Do I understand it correctly? 

Yeah, you’re right. The src_ip and dst_ip are saved withing the struct ofl_match_header. In fact, this match struct hold a collection of all OpenFlow OXM* fields. These are the filed you can use to match a packet. You can use the QosController:ExtractIpv4Address () to retrieve the desired IPv4 address from the match struct.
Cheers,
Luciano.

Message has been deleted

Luciano Jerez Chaves

unread,
Jun 14, 2017, 12:57:48 PM6/14/17
to ofswitch...@googlegroups.com
Hi,

Yeah, it means that waf can’f find your source code.

The general rule is: every cc file you place in the scratch directory will be compiled as a new scenario. For instance, a file scratch/hello.cc can be run using ./waf --run hello. Note that each file must have its main function, otherwise it won’t work. If you scenario requires more than one file, create a new directory under scratch folder and place all your files whithin it. Note, a single file must have the main, and use the directory name to run this scenario.

So, copy the ofswitch13-qos-controller folder to the scratch diretory to run it (if you have enable examples during ns-3 compilation you don’t need to copy because it was already compiled from its original place). In the case of your controller, follow the same logic.
 
--
Luciano Jerez Chaves
Assistant Professor at DCC/UFJF
PhD candidate at LRC/UNICAMP
http://www.lrc.ic.unicamp.br/~luciano

On 13 Jun 2017, at 16:00, Xin Xing <hannib...@gmail.com> wrote:





Hello Luciano,

First thank you for your patience and help.

I want to write a controller called "Mycontroller" based on your Qoscontroller and Ofswitch13Controller. However, when I compile it with my mainscript, it shows following error:
 

I think it means that the script can not find myController. So what shall I do? 

And another question is for your Qoscontroller example, how could I run it ? I copy them into ns3.26 "scratch" folder, then run it, which shows error.

The attachment is my .cc and .h script.

Thank you for your time and help.
 

在 2017年6月5日星期一 UTC-5上午11:42:52,Luciano Jerez Chaves写道:
Hi :)

To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-users+unsubscribe...@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "ofswitch13-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-users+unsub...@googlegroups.com.
To post to this group, send email to ofswitch...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "ofswitch13-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-use...@googlegroups.com.
To post to this group, send email to ofswitch...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
<my-controller.cc><my-controller.h>

Xin Xing

unread,
Jun 14, 2017, 1:12:22 PM6/14/17
to ofswitch13-users
Hi Luciano,

Thank you for your reply. I run your Qos-controller correctly. In fact, another thread asked you the same question, I miss it. I am sorry for repeated question.

My problem is following: I don't run my script under ns-3.26, in fact, I run it under ns3-dce. Because I need to combine ns3.26 with MPTCP under Linux-kernel in my project. If I install the controller say Ofswitch13-controller  or Ofswitch13learningController in my mainscript, it could work. But, when I run self-defined controll MyController, It can not find the source. Do you have any suggestion for how to compile and run this. 

Thank you for time and help.
Best wishes,
Xin


在 2017年6月14日星期三 UTC-5上午11:57:48,Luciano Jerez Chaves写道:

Luciano Jerez Chaves

unread,
Jun 16, 2017, 10:32:36 AM6/16/17
to ofswitch13-users
Hi Xin,

Unfurtunatelly, I’ve never used ns-3 with DCE, so I don’t know what are the differences between them with respect to the waf.
I’m not an expert on how waf works internally, maybe you can find some help on ns-3 users list.
Cheers,

--
Luciano 

Xin Xing

unread,
Jun 29, 2017, 2:17:32 PM6/29/17
to ofswitch13-users
Hi Luciano,

Sorry for my later reply. Thank you for your time and help, anyway. I found that what I need to do is modify the wscript, then it would work.

Best wishes,
Xin Xing

在 2017年6月16日星期五 UTC-5上午9:32:36,Luciano Jerez Chaves写道:
Hi :)


-- 
You received this message because you are subscribed to the Google Groups "ofswitch13-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-use...@googlegroups.com.
To post to this group, send email to ofswitch...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ofswitch13-users/0d76808e-b971-41c8-8c94-5abf9e57801b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<my-controller.cc><my-controller.h>

-- 
You received this message because you are subscribed to the Google Groups "ofswitch13-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ofswitch13-users+unsub...@googlegroups.com.
To post to this group, send email to ofswitch...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages