Network of Openflow switches with single controller,

647 views
Skip to first unread message

Nitin

unread,
Oct 31, 2011, 11:05:31 AM10/31/11
to ns-3-users
Hello NS3 users,

I was trying to model a network of openflow switches which will be
controlled by a single controller. I tried it with a model where only
2 switches are connected to a single controller with Onoff application
running at the nodes.
When I connect the switches with individual controllers, it works
fine. But when i connect to a single controller the process goes into
a infinite loop.
So i was wondering, its a implementation bug or if I need to do
something to ensure the desired functionality.

Best Regards
Nitin

Lalith Suresh

unread,
Oct 31, 2011, 6:04:46 PM10/31/11
to ns-3-...@googlegroups.com
I'm not familiar with ns-3-openflow, and I don't see any such limitation being mentioned in the documentation, so I'd be inclined to think it's a bug.

Have you tried enabling NS_LOG=OpenFlowSwitchNetDevice (and so forth) to try and pin down the problem? If you're sure its a bug and are able to reproduce the problem, do file a bug report at www.nsnam.org/bugzilla.
 
Best Regards
Nitin

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Lalith Suresh

Nitin

unread,
Nov 2, 2011, 5:00:42 AM11/2/11
to ns-3-users
HI Lalith,

Thank you for the response. I have enabled the logs, and what i see is
I can create the switch configurations with a single controller.
However, when the simulation is executed is goes into a infinite loop,
where the controller just keeps forwarding the broadcast packet.

Regards
Nitin

On Oct 31, 11:04 pm, Lalith Suresh <suresh.lal...@gmail.com> wrote:

Nitin

unread,
Nov 2, 2011, 9:46:05 AM11/2/11
to ns-3-users
Just as a reference posting my code which is a modification of the
given openflow example.. it works fine with two controllers but fails
with single controller

#include <iostream>
#include <fstream>

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/applications-module.h"
#include "ns3/openflow-module.h"
#include "ns3/log.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("OpenFlowCsmaSwitchExample");

bool verbose = false;
bool use_drop = false;
ns3::Time timeout = ns3::Seconds (0);

bool
SetVerbose (std::string value)
{
verbose = true;
return true;
}

bool
SetDrop (std::string value)
{
use_drop = true;
return true;
}

bool
SetTimeout (std::string value)
{
try {
timeout = ns3::Seconds (atof (value.c_str ()));
return true;
}
catch (...) { return false; }
return false;
}

int
main (int argc, char *argv[])
{
#ifdef NS3_OPENFLOW
//
// Allow the user to override any of the defaults and the above
Bind() at
// run-time, via command-line arguments
//
CommandLine cmd;
cmd.AddValue ("v", "Verbose (turns on logging).", MakeCallback
(&SetVerbose));
cmd.AddValue ("verbose", "Verbose (turns on logging).", MakeCallback
(&SetVerbose));
cmd.AddValue ("d", "Use Drop Controller (Learning if not
specified).", MakeCallback (&SetDrop));
cmd.AddValue ("drop", "Use Drop Controller (Learning if not
specified).", MakeCallback (&SetDrop));
cmd.AddValue ("t", "Learning Controller Timeout (has no effect if
drop controller is specified).", MakeCallback ( &SetTimeout));
cmd.AddValue ("timeout", "Learning Controller Timeout (has no effect
if drop controller is specified).", MakeCallback ( &SetTimeout));

cmd.Parse (argc, argv);

if (verbose)
{
LogComponentEnable ("OpenFlowCsmaSwitchExample",
LOG_LEVEL_INFO);
LogComponentEnable ("OpenFlowInterface", LOG_LEVEL_INFO);
LogComponentEnable ("OpenFlowSwitchNetDevice", LOG_LEVEL_INFO);
}

//
// Explicitly create the nodes required by the topology (shown
above).
//
NS_LOG_INFO ("Create nodes.");
NodeContainer terminals;
terminals.Create (2);

NodeContainer csmaSwitch;
csmaSwitch.Create (2);

NS_LOG_INFO ("Build Topology");
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));

// Create the csma links, from each terminal to the switch
NetDeviceContainer terminalDevicesTp,terminalDevicesBt;
NetDeviceContainer switchDevicesTp,switchDevicesBt;
NetDeviceContainer link = csma.Install (NodeContainer (terminals.Get
(0), csmaSwitch.Get (0)));
terminalDevicesTp.Add (link.Get (0));
switchDevicesTp.Add (link.Get (1));

