17#include "ns3/config.h" 
   18#include "ns3/mobility-helper.h" 
   19#include "ns3/mobility-model.h" 
   20#include "ns3/node-list.h" 
   21#include "ns3/string.h" 
   23#include "ns3/wave-helper.h" 
   24#include "ns3/wave-mac-helper.h" 
   25#include "ns3/wave-net-device.h" 
   26#include "ns3/yans-wifi-helper.h" 
   80    void DoRun() 
override;
 
  142                                       "check whether is CCH interval");
 
  147                                       "check whether is SCH interval");
 
  152                                       "check whether is Guard interval");
 
  165    bool test = (((now - guardi) % synci) == 0);
 
  185    bool test = ((now - guardi - cchi) % synci == 0);
 
  203        test = ((now % sync) == 0);
 
  209        test = (((now - cchi) % sync) == 0);
 
  224                          "normally CCH interval is 50ms");
 
  227                          "normally SCH interval is 50ms");
 
  230                          "normally Sync interval is 50ms");
 
  233                          "normally Guard interval is 50ms");
 
  238                          "valid configuration of channel intervals");
 
  243                          "invalid configuration of channel intervals");
 
  249                          "invalid configuration of channel intervals");
 
  424    mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
 
  425    mobility.Install(
nodes);
 
  428    model->SetPosition(Vector(0, 0, 0));
 
  429    for (
uint32_t n = 1; n != nodesNumber; ++n)
 
  431        double angle = (
PI / 180) * (360 / (nodesNumber - 1) * n);
 
  432        double x = cos(angle) * 10;
 
  433        double y = sin(angle) * 10;
 
  435        model->SetPosition(Vector(x, y, 0));
 
  463    void SendIp(
bool shouldSucceed, 
bool ipv6);
 
  478    void DoRun() 
override;
 
  513    uint16_t protocol = 0x80dd; 
 
  514    bool result = 
m_sender->
SendX(packet, dest, protocol, txInfo);
 
  523    const static uint16_t IPv4_PROT_NUMBER = 0x0800;
 
  524    const static uint16_t IPv6_PROT_NUMBER = 0x86DD;
 
  525    uint16_t protocol = ipv6 ? IPv6_PROT_NUMBER : IPv4_PROT_NUMBER;
 
  543        m_sender = DynamicCast<WaveNetDevice>(devices.Get(0));
 
  665        m_sender = DynamicCast<WaveNetDevice>(devices.Get(0));
 
  705        m_sender = DynamicCast<WaveNetDevice>(devices.Get(0));
 
  814    void DoRun() 
override;
 
  843                          "TestContinuousAfter fail at " << 
Now().As(
Time::S));
 
  859                          "TestExtendedAfter fail at " << 
Now().As(
Time::S));
 
  875                          "TestAlternating fail at " << 
Now().As(
Time::S));
 
  881    const static uint16_t WSMP_PROT_NUMBER = 0x88DC;
 
  885    uint8_t* 
data = 
new uint8_t[112];
 
  886    data[0] = (receiverId >> 24) & 0xFF;
 
  887    data[1] = (receiverId >> 16) & 0xFF;
 
  888    data[2] = (receiverId >> 8) & 0xFF;
 
  889    data[3] = (receiverId >> 0) & 0xFF;
 
  892    data[4] = (ts >> 56) & 0xFF;
 
  893    data[5] = (ts >> 48) & 0xFF;
 
  894    data[6] = (ts >> 40) & 0xFF;
 
  895    data[7] = (ts >> 32) & 0xFF;
 
  896    data[8] = (ts >> 24) & 0xFF;
 
  897    data[9] = (ts >> 16) & 0xFF;
 
  898    data[10] = (ts >> 8) & 0xFF;
 
  899    data[11] = (ts >> 0) & 0xFF;
 
  914    uint8_t* 
data = 
new uint8_t[pkt->GetSize()];
 
  915    pkt->CopyData(
data, pkt->GetSize());
 
  925    uint64_t ts = 
data[4];
 
  940    Time sendTime = TimeStep(ts);
 
  946    uint32_t curNodeId = dev->GetNode()->GetId();
 
 1032            uint32_t channel = WaveChannels[i - 1];
 
 1183            uint32_t channel = WaveChannels[i - 1];
 
 1306            uint32_t channel = WaveChannels[i - 1];
 
 1368    void DoRun() 
override;
 
 1404    const static uint16_t WSMP_PROT_NUMBER = 0x88DC;
 
 1408    data[0] = (sequence >> 24) & 0xFF;
 
 1409    data[1] = (sequence >> 16) & 0xFF;
 
 1410    data[2] = (sequence >> 8) & 0xFF;
 
 1411    data[3] = (sequence >> 0) & 0xFF;
 
 1414    data[4] = (ts >> 56) & 0xFF;
 
 1415    data[5] = (ts >> 48) & 0xFF;
 
 1416    data[6] = (ts >> 40) & 0xFF;
 
 1417    data[7] = (ts >> 32) & 0xFF;
 
 1418    data[8] = (ts >> 24) & 0xFF;
 
 1419    data[9] = (ts >> 16) & 0xFF;
 
 1420    data[10] = (ts >> 8) & 0xFF;
 
 1421    data[11] = (ts >> 0) & 0xFF;
 
 1436    uint8_t* 
data = 
new uint8_t[pkt->GetSize()];
 
 1437    pkt->CopyData(
data, pkt->GetSize());
 
 1447    uint64_t ts = 
data[4];
 
 1462    Time sendTime = TimeStep(ts);
 
 1467    Time duration = curTime - sendTime;
 
 1473                              "fail to test Annex C when packet sequence is " << seq);
 
 1479                              "fail to test Annex C when packet sequence is " << seq);
 
 1485                              "fail to test Annex C when packet sequence is " << seq);
 
 1491                              "fail to test Annex C when packet sequence is " << seq);
 
