23 #include "ns3/abort.h"
25 #include "ns3/uinteger.h"
26 #include "ns3/inet-socket-address.h"
27 #include "ns3/point-to-point-helper.h"
28 #include "ns3/internet-stack-helper.h"
29 #include "ns3/ipv4-address-helper.h"
30 #include "ns3/ipv4-header.h"
31 #include "ns3/packet-sink-helper.h"
32 #include "ns3/udp-client-server-helper.h"
33 #include "ns3/udp-header.h"
34 #include "ns3/simulator.h"
35 #include "ns3/wimax-helper.h"
36 #include "ns3/mobility-helper.h"
37 #include "ns3/global-route-manager.h"
38 #include "ns3/wimax-tlv.h"
39 #include "ns3/ipcs-classifier-record.h"
40 #include "ns3/service-flow.h"
55 virtual void DoRun (
void);
59 Ns3WimaxCsParamTlvTestCase::Ns3WimaxCsParamTlvTestCase ()
60 :
TestCase (
"Test the CS parameters tlv implementation.")
64 Ns3WimaxCsParamTlvTestCase::~Ns3WimaxCsParamTlvTestCase ()
93 sfVectorTlvValue.Add (csParam.
ToTlv ());
95 Tlv tlvSent (145, sfVectorTlvValue.GetSerializedSize (), sfVectorTlvValue);
100 packet->RemoveHeader (tlvReceived);
101 if (tlvReceived.GetType () == Tlv::UPLINK_SERVICE_FLOW)
105 for (std::vector<Tlv*>::const_iterator iter = sfVecValue->Begin (); iter
106 != sfVecValue->End (); ++iter)
108 if ((*iter)->GetType () == SfVectorTlvValue::IPV4_CS_Parameters)
118 17),
false,
"The classifier address did not match.");
123 6),
false,
"The classifier address did not match.");
128 17),
false,
"The classifier addresses matched.");
133 8),
false,
"The classifier addresses matched.");
150 virtual void DoRun (
void);
154 Ns3WimaxSfTlvTestCase::Ns3WimaxSfTlvTestCase ()
155 :
TestCase (
"Test the service flow tlv implementation.")
159 Ns3WimaxSfTlvTestCase::~Ns3WimaxSfTlvTestCase ()
171 sf.SetConvergenceSublayerParam (csParam);
172 sf.SetCsSpecification (ServiceFlow::IPV4);
173 sf.SetServiceSchedulingType (ServiceFlow::SF_TYPE_UGS);
174 sf.SetMaxSustainedTrafficRate (1000000);
175 sf.SetMinReservedTrafficRate (1000000);
176 sf.SetMinTolerableTrafficRate (1000000);
177 sf.SetMaximumLatency (10);
178 sf.SetMaxTrafficBurst (1000);
179 sf.SetTrafficPriority (1);
189 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetDirection (), ServiceFlow::SF_DIRECTION_DOWN,
"The sfRecv had the wrong direction.");
190 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetSfid (), 100,
"The sfRecv had the wrong sfid.");
191 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetCsSpecification (), ServiceFlow::IPV4,
"The sfRecv had the wrong cs specification.");
192 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetServiceSchedulingType (), ServiceFlow::SF_TYPE_UGS,
"The sfRecv had the wrong service scheduling type.");
193 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxSustainedTrafficRate (), 1000000,
"The sfRecv had the wrong maximum sustained traffic rate.");
194 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinReservedTrafficRate (), 1000000,
"The sfRecv had the wrong minimum reserved traffic rate.");
195 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinTolerableTrafficRate (), 1000000,
"The sfRecv had the wrong minimum tolerable traffic rate.");
196 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaximumLatency (), 10,
"The sfRecv had the wrong maximum latency.");
197 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxTrafficBurst (), 1000,
"The sfRecv had the wrong maximum traffic burst.");
198 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetTrafficPriority (), 1,
"The sfRecv had the wrong traffic priority.");
208 Ns3WimaxTlvTestSuite::Ns3WimaxTlvTestSuite ()
uint32_t RemoveHeader(Header &header)
a class to represent an Ipv4 address mask
bool CheckMatch(Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort, uint8_t proto) const
check if a packets can be used with this classifier
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
virtual void DoRun(void)
Implementation to actually run this test case.
void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask)
add a new source ip address to the classifier
void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh)
add a range of source port to the classifier
virtual void DoRun(void)
Implementation to actually run this test case.
Tlv ToTlv(void) const
creates a tlv from the classifier record
void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask)
add a new destination ip address to the classifier
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
void AddDstPortRange(uint16_t dstPortLow, uint16_t dstPortHigh)
add a range of destination port to the classifier
Ipv4 addresses are stored in host order in this class.
void AddProtocol(uint8_t proto)
add a protocol to the classifier
void SetIndex(uint16_t index)
Set the index of the classifier.
Tlv ToTlv(void) const
creates a TLV from this service flow
IpcsClassifierRecord GetPacketClassifierRule(void) const
void AddHeader(const Header &header)