mag="WifiRemoteStationManager selected does not support HT rates"

94 views
Skip to first unread message

qeqe

unread,
Jun 4, 2021, 4:01:50 AM6/4/21
to ns-3-reviews
I am using ofswitch13 to simulate the mobility of the ofswitch in wireless environment (wifi)

So I customized the ofswitch13-multiple-domains.cc which is csma to wifi.

But it seems to have a problem while 'build' is successful though.

All links are connected with wifi, through a single AP

help pleeeeez


/*                       Learning Controller   Learning Controller
 *                                         |                     |
 *                                  +----------+          +----------+
 *          Host 0   === | Switch 0 | == | Switch 1 | === Host 1
 *                                  +----------+          +----------+
 *
 *                                                    AP
 */

#include "ns3/command-line.h"
#include "ns3/config.h"
#include "ns3/uinteger.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/string.h"
#include "ns3/log.h"
#include "ns3/yans-wifi-channel.h"

#include <ns3/core-module.h>
#include "ns3/point-to-point-module.h"
#include <ns3/network-module.h>
#include "ns3/applications-module.h"
#include <ns3/csma-module.h>
#include "ns3/mobility-module.h"
#include <ns3/internet-module.h>
#include <ns3/ofswitch13-module.h>
#include "ns3/yans-wifi-helper.h"
#include <ns3/internet-apps-module.h>
#include "ns3/ssid.h"

using namespace ns3;