NetDeviceContainer link1 = csma.Install (NodeContainer
(terminals.Get (1), csmaSwitch.Get (1)));
terminalDevicesBt.Add (link1.Get (0));
switchDevicesBt.Add (link1.Get (1));

NetDeviceContainer link2 = csma.Install (NodeContainer
(csmaSwitch.Get (0), csmaSwitch.Get (1)));
switchDevicesTp.Add (link2.Get (0));
switchDevicesBt.Add (link2.Get (1));

// Create the switch netdevice, which will do the packet switching
Ptr<Node> switchNode1 = csmaSwitch.Get (0);
Ptr<Node> switchNode2 = csmaSwitch.Get (1);
OpenFlowSwitchHelper swtch;

Ptr<ns3::ofi::LearningController> controller1 =
CreateObject<ns3::ofi::LearningController> ();
if (!timeout.IsZero ()) controller1->SetAttribute ("ExpirationTime",
TimeValue (timeout));
swtch.Install (switchNode1, switchDevicesTp, controller1);
swtch.Install (switchNode2, switchDevicesBt, controller1);

//Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Add internet stack to the terminals
InternetStackHelper internet;
internet.Install (terminals);

// We've got the "hardware" in place. Now we need to add IP
addresses.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
ipv4.Assign (terminalDevicesTp);

ipv4.Assign (terminalDevicesBt);

// Create an OnOff application to send UDP datagrams from n0 to n1.
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)

OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address
("10.1.1.2"), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable
(1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable
(0)));

ApplicationContainer app = onoff.Install (terminals.Get (0));
// Start the application
app.Start (Seconds (1.0));
app.Stop (Seconds (1.1));

// Create an optional packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress
(Ipv4Address::GetAny (), port)));
app = sink.Install (terminals.Get (1));
app.Start (Seconds (0.0));


//
// Configure tracing of all enqueue, dequeue, and NetDevice receive
events.
// Trace output will be sent to the file "openflow-switch.tr"
//
AsciiTraceHelper ascii;
csma.EnableAsciiAll (ascii.CreateFileStream ("openflow-switch.tr"));

//
// Also configure some tcpdump traces; each interface will be
traced.
// The output files will be named:
// openflow-switch-<nodeId>-<interfaceId>.pcap
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
//
csma.EnablePcapAll ("openflow-switch", false);

//
// Now, do the actual simulation.
//
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
#else
NS_LOG_INFO ("NS-3 OpenFlow is not enabled. Cannot run
simulation.");
#endif // NS3_OPENFLOW

msolima3

unread,
Jun 29, 2012, 3:06:32 PM6/29/12
to ns-3-...@googlegroups.com
Hi Nitin,

I see that this post is a old, but I'm running into the exact same problem.
Did you manage to find any solution for it ?
Or you moved on to another simulation approach, if so please advise me because I'm trying to simulate an OPenFlow network as well and running into the same problem.

Thanks

Ishaan Bir Singh

unread,
Oct 28, 2012, 1:43:24 PM10/28/12
to ns-3-...@googlegroups.com
Hi, Nitin, Lalith and msolima3,

Even I am trying to achieve the same topology (single controller controlling multiple switches). Would greatly appreciate if you could share your experiences trying/achieving this. 

Thanks,

Ishaan Bir Singh

Research Intern
Ericsson Research

劉耕含

unread,
Nov 10, 2012, 2:09:43 AM11/10/12
to ns-3-...@googlegroups.com
Hi, I also encountered the problem of single controller with multiple switches.
The problem description is the DNS request can't find the target.
Did any one have the same problem?

BR,
Gordon

Ishaan Bir Singh於 2012年10月29日星期一UTC+8上午1時43分25秒寫道:

Dongsoo Kim

unread,
Jan 19, 2015, 1:26:47 AM1/19/15
to ns-3-...@googlegroups.com, nitinm...@gmail.com
I believe this problem is caused by the incomplete implementation of DropController and LearningController.  Both controllers process and handle only OFPT_PACKET_IN packet type.  But, if two switches are connected, they must learn each other by using other OF control packet such as OFPT_PORT_STATUS which is ignored by the controllers.  





Reply all
Reply to author
Forward
0 new messages