A Discrete-Event Network Simulator
API
ofswitch13-helper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 University of Campinas (Unicamp)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Luciano Jerez Chaves <ljerezchaves@gmail.com>
18  */
19 
20 #ifndef OFSWITCH13_HELPER_H
21 #define OFSWITCH13_HELPER_H
22 
23 #include <ns3/application-container.h>
24 #include <ns3/csma-helper.h>
25 #include <ns3/inet-socket-address.h>
26 #include <ns3/internet-stack-helper.h>
27 #include <ns3/ipv4-address-helper.h>
28 #include <ns3/ipv4-interface-container.h>
29 #include <ns3/names.h>
30 #include <ns3/node-container.h>
31 #include <ns3/object-factory.h>
32 #include <ns3/ofswitch13-controller.h>
33 #include <ns3/ofswitch13-device-container.h>
34 #include <ns3/ofswitch13-device.h>
35 #include <ns3/ofswitch13-interface.h>
36 #include <ns3/point-to-point-helper.h>
37 #include <ns3/simple-ref-count.h>
38 
39 #include <string>
40 
41 namespace ns3
42 {
43 
44 class Node;
45 class AttributeValue;
46 class OFSwitch13Controller;
47 class OFSwitch13LearningController;
48 
72 class OFSwitch13Helper : public Object
73 {
74  public:
80  {
81  SINGLECSMA = 0,
83  DEDICATEDP2P = 2
84  };
85 
87  ~OFSwitch13Helper() override;
88 
93  static TypeId GetTypeId();
94 
101  void SetDeviceAttribute(std::string n1, const AttributeValue& v1);
102 
110 
117  virtual void SetChannelDataRate(DataRate rate);
118 
127  void EnableOpenFlowPcap(std::string prefix = "ofchannel",
128  bool promiscuous = true);
129 
137  void EnableOpenFlowAscii(std::string prefix = "ofchannel");
138 
149  void EnableDatapathStats(std::string prefix = "datapath",
150  bool useNodeNames = false);
151 
163  NetDeviceContainer& swPorts);
164 
174 
184 
192  virtual void CreateOpenFlowChannels() = 0;
193 
205  static void SetAddressBase(Ipv4Address network,
206  Ipv4Mask mask,
207  Ipv4Address base = "0.0.0.1");
208 
217  static void EnableDatapathLogs(std::string prefix = "",
218  bool explicitFilename = false);
219 
220  protected:
222  void DoDispose() override;
223 
227  bool m_blocked;
228 
232 
236 
238 };
239 
240 } // namespace ns3
241 #endif /* OFSWITCH1_CONTROLLER_HELPER_H */
Hold a value for an Attribute.
Definition: attribute.h:70
build a set of CsmaNetDevice objects
Definition: csma-helper.h:48
Class for representing data rates.
Definition: data-rate.h:90
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:258
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Holds a vector of ns3::OFSwitch13Device pointers.
This is a base class that must be extended to create and configure an OpenFlow 1.3 network domain com...
static void EnableDatapathLogs(std::string prefix="", bool explicitFilename=false)
Enable OpenFlow datapath logs at all OpenFlow switch devices on the simulation.
InternetStackHelper m_internet
Helper for TCP/IP stack.
void EnableOpenFlowPcap(std::string prefix="ofchannel", bool promiscuous=true)
Enable pacp traces at OpenFlow channel between controller and switches.
Ptr< OFSwitch13Device > InstallSwitch(Ptr< Node > swNode)
This method creates an OpenFlow device and aggregates it to the switch node.
static void SetAddressBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the IP network base address, used to assign IP addresses to switches and controllers during the C...
DataRate m_channelDataRate
OF channel data rate.
ObjectFactory m_devFactory
OF device factory.
ChannelType
OpenFlow channel type, used to create the connections.
@ DEDICATEDP2P
Uses individual P2P channels.
@ DEDICATEDCSMA
Uses individual CSMA channels.
@ SINGLECSMA
Uses a single shared CSMA channel.
void EnableDatapathStats(std::string prefix="datapath", bool useNodeNames=false)
Enable OpenFlow datapath statistics at OpenFlow switch devices configured by this helper.
void DoDispose() override
Destructor implementation.
virtual void SetChannelType(ChannelType type)
Set the OpenFlow channel type used to create the connections between switches and controllers.
PointToPointHelper m_p2pHelper
Helper for P2P links.
NetDeviceContainer m_controlDevs
OF channel ctrl devices.
CsmaHelper m_csmaHelper
Helper for CSMA links.
Ptr< OFSwitch13Device > InstallSwitch(Ptr< Node > swNode, NetDeviceContainer &swPorts)
This method creates an OpenFlow device and aggregates it to the switch node.
void EnableOpenFlowAscii(std::string prefix="ofchannel")
Enable ASCII traces at OpenFlow channel between controller and switches.
static TypeId GetTypeId()
Register this type.
OFSwitch13DeviceContainer InstallSwitch(NodeContainer &swNodes)
This method creates and aggregates an OpenFlow device to each switch node in the container.
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Set an attribute on each OpenFlow device created by this helper.
static Ipv4AddressHelper m_ipv4helper
Helper for IP address.
~OFSwitch13Helper() override
Dummy destructor, see DoDispose.
OFSwitch13DeviceContainer m_openFlowDevs
OF switch devices.
bool m_blocked
Block this helper.
ChannelType m_channelType
OF channel type.
OFSwitch13Helper()
Default constructor.
virtual void CreateOpenFlowChannels()=0
This virtual method must interconnect all switches to all controllers installed by this helper and st...
virtual void SetChannelDataRate(DataRate rate)
Set the OpenFlow channel data rate used to create the connections between switches and controllers.
NodeContainer m_switchNodes
OF switch nodes.
Instantiate subclasses of ns3::Object.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.