24
|
1 |
// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Implements the integration tests for the SPUD using RawIpNif
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
|
|
24 |
#include "te_spudNetworkSideSteps.h"
|
|
25 |
#include <c32comm.h> // uniquely for the call to StartC32WithCMISuppressions
|
|
26 |
#include "spudNetSideQos.h"
|
|
27 |
#include <simtsy.h>
|
|
28 |
#include <commdbconnpref.h>
|
|
29 |
#include <nifvar.h> // Nifman Progress notifications
|
|
30 |
#include <in_sock.h>
|
|
31 |
#include <es_enum.h>
|
|
32 |
#include <comms-infras/es_config.h>
|
|
33 |
#include <nifman.h>
|
|
34 |
|
|
35 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
36 |
#include <networking/qoslib.h>
|
|
37 |
#else
|
|
38 |
#include <commsdat.h>
|
|
39 |
#include <commsdattypesv1_1.h>
|
|
40 |
#include <commsdattypeinfov1_1_internal.h>
|
|
41 |
#endif
|
|
42 |
|
|
43 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
44 |
using namespace CommsDat;
|
|
45 |
#define PDPIAP 2
|
|
46 |
#endif
|
|
47 |
|
|
48 |
using namespace te_spudNetworkSide;
|
|
49 |
|
|
50 |
_LIT(KCsyName,"PKTLOOPBACK");
|
|
51 |
_LIT8(KCommWriteData, "Data to send");
|
|
52 |
_LIT8(KCommWriteData2, "Second data to send");
|
|
53 |
// length of a buffer long enough to read KCommWriteData
|
|
54 |
const TUint KCommReadBufSize = 64;
|
|
55 |
|
|
56 |
// These aren't defined in a common header file.
|
|
57 |
static const RProperty::TType KUidPSCsyWriteResultCategoryKeyType = RProperty::EInt;
|
|
58 |
static const TUid KUidPSCsyWriteResultCategory = {0x10206869}; //KUidLoopbackCSYMin + 5
|
|
59 |
|
|
60 |
const TTimeIntervalMicroSeconds32 KReadDelay(10000000);
|
|
61 |
const TUint KTimeToStartSecondary(1000000*5); // give it 5 seconds in case logging is on
|
|
62 |
|
|
63 |
/**
|
|
64 |
Implements the pure virtual doTestStepPreambleL defined in CTestStep.
|
|
65 |
Used to disable the phone book synchronizer
|
|
66 |
which may cause the tests to fail.
|
|
67 |
|
|
68 |
|
|
69 |
@return EPass if successful.
|
|
70 |
@leave If Phonebook synchronizer disabling fails.
|
|
71 |
*/
|
|
72 |
TVerdict CSpudNetSideTestBase::doTestStepPreambleL()
|
|
73 |
{
|
|
74 |
_LIT(KPhbkSyncCMI, "phbsync.cmi");
|
|
75 |
TInt err = StartC32WithCMISuppressions(KPhbkSyncCMI);
|
|
76 |
TESTL(KErrNone == err || KErrAlreadyExists == err);
|
|
77 |
INFO_PRINTF1(_L("Test Step Preamble: disabled Phonebook Synchronizer."));
|
|
78 |
return EPass;
|
|
79 |
}
|
|
80 |
|
|
81 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
82 |
TVerdict CSpudNetSideTestBase::doTestStepPostambleL()
|
|
83 |
{
|
|
84 |
ClearPolicySelector2QosParametersTableL();
|
|
85 |
return TestStepResult();
|
|
86 |
}
|
|
87 |
#endif
|
|
88 |
|
|
89 |
void CSpudNetSideTestBase::FailNextPktLoopbackCsyWriteL(TInt aPortNum, TInt aErrorCode)
|
|
90 |
{
|
|
91 |
TInt dummy(0);
|
|
92 |
TInt ret = RProperty::Get(KUidPSCsyWriteResultCategory, aPortNum, dummy);
|
|
93 |
if(ret == KErrNotFound)
|
|
94 |
{
|
|
95 |
RProperty::Define(KUidPSCsyWriteResultCategory, aPortNum, KUidPSCsyWriteResultCategoryKeyType);
|
|
96 |
}
|
|
97 |
TestL(RProperty::Set(KUidPSCsyWriteResultCategory, aPortNum, aErrorCode), _L("Set PSCsy write result"));
|
|
98 |
INFO_PRINTF3(_L("Next write on [PKTLOOPBACK::%d] is going to fail with [%d]"), aPortNum, aErrorCode);
|
|
99 |
}
|
|
100 |
|
|
101 |
/**
|
|
102 |
Blocks until Nifman progress notification is received.
|
|
103 |
|
|
104 |
|
|
105 |
@param aReqStatus Request status to wait on for the notification
|
|
106 |
@param aProgress Nifman progress notification code, for sanity check. This is the progress that was subscribed for.
|
|
107 |
@param aErrCode expected progress error code.
|
|
108 |
@leave if the error code received is not equal to the expected.
|
|
109 |
*/
|
|
110 |
void CSpudNetSideTestBase::WaitForProgressNotificationL(TRequestStatus& aReqStatus, TInt aProgress, TInt aErrCode)
|
|
111 |
{
|
|
112 |
INFO_PRINTF3(_L("Waiting for Nifman Progress: stage[%d] with error[%d]"), aProgress, aErrCode);
|
|
113 |
User::WaitForRequest(aReqStatus);
|
|
114 |
if(KErrNone != aReqStatus.Int())
|
|
115 |
{
|
|
116 |
INFO_PRINTF2(_L("Unexpected error on progress notification: [%d]"), aReqStatus.Int());
|
|
117 |
User::Leave(aReqStatus.Int());
|
|
118 |
}
|
|
119 |
|
|
120 |
INFO_PRINTF3(_L("Received Progress [%d], error[%d]"), iProgressBuf().iStage, iProgressBuf().iError);
|
|
121 |
|
|
122 |
if(aErrCode != iProgressBuf().iError)
|
|
123 |
{
|
|
124 |
User::Leave(KErrArgument);
|
|
125 |
}
|
|
126 |
|
|
127 |
ASSERT(aProgress == iProgressBuf().iStage); // Error in Nifman Progress Notification mechanism
|
|
128 |
}
|
|
129 |
|
|
130 |
/**
|
|
131 |
Retrieves the PDP context type (EPrimaryContext or ESecondaryContext) from the configuration file
|
|
132 |
|
|
133 |
@param aContextTypeName the name of the context to retrieve the type for
|
|
134 |
@return the type of fhe context
|
|
135 |
@leave if this setting is not in the configuration file, or if the type is unrecognized
|
|
136 |
*/
|
|
137 |
TContextType CSpudNetSideTestBase::RetrieveContextTypeFromConfigL(const TDesC& aContextTypeName)
|
|
138 |
{
|
|
139 |
TPtrC eventStr;
|
|
140 |
if(!GetStringFromConfig(ConfigSection(), aContextTypeName, eventStr))
|
|
141 |
{
|
|
142 |
INFO_PRINTF2(_L("Context config type[%S] not in config. Leaving with KErrNotFound"), &aContextTypeName);
|
|
143 |
User::Leave(KErrNotFound);
|
|
144 |
}
|
|
145 |
|
|
146 |
INFO_PRINTF3(_L("Context type is [%S] for request [%S]"), &eventStr, &aContextTypeName);
|
|
147 |
|
|
148 |
// convert the enum
|
|
149 |
TContextType contextType(EPrimaryContext);
|
|
150 |
if(eventStr.Compare(TPtrC(_L("EPrimaryContext"))) == 0)
|
|
151 |
{
|
|
152 |
contextType = EPrimaryContext;
|
|
153 |
}
|
|
154 |
else if(eventStr.Compare(TPtrC(_L("ESecondaryContext"))) == 0)
|
|
155 |
{
|
|
156 |
contextType = ESecondaryContext;
|
|
157 |
}
|
|
158 |
else
|
|
159 |
{
|
|
160 |
INFO_PRINTF2(_L("Context type [%S] does not match 'EPrimaryContext' or 'ESecondaryContext'"), &eventStr);
|
|
161 |
User::Leave(KErrCorrupt);
|
|
162 |
}
|
|
163 |
|
|
164 |
return contextType;
|
|
165 |
}
|
|
166 |
|
|
167 |
/**
|
|
168 |
Retrieves the COMM role (DTE / DCE) from config
|
|
169 |
|
|
170 |
@param aCommRoleName the name of the parameter to retrieve the role for
|
|
171 |
@return the comm role
|
|
172 |
@leave the setting is not found or if the role is unrecognized
|
|
173 |
*/
|
|
174 |
TCommRole CSpudNetSideTestBase::RetrieveCommRoleFromConfigL(const TDesC& aCommRoleName)
|
|
175 |
{
|
|
176 |
TPtrC roleStr;
|
|
177 |
if(!GetStringFromConfig(ConfigSection(), aCommRoleName, roleStr))
|
|
178 |
{
|
|
179 |
INFO_PRINTF2(_L("Comm role[%S] not in config. Leaving with KErrNotFound"), &aCommRoleName);
|
|
180 |
User::Leave(KErrNotFound);
|
|
181 |
}
|
|
182 |
|
|
183 |
INFO_PRINTF3(_L("Comm role is [%S] for request [%S]"), &roleStr, &aCommRoleName);
|
|
184 |
|
|
185 |
// convert the enum
|
|
186 |
TCommRole commRole(ECommRoleDTE);
|
|
187 |
if(roleStr.Compare(TPtrC(_L("ECommRoleDTE"))) == 0)
|
|
188 |
{
|
|
189 |
commRole = ECommRoleDTE;
|
|
190 |
}
|
|
191 |
else if(roleStr.Compare(TPtrC(_L("ECommRoleDCE"))) == 0)
|
|
192 |
{
|
|
193 |
commRole = ECommRoleDCE;
|
|
194 |
}
|
|
195 |
else
|
|
196 |
{
|
|
197 |
INFO_PRINTF2(_L("Comm role [%S] does not match 'ECommRoleDTE' or 'ECommRoleDCE'"), &roleStr);
|
|
198 |
User::Leave(KErrCorrupt);
|
|
199 |
}
|
|
200 |
|
|
201 |
return commRole;
|
|
202 |
}
|
|
203 |
|
|
204 |
/**
|
|
205 |
Retrieves the value of the network side event from the configuration file
|
|
206 |
|
|
207 |
@param the name of the even parameter
|
|
208 |
@return the network side event value (actually an index in publish-subscribe section in the SIM.TSY config.txt)
|
|
209 |
@leave if the setting cannot be found
|
|
210 |
*/
|
|
211 |
TInt CSpudNetSideTestBase::RetrieveNetSideEventValFromConfigL(const TDesC& aEventValName)
|
|
212 |
{
|
|
213 |
TInt val(0);
|
|
214 |
if(!GetIntFromConfig(ConfigSection(), aEventValName, val))
|
|
215 |
{
|
|
216 |
User::Leave(KErrNotFound);
|
|
217 |
}
|
|
218 |
return val;
|
|
219 |
}
|
|
220 |
|
|
221 |
/**
|
|
222 |
Retrieves the type of the network side event (QoS Change, ContextStatus change, etc)
|
|
223 |
|
|
224 |
@param aEventName event parameter name
|
|
225 |
@return the event type
|
|
226 |
@leave if parameter cannot be found, or if the value is unrecognized
|
|
227 |
*/
|
|
228 |
TEtelRequestType CSpudNetSideTestBase::RetrieveNetSideEventRequestFromConfigL(const TDesC& aEventName)
|
|
229 |
{
|
|
230 |
TPtrC eventStr;
|
|
231 |
if(!GetStringFromConfig(ConfigSection(), aEventName, eventStr))
|
|
232 |
{
|
|
233 |
INFO_PRINTF2(_L("NetSide event [%S] not in config. Leaving with KErrNotFound"), &aEventName);
|
|
234 |
User::Leave(KErrNotFound);
|
|
235 |
}
|
|
236 |
|
|
237 |
INFO_PRINTF3(_L("NetSide event is [%S] for request [%S]"), &eventStr, &aEventName);
|
|
238 |
|
|
239 |
// convert the enum
|
|
240 |
TEtelRequestType request(EInvalidRequest);
|
|
241 |
if(eventStr.Compare(TPtrC(_L("ENetworkQoSChange"))) == 0)
|
|
242 |
{
|
|
243 |
request = ENetworkQoSChange;
|
|
244 |
}
|
|
245 |
else if(eventStr.Compare(TPtrC(_L("ENetworkChangeRegStatus"))) == 0)
|
|
246 |
{
|
|
247 |
request = ENetworkChangeRegStatus;
|
|
248 |
}
|
|
249 |
else if(eventStr.Compare(TPtrC(_L("EContextStatusChange"))) == 0)
|
|
250 |
{
|
|
251 |
request = EContextStatusChange;
|
|
252 |
}
|
|
253 |
else
|
|
254 |
{
|
|
255 |
ERR_PRINTF2(_L("Unknown event [%S] requested. Leaving with KErrArgument"), &eventStr);
|
|
256 |
User::Leave(KErrArgument);
|
|
257 |
}
|
|
258 |
return request;
|
|
259 |
}
|
|
260 |
|
|
261 |
/**
|
|
262 |
Sets the section for the simtsy to use in its config.txt file.
|
|
263 |
The section that will be used is testX, where X is the parameter aTestNumber
|
|
264 |
*/
|
|
265 |
void CSpudNetSideTestBase::SetSimTsyTestNumberL(TInt aTestNumber)
|
|
266 |
{
|
|
267 |
TestL(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, aTestNumber), _L("Set Sim TSY test number"));
|
|
268 |
}
|
|
269 |
|
|
270 |
/**
|
|
271 |
Gets the mandatory settings from the test configuration
|
|
272 |
|
|
273 |
@leave if not found
|
|
274 |
*/
|
|
275 |
void CSpudNetSideTestBase::RetrieveMandatorySettingsFromConfigL()
|
|
276 |
{
|
|
277 |
if(!GetIntFromConfig(ConfigSection(), _L("SimTsyTestNum"), iSimTsyTestNum))
|
|
278 |
{
|
|
279 |
ERR_PRINTF1(_L("Failed to read mandatory settings (SimTsyTestNum, etc) from the config file."));
|
|
280 |
User::Leave(KErrNotFound);
|
|
281 |
}
|
|
282 |
}
|
|
283 |
|
|
284 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
285 |
/**
|
|
286 |
Read Qos Parameter Settings from config
|
|
287 |
|
|
288 |
@leave if not found
|
|
289 |
*/
|
|
290 |
void CSpudNetSideTestBase::ReadQosParameterSettingsFromConfigL()
|
|
291 |
{
|
|
292 |
_LIT(KPolicySelector, "PolicySelector");
|
|
293 |
_LIT(KParametersType, "ParametersType");
|
|
294 |
_LIT(KGenericQosRecord, "GenericQosRecord");
|
|
295 |
_LIT(KUmtsR99QoSAndOnTableRecord, "UmtsR99QoSAndOnTableRecord");
|
|
296 |
_LIT(KParametersRecordId, "ParametersRecordId");
|
|
297 |
|
|
298 |
TPtrC parameterType;
|
|
299 |
TInt record;
|
|
300 |
|
|
301 |
if(!GetStringFromConfig(ConfigSection(), KParametersType, parameterType))
|
|
302 |
{
|
|
303 |
ERR_PRINTF1(_L("Failed to read mandatory settings (ParametersType, etc) from the config file."));
|
|
304 |
User::Leave(KErrNotFound);
|
|
305 |
}
|
|
306 |
|
|
307 |
if(!GetIntFromConfig(ConfigSection(), KParametersRecordId, record))
|
|
308 |
{
|
|
309 |
ERR_PRINTF1(_L("Failed to read mandatory settings (ParametersRecord, etc) from the config file."));
|
|
310 |
User::Leave(KErrNotFound);
|
|
311 |
}
|
|
312 |
|
|
313 |
if(!GetIntFromConfig(ConfigSection(), KPolicySelector, iPolicySelector))
|
|
314 |
{
|
|
315 |
ERR_PRINTF1(_L("Failed to read mandatory settings (PolicySelector, etc) from the config file."));
|
|
316 |
User::Leave(KErrNotFound);
|
|
317 |
}
|
|
318 |
|
|
319 |
if (parameterType.Compare(KGenericQosRecord()) == 0)
|
|
320 |
{
|
|
321 |
iQosParametersRecord = KCDTIdGenericQosRecord | record;
|
|
322 |
}
|
|
323 |
else if (parameterType.Compare(KUmtsR99QoSAndOnTableRecord()) == 0)
|
|
324 |
{
|
|
325 |
iQosParametersRecord = KCDTIdUmtsR99QoSAndOnTableRecord | record;
|
|
326 |
}
|
|
327 |
else
|
|
328 |
{
|
|
329 |
ERR_PRINTF2(_L("Invalid value for ParametersType. %S"), ¶meterType);
|
|
330 |
User::Leave(KErrArgument);
|
|
331 |
}
|
|
332 |
}
|
|
333 |
#endif
|
|
334 |
|
|
335 |
|
|
336 |
/**
|
|
337 |
Implements the pure virtual doTestStepL defined in CTestStep.
|
|
338 |
Allows the base class to execute before any of the derived
|
|
339 |
tests is called.
|
|
340 |
|
|
341 |
@leave If any of the called methods leaves.
|
|
342 |
*/
|
|
343 |
TVerdict CSpudNetSideTestBase::doTestStepL()
|
|
344 |
{
|
|
345 |
// Initialize the mandatory objects, without which there is not point in running the tests.
|
|
346 |
RetrieveMandatorySettingsFromConfigL();
|
|
347 |
|
|
348 |
TRAPD(esockConnErr, TestL(iEsock.Connect(), _L("RSockeServ::Connect")));
|
|
349 |
if(KErrNone != esockConnErr)
|
|
350 |
{
|
|
351 |
INFO_PRINTF1(_L("ESock thread is dead. Most likely, it was crashed by the previous test case. Check the Root Server logs."));
|
|
352 |
SetTestStepResult(EInconclusive);
|
|
353 |
return TestStepResult();
|
|
354 |
}
|
|
355 |
|
|
356 |
// Sim.Tsy test section to use with the test
|
|
357 |
INFO_PRINTF2(_L("Sim TSY test number: [%d]"), iSimTsyTestNum);
|
|
358 |
SetSimTsyTestNumberL(iSimTsyTestNum);
|
|
359 |
|
|
360 |
ASSERT(!CActiveScheduler::Current()); // We should not have an AS at this point.
|
|
361 |
CActiveScheduler* testSched = new(ELeave) CActiveScheduler;
|
|
362 |
CleanupStack::PushL(testSched);
|
|
363 |
CActiveScheduler::Install(testSched);
|
|
364 |
|
|
365 |
|
|
366 |
// Test sequence itself:
|
|
367 |
TVerdict testResult = EFail;
|
|
368 |
TRAPD(err, testResult = RunTestStepL());
|
|
369 |
if(KErrNone == err)
|
|
370 |
{
|
|
371 |
INFO_PRINTF1(_L("Test Step Completion."));
|
|
372 |
SetTestStepResult(testResult);
|
|
373 |
}
|
|
374 |
else
|
|
375 |
{
|
|
376 |
ERR_PRINTF2(_L("Test Step Failure: the step left with [%d]"), err);
|
|
377 |
SetTestStepResult(EFail);
|
|
378 |
}
|
|
379 |
|
|
380 |
|
|
381 |
// It's OK to close these more than once.
|
|
382 |
iLoopbackPort.Close();
|
|
383 |
iCommServer.Close();
|
|
384 |
|
|
385 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
386 |
iQoSPolicy_1.Close();
|
|
387 |
#endif
|
|
388 |
iSocketJoin.Close();
|
|
389 |
|
|
390 |
iSocket.Close();
|
|
391 |
iInterface.Close();
|
|
392 |
|
|
393 |
iEsock.Close();
|
|
394 |
|
|
395 |
CActiveScheduler::Install(NULL); // uninstall the test scheduler
|
|
396 |
CleanupStack::PopAndDestroy(testSched);
|
|
397 |
|
|
398 |
return TestStepResult();
|
|
399 |
}
|
|
400 |
|
|
401 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
402 |
/**
|
|
403 |
Blocks until a QoS event is received
|
|
404 |
|
|
405 |
@param aQosEventString the name of config parameter holding the expected event
|
|
406 |
@param aReasonCodeString the name of the config parameter holding the expected reason
|
|
407 |
@leave if the received event is not what was expected
|
|
408 |
*/
|
|
409 |
void CSpudNetSideTestBase::WaitForQoSEventL(const TDesC& aQosEventString, const TDesC& aReasonCodeString)
|
|
410 |
{
|
|
411 |
|
|
412 |
TQoSEvent expQosEvent = RetrieveQosEventFromConfigL(aQosEventString);
|
|
413 |
if(expQosEvent == EQoSEventFailure || expQosEvent == EQoSEventAdapt || expQosEvent == EQoSEventJoin)
|
|
414 |
{
|
|
415 |
TInt reason = RetrieveNetSideEventValFromConfigL(aReasonCodeString);
|
|
416 |
WaitForQoSEventL(expQosEvent,reason);
|
|
417 |
}
|
|
418 |
else
|
|
419 |
{
|
|
420 |
WaitForQoSEventL(expQosEvent,KErrNone);
|
|
421 |
}
|
|
422 |
}
|
|
423 |
|
|
424 |
/**
|
|
425 |
Blocks until a QoS event is received
|
|
426 |
|
|
427 |
@param aQosEventString the name of config parameter holding the expecting event
|
|
428 |
@param aReasonCode the expected reason
|
|
429 |
@leave if the received event is not what was expected
|
|
430 |
*/
|
|
431 |
void CSpudNetSideTestBase::WaitForQoSEventL(const TDesC& aQosEventString, TInt aReasonCode)
|
|
432 |
{
|
|
433 |
|
|
434 |
TQoSEvent expQosEvent = RetrieveQosEventFromConfigL(aQosEventString);
|
|
435 |
WaitForQoSEventL(expQosEvent,aReasonCode);
|
|
436 |
}
|
|
437 |
|
|
438 |
/**
|
|
439 |
Blocks until a QoS event is received
|
|
440 |
|
|
441 |
@param aQosEventString the expected event
|
|
442 |
@param aReasonCode the expected reason
|
|
443 |
@leave if the received event is not what was expected
|
|
444 |
*/
|
|
445 |
void CSpudNetSideTestBase::WaitForQoSEventL(TQoSEvent aQosEvent, TInt aReasonCode)
|
|
446 |
{
|
|
447 |
INFO_PRINTF1(_L("Waiting for QoS Event: starting ActiveScheduler"));
|
|
448 |
CActiveScheduler::Start();
|
|
449 |
// We have received QoS event at this point.
|
|
450 |
TPtrC expectedEvent(QoSEventToText(aQosEvent));
|
|
451 |
TPtrC receivedEvent(QoSEventToText(iReceivedQosEvent));
|
|
452 |
if(aQosEvent == EQoSEventFailure || aQosEvent == EQoSEventAdapt || aQosEvent == EQoSEventJoin)
|
|
453 |
{
|
|
454 |
INFO_PRINTF5(_L("Qos Event [%S] and Reason [%d] expected, [%S] and Reason [%d] received"), &expectedEvent,aReasonCode, &receivedEvent,iQosReason );
|
|
455 |
if(aQosEvent == iReceivedQosEvent && iQosReason == aReasonCode)
|
|
456 |
{
|
|
457 |
INFO_PRINTF1(_L("OK. correct event and reason received."));
|
|
458 |
}
|
|
459 |
else
|
|
460 |
{
|
|
461 |
INFO_PRINTF1(_L("Failure: unexpected event or reason"));
|
|
462 |
User::Leave(KErrCorrupt);
|
|
463 |
}
|
|
464 |
}
|
|
465 |
else
|
|
466 |
{
|
|
467 |
INFO_PRINTF3(_L("Qos Event [%S] expected, [%S] received"), &expectedEvent, &receivedEvent);
|
|
468 |
if(aQosEvent == iReceivedQosEvent)
|
|
469 |
{
|
|
470 |
INFO_PRINTF1(_L("OK. correct event received."));
|
|
471 |
}
|
|
472 |
else
|
|
473 |
{
|
|
474 |
INFO_PRINTF1(_L("Failure: unexpected event"));
|
|
475 |
User::Leave(KErrCorrupt);
|
|
476 |
}
|
|
477 |
}
|
|
478 |
}
|
|
479 |
|
|
480 |
/**
|
|
481 |
Wrapper for WaitForOptionalQoSEventL(TQoSEvent aQosEvent, TInt aReasonCode, TQoSEvent aOptionalQosEvent, TInt aOptionalReasonCode)
|
|
482 |
*/
|
|
483 |
void CSpudNetSideTestBase::WaitForOptionalQoSEventL(const TDesC& aQosEventString, const TDesC& aReasonCodeString, const TDesC& aOptionalQosEventString, const TDesC& aOptionalReasonCodeString)
|
|
484 |
{
|
|
485 |
TQoSEvent optionalEvent = (TQoSEvent)0;
|
|
486 |
TRAPD(err, optionalEvent = RetrieveQosEventFromConfigL(aOptionalQosEventString));
|
|
487 |
if (KErrArgument == err)
|
|
488 |
{
|
|
489 |
// Could not find any optional events
|
|
490 |
WaitForQoSEventL(aQosEventString,aReasonCodeString);
|
|
491 |
}
|
|
492 |
else
|
|
493 |
{
|
|
494 |
// found an optional event
|
|
495 |
WaitForOptionalQoSEventL(aQosEventString,aReasonCodeString,optionalEvent,aOptionalReasonCodeString);
|
|
496 |
}
|
|
497 |
}
|
|
498 |
|
|
499 |
/**
|
|
500 |
Wrapper for WaitForOptionalQoSEventL(TQoSEvent aQosEvent, TInt aReasonCode, TQoSEvent aOptionalQosEvent, TInt aOptionalReasonCode)
|
|
501 |
*/
|
|
502 |
void CSpudNetSideTestBase::WaitForOptionalQoSEventL(const TDesC& aQosEventString, const TDesC& aReasonCodeString, TQoSEvent aOptionalQosEvent, const TDesC& aOptionalReasonCodeString)
|
|
503 |
{
|
|
504 |
TQoSEvent expQosEvent = RetrieveQosEventFromConfigL(aQosEventString);
|
|
505 |
TInt expQosReason = KErrNone;
|
|
506 |
TInt optionalExpQosReason = KErrNone;
|
|
507 |
if(expQosEvent == EQoSEventFailure || expQosEvent == EQoSEventAdapt || expQosEvent == EQoSEventJoin)
|
|
508 |
{
|
|
509 |
expQosReason = RetrieveNetSideEventValFromConfigL(aReasonCodeString);
|
|
510 |
}
|
|
511 |
if(aOptionalQosEvent == EQoSEventFailure || aOptionalQosEvent == EQoSEventAdapt || aOptionalQosEvent == EQoSEventJoin)
|
|
512 |
{
|
|
513 |
optionalExpQosReason = RetrieveNetSideEventValFromConfigL(aOptionalReasonCodeString);
|
|
514 |
}
|
|
515 |
WaitForOptionalQoSEventL(expQosEvent, expQosReason, aOptionalQosEvent, optionalExpQosReason);
|
|
516 |
}
|
|
517 |
|
|
518 |
/**
|
|
519 |
Blocks until a QoS event is received
|
|
520 |
|
|
521 |
@param aQosEventString the expected event
|
|
522 |
@param aReasonCode the expected reason
|
|
523 |
@leave if the received event is not what was expected
|
|
524 |
*/
|
|
525 |
void CSpudNetSideTestBase::WaitForOptionalQoSEventL(TQoSEvent aQosEvent, TInt aReasonCode, TQoSEvent aOptionalQosEvent, TInt aOptionalReasonCode)
|
|
526 |
{
|
|
527 |
INFO_PRINTF1(_L("Waiting for optional QoS Event: starting ActiveScheduler"));
|
|
528 |
CActiveScheduler::Start();
|
|
529 |
// We have received QoS event at this point.
|
|
530 |
TPtrC expectedEvent(QoSEventToText(aQosEvent));
|
|
531 |
TPtrC receivedEvent(QoSEventToText(iReceivedQosEvent));
|
|
532 |
if(iReceivedQosEvent == EQoSEventFailure || iReceivedQosEvent == EQoSEventAdapt || iReceivedQosEvent == EQoSEventJoin)
|
|
533 |
{
|
|
534 |
INFO_PRINTF5(_L("Qos Event [%S] and Reason [%d] expected, [%S] and Reason [%d] received"), &expectedEvent,aReasonCode, &receivedEvent,iQosReason );
|
|
535 |
if(aQosEvent == iReceivedQosEvent && iQosReason == aReasonCode)
|
|
536 |
{
|
|
537 |
INFO_PRINTF1(_L("OK. correct event and reason received."));
|
|
538 |
return;
|
|
539 |
}
|
|
540 |
else if (aOptionalQosEvent != iReceivedQosEvent || iQosReason != aOptionalReasonCode)
|
|
541 |
{
|
|
542 |
INFO_PRINTF1(_L("Failure: unexpected event or reason"));
|
|
543 |
User::Leave(KErrCorrupt);
|
|
544 |
}
|
|
545 |
INFO_PRINTF1(_L("OK. optional event and reason received."));
|
|
546 |
// fall through and wait for non-optional event
|
|
547 |
}
|
|
548 |
else
|
|
549 |
{
|
|
550 |
INFO_PRINTF3(_L("Qos Event [%S] expected, [%S] received"), &expectedEvent, &receivedEvent);
|
|
551 |
if(aQosEvent == iReceivedQosEvent)
|
|
552 |
{
|
|
553 |
INFO_PRINTF1(_L("OK. correct event received."));
|
|
554 |
return;
|
|
555 |
}
|
|
556 |
else if (aOptionalQosEvent != iReceivedQosEvent)
|
|
557 |
{
|
|
558 |
INFO_PRINTF1(_L("Failure: unexpected event"));
|
|
559 |
User::Leave(KErrCorrupt);
|
|
560 |
}
|
|
561 |
// fall through and wait for non-optional event
|
|
562 |
}
|
|
563 |
|
|
564 |
INFO_PRINTF1(_L("Waiting for second QoS Event: starting ActiveScheduler"));
|
|
565 |
CActiveScheduler::Start();
|
|
566 |
// We have received QoS event at this point.
|
|
567 |
if(aQosEvent == EQoSEventFailure || aQosEvent == EQoSEventAdapt || aQosEvent == EQoSEventJoin)
|
|
568 |
{
|
|
569 |
INFO_PRINTF5(_L("Qos Event [%S] and Reason [%d] expected, [%S] and Reason [%d] received"), &expectedEvent,aReasonCode, &receivedEvent,iQosReason );
|
|
570 |
if(aQosEvent == iReceivedQosEvent && iQosReason == aReasonCode)
|
|
571 |
{
|
|
572 |
INFO_PRINTF1(_L("OK. correct event and reason received."));
|
|
573 |
}
|
|
574 |
else
|
|
575 |
{
|
|
576 |
INFO_PRINTF1(_L("Failure: unexpected event or reason"));
|
|
577 |
User::Leave(KErrCorrupt);
|
|
578 |
}
|
|
579 |
}
|
|
580 |
else
|
|
581 |
{
|
|
582 |
INFO_PRINTF3(_L("Qos Event [%S] expected, [%S] received"), &expectedEvent, &receivedEvent);
|
|
583 |
if(aQosEvent == iReceivedQosEvent)
|
|
584 |
{
|
|
585 |
INFO_PRINTF1(_L("OK. correct event received."));
|
|
586 |
}
|
|
587 |
else
|
|
588 |
{
|
|
589 |
INFO_PRINTF1(_L("Failure: unexpected event"));
|
|
590 |
User::Leave(KErrCorrupt);
|
|
591 |
}
|
|
592 |
}
|
|
593 |
}
|
|
594 |
|
|
595 |
/**
|
|
596 |
Upcall from the QoS framework on reception of a QoS event
|
|
597 |
*/
|
|
598 |
void CSpudNetSideTestBase::Event(const CQoSEventBase& aEvent)
|
|
599 |
{
|
|
600 |
CActiveScheduler::Stop();
|
|
601 |
|
|
602 |
INFO_PRINTF1(_L("QoS Event received: stopping ActiveScheduler"));
|
|
603 |
iReceivedQosEvent = (TQoSEvent)aEvent.EventType();
|
|
604 |
switch(aEvent.EventType())
|
|
605 |
{
|
|
606 |
case EQoSEventFailure:
|
|
607 |
{
|
|
608 |
iQosReason = (static_cast<const CQoSFailureEvent*>(&aEvent))->Reason();
|
|
609 |
|
|
610 |
INFO_PRINTF2(_L("Receive CQoSFailureEvent reason: %d"),iQosReason );
|
|
611 |
break;
|
|
612 |
}
|
|
613 |
|
|
614 |
case EQoSEventAdapt:
|
|
615 |
{
|
|
616 |
iQosReason = (static_cast<const CQoSAdaptEvent*>(&aEvent))->Reason();
|
|
617 |
|
|
618 |
INFO_PRINTF2(_L("Receive CQoSAdaptEvent reason: %d"),iQosReason );
|
|
619 |
break;
|
|
620 |
}
|
|
621 |
|
|
622 |
case EQoSEventJoin:
|
|
623 |
{
|
|
624 |
iQosReason = (static_cast<const CQoSJoinEvent*>(&aEvent))->Reason();
|
|
625 |
|
|
626 |
INFO_PRINTF2(_L("Receive CQoSJoinEvent reason: %d"),iQosReason );
|
|
627 |
break;
|
|
628 |
}
|
|
629 |
|
|
630 |
default:
|
|
631 |
break;
|
|
632 |
}
|
|
633 |
}
|
|
634 |
#endif // SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
635 |
|
|
636 |
/**
|
|
637 |
Logs a message and leaves on error
|
|
638 |
|
|
639 |
@param aErrCode error code to check
|
|
640 |
@param aMsg message to log
|
|
641 |
@leave if aError is other than KErrNone
|
|
642 |
*/
|
|
643 |
void CSpudNetSideTestBase::TestL(TInt aErrCode, const TDesC& aMsg)
|
|
644 |
{
|
|
645 |
TestL(aErrCode, KErrNone, aMsg);
|
|
646 |
}
|
|
647 |
|
|
648 |
/**
|
|
649 |
Used to verify that an error code is what expected, and log the associated comment
|
|
650 |
|
|
651 |
@param aErrCode the error code to check
|
|
652 |
@param aExpErrCode the expected error code
|
|
653 |
@param aMsg the message to log before testing
|
|
654 |
@leave if aErrCode != aExpErrCode
|
|
655 |
*/
|
|
656 |
void CSpudNetSideTestBase::TestL(TInt aErrCode, TInt aExpErrCode, const TDesC& aMsg)
|
|
657 |
{
|
|
658 |
if(aExpErrCode == aErrCode)
|
|
659 |
{
|
|
660 |
INFO_PRINTF3(_L("[%S]. err[%d], as expected. OK."), &aMsg, aErrCode);
|
|
661 |
}
|
|
662 |
else
|
|
663 |
{
|
|
664 |
ERR_PRINTF5(_L("Failed: [%S]. err[%d], expected [%d]. Leaving with [%d])."), &aMsg, aErrCode, aExpErrCode, aErrCode);
|
|
665 |
User::Leave(aErrCode);
|
|
666 |
}
|
|
667 |
}
|
|
668 |
|
|
669 |
/**
|
|
670 |
Used to verify that a boolean is as expected, and log the associated comment
|
|
671 |
|
|
672 |
@param aBool the boolean to check
|
|
673 |
@param aMsg the message to log before testing
|
|
674 |
@leave if aBool == EFalse
|
|
675 |
*/
|
|
676 |
void CSpudNetSideTestBase::TestBooleanTrueL(TBool aBool, const TDesC& aMsg)
|
|
677 |
{
|
|
678 |
if(aBool)
|
|
679 |
{
|
|
680 |
INFO_PRINTF2(_L("[%S]. Value is true, as expected. OK."), &aMsg);
|
|
681 |
}
|
|
682 |
else
|
|
683 |
{
|
|
684 |
ERR_PRINTF2(_L("Failed: [%S]. Value is false. Leaving with KErrGeneral)."), &aMsg);
|
|
685 |
User::Leave(KErrGeneral);
|
|
686 |
}
|
|
687 |
}
|
|
688 |
|
|
689 |
/**
|
|
690 |
Starts only the primary PDP context by explicitly starting a network interface.
|
|
691 |
|
|
692 |
@leave if the interface start error is not what is expected.
|
|
693 |
*/
|
|
694 |
void CSpudNetSideTestBase::StartPrimaryOnlyL()
|
|
695 |
{
|
|
696 |
TInt primaryCreationErr(KErrNone);
|
|
697 |
TInt primaryIapId(0);
|
|
698 |
if(!GetIntFromConfig(ConfigSection(), _L("PrimaryIapId1"), primaryIapId) ||
|
|
699 |
!GetIntFromConfig(ConfigSection(), _L("PrimaryActivationErr1"), primaryCreationErr))
|
|
700 |
{
|
|
701 |
User::Leave(KErrNotFound);
|
|
702 |
}
|
|
703 |
|
|
704 |
TCommDbConnPref iap1prefs;
|
|
705 |
iap1prefs.SetIapId(primaryIapId);
|
|
706 |
TestL(iInterface.Open(iEsock), _L("RConnection::Open on interface"));
|
|
707 |
TestL(iInterface.Start(iap1prefs),primaryCreationErr, _L("RConnection::Start on interface"));
|
|
708 |
}
|
|
709 |
|
|
710 |
/**
|
|
711 |
Opens a socket, binds it, connects it to the destination.
|
|
712 |
N.B. This socket is NOT explicitly bound to the primary PDP context
|
|
713 |
|
|
714 |
@leave if the socket cannot be opened.
|
|
715 |
*/
|
|
716 |
void CSpudNetSideTestBase::OpenPrimarySocketL()
|
|
717 |
{
|
|
718 |
TestL(iSocket.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp), _L("RSocket::Open"));
|
|
719 |
TInetAddr localAddr;
|
|
720 |
localAddr.SetPort(KConfiguredTftFilter1DestPort);
|
|
721 |
TestL(iSocket.Bind(localAddr), _L("Binding the local Socket"));
|
|
722 |
|
|
723 |
|
|
724 |
TInetAddr dstAddr;
|
|
725 |
dstAddr.SetPort(KConfiguredTftFilter1SrcPort);
|
|
726 |
dstAddr.Input(KConfiguredTftFilter1SrcAddr);
|
|
727 |
|
|
728 |
TRequestStatus status;
|
|
729 |
iSocket.Connect(dstAddr, status);
|
|
730 |
User::WaitForRequest(status);
|
|
731 |
TestL(status.Int(), _L("RSocket::Connect status opening primary socket"));
|
|
732 |
}
|
|
733 |
|
|
734 |
/**
|
|
735 |
Causes GUQoS to activate a secondary PDP context
|
|
736 |
|
|
737 |
@leave if the secondary cannot be activated
|
|
738 |
*/
|
|
739 |
void CSpudNetSideTestBase::StartSecondaryL()
|
|
740 |
{
|
|
741 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
742 |
// get IAP no. from config, added for R4 and R5 tests,
|
|
743 |
// If there isn't an IAP number in the .ini file, default to PDPIAP
|
|
744 |
TInt iap;
|
|
745 |
if(!GetIntFromConfig(ConfigSection(), _L("PrimaryIapId1"), iap))
|
|
746 |
{
|
|
747 |
iap = PDPIAP;
|
|
748 |
}
|
|
749 |
|
|
750 |
VerifySubconnectionCountL(_L("SubConnectionCount1"), iap);
|
|
751 |
|
|
752 |
ReadQosParameterSettingsFromConfigL();
|
|
753 |
#endif
|
|
754 |
|
|
755 |
InitiateSecondaryStartL();
|
|
756 |
|
|
757 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
758 |
WaitForQoSEventL(_L("SecondaryActivationEvent2"),_L("SecondaryActivationEvent2Reason"));
|
|
759 |
#else
|
|
760 |
User::After(KTimeToStartSecondary);
|
|
761 |
VerifySubconnectionCountL(_L("SubConnectionCount2"), iap);
|
|
762 |
#endif
|
|
763 |
}
|
|
764 |
|
|
765 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
766 |
void CSpudNetSideTestBase::VerifySubconnectionCountL(const TDesC& aSubConnDesc, TUint aIap)
|
|
767 |
{
|
|
768 |
TInt count;
|
|
769 |
if(!GetIntFromConfig(ConfigSection(), aSubConnDesc, count))
|
|
770 |
{
|
|
771 |
ERR_PRINTF2(_L("Failed to subconnection count (%S) from the config file."), &aSubConnDesc);
|
|
772 |
User::Leave(KErrNotFound);
|
|
773 |
}
|
|
774 |
VerifySubconnectionCountL(count, aIap);
|
|
775 |
}
|
|
776 |
|
|
777 |
void CSpudNetSideTestBase::VerifySubconnectionCountL(TUint aSubConnectionCount, TUint aIap)
|
|
778 |
{
|
|
779 |
TUint count;
|
|
780 |
|
|
781 |
RConnection conn;
|
|
782 |
|
|
783 |
User::LeaveIfError(conn.Open(iEsock));
|
|
784 |
CleanupClosePushL(conn);
|
|
785 |
|
|
786 |
User::LeaveIfError(conn.EnumerateConnections(count));
|
|
787 |
if (count)
|
|
788 |
{
|
|
789 |
TConnectionInfo tconninfo;
|
|
790 |
TPckg<TConnectionInfo> conninfo(tconninfo);
|
|
791 |
|
|
792 |
while(count>0)
|
|
793 |
{
|
|
794 |
User::LeaveIfError(conn.GetConnectionInfo(count, conninfo));
|
|
795 |
if (tconninfo.iIapId == aIap)
|
|
796 |
{
|
|
797 |
break;
|
|
798 |
}
|
|
799 |
|
|
800 |
count--;
|
|
801 |
}
|
|
802 |
|
|
803 |
if (count)
|
|
804 |
{
|
|
805 |
User::LeaveIfError(conn.Attach(conninfo, RConnection::EAttachTypeMonitor));
|
|
806 |
User::After(5000);
|
|
807 |
User::LeaveIfError(conn.EnumerateSubConnections(count));
|
|
808 |
}
|
|
809 |
}
|
|
810 |
CleanupStack::PopAndDestroy(&conn);
|
|
811 |
|
|
812 |
// if count is 0, then there are 0 connection and therefore 0 subconnections
|
|
813 |
INFO_PRINTF3(_L("Expected Subconnection count [%d] Actual Subconnection count [%d]"), aSubConnectionCount, count);
|
|
814 |
TestL(count == aSubConnectionCount, ETrue, _L("Comparing subconnection count."));
|
|
815 |
}
|
|
816 |
|
|
817 |
void CSpudNetSideTestBase::ClearPolicySelector2QosParametersTableL()
|
|
818 |
{
|
|
819 |
CommsDat::CMDBSession* dbSession;
|
|
820 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
821 |
dbSession = CMDBSession::NewL(KCDVersion1_2);
|
|
822 |
#else
|
|
823 |
dbSession = CMDBSession::NewL(KCDVersion1_1);
|
|
824 |
#endif
|
|
825 |
CleanupStack::PushL(dbSession);
|
|
826 |
|
|
827 |
/* delete all records for this policy selector */
|
|
828 |
CMDBRecordSet<CCDPolicySelector2ParamsRecord>* records =
|
|
829 |
new(ELeave) CMDBRecordSet<CCDPolicySelector2ParamsRecord>(KCDTIdPolicySelector2ParamsRecord);
|
|
830 |
CleanupStack::PushL(records);
|
|
831 |
|
|
832 |
TRAPD(err, records->LoadL(*dbSession));
|
|
833 |
if (err == KErrNone)
|
|
834 |
records->DeleteL(*dbSession);
|
|
835 |
CleanupStack::PopAndDestroy(records);
|
|
836 |
|
|
837 |
CleanupStack::PopAndDestroy(dbSession);
|
|
838 |
}
|
|
839 |
|
|
840 |
void CSpudNetSideTestBase::UpdatePolicySelector2QosParametersTableL(TUint aPolicySelector, TUint aQosParameter)
|
|
841 |
{
|
|
842 |
ClearPolicySelector2QosParametersTableL();
|
|
843 |
|
|
844 |
CommsDat::CMDBSession* dbSession;
|
|
845 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
846 |
dbSession = CMDBSession::NewL(KCDVersion1_2);
|
|
847 |
#else
|
|
848 |
dbSession = CMDBSession::NewL(KCDVersion1_1);
|
|
849 |
#endif
|
|
850 |
|
|
851 |
CleanupStack::PushL(dbSession);
|
|
852 |
|
|
853 |
CCDPolicySelector2ParamsRecord* newrec =
|
|
854 |
static_cast<CCDPolicySelector2ParamsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdPolicySelector2ParamsRecord));
|
|
855 |
CleanupStack::PushL(newrec);
|
|
856 |
newrec->SetRecordId(KCDNewRecordRequest);
|
|
857 |
newrec->iPolicySelectorId = aPolicySelector;
|
|
858 |
newrec->iParamsId = aQosParameter;
|
|
859 |
|
|
860 |
newrec->StoreL(*dbSession);
|
|
861 |
CleanupStack::PopAndDestroy(newrec);
|
|
862 |
|
|
863 |
CleanupStack::PopAndDestroy(dbSession);
|
|
864 |
}
|
|
865 |
#endif
|
|
866 |
|
|
867 |
/**
|
|
868 |
Initiates the start (creation & activation) of a secondary PDP context, but does not wait/verify that the context
|
|
869 |
was actually created / activated
|
|
870 |
|
|
871 |
@leave if the start cannot be initiated: a socket cannot be opened, etc
|
|
872 |
*/
|
|
873 |
void CSpudNetSideTestBase::InitiateSecondaryStartL()
|
|
874 |
{
|
|
875 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
876 |
ReadQosParameterSettingsFromConfigL();
|
|
877 |
|
|
878 |
UpdatePolicySelector2QosParametersTableL(iPolicySelector, iQosParametersRecord);
|
|
879 |
#endif
|
|
880 |
|
|
881 |
TestL(iSocket.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp), _L("RSocket::Open"));
|
|
882 |
TInetAddr localAddr;
|
|
883 |
localAddr.SetPort(KConfiguredTftFilter1DestPort);
|
|
884 |
TestL(iSocket.Bind(localAddr), _L("Binding the local Socket"));
|
|
885 |
|
|
886 |
TInetAddr dstAddr;
|
|
887 |
dstAddr.SetPort(KConfiguredTftFilter1SrcPort);
|
|
888 |
dstAddr.Input(KConfiguredTftFilter1SrcAddr);
|
|
889 |
|
|
890 |
TRequestStatus status;
|
|
891 |
iSocket.Connect(dstAddr, status);
|
|
892 |
User::WaitForRequest(status);
|
|
893 |
TestL(status.Int(), _L("Connecting to local socket"));
|
|
894 |
|
|
895 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
896 |
TQoSSelector selector;
|
|
897 |
selector.SetAddr(iSocket);
|
|
898 |
TestL(iQoSPolicy_1.Open(selector), _L("Opening Policy"));
|
|
899 |
TestL(iQoSPolicy_1.NotifyEvent(*this), _L("Requesting Event notification on QosChannel"));
|
|
900 |
|
|
901 |
CQoSParameters *parameters = new(ELeave) CQoSParameters;
|
|
902 |
CleanupStack::PushL(parameters);
|
|
903 |
|
|
904 |
SetQoSParameters(*parameters);
|
|
905 |
|
|
906 |
TestL(iQoSPolicy_1.SetQoS(*parameters), _L("Setting Qos Parameters"));
|
|
907 |
|
|
908 |
WaitForQoSEventL(_L("SecondaryActivationEvent1"),KErrNone);
|
|
909 |
|
|
910 |
CleanupStack::PopAndDestroy(parameters);
|
|
911 |
#endif
|
|
912 |
}
|
|
913 |
|
|
914 |
|
|
915 |
|
|
916 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
917 |
//This method must be called after StartSecondaryL() is called.
|
|
918 |
void CSpudNetSideTestBase::ChangeQoSL()
|
|
919 |
{
|
|
920 |
|
|
921 |
CQoSParameters *parameters = new(ELeave) CQoSParameters;
|
|
922 |
CleanupStack::PushL(parameters);
|
|
923 |
|
|
924 |
SetQoSParameters1(*parameters);
|
|
925 |
|
|
926 |
TestL(iQoSPolicy_1.SetQoS(*parameters), _L("Setting Qos Parameters"));
|
|
927 |
|
|
928 |
WaitForOptionalQoSEventL(_L("ExpQoSEvent1"), _L("ExpQoSEvent1Reason"), _L("OptionalQoSEvent1"), _L("OptionalQoSEvent1Reason"));
|
|
929 |
|
|
930 |
WaitForQoSEventL(_L("ExpQoSEvent2"),_L("ExpQoSEvent2Reason"));
|
|
931 |
|
|
932 |
CleanupStack::PopAndDestroy(parameters);
|
|
933 |
}
|
|
934 |
#endif
|
|
935 |
|
|
936 |
|
|
937 |
/**
|
|
938 |
Initialize a port on a loopback CSY (of some sort)
|
|
939 |
|
|
940 |
@leave if the port cannot be opened
|
|
941 |
*/
|
|
942 |
void CSpudNetSideTestBase::InitLoopbackL(const TDesC& aLoopbackPortName)
|
|
943 |
{
|
|
944 |
TestL(iCommServer.Connect(), _L("Connecting to Comm server"));
|
|
945 |
TestL(iCommServer.LoadCommModule(KCsyName), _L("Loading CSY"));
|
|
946 |
|
|
947 |
TCommRole commRole = RetrieveCommRoleFromConfigL(_L("CommRole"));
|
|
948 |
TestL(iLoopbackPort.Open(iCommServer, aLoopbackPortName, ECommExclusive, commRole), _L("Opening loopback port"));
|
|
949 |
}
|
|
950 |
|
|
951 |
void CSpudNetSideTestBase::SendUntilTimeoutL()
|
|
952 |
{
|
|
953 |
TBuf8<KCommReadBufSize> commReadBuf;
|
|
954 |
ASSERT(iLoopbackPort.SubSessionHandle());
|
|
955 |
|
|
956 |
TRequestStatus sendStatus, readStatus;
|
|
957 |
TInt maxIterations = 10;
|
|
958 |
// we try sending a packet a number of times, because the first packet may be sent
|
|
959 |
// before Etel has notified the SPUD of a change in context status
|
|
960 |
do
|
|
961 |
{
|
|
962 |
// small delay to allow Etel to notify SPUD of change in status
|
|
963 |
User::After(800000);
|
|
964 |
iSocket.Send(KCommWriteData, 0, sendStatus);
|
|
965 |
User::WaitForRequest(sendStatus);
|
|
966 |
TestL(sendStatus.Int(), _L("Socket send status"));
|
|
967 |
|
|
968 |
// ensure the packet was sent by reading from the loopback COMM port
|
|
969 |
// opposite the current context's COMM port
|
|
970 |
iLoopbackPort.Read(readStatus, KReadDelay, commReadBuf);
|
|
971 |
User::WaitForRequest(readStatus);
|
|
972 |
maxIterations--;
|
|
973 |
} while ( (readStatus == KErrNone) && (maxIterations > 0) );
|
|
974 |
|
|
975 |
TestL(readStatus.Int(), KErrCancel, _L("Send timed-out"));
|
|
976 |
}
|
|
977 |
|
|
978 |
void CSpudNetSideTestBase::SendSinglePacketL()
|
|
979 |
{
|
|
980 |
TBuf8<KCommReadBufSize> commReadBuf;
|
|
981 |
ASSERT(iLoopbackPort.SubSessionHandle());
|
|
982 |
|
|
983 |
TRequestStatus sendStatus, readStatus;
|
|
984 |
iSocket.Send(KCommWriteData, 0, sendStatus);
|
|
985 |
User::WaitForRequest(sendStatus);
|
|
986 |
TestL(sendStatus.Int(), _L("Primary socket send status"));
|
|
987 |
|
|
988 |
// ensure the packet was sent by reading from the loopback COMM port
|
|
989 |
// opposite the current context's COMM port
|
|
990 |
iLoopbackPort.Read(readStatus, KReadDelay, commReadBuf);
|
|
991 |
User::WaitForRequest(readStatus);
|
|
992 |
|
|
993 |
TestL(readStatus.Int(), _L("Send status"));
|
|
994 |
// make sure the received length is greater than the sent length
|
|
995 |
TInt sentLength = ((TDesC8)KCommWriteData).Length();
|
|
996 |
TestL((commReadBuf.Length() >= sentLength) ? KErrNone : KErrCorrupt, _L("Received length is greater than sent length"));
|
|
997 |
}
|
|
998 |
|
|
999 |
void CSpudNetSideTestBase::StopPrimary()
|
|
1000 |
{
|
|
1001 |
iLoopbackPort.Close();
|
|
1002 |
iCommServer.Close();
|
|
1003 |
iSocket.Close();
|
|
1004 |
}
|
|
1005 |
|
|
1006 |
/**
|
|
1007 |
Stops the secondary PDP context.
|
|
1008 |
After this method returns, GUQoS has initiated its timeout before actually deleting the context.
|
|
1009 |
That is, when this method returns, the context itself is still active
|
|
1010 |
|
|
1011 |
@leave if the procedure cannot be completed successfully.
|
|
1012 |
*/
|
|
1013 |
void CSpudNetSideTestBase::StopSecondaryL()
|
|
1014 |
{
|
|
1015 |
iLoopbackPort.Close();
|
|
1016 |
iCommServer.Close();
|
|
1017 |
|
|
1018 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1019 |
TestL(iQoSPolicy_1.CancelNotifyEvent(*this), _L("Cancelling QoS Notify"));
|
|
1020 |
TestL(iQoSPolicy_1.Close(), _L("Closing QoS Channel"));
|
|
1021 |
#endif
|
|
1022 |
iSocket.Close();
|
|
1023 |
}
|
|
1024 |
|
|
1025 |
|
|
1026 |
/**
|
|
1027 |
Retrieves a QoS event from the config file, based on the parameter name
|
|
1028 |
|
|
1029 |
@param aQosEventReq the name of the parameter
|
|
1030 |
@leave if the event cannot be retrieved, or is unrecognized.
|
|
1031 |
*/
|
|
1032 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1033 |
enum TQoSEvent CSpudNetSideTestBase::RetrieveQosEventFromConfigL(const TDesC& aQosEventReq)
|
|
1034 |
{
|
|
1035 |
TPtrC qosEventName;
|
|
1036 |
if(!GetStringFromConfig(ConfigSection(), aQosEventReq, qosEventName))
|
|
1037 |
{
|
|
1038 |
ERR_PRINTF2(_L("Failed to read [%S] from the config file."), &aQosEventReq);
|
|
1039 |
User::Leave(KErrNotFound);
|
|
1040 |
}
|
|
1041 |
|
|
1042 |
if(qosEventName.Compare(TPtrC(_L("EQoSEventFailure"))) == 0)
|
|
1043 |
{
|
|
1044 |
return EQoSEventFailure;
|
|
1045 |
}
|
|
1046 |
else if(qosEventName.Compare(TPtrC(_L("EQoSEventConfirm"))) == 0)
|
|
1047 |
{
|
|
1048 |
return EQoSEventConfirm;
|
|
1049 |
}
|
|
1050 |
else if(qosEventName.Compare(TPtrC(_L("EQoSEventAdapt"))) == 0)
|
|
1051 |
{
|
|
1052 |
return EQoSEventAdapt;
|
|
1053 |
}
|
|
1054 |
else if(qosEventName.Compare(TPtrC(_L("EQoSEventJoin"))) == 0)
|
|
1055 |
{
|
|
1056 |
return EQoSEventJoin;
|
|
1057 |
}
|
|
1058 |
else if(qosEventName.Compare(TPtrC(_L("EQoSEventAddPolicy"))) == 0)
|
|
1059 |
{
|
|
1060 |
return EQoSEventAddPolicy;
|
|
1061 |
}
|
|
1062 |
else
|
|
1063 |
{
|
|
1064 |
ERR_PRINTF2(_L("Unrecognized event[%S] requested. Leaving with KErrArgument."), &qosEventName);
|
|
1065 |
User::Leave(KErrArgument);
|
|
1066 |
}
|
|
1067 |
return EQoSEventConfirm;
|
|
1068 |
};
|
|
1069 |
#endif
|
|
1070 |
|
|
1071 |
/**
|
|
1072 |
Must be called after simtsy has been initialized.
|
|
1073 |
Instructs the simtsy to complete a given request/notification. The supported commands are given in TEtelRequestType.
|
|
1074 |
The parameter supplied in aNewValue instructs the simtsy what data from the config.txt to use in the completion of the request.
|
|
1075 |
The aNewValue is the index to the entry to be used to complete the request for the current test step section, ie if aNewValue
|
|
1076 |
is 0, iTestNumber is 3, and aEtelCommand is ENetworkQoSChange, the entry will complete any NotifyNetworkQoSChange calls
|
|
1077 |
with data from the first QosProfileReqR99 entry of section [test3] in the config.txt file
|
|
1078 |
*/
|
|
1079 |
void CSpudNetSideTestBase::EtelRequestL(TEtelRequestType aEtelCommand, TInt aNewValue)
|
|
1080 |
{
|
|
1081 |
INFO_PRINTF3(_L("EtelRequest: aEtelCommand = %d, aNewValue = %d"), aEtelCommand, aNewValue);
|
|
1082 |
|
|
1083 |
TUint key(0);
|
|
1084 |
|
|
1085 |
switch (aEtelCommand)
|
|
1086 |
{
|
|
1087 |
case ENetworkQoSChange:
|
|
1088 |
key = KPSSimTsyNetworkQoSChange;
|
|
1089 |
break;
|
|
1090 |
case ENetworkChangeRegStatus:
|
|
1091 |
key = KPSSimtsyPacketServiceNtwkRegStatusChange;
|
|
1092 |
break;
|
|
1093 |
case EContextStatusChange:
|
|
1094 |
key = KPSSimtsyPacketContextStatusChange;
|
|
1095 |
break;
|
|
1096 |
default:
|
|
1097 |
ASSERT(EFalse);
|
|
1098 |
}
|
|
1099 |
|
|
1100 |
// simtsy will listen for any changes to the property, and complete the corresponding request
|
|
1101 |
TestL(RProperty::Set(KUidPSSimTsyCategory, key, aNewValue), _L("Request to trigger SimTsy event issued."));
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
/**
|
|
1105 |
Dummy test step: Used to make sure that ESock server did not crash
|
|
1106 |
|
|
1107 |
@leave does not leave
|
|
1108 |
*/
|
|
1109 |
enum TVerdict CESockCheck::RunTestStepL()
|
|
1110 |
{
|
|
1111 |
INFO_PRINTF1(_L("SUCCESS: Could not detect Esock crash as a result of the previous test."));
|
|
1112 |
return EPass;
|
|
1113 |
}
|
|
1114 |
|
|
1115 |
/**
|
|
1116 |
Tests creation of the primary PDP context by explicitly starting the interface
|
|
1117 |
|
|
1118 |
@leave if the test fails.
|
|
1119 |
*/
|
|
1120 |
enum TVerdict CSpudPrimary::RunTestStepL()
|
|
1121 |
{
|
|
1122 |
StartPrimaryOnlyL();
|
|
1123 |
iInterface.Stop();
|
|
1124 |
iInterface.Close();
|
|
1125 |
|
|
1126 |
return EPass;
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
/**
|
|
1130 |
Test operation of the primary PDP context when there is a network side event
|
|
1131 |
|
|
1132 |
@leave if the test fails.
|
|
1133 |
*/
|
|
1134 |
enum TVerdict CSpudPrimaryEvent::RunTestStepL()
|
|
1135 |
{
|
|
1136 |
TInt idx = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
1137 |
TEtelRequestType request = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq1"));
|
|
1138 |
|
|
1139 |
TInt expProgress(0);
|
|
1140 |
TInt expErrorCode(0);
|
|
1141 |
if(!GetIntFromConfig(ConfigSection(), _L("ExpectedNifProgress"), expProgress) ||
|
|
1142 |
!GetIntFromConfig(ConfigSection(), _L("ExpectedNifError"), expErrorCode))
|
|
1143 |
{
|
|
1144 |
User::Leave(KErrNotFound);
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
StartPrimaryOnlyL();
|
|
1148 |
|
|
1149 |
|
|
1150 |
TRequestStatus progressReqSt;
|
|
1151 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt, static_cast<TUint>(expProgress));
|
|
1152 |
|
|
1153 |
EtelRequestL(request, idx); // Will fire after we register for notifications
|
|
1154 |
WaitForProgressNotificationL(progressReqSt, expProgress, expErrorCode); // We can wait here forever. Set timeout on test step.
|
|
1155 |
if(KLinkLayerClosed == expProgress) // The Nif is expected to shutdown, so if we are here, then the NIF is down.
|
|
1156 |
{
|
|
1157 |
// N.B.
|
|
1158 |
// At this point the NIF is down, and all the associated data structures in ESock server / Nifman are in
|
|
1159 |
// the process of being deleted, or have been deleted already.
|
|
1160 |
// Calling *anything* on the NIF itself is no longer possible, because there is no NIF.
|
|
1161 |
// Typically, ESock will react with KErrNotReady(-18) to these attempts.
|
|
1162 |
// Because of timing issues (ESock thread vs. TestExecute thread), especially on hardware,
|
|
1163 |
// ESock client-side objects may not be yet aware of that, and return KErrNone. This makes testing for the
|
|
1164 |
// return error codes problematic.
|
|
1165 |
// In any case, calling Stop() on the NIF is inappropriate. Close() closes the client-side handle,
|
|
1166 |
// which is OK.
|
|
1167 |
iInterface.Close();
|
|
1168 |
}
|
|
1169 |
else // The interface was not stopped. We should stop it now and verity that is was OK.
|
|
1170 |
{
|
|
1171 |
TestL(iInterface.Stop(), _L("Shutting down the interface using RConnection::Stop()"));
|
|
1172 |
}
|
|
1173 |
|
|
1174 |
return EPass;
|
|
1175 |
}
|
|
1176 |
|
|
1177 |
/**
|
|
1178 |
Test of the primary PDP context progress.
|
|
1179 |
|
|
1180 |
@leave if the test fails.
|
|
1181 |
*/
|
|
1182 |
enum TVerdict CSpudPrimaryContextEventProgress::RunTestStepL()
|
|
1183 |
{
|
|
1184 |
StartPrimaryOnlyL();
|
|
1185 |
/*
|
|
1186 |
* After opening & starting the connection, the connection goes through various states:
|
|
1187 |
* Those are KStartingSelection->KFinishedSelection->KPsdStartingConfiguration->KPsdFinishedConfiguration
|
|
1188 |
* ->KStartingConnection->KConnectionOpen->KLinkLayerOpen.
|
|
1189 |
* But if DHCP is enabled, then after KConnectionOpen the connection goes through these states.
|
|
1190 |
* KConfigDaemonLoading->KConfigDaemonLoaded->KConfigDaemonStartingRegistration
|
|
1191 |
* ->KConfigDaemonFinishedRegistration->KLinkLayerOpen.
|
|
1192 |
*/
|
|
1193 |
TRequestStatus progressReqSt;
|
|
1194 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1195 |
|
|
1196 |
User::WaitForRequest(progressReqSt);
|
|
1197 |
TestL(iProgressBuf().iStage, KStartingSelection, _L("RConnection Stage KStartingSelection"));
|
|
1198 |
|
|
1199 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1200 |
User::WaitForRequest(progressReqSt);
|
|
1201 |
TestL(iProgressBuf().iStage, KFinishedSelection, _L("RConnection Stage KFinishedSelection"));
|
|
1202 |
|
|
1203 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1204 |
User::WaitForRequest(progressReqSt);
|
|
1205 |
TestL(iProgressBuf().iStage, KPsdStartingConfiguration, _L("RConnection Stage KPsdStartingConfiguration"));
|
|
1206 |
|
|
1207 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1208 |
User::WaitForRequest(progressReqSt);
|
|
1209 |
TestL(iProgressBuf().iStage, KPsdFinishedConfiguration, _L("RConnection Stage KPsdFinishedConfiguration"));
|
|
1210 |
|
|
1211 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1212 |
User::WaitForRequest(progressReqSt);
|
|
1213 |
TestL(iProgressBuf().iStage, KPsdStartingActivation, _L("RConnection Stage KPsdStartingActivation"));
|
|
1214 |
|
|
1215 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1216 |
User::WaitForRequest(progressReqSt);
|
|
1217 |
TestL(iProgressBuf().iStage, KPsdFinishedActivation, _L("RConnection Stage KPsdFinishedActivation"));
|
|
1218 |
|
|
1219 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1220 |
User::WaitForRequest(progressReqSt);
|
|
1221 |
TestL(iProgressBuf().iStage, KLinkLayerOpen, _L("RConnection Stage KLinkLayerOpen"));
|
|
1222 |
|
|
1223 |
iInterface.Stop();
|
|
1224 |
|
|
1225 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1226 |
User::WaitForRequest(progressReqSt);
|
|
1227 |
TestL(iProgressBuf().iStage, KPsdStartingDeactivation, _L("RConnection Stage KPsdStartingDeactivation"));
|
|
1228 |
|
|
1229 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1230 |
User::WaitForRequest(progressReqSt);
|
|
1231 |
TestL(iProgressBuf().iStage, KPsdFinishedDeactivation, _L("RConnection Stage KPsdFinishedDeactivation"));
|
|
1232 |
|
|
1233 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt);
|
|
1234 |
User::WaitForRequest(progressReqSt);
|
|
1235 |
TestL(iProgressBuf().iStage, KLinkLayerClosed, _L("RConnection Stage KLinkLayerClosed"));
|
|
1236 |
|
|
1237 |
iInterface.Close();
|
|
1238 |
|
|
1239 |
return EPass;
|
|
1240 |
}
|
|
1241 |
|
|
1242 |
/**
|
|
1243 |
Test suspension of a PDP context.
|
|
1244 |
|
|
1245 |
@leave if the test fails.
|
|
1246 |
*/
|
|
1247 |
enum TVerdict CSpudSuspendContext::RunTestStepL()
|
|
1248 |
{
|
|
1249 |
TInt idx1 = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
1250 |
|
|
1251 |
// retrieve whether we are testing a primary or secondary context
|
|
1252 |
TContextType contextType = RetrieveContextTypeFromConfigL(_L("ContextType"));
|
|
1253 |
|
|
1254 |
// retrieve the port opposite the context being tested from the loopback configuration file
|
|
1255 |
TPtrC loopbackPortName;
|
|
1256 |
if(!GetStringFromConfig(ConfigSection(), _L("LoopbackPort"), loopbackPortName))
|
|
1257 |
{
|
|
1258 |
INFO_PRINTF1(_L("NetSide event [LoopbackPort] not in config. Leaving with KErrNotFound"));
|
|
1259 |
User::Leave(KErrNotFound);
|
|
1260 |
}
|
|
1261 |
|
|
1262 |
TRequestStatus status;
|
|
1263 |
|
|
1264 |
if (EPrimaryContext == contextType)
|
|
1265 |
{
|
|
1266 |
// Open a primary context specifying the RConnection explicitly so we can also test
|
|
1267 |
// RConnection::ProgressNotification to ensure KDataTransferTemporarilyBlocked is sent
|
|
1268 |
// when the primary PDP context is suspended.
|
|
1269 |
StartPrimaryOnlyL();
|
|
1270 |
|
|
1271 |
TestL(iSocket.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp, iInterface), _L("RSocket::Open"));
|
|
1272 |
TInetAddr localAddr;
|
|
1273 |
localAddr.SetPort(KConfiguredTftFilter1DestPort);
|
|
1274 |
TestL(iSocket.Bind(localAddr), _L("Binding the local Socket"));
|
|
1275 |
|
|
1276 |
TInetAddr dstAddr;
|
|
1277 |
dstAddr.SetPort(KConfiguredTftFilter1SrcPort);
|
|
1278 |
|
|
1279 |
TPtrC ip6Addr;
|
|
1280 |
if(GetStringFromConfig(ConfigSection(), _L("IP6Addr"), ip6Addr))
|
|
1281 |
{
|
|
1282 |
dstAddr.Input(ip6Addr);
|
|
1283 |
}
|
|
1284 |
else
|
|
1285 |
{
|
|
1286 |
dstAddr.Input(KConfiguredTftFilter1SrcAddr);
|
|
1287 |
}
|
|
1288 |
|
|
1289 |
iSocket.Connect(dstAddr, status);
|
|
1290 |
User::WaitForRequest(status);
|
|
1291 |
TestL(status.Int(), _L("RSocket::Connect status opening primary socket"));
|
|
1292 |
}
|
|
1293 |
else if (ESecondaryContext == contextType)
|
|
1294 |
{
|
|
1295 |
StartSecondaryL();
|
|
1296 |
}
|
|
1297 |
else
|
|
1298 |
{
|
|
1299 |
User::Leave(KErrGeneral);
|
|
1300 |
}
|
|
1301 |
|
|
1302 |
// start loopback port that packets for the current context will be sent to
|
|
1303 |
InitLoopbackL(loopbackPortName);
|
|
1304 |
|
|
1305 |
// the SPUD may not have created the first context until the first packet is sent
|
|
1306 |
SendSinglePacketL();
|
|
1307 |
|
|
1308 |
TNifProgressBuf progress;
|
|
1309 |
|
|
1310 |
// Request a progress notification for a primary context - we should be notified if the PDP context is suspended.
|
|
1311 |
if (EPrimaryContext == contextType)
|
|
1312 |
{
|
|
1313 |
iInterface.ProgressNotification(progress, status);
|
|
1314 |
}
|
|
1315 |
|
|
1316 |
// trigger suspending the context
|
|
1317 |
EtelRequestL(EContextStatusChange, idx1);
|
|
1318 |
|
|
1319 |
// ensure that the context does not send packets
|
|
1320 |
SendUntilTimeoutL();
|
|
1321 |
|
|
1322 |
// Keep waiting until a KDataTransferTemporarilyBlocked progress notification from a
|
|
1323 |
// primary context is received or the test step is timed out indicating failure.
|
|
1324 |
if (EPrimaryContext == contextType)
|
|
1325 |
{
|
|
1326 |
User::WaitForRequest( status );
|
|
1327 |
while( progress().iStage != KDataTransferTemporarilyBlocked )
|
|
1328 |
{
|
|
1329 |
iInterface.ProgressNotification(progress, status);
|
|
1330 |
User::WaitForRequest( status );
|
|
1331 |
}
|
|
1332 |
}
|
|
1333 |
|
|
1334 |
TInt idx2 = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq2Idx"));
|
|
1335 |
|
|
1336 |
// trigger resuming the context
|
|
1337 |
EtelRequestL(EContextStatusChange, idx2);
|
|
1338 |
|
|
1339 |
// ensure we can again send packets
|
|
1340 |
SendSinglePacketL();
|
|
1341 |
|
|
1342 |
if (EPrimaryContext == contextType)
|
|
1343 |
{
|
|
1344 |
iInterface.Stop();
|
|
1345 |
iInterface.Close();
|
|
1346 |
|
|
1347 |
StopPrimary();
|
|
1348 |
}
|
|
1349 |
else if (ESecondaryContext == contextType)
|
|
1350 |
{
|
|
1351 |
StopSecondaryL();
|
|
1352 |
}
|
|
1353 |
|
|
1354 |
return EPass;
|
|
1355 |
}
|
|
1356 |
|
|
1357 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1358 |
/**
|
|
1359 |
Test operation of the secondary PDP context when there is a network side event
|
|
1360 |
|
|
1361 |
@leave if the test fails.
|
|
1362 |
*/
|
|
1363 |
enum TVerdict CSpudSecondaryEvent::RunTestStepL()
|
|
1364 |
{
|
|
1365 |
|
|
1366 |
TInt idx = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
1367 |
TEtelRequestType request = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq1"));
|
|
1368 |
|
|
1369 |
StartSecondaryL();
|
|
1370 |
|
|
1371 |
EtelRequestL(request, idx);
|
|
1372 |
|
|
1373 |
WaitForOptionalQoSEventL(_L("ExpQoSEvent1"),_L("ExpQoSEvent1Reason"), _L("OptionalQoSEvent1"), _L("OptionalQoSEvent1Reason"));
|
|
1374 |
|
|
1375 |
StopSecondaryL();
|
|
1376 |
|
|
1377 |
return EPass;
|
|
1378 |
}
|
|
1379 |
#endif
|
|
1380 |
|
|
1381 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1382 |
/**
|
|
1383 |
Test operation of the secondary PDP context when there are 2 network side events.
|
|
1384 |
|
|
1385 |
@leave if the test fails.
|
|
1386 |
*/
|
|
1387 |
enum TVerdict CSpudTwoSecondaryEvents::RunTestStepL()
|
|
1388 |
{
|
|
1389 |
TInt idx1 = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
1390 |
TEtelRequestType request1 = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq1"));
|
|
1391 |
|
|
1392 |
StartSecondaryL();
|
|
1393 |
EtelRequestL(request1, idx1);
|
|
1394 |
|
|
1395 |
WaitForQoSEventL(_L("ExpQoSEvent1"),_L("ExpQoSEvent1Reason"));
|
|
1396 |
|
|
1397 |
TInt idx2 = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq2Idx"));
|
|
1398 |
TEtelRequestType request2 = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq2"));
|
|
1399 |
|
|
1400 |
EtelRequestL(request2, idx2);
|
|
1401 |
|
|
1402 |
StopSecondaryL();
|
|
1403 |
|
|
1404 |
return EPass;
|
|
1405 |
};
|
|
1406 |
#endif
|
|
1407 |
|
|
1408 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1409 |
/**
|
|
1410 |
Test operation of the secondary PDP context when there is a network side event, but after
|
|
1411 |
the context was stopped (i.e. it is being deactivated / deleted / etc)
|
|
1412 |
|
|
1413 |
@leave if the test fails.
|
|
1414 |
*/
|
|
1415 |
enum TVerdict CSpudSecondaryEvent2::RunTestStepL()
|
|
1416 |
{
|
|
1417 |
TInt idx1 = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
1418 |
TEtelRequestType request1 = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq1"));
|
|
1419 |
|
|
1420 |
StartSecondaryL();
|
|
1421 |
EtelRequestL(request1, idx1);
|
|
1422 |
|
|
1423 |
WaitForQoSEventL(_L("ExpQoSEvent1"),_L("ExpQoSEvent1Reason"));
|
|
1424 |
|
|
1425 |
StopSecondaryL();
|
|
1426 |
|
|
1427 |
TInt idx2 = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq2Idx"));
|
|
1428 |
TEtelRequestType request2 = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq2"));
|
|
1429 |
|
|
1430 |
StartSecondaryL(); // reopen the context on the same SPUD
|
|
1431 |
EtelRequestL(request2, idx2);
|
|
1432 |
|
|
1433 |
WaitForQoSEventL(_L("ExpQoSEvent2"),_L("ExpQoSEvent2Reason"));
|
|
1434 |
|
|
1435 |
StopSecondaryL();
|
|
1436 |
|
|
1437 |
return EPass;
|
|
1438 |
};
|
|
1439 |
#endif
|
|
1440 |
|
|
1441 |
/**
|
|
1442 |
Test operation of the secondary PDP context when there are no network-side events.
|
|
1443 |
|
|
1444 |
@leave if the test fails.
|
|
1445 |
*/
|
|
1446 |
enum TVerdict CSpudSecondary::RunTestStepL()
|
|
1447 |
{
|
|
1448 |
StartSecondaryL();
|
|
1449 |
StopSecondaryL();
|
|
1450 |
|
|
1451 |
return EPass;
|
|
1452 |
};
|
|
1453 |
|
|
1454 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1455 |
/**
|
|
1456 |
Test operation of the secondary PDP context when QoS is changed after the context was activated
|
|
1457 |
|
|
1458 |
@leave if the test fails.
|
|
1459 |
*/
|
|
1460 |
enum TVerdict CSpudSecondaryChangeQoS::RunTestStepL()
|
|
1461 |
{
|
|
1462 |
INFO_PRINTF1(_L("CSpudSecondaryChangeQoS test start"));
|
|
1463 |
|
|
1464 |
StartSecondaryL();
|
|
1465 |
ChangeQoSL();
|
|
1466 |
StopSecondaryL();
|
|
1467 |
return EPass;
|
|
1468 |
};
|
|
1469 |
#endif // SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1470 |
|
|
1471 |
/**
|
|
1472 |
Test the operation of the primary PDP context when there is an event when the lower NIF for the primary is being started
|
|
1473 |
|
|
1474 |
@leave if the test fails.
|
|
1475 |
*/
|
|
1476 |
enum TVerdict CSpudPrimaryEventOnLowerNifStarting::RunTestStepL()
|
|
1477 |
{
|
|
1478 |
TInt idx = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
1479 |
TEtelRequestType request = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq1"));
|
|
1480 |
|
|
1481 |
TInt expProgress(0);
|
|
1482 |
TInt expErrorCode(0);
|
|
1483 |
TInt primaryIapId(0);
|
|
1484 |
TInt millisBeforeEvent(0);
|
|
1485 |
if(!GetIntFromConfig(ConfigSection(), _L("PrimaryIapId1"), primaryIapId) ||
|
|
1486 |
!GetIntFromConfig(ConfigSection(), _L("MillisBeforeEvent"), millisBeforeEvent) ||
|
|
1487 |
!GetIntFromConfig(ConfigSection(), _L("ExpectedNifProgress"), expProgress) ||
|
|
1488 |
!GetIntFromConfig(ConfigSection(), _L("ExpectedNifError"), expErrorCode))
|
|
1489 |
{
|
|
1490 |
User::Leave(KErrNotFound);
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
TRequestStatus startReq;
|
|
1494 |
TCommDbConnPref iap1prefs;
|
|
1495 |
iap1prefs.SetIapId(primaryIapId);
|
|
1496 |
TestL(iInterface.Open(iEsock), _L("RConnection::Open on interface"));
|
|
1497 |
iInterface.Start(iap1prefs, startReq);
|
|
1498 |
|
|
1499 |
|
|
1500 |
//register for progress notification
|
|
1501 |
TRequestStatus progressReqSt;
|
|
1502 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt, KFinishedSelection);
|
|
1503 |
WaitForProgressNotificationL(progressReqSt, KFinishedSelection, KErrNone);
|
|
1504 |
|
|
1505 |
iInterface.ProgressNotification(iProgressBuf, progressReqSt, expProgress);
|
|
1506 |
|
|
1507 |
User::After(millisBeforeEvent);
|
|
1508 |
EtelRequestL(request, idx);
|
|
1509 |
WaitForProgressNotificationL(progressReqSt, static_cast<TUint>(expProgress), expErrorCode);
|
|
1510 |
|
|
1511 |
iInterface.Close();
|
|
1512 |
return EPass;
|
|
1513 |
};
|
|
1514 |
|
|
1515 |
|
|
1516 |
/**
|
|
1517 |
Test RConnection::Stop on Spud, when Spud is processing network-side event, and potentially there are
|
|
1518 |
requests outstanding on Etel
|
|
1519 |
|
|
1520 |
@leave if the test fails.
|
|
1521 |
*/
|
|
1522 |
enum TVerdict CSpudPrimaryInterfaceEventStop::RunTestStepL()
|
|
1523 |
{
|
|
1524 |
TInt idx = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
1525 |
TEtelRequestType request = RetrieveNetSideEventRequestFromConfigL(_L("QoSEventReq1"));
|
|
1526 |
|
|
1527 |
TInt primaryIapId(0);
|
|
1528 |
if(!GetIntFromConfig(ConfigSection(), _L("PrimaryIapId1"), primaryIapId))
|
|
1529 |
{
|
|
1530 |
User::Leave(KErrNotFound);
|
|
1531 |
}
|
|
1532 |
|
|
1533 |
TRequestStatus startReq;
|
|
1534 |
TCommDbConnPref iap1prefs;
|
|
1535 |
iap1prefs.SetIapId(primaryIapId);
|
|
1536 |
TestL(iInterface.Open(iEsock), _L("RConnection::Open on interface"));
|
|
1537 |
iInterface.Start(iap1prefs, startReq);
|
|
1538 |
|
|
1539 |
TInt primStartErr(KErrNone);
|
|
1540 |
if(GetIntFromConfig(ConfigSection(), _L("PrimaryStartErr1"), primStartErr))
|
|
1541 |
{
|
|
1542 |
User::WaitForRequest(startReq);
|
|
1543 |
TestL(startReq.Int(), primStartErr, _L("Interface started."));
|
|
1544 |
}
|
|
1545 |
|
|
1546 |
EtelRequestL(request, idx);
|
|
1547 |
|
|
1548 |
StopInterfaceL(); // Stop the interface when SPUD is processing the Etel event.
|
|
1549 |
return EPass;
|
|
1550 |
};
|
|
1551 |
|
|
1552 |
/**
|
|
1553 |
Test RConnection:Stop on Spud, when the primary PDP context is being started.
|
|
1554 |
|
|
1555 |
@leave if the test fails.
|
|
1556 |
*/
|
|
1557 |
enum TVerdict CSpudPrimayStartingStop::RunTestStepL()
|
|
1558 |
{
|
|
1559 |
TInt primaryCreationErr(KErrNone);
|
|
1560 |
TInt primaryIapId(0);
|
|
1561 |
if(!GetIntFromConfig(ConfigSection(), _L("PrimaryIapId1"), primaryIapId) ||
|
|
1562 |
!GetIntFromConfig(ConfigSection(), _L("PrimaryActivationErr1"), primaryCreationErr))
|
|
1563 |
{
|
|
1564 |
User::Leave(KErrNotFound);
|
|
1565 |
}
|
|
1566 |
TCommDbConnPref iap1prefs;
|
|
1567 |
iap1prefs.SetIapId(primaryIapId);
|
|
1568 |
TestL(iInterface.Open(iEsock), _L("RConnection::Open on interface"));
|
|
1569 |
|
|
1570 |
// start then stop the interface
|
|
1571 |
TRequestStatus startStatus;
|
|
1572 |
iInterface.Start(iap1prefs, startStatus);
|
|
1573 |
// wait for enough time to be initialising the phone
|
|
1574 |
User::After(5000000);
|
|
1575 |
iInterface.Stop();
|
|
1576 |
User::WaitForRequest(startStatus);
|
|
1577 |
TestL(startStatus.Int(), primaryCreationErr, _L("RConnection::Start on interface"));
|
|
1578 |
|
|
1579 |
iInterface.Close();
|
|
1580 |
|
|
1581 |
return EPass;
|
|
1582 |
}
|
|
1583 |
|
|
1584 |
/**
|
|
1585 |
Test RConnection:Stop on Spud, when the secondary PDP context is being started.
|
|
1586 |
|
|
1587 |
@leave if the test fails.
|
|
1588 |
*/
|
|
1589 |
enum TVerdict CSpudSecondaryStartingStop::RunTestStepL()
|
|
1590 |
{
|
|
1591 |
|
|
1592 |
InitiateSecondaryStartL();
|
|
1593 |
User::After(KTimeToStartSecondary);
|
|
1594 |
// We don't know for sure when the secondary is being activated (as opposed to TFT set, etc).
|
|
1595 |
// So, we must set the stop wait + activation wait to be large enough to mask the timing
|
|
1596 |
// differences on different platforms, especially, hw vs emulator.
|
|
1597 |
StopInterfaceL(); // QoSConfirm never comes, we stop the interface before it.
|
|
1598 |
|
|
1599 |
// Don't leave QoS lingering.
|
|
1600 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1601 |
TestL(iQoSPolicy_1.CancelNotifyEvent(*this), _L("Cancelling QoS Notify"));
|
|
1602 |
TestL(iQoSPolicy_1.Close(), _L("Closing QoS Channel"));
|
|
1603 |
#endif
|
|
1604 |
|
|
1605 |
iSocket.Close();
|
|
1606 |
|
|
1607 |
return EPass;
|
|
1608 |
}
|
|
1609 |
|
|
1610 |
|
|
1611 |
/**
|
|
1612 |
Test RConnection:Stop on Spud, when the lower NIF for secondary PDP context has reported LinkLayerDown, and Spud
|
|
1613 |
has requests outstading to handle it.
|
|
1614 |
|
|
1615 |
@leave if the test fails.
|
|
1616 |
*/
|
|
1617 |
enum TVerdict CSpudSecondaryLowerNifDownStop::RunTestStepL()
|
|
1618 |
{
|
|
1619 |
StartSecondaryL();
|
|
1620 |
|
|
1621 |
TInt loopbackPort;
|
|
1622 |
if(!GetIntFromConfig(ConfigSection(), _L("SecondaryLoopbackPort"), loopbackPort))
|
|
1623 |
{
|
|
1624 |
User::Leave(KErrNotFound);
|
|
1625 |
}
|
|
1626 |
FailNextPktLoopbackCsyWriteL(loopbackPort, KErrCompletion);
|
|
1627 |
TRequestStatus sendStatus;
|
|
1628 |
iSocket.Send(KCommWriteData, 0, sendStatus);
|
|
1629 |
User::WaitForRequest(sendStatus);
|
|
1630 |
TestL(sendStatus.Int(), _L("Sent data on socket to cause Lower NIF LinkLayerDown"));
|
|
1631 |
|
|
1632 |
// LinkLayerDown was called, secondary context deletion is outstanding.
|
|
1633 |
// We sneak in and stop the entire interface.
|
|
1634 |
// We don't bother listening for QoS failure in this particular test.
|
|
1635 |
StopInterfaceL();
|
|
1636 |
|
|
1637 |
StopSecondaryL();
|
|
1638 |
|
|
1639 |
return EPass;
|
|
1640 |
}
|
|
1641 |
|
|
1642 |
/**
|
|
1643 |
Test RConnection:Stop on Spud, when the secondary PDP context is being deleted by GUQoS due to idle timeout.
|
|
1644 |
|
|
1645 |
@leave if the test fails.
|
|
1646 |
*/
|
|
1647 |
enum TVerdict CSpudSecondaryInterfaceEventStop::RunTestStepL()
|
|
1648 |
{
|
|
1649 |
StartSecondaryL();
|
|
1650 |
|
|
1651 |
// Cleanup
|
|
1652 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1653 |
TestL(iQoSPolicy_1.CancelNotifyEvent(*this), _L("Cancelling QoS Notify"));
|
|
1654 |
TestL(iQoSPolicy_1.Close(), _L("Closing QoS Channel"));
|
|
1655 |
#endif
|
|
1656 |
iSocket.Close();
|
|
1657 |
|
|
1658 |
StopInterfaceL(); // Stop the entire interface.
|
|
1659 |
|
|
1660 |
return EPass;
|
|
1661 |
}
|
|
1662 |
|
|
1663 |
/**
|
|
1664 |
Test the effects of expiry of GUQoS timeout & deletion of the secondary interface, once RConnection:Stop on Spud
|
|
1665 |
was called already.
|
|
1666 |
|
|
1667 |
@leave if the test fails.
|
|
1668 |
*/
|
|
1669 |
enum TVerdict CSpudSecondaryInterfaceStop::RunTestStepL()
|
|
1670 |
{
|
|
1671 |
StartSecondaryL();
|
|
1672 |
StopInterfaceL(); // Stop the entire interface.
|
|
1673 |
|
|
1674 |
// Cleanup
|
|
1675 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1676 |
TestL(iQoSPolicy_1.CancelNotifyEvent(*this), _L("Cancelling QoS Notify"));
|
|
1677 |
TestL(iQoSPolicy_1.Close(), _L("Closing QoS Channel"));
|
|
1678 |
#endif
|
|
1679 |
iSocket.Close();
|
|
1680 |
|
|
1681 |
return EPass;
|
|
1682 |
};
|
|
1683 |
|
|
1684 |
|
|
1685 |
/**
|
|
1686 |
Test RConnection:Stop on Spud, when the primary PDP context is being deleted as a result of LinkLayerDown from the
|
|
1687 |
lower NIF.
|
|
1688 |
|
|
1689 |
@leave if the test fails.
|
|
1690 |
*/
|
|
1691 |
enum TVerdict CSpudPrimaryDeletionInterfaceStop::RunTestStepL()
|
|
1692 |
{
|
|
1693 |
StartPrimaryOnlyL(); // bring the primary up.
|
|
1694 |
TestL(iSocket.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp, iInterface), _L("RSocket::Open"));
|
|
1695 |
|
|
1696 |
TInetAddr dstAddr;
|
|
1697 |
dstAddr.SetPort(KConfiguredTftFilter1SrcPort);
|
|
1698 |
dstAddr.Input(KConfiguredTftFilter1SrcAddr);
|
|
1699 |
|
|
1700 |
TRequestStatus status;
|
|
1701 |
iSocket.Connect(dstAddr, status);
|
|
1702 |
User::WaitForRequest(status);
|
|
1703 |
TestL(status.Int(), _L("Socket connected to destination."));
|
|
1704 |
|
|
1705 |
TInt loopbackPort;
|
|
1706 |
if(!GetIntFromConfig(ConfigSection(), _L("PrimaryLoopbackPort"), loopbackPort))
|
|
1707 |
{
|
|
1708 |
User::Leave(KErrNotFound);
|
|
1709 |
}
|
|
1710 |
FailNextPktLoopbackCsyWriteL(loopbackPort, KErrCompletion);
|
|
1711 |
|
|
1712 |
TRequestStatus sendStatus;
|
|
1713 |
iSocket.Send(KCommWriteData, 0, sendStatus);
|
|
1714 |
User::WaitForRequest(sendStatus);
|
|
1715 |
TestL(sendStatus.Int(), 0, _L("Socket send status")); // cause the lower NIF send to fail.
|
|
1716 |
// Keep Nifman in Long idle timeout. This is more realistic scenario.
|
|
1717 |
// Now the lower NIF has fired LinkLayerDown, and the primary context is being deleted.
|
|
1718 |
// Sim TSY delays the completion of the deletion request.
|
|
1719 |
// In the meanwhile, we sneak in and stop the interface.
|
|
1720 |
|
|
1721 |
StopInterfaceL();
|
|
1722 |
return EPass;
|
|
1723 |
};
|
|
1724 |
|
|
1725 |
/**
|
|
1726 |
Test RConnection:Stop on Spud, when only the primary PDP context exists and is active (i.e. no secondaries)
|
|
1727 |
|
|
1728 |
@leave if the test fails.
|
|
1729 |
*/
|
|
1730 |
enum TVerdict CSpudPrimaryInterfaceStop::RunTestStepL()
|
|
1731 |
{
|
|
1732 |
StartPrimaryOnlyL();
|
|
1733 |
StopInterfaceL();
|
|
1734 |
return EPass;
|
|
1735 |
}
|
|
1736 |
|
|
1737 |
/**
|
|
1738 |
Stops the interface using the specified method:
|
|
1739 |
RConnection:Stop with EStopAuthoritative / EStopNormal, or Nifman idle timeout.
|
|
1740 |
The type of stop is read from the config file.
|
|
1741 |
The method connects to the interface to issue the Stop if necessary.
|
|
1742 |
The method listens for KLinkLayerClosed progress notification with the specified error.
|
|
1743 |
|
|
1744 |
@leave if KLinkLayerClosed is not received correctly, or received with unexpected error code.
|
|
1745 |
*/
|
|
1746 |
void CSpudNetSideTestBase::StopInterfaceL()
|
|
1747 |
{
|
|
1748 |
TInt millisBeforeStop(0);
|
|
1749 |
TInt ifaceStopErrCode(KErrNone);
|
|
1750 |
TPtrC ifaceStopTypeStr;
|
|
1751 |
if(!GetIntFromConfig(ConfigSection(), _L("MillisBeforeStop"), millisBeforeStop) ||
|
|
1752 |
!GetIntFromConfig(ConfigSection(), _L("IfaceStopErrCode"), ifaceStopErrCode) ||
|
|
1753 |
!GetStringFromConfig(ConfigSection(), _L("IfaceStopType"), ifaceStopTypeStr) )
|
|
1754 |
{
|
|
1755 |
User::Leave(KErrNotFound);
|
|
1756 |
}
|
|
1757 |
INFO_PRINTF4(_L("RConnection::Stop: pause[%d], Type[%S], Error Code[%d]"),
|
|
1758 |
millisBeforeStop, &ifaceStopTypeStr, ifaceStopErrCode);
|
|
1759 |
|
|
1760 |
// Attach monitor
|
|
1761 |
RConnection ifaceMonitor;
|
|
1762 |
TestL(ifaceMonitor.Open(iEsock), _L("Opening RConnection for monitoring"));
|
|
1763 |
CleanupClosePushL(ifaceMonitor);
|
|
1764 |
|
|
1765 |
TUint ifaceCount = 0;
|
|
1766 |
TestL(ifaceMonitor.EnumerateConnections(ifaceCount), _L("Enumerating interfaces"));
|
|
1767 |
ASSERT(1 == ifaceCount); // We have only 1 spud instance
|
|
1768 |
|
|
1769 |
TConnectionInfo info;
|
|
1770 |
TPckg<TConnectionInfo> ifaceInfo(info);
|
|
1771 |
static const TInt KIfaceIdx(1); // we have one and only iface.
|
|
1772 |
TestL(ifaceMonitor.GetConnectionInfo(KIfaceIdx, ifaceInfo), _L("Getting connection info"));
|
|
1773 |
|
|
1774 |
RConnection controlConn;
|
|
1775 |
TestL(controlConn.Open(iEsock), _L("Opening Normal Connection"));
|
|
1776 |
CleanupClosePushL(controlConn);
|
|
1777 |
|
|
1778 |
TestL(controlConn.Attach(ifaceInfo, RConnection::EAttachTypeNormal), _L("Attaching Normally"));
|
|
1779 |
TestL(ifaceMonitor.Attach(ifaceInfo, RConnection::EAttachTypeMonitor), _L("Attaching as Monitor"));
|
|
1780 |
|
|
1781 |
|
|
1782 |
//register for progress notification
|
|
1783 |
TRequestStatus progressReqSt;
|
|
1784 |
ifaceMonitor.ProgressNotification(iProgressBuf, progressReqSt, static_cast<TUint>(KLinkLayerClosed));
|
|
1785 |
|
|
1786 |
|
|
1787 |
User::After(millisBeforeStop);
|
|
1788 |
INFO_PRINTF1(_L("About to stop interface."));
|
|
1789 |
// Shutdown the interface and get the resulting progress
|
|
1790 |
if(ifaceStopTypeStr.Compare(TPtrC(_L("EStopNormal"))) == 0)
|
|
1791 |
{
|
|
1792 |
TestL(controlConn.Stop(RConnection::EStopNormal), _L("Normal Stop on the Interface"));
|
|
1793 |
}
|
|
1794 |
else if(ifaceStopTypeStr.Compare(TPtrC(_L("EStopAuthoritative"))) == 0)
|
|
1795 |
{
|
|
1796 |
TestL(controlConn.Stop(RConnection::EStopAuthoritative),_L("Authoritative Stop on the Interface"));
|
|
1797 |
}
|
|
1798 |
else if(ifaceStopTypeStr.Compare(TPtrC(_L("NifmanIdleTimeout")))== 0)
|
|
1799 |
{
|
|
1800 |
controlConn.Close(); // Let Nifman short idle timeout take the interface down for us.
|
|
1801 |
// The monitor connection does not affect the timeout.
|
|
1802 |
}
|
|
1803 |
else
|
|
1804 |
{
|
|
1805 |
User::Leave(KErrArgument);
|
|
1806 |
}
|
|
1807 |
|
|
1808 |
|
|
1809 |
WaitForProgressNotificationL(progressReqSt, KLinkLayerClosed, ifaceStopErrCode);
|
|
1810 |
CleanupStack::PopAndDestroy(&controlConn);
|
|
1811 |
CleanupStack::PopAndDestroy(&ifaceMonitor);
|
|
1812 |
}
|
|
1813 |
|
|
1814 |
|
|
1815 |
//------------------------------------------------------
|
|
1816 |
// TODO?: read Qos Parameters from config file.
|
|
1817 |
// not really necessary, because it is easier to use a different section in config.txt
|
|
1818 |
// Must correspond to Sim.tsy config.txt file. These parameters are
|
|
1819 |
// negotiated by GuQoS and then the negotiated
|
|
1820 |
// parameters are used for comparison by Sim.tsy
|
|
1821 |
//------------------------------------------------------
|
|
1822 |
|
|
1823 |
/**
|
|
1824 |
Set the QoS parameters to value set 0
|
|
1825 |
*/
|
|
1826 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1827 |
void CSpudNetSideTestBase::SetQoSParameters(CQoSParameters& aParameters)
|
|
1828 |
{
|
|
1829 |
aParameters.SetUpLinkMaximumBurstSize(1024);
|
|
1830 |
aParameters.SetUpLinkMaximumPacketSize(768);
|
|
1831 |
aParameters.SetUplinkBandwidth(1024);
|
|
1832 |
aParameters.SetUpLinkAveragePacketSize(768);
|
|
1833 |
aParameters.SetUpLinkPriority(3);
|
|
1834 |
aParameters.SetUpLinkDelay(250);
|
|
1835 |
|
|
1836 |
aParameters.SetDownLinkMaximumBurstSize(1024);
|
|
1837 |
aParameters.SetDownLinkMaximumPacketSize(512);
|
|
1838 |
aParameters.SetDownlinkBandwidth(1024);
|
|
1839 |
aParameters.SetDownLinkAveragePacketSize(512);
|
|
1840 |
aParameters.SetDownLinkPriority(KQoSLowestPriority);
|
|
1841 |
aParameters.SetDownLinkDelay(250);
|
|
1842 |
}
|
|
1843 |
|
|
1844 |
/**
|
|
1845 |
Set the QoS parameters to value set 1
|
|
1846 |
*/
|
|
1847 |
void CSpudNetSideTestBase::SetQoSParameters1(CQoSParameters& aParameters)
|
|
1848 |
{
|
|
1849 |
aParameters.SetUplinkBandwidth(1020);
|
|
1850 |
aParameters.SetUpLinkMaximumBurstSize(896);
|
|
1851 |
aParameters.SetUpLinkMaximumPacketSize(768);
|
|
1852 |
aParameters.SetUpLinkDelay(250);
|
|
1853 |
aParameters.SetUpLinkPriority(3);
|
|
1854 |
|
|
1855 |
aParameters.SetUpLinkAveragePacketSize(400);
|
|
1856 |
|
|
1857 |
aParameters.SetDownlinkBandwidth(1020);
|
|
1858 |
aParameters.SetDownLinkMaximumBurstSize(768);
|
|
1859 |
aParameters.SetDownLinkMaximumPacketSize(512);
|
|
1860 |
aParameters.SetDownLinkDelay(250);
|
|
1861 |
aParameters.SetDownLinkPriority(KQoSLowestPriority);
|
|
1862 |
|
|
1863 |
aParameters.SetDownLinkAveragePacketSize(400);
|
|
1864 |
}
|
|
1865 |
#endif
|
|
1866 |
|
|
1867 |
|
|
1868 |
/**
|
|
1869 |
Starts a primary context by starting and interface, and starts PPP instances opposite the primary context
|
|
1870 |
@leave If any of the above steps fail
|
|
1871 |
*/
|
|
1872 |
TVerdict CSpudPppPrimary::RunTestStepL()
|
|
1873 |
{
|
|
1874 |
TInt primarySpudIapId, firstPppIapId;
|
|
1875 |
|
|
1876 |
TestBooleanTrueL(GetIntFromConfig(ConfigSection(), _L("PrimarySpudIapId"), primarySpudIapId), _L("Get Iap ID for first Ppp instance"));
|
|
1877 |
TestBooleanTrueL(GetIntFromConfig(ConfigSection(), _L("PppIapId1"), firstPppIapId), _L("Get Iap ID for second Ppp instance"));
|
|
1878 |
|
|
1879 |
TCommDbConnPref primarySpudPrefs, firstPppPrefs;
|
|
1880 |
primarySpudPrefs.SetIapId(primarySpudIapId);
|
|
1881 |
firstPppPrefs.SetIapId(firstPppIapId);
|
|
1882 |
RConnection pppInterface;
|
|
1883 |
TestL(iInterface.Open(iEsock), _L("RConnection::Open on SPUD interface"));
|
|
1884 |
TestL(pppInterface.Open(iEsock), _L("RConnection::Open on PPP interface"));
|
|
1885 |
|
|
1886 |
TRequestStatus spudStatus, pppStatus;
|
|
1887 |
iInterface.Start(primarySpudPrefs, spudStatus);
|
|
1888 |
pppInterface.Start(firstPppPrefs, pppStatus);
|
|
1889 |
User::WaitForRequest(spudStatus);
|
|
1890 |
User::WaitForRequest(pppStatus);
|
|
1891 |
TestL(spudStatus.Int(), KErrNone, _L("RConnection::Start on SPUD interface"));
|
|
1892 |
TestL(pppStatus.Int(), KErrNone, _L("RConnection::Start on PPP interface"));
|
|
1893 |
|
|
1894 |
return EPass;
|
|
1895 |
}
|
|
1896 |
|
|
1897 |
/** Class that sets up and starts an RConnection, then receives its request completion event as an active object */
|
|
1898 |
class CConnectionStart : public CActive
|
|
1899 |
{
|
|
1900 |
public:
|
|
1901 |
~CConnectionStart();
|
|
1902 |
static CConnectionStart* NewLC(RSocketServ& aEsock, CSpudNetSideTestBase& aTestStep, TInt aIapId);
|
|
1903 |
void RunL();
|
|
1904 |
void DoCancel()
|
|
1905 |
{}
|
|
1906 |
RConnection iInterface;
|
|
1907 |
|
|
1908 |
private:
|
|
1909 |
CConnectionStart(CSpudNetSideTestBase& aTestStep);
|
|
1910 |
void ConstructL(RSocketServ& aEsock, TInt aIapId);
|
|
1911 |
CSpudNetSideTestBase& iTestStep;
|
|
1912 |
TCommDbConnPref iPrefs;
|
|
1913 |
};
|
|
1914 |
|
|
1915 |
CConnectionStart::CConnectionStart(CSpudNetSideTestBase& aTestStep)
|
|
1916 |
: CActive(EPriorityStandard), iTestStep(aTestStep)
|
|
1917 |
{}
|
|
1918 |
|
|
1919 |
CConnectionStart::~CConnectionStart()
|
|
1920 |
{
|
|
1921 |
iInterface.Close();
|
|
1922 |
|
|
1923 |
Cancel();
|
|
1924 |
}
|
|
1925 |
|
|
1926 |
/**
|
|
1927 |
Starts a secondary context by creating a socket with QoS, starts a rawipnif instance opposite
|
|
1928 |
the secondary context, deletes the primary context then sends data on the primary context's socket
|
|
1929 |
Since the primary context is down, the data should get routed onto the secondary context
|
|
1930 |
@leave If any of the above steps fail
|
|
1931 |
*/
|
|
1932 |
|
|
1933 |
TBool CSpudNetSideTestBase::SpudDeletePrimaryPdpL()
|
|
1934 |
{
|
|
1935 |
RTimer GuardTimer;
|
|
1936 |
GuardTimer.CreateLocal(); // for this thread
|
|
1937 |
TRequestStatus TimerStatus; // status to monitor timer
|
|
1938 |
const TUint KWaitTimeout = 5000000;
|
|
1939 |
|
|
1940 |
TRequestStatus recvStatus, sendStatus;
|
|
1941 |
|
|
1942 |
TInetAddr spudPrimaryPort, spudSecondaryPort, secondPppPort;
|
|
1943 |
spudSecondaryPort.SetPort(KConfiguredTftFilter1DestPort);
|
|
1944 |
spudPrimaryPort.SetPort(KConfiguredTftFilter2DestPort);
|
|
1945 |
secondPppPort.SetPort(KConfiguredTftFilter1SrcPort);
|
|
1946 |
|
|
1947 |
RSocket primarySocket; // the secondary socket
|
|
1948 |
TestL(primarySocket.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp), _L("RSocket::Open for primary context's socket"));
|
|
1949 |
CleanupClosePushL<RSocket>(primarySocket);
|
|
1950 |
TestL(primarySocket.Bind(spudPrimaryPort), _L("Binding the local Socket for the primary context"));
|
|
1951 |
|
|
1952 |
// set the dest addr to the address of the IAP corresponding to IapId entry from the config file
|
|
1953 |
TInetAddr dstAddr;
|
|
1954 |
dstAddr.SetPort(KConfiguredTftFilter1SrcPort);
|
|
1955 |
dstAddr.Input(KConfiguredTftFilter1SrcAddr);
|
|
1956 |
TRequestStatus status;
|
|
1957 |
primarySocket.Connect(dstAddr, status);
|
|
1958 |
User::WaitForRequest(status);
|
|
1959 |
TestL(status.Int(), _L("Connecting to local socket for the primary context"));
|
|
1960 |
|
|
1961 |
// start a secondary context with QoS parameters connected to the same address as above
|
|
1962 |
// it will use the iSocket member variable to connect to the address
|
|
1963 |
|
|
1964 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1965 |
User::After(10*KTimeToStartSecondary);
|
|
1966 |
VerifySubconnectionCountL(_L("SubConnectionCount1"), PDPIAP);
|
|
1967 |
#endif
|
|
1968 |
InitiateSecondaryStartL();
|
|
1969 |
|
|
1970 |
TInt oppositeSecondaryIapId;
|
|
1971 |
TestBooleanTrueL(GetIntFromConfig(ConfigSection(), _L("IapId"), oppositeSecondaryIapId), _L("Get Iap ID for the rawipnif instance opposite the secondary context"));
|
|
1972 |
|
|
1973 |
// start rawipnif instance opposite the SPUD's secondary context, and open a socket on it
|
|
1974 |
CConnectionStart *secondaryIfStart = CConnectionStart::NewLC(iEsock, *this, oppositeSecondaryIapId);
|
|
1975 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
1976 |
WaitForQoSEventL(_L("SecondaryActivationEvent2"), _L("SecondaryActivationEvent2Reason"));
|
|
1977 |
#else
|
|
1978 |
User::After(KTimeToStartSecondary);
|
|
1979 |
VerifySubconnectionCountL(_L("SubConnectionCount2"), PDPIAP);
|
|
1980 |
#endif
|
|
1981 |
|
|
1982 |
RSocket oppositeSecondarySocket;
|
|
1983 |
TestL(oppositeSecondarySocket.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp, secondaryIfStart->iInterface), _L("Opening socket opposite secondary context"));
|
|
1984 |
CleanupClosePushL<RSocket>(oppositeSecondarySocket);
|
|
1985 |
User::LeaveIfError(oppositeSecondarySocket.Bind(secondPppPort));
|
|
1986 |
|
|
1987 |
// send data through the SPUD's secondary context to the rawipnif instance
|
|
1988 |
TBuf8<KCommReadBufSize> commReadBuf;
|
|
1989 |
oppositeSecondarySocket.RecvFrom(commReadBuf, spudSecondaryPort, 0, recvStatus);
|
|
1990 |
|
|
1991 |
iSocket.Send(KCommWriteData, 0, sendStatus);
|
|
1992 |
User::WaitForRequest(sendStatus);
|
|
1993 |
|
|
1994 |
TestL(sendStatus.Int(), _L("Send status on secondary context"));
|
|
1995 |
|
|
1996 |
GuardTimer.After(TimerStatus,KWaitTimeout);
|
|
1997 |
//User::WaitForRequest(recvStatus);
|
|
1998 |
User::WaitForRequest(recvStatus, TimerStatus);
|
|
1999 |
|
|
2000 |
GuardTimer.Cancel();
|
|
2001 |
User::WaitForAnyRequest();
|
|
2002 |
|
|
2003 |
TestL(recvStatus.Int(), _L("Receive status from secondary context"));
|
|
2004 |
TestL(commReadBuf.Compare(KCommWriteData), _L("Sent data matches received data on secondary context"));
|
|
2005 |
|
|
2006 |
// cause a network event, deleting the primary context
|
|
2007 |
TInt idx = RetrieveNetSideEventValFromConfigL(_L("QoSEventReq1Idx"));
|
|
2008 |
EtelRequestL(EContextStatusChange, idx);
|
|
2009 |
|
|
2010 |
// pause to allow notification of the deletion to get through
|
|
2011 |
User::After(1000000);
|
|
2012 |
|
|
2013 |
// send data through the SPUD's primary context
|
|
2014 |
// with the primary context deleted, the remaining secondary context should become the default context
|
|
2015 |
// and this data should get sent through the secondary context
|
|
2016 |
primarySocket.Send(KCommWriteData, 0, sendStatus);
|
|
2017 |
User::WaitForRequest(sendStatus);
|
|
2018 |
TestL(sendStatus.Int(), _L("Send status on primary context"));
|
|
2019 |
// GuQoS will drop the previous packet, and be triggered to modify the secondary context to become the default context
|
|
2020 |
// pause to allow GuQos to do this
|
|
2021 |
User::After(1000000);
|
|
2022 |
// this packet should make it through
|
|
2023 |
oppositeSecondarySocket.RecvFrom(commReadBuf, spudPrimaryPort, 0, recvStatus);
|
|
2024 |
primarySocket.Send(KCommWriteData, 0, sendStatus);
|
|
2025 |
User::WaitForRequest(sendStatus);
|
|
2026 |
TestL(sendStatus.Int(), _L("Send status on primary context"));
|
|
2027 |
User::WaitForRequest(recvStatus);
|
|
2028 |
TestL(recvStatus.Int(), _L("Receive status from primary context"));
|
|
2029 |
TestL(commReadBuf.Compare(KCommWriteData), _L("Sent data matches received data from primary context"));
|
|
2030 |
|
|
2031 |
// make sure sending on the secondary still works
|
|
2032 |
oppositeSecondarySocket.RecvFrom(commReadBuf, spudSecondaryPort, 0, recvStatus);
|
|
2033 |
iSocket.Send(KCommWriteData, 0, sendStatus);
|
|
2034 |
User::WaitForRequest(sendStatus);
|
|
2035 |
TestL(sendStatus.Int(), _L("Send status from secondary context"));
|
|
2036 |
User::WaitForRequest(recvStatus);
|
|
2037 |
TestL(recvStatus.Int(), _L("Receive status from secondary context"));
|
|
2038 |
TestL(commReadBuf.Compare(KCommWriteData), _L("Sent data matches received data from secondary context"));
|
|
2039 |
|
|
2040 |
// cleanup
|
|
2041 |
CleanupStack::PopAndDestroy(&oppositeSecondarySocket);
|
|
2042 |
|
|
2043 |
if (secondaryIfStart->IsActive())
|
|
2044 |
{
|
|
2045 |
secondaryIfStart->Deque();
|
|
2046 |
}
|
|
2047 |
CleanupStack::PopAndDestroy(secondaryIfStart);
|
|
2048 |
CleanupStack::PopAndDestroy(&primarySocket);
|
|
2049 |
|
|
2050 |
return ETrue;
|
|
2051 |
}
|
|
2052 |
|
|
2053 |
TVerdict CSpudDeletePrimary::RunTestStepL()
|
|
2054 |
{
|
|
2055 |
if(SpudDeletePrimaryPdpL())
|
|
2056 |
{
|
|
2057 |
return EPass;
|
|
2058 |
}
|
|
2059 |
|
|
2060 |
return EFail;
|
|
2061 |
}
|
|
2062 |
|
|
2063 |
|
|
2064 |
/**
|
|
2065 |
Opens and starts a connection, using aIapId as the preferred IAP
|
|
2066 |
@param aEsock The socket server to open the connection on
|
|
2067 |
@param aTestStep The test steps logging is used
|
|
2068 |
@param aIapId The IAP to use for the connection
|
|
2069 |
@leave Any error returned from RConnection::Open, or KErrNoMemory if new(ELeave) fails
|
|
2070 |
*/
|
|
2071 |
CConnectionStart* CConnectionStart::NewLC(RSocketServ& aEsock, CSpudNetSideTestBase& aTestStep, TInt aIapId)
|
|
2072 |
{
|
|
2073 |
CConnectionStart *me = new(ELeave) CConnectionStart(aTestStep);
|
|
2074 |
CleanupStack::PushL(me);
|
|
2075 |
me->ConstructL(aEsock, aIapId);
|
|
2076 |
return me;
|
|
2077 |
}
|
|
2078 |
|
|
2079 |
void CConnectionStart::ConstructL(RSocketServ& aEsock, TInt aIapId)
|
|
2080 |
{
|
|
2081 |
CActiveScheduler::Add(this);
|
|
2082 |
SetActive();
|
|
2083 |
iPrefs.SetIapId(aIapId);
|
|
2084 |
iTestStep.TestL(iInterface.Open(aEsock), _L("RConnection::Open on interface"));
|
|
2085 |
iInterface.Start(iPrefs, iStatus);
|
|
2086 |
}
|
|
2087 |
|
|
2088 |
/**
|
|
2089 |
Tests that the RConnection::Start succeeded
|
|
2090 |
@leave Leaves with the status of the RConnection::Start if the status is not KErrNone
|
|
2091 |
*/
|
|
2092 |
void CConnectionStart::RunL()
|
|
2093 |
{
|
|
2094 |
iTestStep.TestL(iStatus.Int(), _L("RConnection::Start status"));
|
|
2095 |
}
|
|
2096 |
|
|
2097 |
/**
|
|
2098 |
Starts a secondary context by creating a socket with QoS, starts PPP instances opposite the PPP instances
|
|
2099 |
from the primary and secondary contexts, then sends data between them
|
|
2100 |
@leave If any of the above steps fail
|
|
2101 |
*/
|
|
2102 |
TVerdict CSpudPppSecondarySend::RunTestStepL()
|
|
2103 |
{
|
|
2104 |
TRequestStatus connectStatus, recvStatus, sendStatus;
|
|
2105 |
|
|
2106 |
TInetAddr spudSecondaryPort, spudSecondaryAddr, secondPppPort;
|
|
2107 |
spudSecondaryPort.SetPort(KConfiguredTftFilter1DestPort);
|
|
2108 |
spudSecondaryAddr.SetPort(KConfiguredTftFilter1DestPort);
|
|
2109 |
spudSecondaryAddr.Input(KConfiguredTftFilter2DestAddr);
|
|
2110 |
secondPppPort.SetPort(KConfiguredTftFilter1SrcPort);
|
|
2111 |
|
|
2112 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
2113 |
VerifySubconnectionCountL(_L("SubConnectionCount1"), PDPIAP);
|
|
2114 |
#endif
|
|
2115 |
// start a secondary context
|
|
2116 |
InitiateSecondaryStartL();
|
|
2117 |
|
|
2118 |
TInt primaryIapId, secondaryIapId;
|
|
2119 |
TestBooleanTrueL(GetIntFromConfig(ConfigSection(), _L("PppIapId1"), primaryIapId), _L("Get Iap ID for first Ppp instance"));
|
|
2120 |
TestBooleanTrueL(GetIntFromConfig(ConfigSection(), _L("PppIapId2"), secondaryIapId), _L("Get Iap ID for second Ppp instance"));
|
|
2121 |
|
|
2122 |
// start 2 more PPP instances opposite the SPUD's primary and secondary context PPP instances
|
|
2123 |
CConnectionStart *primaryIfStart = CConnectionStart::NewLC(iEsock, *this, primaryIapId);
|
|
2124 |
CConnectionStart *secondaryIfStart = CConnectionStart::NewLC(iEsock, *this, secondaryIapId);
|
|
2125 |
|
|
2126 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
2127 |
WaitForQoSEventL(_L("SecondaryActivationEvent2"), _L("SecondaryActivationEvent2Reason"));
|
|
2128 |
#else
|
|
2129 |
User::After(2*KTimeToStartSecondary);
|
|
2130 |
VerifySubconnectionCountL(_L("SubConnectionCount2"), PDPIAP);
|
|
2131 |
#endif
|
|
2132 |
|
|
2133 |
// set up a socket from the second PPP instance (that connects to the SPUD's secondary context)
|
|
2134 |
RSocket secondPppSocket;
|
|
2135 |
User::LeaveIfError(secondPppSocket.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp, secondaryIfStart->iInterface));
|
|
2136 |
CleanupClosePushL<RSocket>(secondPppSocket);
|
|
2137 |
User::LeaveIfError(secondPppSocket.Bind(secondPppPort));
|
|
2138 |
secondPppSocket.Connect(spudSecondaryAddr, connectStatus);
|
|
2139 |
User::WaitForRequest(connectStatus);
|
|
2140 |
TestL(connectStatus.Int(), _L("Connecting to local socket"));
|
|
2141 |
|
|
2142 |
// send data through the SPUD's secondary context to the second PPP instance
|
|
2143 |
TBuf8<KCommReadBufSize> commReadBuf;
|
|
2144 |
secondPppSocket.RecvFrom(commReadBuf, spudSecondaryPort, 0, recvStatus);
|
|
2145 |
iSocket.Send(KCommWriteData, 0, sendStatus);
|
|
2146 |
User::WaitForRequest(sendStatus);
|
|
2147 |
User::WaitForRequest(recvStatus);
|
|
2148 |
TestL(commReadBuf.Compare(KCommWriteData), _L("Sent data matches received data"));
|
|
2149 |
|
|
2150 |
// send data in the opposite direction
|
|
2151 |
iSocket.RecvFrom(commReadBuf, secondPppPort, 0, recvStatus);
|
|
2152 |
secondPppSocket.Send(KCommWriteData2, 0, sendStatus);
|
|
2153 |
User::WaitForRequest(sendStatus);
|
|
2154 |
User::WaitForRequest(recvStatus);
|
|
2155 |
TestL(commReadBuf.Compare(KCommWriteData2), _L("Sent data matches received data"));
|
|
2156 |
|
|
2157 |
|
|
2158 |
// cleanup
|
|
2159 |
CleanupStack::PopAndDestroy(&secondPppSocket);
|
|
2160 |
if (primaryIfStart->IsActive())
|
|
2161 |
{
|
|
2162 |
primaryIfStart->Deque();
|
|
2163 |
}
|
|
2164 |
if (secondaryIfStart->IsActive())
|
|
2165 |
{
|
|
2166 |
secondaryIfStart->Deque();
|
|
2167 |
}
|
|
2168 |
|
|
2169 |
CleanupStack::PopAndDestroy(secondaryIfStart);
|
|
2170 |
CleanupStack::PopAndDestroy(primaryIfStart);
|
|
2171 |
|
|
2172 |
return EPass;
|
|
2173 |
}
|
|
2174 |
/**
|
|
2175 |
Tests creation of multiple primary PDP contexts by explicitly starting the interfaces
|
|
2176 |
|
|
2177 |
@leave if the test fails.
|
|
2178 |
*/
|
|
2179 |
enum TVerdict CSpudMultiPrimary::RunTestStepL()
|
|
2180 |
{
|
|
2181 |
TInt primaryCreationErr(KErrNone);
|
|
2182 |
TInt primaryIapId(0);
|
|
2183 |
TInt maximumConnections = 0;
|
|
2184 |
|
|
2185 |
|
|
2186 |
if (!GetIntFromConfig(ConfigSection(), _L("PrimaryActivationErr1"), primaryCreationErr))
|
|
2187 |
{
|
|
2188 |
User::Leave(KErrNotFound);
|
|
2189 |
}
|
|
2190 |
|
|
2191 |
_LIT(KNumberOfIapsLit, "NumberOfIaps");
|
|
2192 |
if (!GetIntFromConfig(ConfigSection(), KNumberOfIapsLit, maximumConnections))
|
|
2193 |
{
|
|
2194 |
User::Leave(KErrNotFound);
|
|
2195 |
}
|
|
2196 |
|
|
2197 |
|
|
2198 |
// Opening multiple connections, we're not reusing the 'iInterface' member.
|
|
2199 |
//
|
|
2200 |
RPointerArray<RConnection> interfaces;
|
|
2201 |
|
|
2202 |
_LIT(KPrimaryIapFormatLit, "PrimaryIapId%d");
|
|
2203 |
for (TInt i = 0; i < maximumConnections; i++)
|
|
2204 |
{
|
|
2205 |
|
|
2206 |
TBuf<32> primaryIap;
|
|
2207 |
primaryIap.Format(KPrimaryIapFormatLit, i + 1);
|
|
2208 |
if (!GetIntFromConfig(ConfigSection(), primaryIap, primaryIapId))
|
|
2209 |
{
|
|
2210 |
User::Leave(KErrNotFound);
|
|
2211 |
}
|
|
2212 |
|
|
2213 |
|
|
2214 |
INFO_PRINTF2(_L("Creating RConnection object %d"), primaryIapId);
|
|
2215 |
|
|
2216 |
RConnection* p = new (ELeave) RConnection();
|
|
2217 |
|
|
2218 |
|
|
2219 |
interfaces.Append(p);
|
|
2220 |
CleanupStack::PushL(p);
|
|
2221 |
|
|
2222 |
|
|
2223 |
TCommDbConnPref iap1prefs;
|
|
2224 |
iap1prefs.SetIapId(primaryIapId);
|
|
2225 |
|
|
2226 |
INFO_PRINTF2(_L("Test starting Interface IAP ID == %d"), primaryIapId);
|
|
2227 |
|
|
2228 |
TestL(p->Open(iEsock), _L("RConnection::Open the interface"));
|
|
2229 |
TestL(p->Start(iap1prefs),primaryCreationErr, _L("RConnection::Start the interface"));
|
|
2230 |
}
|
|
2231 |
|
|
2232 |
|
|
2233 |
for (TInt i = (interfaces.Count() - 1); i >= 0; i--)
|
|
2234 |
{
|
|
2235 |
RConnection* p = interfaces[i];
|
|
2236 |
interfaces.Remove(i);
|
|
2237 |
|
|
2238 |
p->Stop();
|
|
2239 |
p->Close();
|
|
2240 |
|
|
2241 |
// empty destructor for 'RConnection'
|
|
2242 |
//
|
|
2243 |
CleanupStack::PopAndDestroy(p);
|
|
2244 |
}
|
|
2245 |
|
|
2246 |
interfaces.Reset();
|
|
2247 |
|
|
2248 |
return EPass;
|
|
2249 |
}
|
|
2250 |
|
|
2251 |
enum TVerdict CIoctlAddressRetrieve::RunTestStepL()
|
|
2252 |
{
|
|
2253 |
StartPrimaryOnlyL();
|
|
2254 |
|
|
2255 |
TPtrC addresse;
|
|
2256 |
TBool checkSipAddress = ETrue;
|
|
2257 |
if(!GetStringFromConfig(ConfigSection(), _L("ExpectedAddress"), addresse))
|
|
2258 |
{
|
|
2259 |
checkSipAddress = EFalse;
|
|
2260 |
}
|
|
2261 |
|
|
2262 |
TInt expectedError = KErrNone;
|
|
2263 |
if(!GetIntFromConfig(ConfigSection(), _L("SipAddressExpectedError"), expectedError))
|
|
2264 |
{
|
|
2265 |
expectedError = KErrNone;
|
|
2266 |
}
|
|
2267 |
|
|
2268 |
TInt sipAddressIndex = 0;
|
|
2269 |
if(!GetIntFromConfig(ConfigSection(), _L("IndexOfTheSIPAddressToGet"), sipAddressIndex))
|
|
2270 |
{
|
|
2271 |
User::Leave(KErrNotFound);
|
|
2272 |
}
|
|
2273 |
|
|
2274 |
//call ioctl
|
|
2275 |
TRequestStatus status;
|
|
2276 |
|
|
2277 |
INFO_PRINTF1(_L("Calling ioctl.."));
|
|
2278 |
|
|
2279 |
// Request the Sip address available
|
|
2280 |
TSipServerAddrBuf sipServerAddr;
|
|
2281 |
sipServerAddr().index = sipAddressIndex;
|
|
2282 |
iInterface.Ioctl(KCOLConfiguration, KConnGetSipServerAddr, status, &sipServerAddr);
|
|
2283 |
User::WaitForRequest(status);
|
|
2284 |
|
|
2285 |
INFO_PRINTF2(_L("SIP address retrieval completed with Err[%d]..."), status.Int());
|
|
2286 |
if(status.Int() == expectedError)
|
|
2287 |
{
|
|
2288 |
if (expectedError == KErrNone && checkSipAddress)
|
|
2289 |
{
|
|
2290 |
THostName addr;
|
|
2291 |
sipServerAddr().address.Output(addr);
|
|
2292 |
|
|
2293 |
// Verify the retrieved address is correct
|
|
2294 |
TPtrC addressToCompare;
|
|
2295 |
|
|
2296 |
addressToCompare.Set(addresse);
|
|
2297 |
|
|
2298 |
INFO_PRINTF2(_L("Received SIP address: %S"), &addr);
|
|
2299 |
if(addr.CompareF(addressToCompare) != 0)
|
|
2300 |
{
|
|
2301 |
INFO_PRINTF2(_L("Expected SIP address %S!"), &addressToCompare);
|
|
2302 |
TESTEL(0, KErrNotFound);
|
|
2303 |
}
|
|
2304 |
}
|
|
2305 |
else
|
|
2306 |
{
|
|
2307 |
INFO_PRINTF1(_L("As Expected"));
|
|
2308 |
}
|
|
2309 |
}
|
|
2310 |
else
|
|
2311 |
{
|
|
2312 |
INFO_PRINTF1(_L("Unexpected"));
|
|
2313 |
User::Leave(status.Int());
|
|
2314 |
}
|
|
2315 |
|
|
2316 |
iInterface.Stop();
|
|
2317 |
iInterface.Close();
|
|
2318 |
|
|
2319 |
return EPass;
|
|
2320 |
}
|