22 #include "ns3/data-rate.h"
23 #include "ns3/dhcp-client.h"
24 #include "ns3/dhcp-helper.h"
25 #include "ns3/dhcp-server.h"
26 #include "ns3/internet-stack-helper.h"
27 #include "ns3/ipv4-address-helper.h"
28 #include "ns3/simple-net-device-helper.h"
29 #include "ns3/simple-net-device.h"
55 void LeaseObtained(std::string context,
const Ipv4Address& newAddress);
58 void DoRun()
override;
74 uint8_t numericalContext = std::stoi(context,
nullptr, 10);
76 if (numericalContext >= 0 && numericalContext <= 2)
114 DynamicCast<DhcpServer>(dhcpServerApp.
Get(0))
115 ->AddStaticDhcpEntry(devNet.
Get(3)->GetAddress(),
Ipv4Address(
"172.30.0.14"));
118 dhcpClientNetDevs.
Add(devNet.
Get(1));
119 dhcpClientNetDevs.
Add(devNet.
Get(2));
120 dhcpClientNetDevs.
Add(devNet.
Get(3));
136 Simulator::Stop(
Seconds(21.0));
155 Simulator::Destroy();
void DoRun() override
Implementation to actually run this TestCase.
Ipv4Address m_leasedAddress[3]
Address given to the nodes.
void LeaseObtained(std::string context, const Ipv4Address &newAddress)
Triggered by an address lease on a client.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
The helper class used to configure and install DHCP applications on nodes.
ApplicationContainer InstallDhcpServer(Ptr< NetDevice > netDevice, Ipv4Address serverAddr, Ipv4Address poolAddr, Ipv4Mask poolMask, Ipv4Address minAddr, Ipv4Address maxAddr, Ipv4Address gateway=Ipv4Address())
Install DHCP server of a node / NetDevice.
ApplicationContainer InstallDhcpClient(Ptr< NetDevice > netDevice) const
Install DHCP client of a nodes / NetDevice.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Ipv4 addresses are stored in host order in this class.
a class to represent an Ipv4 address mask
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
Connect a TraceSource to a Callback with a context.
build a set of SimpleNetDevice objects
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
static DhcpTestSuite dhcpTestSuite
Static variable for test initialization.
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...