int
main (int argc, char *argv[])
{
  uint16_t simTime = 10;
  bool verbose = false;
  bool trace = false;

  // Configure command line parameters
  CommandLine cmd;
  cmd.AddValue ("simTime", "Simulation time (seconds)", simTime);
  cmd.AddValue ("verbose", "Enable verbose output", verbose);
  cmd.AddValue ("trace", "Enable datapath stats and pcap traces", trace);
  cmd.Parse (argc, argv);
  
  if (verbose)
    {
      OFSwitch13Helper::EnableDatapathLogs ();
      LogComponentEnable ("OFSwitch13Interface", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13Device", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13Port", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13Queue", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13SocketHandler", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13Controller", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13LearningController", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13Helper", LOG_LEVEL_ALL);
      LogComponentEnable ("OFSwitch13InternalHelper", LOG_LEVEL_ALL);
      LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
      LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
    }

  // Enable checksum computations (required by OFSwitch13 module)
  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));

  // Create two host nodes
  NodeContainer hosts;
  hosts.Create (2);

  // Create two switch nodes
  NodeContainer switches;
  switches.Create (2);

  // Create AP node
  NodeContainer wifiApNode;
  wifiApNode.Create (1);

  NodeContainer wifiStaNodes;
  wifiStaNodes.Create (4);

  // 2. Create PHY layer (wireless channel)
  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
  YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
  phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
  Config::SetDefault ("ns3::RangePropagationLossModel::MaxRange", DoubleValue (100));
  channel.AddPropagationLoss ("ns3::RangePropagationLossModel"); //wireless range limited to 5 meters!
  phy.SetChannel (channel.Create ());

  // 4. Create WLAN setting
  WifiHelper wifi;
  //wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
  wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);

  // 5. Create NetDevices
  NodeContainer pair;
  NetDeviceContainer pairDevs;
  NetDeviceContainer hostDevices;
  NetDeviceContainer apDevices;
  NetDeviceContainer switchPorts [2];
  switchPorts [0] = NetDeviceContainer ();
  switchPorts [1] = NetDeviceContainer ();

  // 3. Create MAC layer
  WifiMacHelper mac;
  Ssid ssid = Ssid ("ns-3-ssid");
  // Ssid ssid = Ssid ("ofswitch13-wlan");

  mac.SetType ("ns3::ApWifiMac",
               "Ssid", SsidValue (ssid));
  apDevices = wifi.Install (phy, mac, wifiApNode);

  // Connect host 0 to first switch
  pair = NodeContainer (hosts.Get (0), switches.Get (0));
  pairDevs = wifi.Install (phy, mac, pair);
  hostDevices.Add (pairDevs.Get (0));
  switchPorts [0].Add (pairDevs.Get (1));

  // Connect host 1 to second switch
  pair = NodeContainer (hosts.Get (1), switches.Get (1));
  pairDevs = wifi.Install (phy, mac, pair);
  hostDevices.Add (pairDevs.Get (0));
  switchPorts [1].Add (pairDevs.Get (1));

  // Connect the switches
  pair = NodeContainer (switches.Get (0), switches.Get (1));
  pairDevs = wifi.Install (phy, mac, pair);
  switchPorts [0].Add (pairDevs.Get (0));
  switchPorts [1].Add (pairDevs.Get (1));

  // Create two controller nodes
  NodeContainer controllers;
  controllers.Create (2);

  // Configure both OpenFlow network domains
  Ptr<OFSwitch13InternalHelper> of13Helper0 = CreateObject<OFSwitch13InternalHelper> ();
  of13Helper0->InstallController (controllers.Get (0));
  of13Helper0->InstallSwitch (switches.Get (0), switchPorts [0]);
  of13Helper0->CreateOpenFlowChannels ();

  Ptr<OFSwitch13InternalHelper> of13Helper1 = CreateObject<OFSwitch13InternalHelper> ();
  of13Helper1->InstallController (controllers.Get (1));
  of13Helper1->InstallSwitch (switches.Get (1), switchPorts [1]);
  of13Helper1->CreateOpenFlowChannels ();

  // 6. Setting mobility model
  MobilityHelper mobility;

  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
  positionAlloc->Add (Vector (5.0, 0.0, 0.0));    
  positionAlloc->Add (Vector (0.0, 0.0, 0.0));        
  positionAlloc->Add (Vector (3.0, 0.0, 0.0)); 
  positionAlloc->Add (Vector (6.0, 0.0, 0.0)); 
  positionAlloc->Add (Vector (8.0, 0.0, 0.0));  
  mobility.SetPositionAllocator (positionAlloc);

  /* mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
                                 "MinX", DoubleValue (0.0),
                                 "MinY", DoubleValue (0.0),
                                 "DeltaX", DoubleValue (5.0),
                                 "DeltaY", DoubleValue (10.0),
                                 "GridWidth", UintegerValue (3),
                                 "LayoutType", StringValue ("RowFirst"));

  mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
                             "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));  */

  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  mobility.Install (wifiApNode);
  mobility.Install (switches);
  mobility.Install (hosts);

  // 7. Create Network layer
  InternetStackHelper stack;
  stack.Install (wifiApNode);
  stack.Install (switches);
  stack.Install (hosts);

  // Set IPv4 host addresses
  Ipv4AddressHelper ipv4helpr;
  Ipv4InterfaceContainer hostIpIfaces;
  ipv4helpr.SetBase ("10.1.1.0", "255.255.255.0");
  hostIpIfaces = ipv4helpr.Assign (hostDevices);

  Ipv4InterfaceContainer ApInterface;
  ApInterface = ipv4helpr.Assign (apDevices);

  // Configure ping application between hosts
  V4PingHelper pingHelper = V4PingHelper (hostIpIfaces.GetAddress (1));
  pingHelper.SetAttribute ("Verbose", BooleanValue (true));
  ApplicationContainer pingApps = pingHelper.Install (hosts.Get (0));
  pingApps.Start (Seconds (1));

  //Enable datapath stats and pcap traces at hosts, switch(es), and controller(s)
  if (trace)
  {
  of13Helper0->EnableOpenFlowPcap ("openflow-0");
  of13Helper0->EnableDatapathStats ("switch-stats");
  of13Helper1->EnableOpenFlowPcap ("openflow-1");
  of13Helper1->EnableDatapathStats ("switch-stats");
  //wifiHelper.EnablePcap ("switch", switchPorts [0], true);
  //wifiHelper.EnablePcap ("switch", switchPorts [1], true);
  //wifiHelper.EnablePcap ("host", hostDevices);
  }

  // Run the simulation
  Simulator::Stop (Seconds (simTime));
  Simulator::Run ();
  Simulator::Destroy ();
}

error_snapshot.PNG
Reply all
Reply to author
Forward
0 new messages