#define EXTENDED_ALTERNATING
#define EXTENDED_CONTINUOUS
The Annex C of IEEE 1609.4 : "Avoiding transmission at scheduled guard intervals" This feature is imp...
bool Receive(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive function.
~AnnexC_TestCase() override
Ptr< WaveNetDevice > m_sender
sender
Ptr< WaveNetDevice > m_receiver
receiver
void DoRun() override
Implementation to actually run this TestCase.
void SendPacket(uint32_t packetSize, const TxInfo &txInfo, uint32_t sequence)
Send packet function.
NetDeviceContainer m_devices
devices
This test case tests channel access assignments which is done by StartSch and StopSch method of WaveN...
void TestAlternating(SchInfo &info, bool shouldSucceed)
Test aternating function.
~ChannelAccessTestCase() override
void TestAlternatingAfter(uint32_t channelNumber, bool isAccessAssigned)
Test alternating after function.
NetDeviceContainer m_devices
the devices
void SendX(uint32_t channel, uint32_t receiverId)
Send X function.
uint32_t m_received
received
void DoRun() override
Implementation to actually run this TestCase.
void TestExtendedAfter(uint32_t channelNumber, bool isAccessAssigned)
Test extended after function.
void TestContinuousAfter(uint32_t channelNumber, bool isAccessAssigned)
Test continuous after function.
bool Receive(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive function.
void TestContinuous(SchInfo &info, bool shouldSucceed)
Test continuous function.
void TestExtended(SchInfo &info, bool shouldSucceed)
Test extended function.
Ptr< WaveNetDevice > m_sender
sender
This test case tests the channel coordination.
~ChannelCoordinationTestCase() override
void NotifySchStartNow(Time duration)
Notify SCH start now function.
void TestIntervalAfter(bool cchi, bool schi, bool guardi)
Test interval after function.
void DoRun() override
Implementation to actually run this TestCase.
void NotifyGuardStartNow(Time duration, bool inCchInterval)
Notify guard start now function.
void NotifyCchStartNow(Time duration)
Notify CCS start now function.
Ptr< ChannelCoordinator > m_coordinator
coordinator
ChannelCoordinationTestCase()
route packets or frames in different approaches see 1609.4-2010 chapter 5.3.4
Ptr< WaveNetDevice > m_sender
sender
void SendWsa(bool shouldSucceed, const VsaInfo &vsaInfo)
Send VSA management frames.
void SendWsmp(bool shouldSucceed, const TxInfo &txInfo)
Send WSMP or other packets.
void SendIp(bool shouldSucceed, bool ipv6)
Send IP-based packets.
~ChannelRoutingTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
bool ReceiveVsa(Ptr< const Packet > pkt, const Address &address, uint32_t, uint32_t)
Receive VSA function.
bool Receive(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive function.
CoordinationTestListener is used to test channel coordination events.
void NotifyCchSlotStart(Time duration) override
ChannelCoordinationTestCase * m_coordinatorTest
coordinator test
void NotifySchSlotStart(Time duration) override
~CoordinationTestListener() override
CoordinationTestListener(ChannelCoordinationTestCase *coordinatorTest)
Constructor.
void NotifyGuardSlotStart(Time duration, bool cchi) override
static NetDeviceContainer CreatWaveDevice(uint32_t nodesNumber=2)
Create WAVE device function.
a polymophic address class
receive notifications about channel coordination events.
Time GetSyncInterval() const
void SetSchInterval(Time schi)
bool IsValidConfig() const
bool IsSchInterval(Time duration=Seconds(0.0)) const
static Time GetDefaultCchInterval()
bool IsGuardInterval(Time duration=Seconds(0.0)) const
Time GetSchInterval() const
void SetGuardInterval(Time guardi)
Time GetCchInterval() const
Time GetGuardInterval() const
static Time GetDefaultSchInterval()
void SetCchInterval(Time cchi)
bool IsCchInterval(Time duration=Seconds(0.0)) const
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
static std::vector< uint32_t > GetWaveChannels()
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address GetBroadcast()
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
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.
static Ptr< Node > GetNode(uint32_t n)
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
the organization identifier is a public organizationally unique identifier assigned by the IEEE.
Smart pointer class similar to boost::intrusive_ptr.
Qos Wave Mac Helper class.
static QosWaveMacHelper Default()
Create a mac helper in a default working state.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
int64_t GetTimeStep() const
Get the raw time value, in the current resolution unit.
helps to create WaveNetDevice objects
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
static WaveHelper Default()
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
bool StartSch(const SchInfo &schInfo)
bool DeleteTxProfile(uint32_t channelNumber)
Address GetAddress() const override
Ptr< ChannelScheduler > GetChannelScheduler() const
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
bool StopVsa(uint32_t channelNumber)
bool SendX(Ptr< Packet > packet, const Address &dest, uint32_t protocol, const TxInfo &txInfo)
bool RegisterTxProfile(const TxProfile &txprofile)
bool StartVsa(const VsaInfo &vsaInfo)
bool StopSch(uint32_t channelNumber)
represent a single transmission mode
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
static YansWavePhyHelper Default()
Create a phy helper in a default working state.
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Ptr< YansWifiChannel > Create() const
void SetChannel(Ptr< YansWifiChannel > channel)
Time Now()
create an ns3::Time instance which contains the current simulation time.
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report 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.
static WaveMacTestSuite waveMacTestSuite
the test suite
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...
-ns3 Test suite for the ns3 wrapper script
uint32_t channelNumber
channel number
static const uint32_t packetSize
Packet size generated at the AP.