Bug 2325

Summary: WaveNetDevice can not transmit by default
Product: ns-3 Reporter: Tommaso Pecorella <tommaso.pecorella>
Component: wave moduleAssignee: ns-bugs <ns-bugs>
Status: CONFIRMED ---    
Severity: critical CC: linlinjavaer
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Tommaso Pecorella 2016-03-04 12:19:19 UTC
The bug has been discovered by Yan Zhao in this thread:
https://groups.google.com/forum/#!topic/ns-3-users/CEjEf4ff9Fg

It can be easily reproduced by running:
./waf --run "vanet-routing-compare --protocol=0 --pcap=1 --80211Mode=3"
which results in empty pcaps.

The problem is that Waveretdevice needs a non-null m_txProfile and by default it's set to 0.
The helper doesn't initialize it to anything. As a consequence the NetDevice, by default, doesn't send any packet.
Comment 1 Tommaso Pecorella 2016-03-04 12:40:18 UTC
Additionally, the WAVE channel scheduler must be set up. In src/wave/examples/wave-simple-device.cc there is an example of setup:

  // Alternating access without immediate channel switch
  const SchInfo schInfo = SchInfo (SCH1, false, EXTENDED_ALTERNATING);
  Simulator::Schedule (Seconds (0.0), &WaveNetDevice::StartSch, sender, schInfo);
  // An important point is that the receiver should also be assigned channel
  // access for the same channel to receive packets.
  Simulator::Schedule (Seconds (0.0), &WaveNetDevice::StartSch, receiver, schInfo);

  // both IPv4 and IPv6 packets below will not be inserted to internal queue because of no tx profile registered
  Simulator::Schedule (Seconds (1.0), &WaveNetDeviceExample::SendIpPacket, this, 1, true);
  Simulator::Schedule (Seconds (1.050), &WaveNetDeviceExample::SendIpPacket, this, 2, false);
  //register txprofile
  // IP packets will automatically be sent with txprofile parameter
  const TxProfile txProfile = TxProfile (SCH1);
  Simulator::Schedule (Seconds (2.0), &WaveNetDevice::RegisterTxProfile, sender, txProfile);
  // both IPv4 and IPv6 packet are transmitted successfully
  Simulator::Schedule (Seconds (3.0), &WaveNetDeviceExample::SendIpPacket, this, 3, true);
  Simulator::Schedule (Seconds (3.050), &WaveNetDeviceExample::SendIpPacket, this, 4, false);
  // unregister TxProfile or release channel access
  Simulator::Schedule (Seconds (4.0),&WaveNetDevice::DeleteTxProfile, sender,SCH1);
  Simulator::Schedule (Seconds (4.0),&WaveNetDevice::StopSch, sender,SCH1);
  Simulator::Schedule (Seconds (4.0),&WaveNetDevice::StopSch, receiver, SCH1);
  // these packets will be dropped again because of no channel access assigned and no tx profile registered
  Simulator::Schedule (Seconds (5.0), &WaveNetDeviceExample::SendIpPacket, this, 5, true);
  Simulator::Schedule (Seconds (5.050), &WaveNetDeviceExample::SendIpPacket, this, 6, false);

Note that only the 2 central instructions are sending actual packet, the other ones are to setup the wave net device. All of them are NOT performed by default.
Comment 2 Junling Bu 2016-09-23 08:19:12 UTC
Hi,

I propose the usage as following:
(1) Current WaveNetdevice can only support transmit non-IP based packets in channel CCH by default..
(2) If someone want to transmit packets in SCHs, they have to request device to assign channel access with method WaveNetDevice::StartSch.
(3) If someone wants to transmit IP packets in SCHs, they have to:
  (a) request device to assign channel access with method WaveNetDevice::StartSch.
  (b) request to register a txprofile for IP packets with method WaveNetDevice::RegisterTxProfile.
(4) If someone wants to transmit IP packets in CCH, this request is not allowed.

The proposed usage is based on my personal understanding of IEEE 1609.4 service primitives.
So anyone has other better understanding, please contact me :)
Comment 3 Junling Bu 2016-09-23 08:20:38 UTC
There are similar bug 2489 and bug 2314, which have patches for review.