50 public: |
50 public: |
51 Ns3WimaxCsParamTlvTestCase (); |
51 Ns3WimaxCsParamTlvTestCase (); |
52 virtual ~Ns3WimaxCsParamTlvTestCase (); |
52 virtual ~Ns3WimaxCsParamTlvTestCase (); |
53 |
53 |
54 private: |
54 private: |
55 virtual bool DoRun (void); |
55 virtual void DoRun (void); |
56 |
56 |
57 }; |
57 }; |
58 |
58 |
59 Ns3WimaxCsParamTlvTestCase::Ns3WimaxCsParamTlvTestCase () |
59 Ns3WimaxCsParamTlvTestCase::Ns3WimaxCsParamTlvTestCase () |
60 : TestCase ("Test the CS parameters tlv implementation.") |
60 : TestCase ("Test the CS parameters tlv implementation.") |
63 |
63 |
64 Ns3WimaxCsParamTlvTestCase::~Ns3WimaxCsParamTlvTestCase () |
64 Ns3WimaxCsParamTlvTestCase::~Ns3WimaxCsParamTlvTestCase () |
65 { |
65 { |
66 } |
66 } |
67 |
67 |
68 bool |
68 void |
69 Ns3WimaxCsParamTlvTestCase::DoRun (void) |
69 Ns3WimaxCsParamTlvTestCase::DoRun (void) |
70 { |
70 { |
71 |
71 |
72 IpcsClassifierRecord classifier (Ipv4Address ("10.0.0.0"), |
72 IpcsClassifierRecord classifier (Ipv4Address ("10.0.0.0"), |
73 Ipv4Mask ("255.0.0.0"), |
73 Ipv4Mask ("255.0.0.0"), |
109 { |
109 { |
110 CsParameters csParamsRecv (*(*iter)); |
110 CsParameters csParamsRecv (*(*iter)); |
111 IpcsClassifierRecord classifier = |
111 IpcsClassifierRecord classifier = |
112 csParamsRecv.GetPacketClassifierRule (); |
112 csParamsRecv.GetPacketClassifierRule (); |
113 |
113 |
114 if (!classifier.CheckMatch (Ipv4Address ("10.1.1.1"), |
114 NS_TEST_ASSERT_MSG_EQ (!classifier.CheckMatch (Ipv4Address ("10.1.1.1"), |
115 Ipv4Address ("16.1.1.1"), |
115 Ipv4Address ("16.1.1.1"), |
116 1050, |
116 1050, |
117 3050, |
117 3050, |
118 17)) |
118 17), false, "The classifier address did not match."); |
119 { |
119 NS_TEST_ASSERT_MSG_EQ (!classifier.CheckMatch (Ipv4Address ("10.1.5.1"), |
120 return true; |
|
121 } |
|
122 if (!classifier.CheckMatch (Ipv4Address ("10.1.5.1"), |
|
123 Ipv4Address ("11.1.1.23"), |
120 Ipv4Address ("11.1.1.23"), |
124 1070, |
121 1070, |
125 3040, |
122 3040, |
126 6)) |
123 6), false, "The classifier address did not match."); |
127 { |
124 NS_TEST_ASSERT_MSG_EQ (classifier.CheckMatch (Ipv4Address ("11.1.1.1"), |
128 return true; |
|
129 } |
|
130 if (classifier.CheckMatch (Ipv4Address ("11.1.1.1"), |
|
131 Ipv4Address ("17.1.1.1"), |
125 Ipv4Address ("17.1.1.1"), |
132 1050, |
126 1050, |
133 3050, |
127 3050, |
134 17)) |
128 17), false, "The classifier addresses matched."); |
135 { |
129 NS_TEST_ASSERT_MSG_EQ (classifier.CheckMatch (Ipv4Address ("10.1.1.1"), |
136 return true; |
|
137 } |
|
138 if (classifier.CheckMatch (Ipv4Address ("10.1.1.1"), |
|
139 Ipv4Address ("16.1.1.1"), |
130 Ipv4Address ("16.1.1.1"), |
140 1050, |
131 1050, |
141 3050, |
132 3050, |
142 8)) |
133 8), false, "The classifier addresses matched."); |
143 { |
|
144 return true; |
|
145 } |
|
146 } |
134 } |
147 } |
135 } |
148 } |
136 } |
149 return (false); // Test is passed |
|
150 } |
137 } |
151 // ============================================================================== |
138 // ============================================================================== |
152 |
139 |
153 /* |
140 /* |
154 * Test the service flow tlv implementation. |
141 * Test the service flow tlv implementation. |
158 public: |
145 public: |
159 Ns3WimaxSfTlvTestCase (); |
146 Ns3WimaxSfTlvTestCase (); |
160 virtual ~Ns3WimaxSfTlvTestCase (); |
147 virtual ~Ns3WimaxSfTlvTestCase (); |
161 |
148 |
162 private: |
149 private: |
163 virtual bool DoRun (void); |
150 virtual void DoRun (void); |
164 |
151 |
165 }; |
152 }; |
166 |
153 |
167 Ns3WimaxSfTlvTestCase::Ns3WimaxSfTlvTestCase () |
154 Ns3WimaxSfTlvTestCase::Ns3WimaxSfTlvTestCase () |
168 : TestCase ("Test the service flow tlv implementation.") |
155 : TestCase ("Test the service flow tlv implementation.") |
171 |
158 |
172 Ns3WimaxSfTlvTestCase::~Ns3WimaxSfTlvTestCase () |
159 Ns3WimaxSfTlvTestCase::~Ns3WimaxSfTlvTestCase () |
173 { |
160 { |
174 } |
161 } |
175 |
162 |
176 bool |
163 void |
177 Ns3WimaxSfTlvTestCase::DoRun (void) |
164 Ns3WimaxSfTlvTestCase::DoRun (void) |
178 { |
165 { |
179 IpcsClassifierRecord classifier = IpcsClassifierRecord (); |
166 IpcsClassifierRecord classifier = IpcsClassifierRecord (); |
180 CsParameters csParam (CsParameters::ADD, classifier); |
167 CsParameters csParam (CsParameters::ADD, classifier); |
181 ServiceFlow sf = ServiceFlow (ServiceFlow::SF_DIRECTION_DOWN); |
168 ServiceFlow sf = ServiceFlow (ServiceFlow::SF_DIRECTION_DOWN); |
197 Tlv tlvReceived; |
184 Tlv tlvReceived; |
198 packet->RemoveHeader (tlvReceived); |
185 packet->RemoveHeader (tlvReceived); |
199 |
186 |
200 ServiceFlow sfRecv = ServiceFlow (tlvReceived); |
187 ServiceFlow sfRecv = ServiceFlow (tlvReceived); |
201 |
188 |
202 |
189 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetDirection (), ServiceFlow::SF_DIRECTION_DOWN, "The sfRecv had the wrong direction."); |
203 if (sfRecv.GetDirection () != ServiceFlow::SF_DIRECTION_DOWN |
190 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetSfid (), 100, "The sfRecv had the wrong sfid."); |
204 || sfRecv.GetSfid () != 100 |
191 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetCsSpecification (), ServiceFlow::IPV4, "The sfRecv had the wrong cs specification."); |
205 || sfRecv.GetCsSpecification () != ServiceFlow::IPV4 |
192 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetServiceSchedulingType (), ServiceFlow::SF_TYPE_UGS, "The sfRecv had the wrong service scheduling type."); |
206 || sfRecv.GetServiceSchedulingType () != ServiceFlow::SF_TYPE_UGS |
193 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxSustainedTrafficRate (), 1000000, "The sfRecv had the wrong maximum sustained traffic rate."); |
207 || sfRecv.GetMaxSustainedTrafficRate () != 1000000 |
194 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinReservedTrafficRate (), 1000000, "The sfRecv had the wrong minimum reserved traffic rate."); |
208 || sfRecv.GetMinReservedTrafficRate () != 1000000 |
195 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinTolerableTrafficRate (), 1000000, "The sfRecv had the wrong minimum tolerable traffic rate."); |
209 || sfRecv.GetMinTolerableTrafficRate () != 1000000 |
196 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaximumLatency (), 10, "The sfRecv had the wrong maximum latency."); |
210 || sfRecv.GetMaximumLatency () != 10 |
197 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxTrafficBurst (), 1000, "The sfRecv had the wrong maximum traffic burst."); |
211 || sfRecv.GetMaxTrafficBurst () != 1000 |
198 NS_TEST_ASSERT_MSG_EQ (sfRecv.GetTrafficPriority (), 1, "The sfRecv had the wrong traffic priority."); |
212 || sfRecv.GetTrafficPriority () != 1) |
|
213 { |
|
214 return true; |
|
215 } |
|
216 |
|
217 return false; // Test is passed |
|
218 } |
199 } |
219 |
200 |
220 // ============================================================================== |
201 // ============================================================================== |
221 class Ns3WimaxTlvTestSuite : public TestSuite |
202 class Ns3WimaxTlvTestSuite : public TestSuite |
222 { |
203 { |