author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Thu, 15 Aug 2013 12:01:57 -0700 | |
changeset 10157 | 02e3d2d7d7e1 |
parent 9266 | d26408b17360 |
child 12861 | 20ede1be87a8 |
permissions | -rw-r--r-- |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007,2008, 2009 INRIA, UDcast |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr> |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
19 |
* <amine.ismail@udcast.com> |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
20 |
*/ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
21 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#include <fstream> |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
23 |
#include "ns3/log.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include "ns3/abort.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "ns3/config.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include "ns3/string.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
27 |
#include "ns3/uinteger.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
28 |
#include "ns3/inet-socket-address.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
29 |
#include "ns3/internet-stack-helper.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
30 |
#include "ns3/ipv4-address-helper.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
31 |
#include "ns3/udp-client-server-helper.h" |
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
32 |
#include "ns3/udp-echo-helper.h" |
6858
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
33 |
#include "ns3/simple-net-device.h" |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
34 |
#include "ns3/simple-channel.h" |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
35 |
#include "ns3/test.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
36 |
#include "ns3/simulator.h" |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
37 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
38 |
using namespace ns3; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
39 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
40 |
/** |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
41 |
* Test that all the udp packets generated by an udpClient application are |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
42 |
* correctly received by an udpServer application |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
43 |
*/ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
44 |
|
7166
2ea56ac66361
applications coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6858
diff
changeset
|
45 |
class UdpClientServerTestCase : public TestCase |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
46 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
47 |
public: |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
48 |
UdpClientServerTestCase (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
49 |
virtual ~UdpClientServerTestCase (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
50 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
51 |
private: |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
52 |
virtual void DoRun (void); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
53 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
54 |
}; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
55 |
|
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
56 |
UdpClientServerTestCase::UdpClientServerTestCase () |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
57 |
: TestCase ("Test that all the udp packets generated by an udpClient application are correctly received by an udpServer application") |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
58 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
59 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
60 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
61 |
UdpClientServerTestCase::~UdpClientServerTestCase () |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
62 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
63 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
64 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
65 |
void UdpClientServerTestCase::DoRun (void) |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
66 |
{ |
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
67 |
NodeContainer n; |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
68 |
n.Create (2); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
69 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
70 |
InternetStackHelper internet; |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
71 |
internet.Install (n); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
72 |
|
6858
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
73 |
// link the two nodes |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
74 |
Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice> (); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
75 |
Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice> (); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
76 |
n.Get (0)->AddDevice (txDev); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
77 |
n.Get (1)->AddDevice (rxDev); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
78 |
Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel> (); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
79 |
rxDev->SetChannel (channel1); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
80 |
txDev->SetChannel (channel1); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
81 |
NetDeviceContainer d; |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
82 |
d.Add (txDev); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
83 |
d.Add (rxDev); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
84 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
85 |
Ipv4AddressHelper ipv4; |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
86 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
87 |
ipv4.SetBase ("10.1.1.0", "255.255.255.0"); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
88 |
Ipv4InterfaceContainer i = ipv4.Assign (d); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
89 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
90 |
uint16_t port = 4000; |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
91 |
UdpServerHelper server (port); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
92 |
ApplicationContainer apps = server.Install (n.Get (1)); |
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
93 |
apps.Start (Seconds (1.0)); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
94 |
apps.Stop (Seconds (10.0)); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
95 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
96 |
uint32_t MaxPacketSize = 1024; |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
97 |
Time interPacketInterval = Seconds (1.); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
98 |
uint32_t maxPacketCount = 10; |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
99 |
UdpClientHelper client (i.GetAddress (1), port); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
100 |
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount)); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
101 |
client.SetAttribute ("Interval", TimeValue (interPacketInterval)); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
102 |
client.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize)); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
103 |
apps = client.Install (n.Get (0)); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
104 |
apps.Start (Seconds (2.0)); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
105 |
apps.Stop (Seconds (10.0)); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
106 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
107 |
Simulator::Run (); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
108 |
Simulator::Destroy (); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
109 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
110 |
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost !"); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
111 |
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 8, "Did not receive expected number of packets !"); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
112 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
113 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
114 |
/** |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
115 |
* Test that all the udp packets generated by an udpTraceClient application are |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
116 |
* correctly received by an udpServer application |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
117 |
*/ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
118 |
|
7166
2ea56ac66361
applications coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6858
diff
changeset
|
119 |
class UdpTraceClientServerTestCase : public TestCase |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
120 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
121 |
public: |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
122 |
UdpTraceClientServerTestCase (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
123 |
virtual ~UdpTraceClientServerTestCase (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
124 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
125 |
private: |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
126 |
virtual void DoRun (void); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
127 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
128 |
}; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
129 |
|
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
130 |
UdpTraceClientServerTestCase::UdpTraceClientServerTestCase () |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
131 |
: TestCase ("Test that all the udp packets generated by an udpTraceClient application are correctly received by an udpServer application") |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
132 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
133 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
134 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
135 |
UdpTraceClientServerTestCase::~UdpTraceClientServerTestCase () |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
136 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
137 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
138 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
139 |
void UdpTraceClientServerTestCase::DoRun (void) |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
140 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
141 |
NodeContainer n; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
142 |
n.Create (2); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
143 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
144 |
InternetStackHelper internet; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
145 |
internet.Install (n); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
146 |
|
6858
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
147 |
// link the two nodes |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
148 |
Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice> (); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
149 |
Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice> (); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
150 |
n.Get (0)->AddDevice (txDev); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
151 |
n.Get (1)->AddDevice (rxDev); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
152 |
Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel> (); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
153 |
rxDev->SetChannel (channel1); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
154 |
txDev->SetChannel (channel1); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
155 |
NetDeviceContainer d; |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
156 |
d.Add (txDev); |
2580a2dc2780
Remove device dependency from applications
Tom Henderson <tomh@tomh.org>
parents:
6847
diff
changeset
|
157 |
d.Add (rxDev); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
158 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
159 |
Ipv4AddressHelper ipv4; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
160 |
ipv4.SetBase ("10.1.1.0", "255.255.255.0"); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
161 |
Ipv4InterfaceContainer i = ipv4.Assign (d); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
162 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
163 |
uint16_t port = 4000; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
164 |
UdpServerHelper server (port); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
165 |
ApplicationContainer apps = server.Install (n.Get (1)); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
166 |
apps.Start (Seconds (1.0)); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
167 |
apps.Stop (Seconds (10.0)); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
168 |
|
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
169 |
uint32_t MaxPacketSize = 1400 - 28; // ip/udp header |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
170 |
UdpTraceClientHelper client (i.GetAddress (1), port,""); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
171 |
client.SetAttribute ("MaxPacketSize", UintegerValue (MaxPacketSize)); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
172 |
apps = client.Install (n.Get (0)); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
173 |
apps.Start (Seconds (2.0)); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
174 |
apps.Stop (Seconds (10.0)); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
175 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
176 |
Simulator::Run (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
177 |
Simulator::Destroy (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
178 |
|
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
179 |
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost !"); |
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
180 |
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 247, "Did not receive expected number of packets !"); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
181 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
182 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
183 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
184 |
/** |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
185 |
* Test that all the PacketLossCounter class checks loss correctly in different cases |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
186 |
*/ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
187 |
|
7166
2ea56ac66361
applications coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6858
diff
changeset
|
188 |
class PacketLossCounterTestCase : public TestCase |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
189 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
190 |
public: |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
191 |
PacketLossCounterTestCase (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
192 |
virtual ~PacketLossCounterTestCase (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
193 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
194 |
private: |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
195 |
virtual void DoRun (void); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
196 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
197 |
}; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
198 |
|
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
199 |
PacketLossCounterTestCase::PacketLossCounterTestCase () |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
200 |
: TestCase ("Test that all the PacketLossCounter class checks loss correctly in different cases") |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
201 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
202 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
203 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
204 |
PacketLossCounterTestCase::~PacketLossCounterTestCase () |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
205 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
206 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
207 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
208 |
void PacketLossCounterTestCase::DoRun (void) |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
209 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
210 |
PacketLossCounter lossCounter (32); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
211 |
lossCounter.NotifyReceived (32); //out of order |
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
212 |
for (uint32_t i = 0; i < 64; i++) |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
213 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
214 |
lossCounter.NotifyReceived (i); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
215 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
216 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
217 |
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 0, "Check that 0 packets are lost"); |
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
218 |
|
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
219 |
for (uint32_t i = 65; i < 128; i++) // drop (1) seqNum 64 |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
220 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
221 |
lossCounter.NotifyReceived (i); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
222 |
} |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
223 |
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 1, "Check that 1 packet is lost"); |
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
224 |
|
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
225 |
for (uint32_t i = 134; i < 200; i++) // drop seqNum 128,129,130,131,132,133 |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
226 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
227 |
lossCounter.NotifyReceived (i); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
228 |
} |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
229 |
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 7, "Check that 7 (6+1) packets are lost"); |
6564
dcc61bce9764
must return GetErrorStatus
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6266
diff
changeset
|
230 |
|
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
231 |
// reordering without loss |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
232 |
lossCounter.NotifyReceived (205); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
233 |
lossCounter.NotifyReceived (206); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
234 |
lossCounter.NotifyReceived (207); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
235 |
lossCounter.NotifyReceived (200); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
236 |
lossCounter.NotifyReceived (201); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
237 |
lossCounter.NotifyReceived (202); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
238 |
lossCounter.NotifyReceived (203); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
239 |
lossCounter.NotifyReceived (204); |
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
240 |
for (uint32_t i = 205; i < 250; i++) |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
241 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
242 |
lossCounter.NotifyReceived (i); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
243 |
} |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
244 |
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 7, "Check that 7 (6+1) packets are lost even when reordering happens"); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
245 |
|
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
246 |
// reordering with loss |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
247 |
lossCounter.NotifyReceived (255); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
248 |
// drop (2) seqNum 250, 251 |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
249 |
lossCounter.NotifyReceived (252); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
250 |
lossCounter.NotifyReceived (253); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
251 |
lossCounter.NotifyReceived (254); |
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
252 |
for (uint32_t i = 256; i < 300; i++) |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
253 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
254 |
lossCounter.NotifyReceived (i); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
255 |
} |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7166
diff
changeset
|
256 |
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 9, "Check that 9 (6+1+2) packet are lost"); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
257 |
} |
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
258 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
259 |
/** |
10157
02e3d2d7d7e1
Link to bug num in bug database with \bugid{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9266
diff
changeset
|
260 |
* Test fix for \bugid{1378} |
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
261 |
*/ |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
262 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
263 |
class UdpEchoClientSetFillTestCase : public TestCase |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
264 |
{ |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
265 |
public: |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
266 |
UdpEchoClientSetFillTestCase (); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
267 |
virtual ~UdpEchoClientSetFillTestCase (); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
268 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
269 |
private: |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
270 |
virtual void DoRun (void); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
271 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
272 |
}; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
273 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
274 |
UdpEchoClientSetFillTestCase::UdpEchoClientSetFillTestCase () |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
275 |
: TestCase ("Test that the UdpEchoClient::SetFill class sets packet size (bug 1378)") |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
276 |
{ |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
277 |
} |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
278 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
279 |
UdpEchoClientSetFillTestCase::~UdpEchoClientSetFillTestCase () |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
280 |
{ |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
281 |
} |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
282 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
283 |
void UdpEchoClientSetFillTestCase::DoRun (void) |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
284 |
{ |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
285 |
NodeContainer nodes; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
286 |
nodes.Create (2); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
287 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
288 |
InternetStackHelper internet; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
289 |
internet.Install (nodes); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
290 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
291 |
Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice> (); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
292 |
Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice> (); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
293 |
nodes.Get (0)->AddDevice (txDev); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
294 |
nodes.Get (1)->AddDevice (rxDev); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
295 |
Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel> (); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
296 |
rxDev->SetChannel (channel1); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
297 |
txDev->SetChannel (channel1); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
298 |
NetDeviceContainer d; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
299 |
d.Add (txDev); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
300 |
d.Add (rxDev); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
301 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
302 |
Ipv4AddressHelper ipv4; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
303 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
304 |
ipv4.SetBase ("10.1.1.0", "255.255.255.0"); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
305 |
Ipv4InterfaceContainer interfaces = ipv4.Assign (d); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
306 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
307 |
uint16_t port = 5000; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
308 |
UdpEchoServerHelper echoServer (port); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
309 |
ApplicationContainer serverApps = echoServer.Install (nodes.Get (1)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
310 |
serverApps.Start (Seconds (1.0)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
311 |
serverApps.Stop (Seconds (10.0)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
312 |
UdpEchoClientHelper echoClient (interfaces.GetAddress (1), port); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
313 |
echoClient.SetAttribute ("MaxPackets", UintegerValue (1)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
314 |
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0))); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
315 |
echoClient.SetAttribute ("PacketSize", UintegerValue (1024)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
316 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
317 |
ApplicationContainer clientApps = echoClient.Install (nodes.Get (0)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
318 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
319 |
uint8_t arry[64]; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
320 |
uint8_t i; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
321 |
for (i = 0; i < 64; i++) |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
322 |
{ |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
323 |
arry[i] = i; |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
324 |
} |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
325 |
echoClient.SetFill (clientApps.Get (0), &(arry[0]), (uint32_t)64, (uint32_t)64); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
326 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
327 |
clientApps.Start (Seconds (2.0)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
328 |
clientApps.Stop (Seconds (10.0)); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
329 |
|
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
330 |
Simulator::Run (); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
331 |
Simulator::Destroy (); |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
332 |
} |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
333 |
|
7166
2ea56ac66361
applications coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6858
diff
changeset
|
334 |
class UdpClientServerTestSuite : public TestSuite |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
335 |
{ |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
336 |
public: |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
337 |
UdpClientServerTestSuite (); |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
338 |
}; |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
339 |
|
7749
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
340 |
UdpClientServerTestSuite::UdpClientServerTestSuite () |
7458a10a17d1
Fix bug 1378 (UdpEchoClient::SetFill() does not set packet size correctly) (fix from jesse1013000@gmail.com)
Tom Henderson <tomh@tomh.org>
parents:
7256
diff
changeset
|
341 |
: TestSuite ("udp-client-server", UNIT) |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
342 |
{ |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
7749
diff
changeset
|
343 |
AddTestCase (new UdpTraceClientServerTestCase, TestCase::QUICK); |
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
7749
diff
changeset
|
344 |
AddTestCase (new UdpClientServerTestCase, TestCase::QUICK); |
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
7749
diff
changeset
|
345 |
AddTestCase (new PacketLossCounterTestCase, TestCase::QUICK); |
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
7749
diff
changeset
|
346 |
AddTestCase (new UdpEchoClientSetFillTestCase, TestCase::QUICK); |
5781
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
347 |
} |
2557c340ea15
Adding 3 new applications:udp-client, udp-server, udp-trace-client.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
348 |
|
6774
034f362af24d
Make all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6564
diff
changeset
|
349 |
static UdpClientServerTestSuite udpClientServerTestSuite; |