datacommsserver/esockserver/test/TE_RConnection/src/te_BearerMobilityTestSuite.cpp
changeset 4 928ed51ddc43
parent 0 dfb7c4ff071f
equal deleted inserted replaced
3:b6139031a239 4:928ed51ddc43
    20  @file te_BearerMobilityTestSuite.cpp
    20  @file te_BearerMobilityTestSuite.cpp
    21  @file
    21  @file
    22 */
    22 */
    23 
    23 
    24 #include "te_BearerMobilityTestSuite.h"
    24 #include "te_BearerMobilityTestSuite.h"
       
    25 #include <es_enum_internal.h>
    25 #include <ecom/ecom.h>
    26 #include <ecom/ecom.h>
    26 
    27 #include <comms-infras/mobilitymessagesecom.h>
       
    28 #include <dummynifvar.h>
    27 
    29 
    28 using namespace ESock;
    30 using namespace ESock;
    29 
    31 
    30 // CBearerMobilityTestStep_761402
    32 // CBearerMobilityTestStep_761402
    31 //-------------------------------
    33 //-------------------------------
   309 	CTestStep* testStep = NULL;
   311 	CTestStep* testStep = NULL;
   310 	if(aStepName.Compare(_L("NET_BMOBILITY_761402")) == 0)
   312 	if(aStepName.Compare(_L("NET_BMOBILITY_761402")) == 0)
   311 		testStep = new CBearerMobilityTestStep_761402();
   313 		testStep = new CBearerMobilityTestStep_761402();
   312 	else if(aStepName.Compare(_L("NET_BMOBILITY_761403")) == 0)
   314 	else if(aStepName.Compare(_L("NET_BMOBILITY_761403")) == 0)
   313 		testStep = new CBearerMobilityTestStep_761403();
   315 		testStep = new CBearerMobilityTestStep_761403();
       
   316 	else if(aStepName.Compare(_L("NET_BMOBILITY_761404")) == 0)
       
   317 		testStep = new CBearerMobilityTestStep_761404();
       
   318 	else if(aStepName.Compare(_L("NET_BMOBILITY_761405")) == 0)
       
   319 		testStep = new CBearerMobilityTestStep_761405();
   314 	
   320 	
   315 	return testStep;
   321 	return testStep;
   316 	}
   322 	}
   317 
   323 
       
   324 const TInt KBufferLength = 512;
       
   325 const TInt KEchoPortNum = 8;
       
   326 TInt RequestInterfaceDownL(RConnection& conn, RSocketServ& ss)
       
   327 /**
       
   328  * Sends a special packet to the dummy nif telling it to signal that the interface is down
       
   329  * @param conn The connection to signal
       
   330  * @param ss The socket server that the connection is within
       
   331  * @return system wide error code
       
   332  */
       
   333 {
       
   334 	TRequestStatus status;
       
   335 
       
   336 	TBuf8<KBufferLength> buffer;
       
   337 
       
   338 	RSocket sock;
       
   339 	TInetAddr dest;
       
   340 
       
   341 	User::LeaveIfError(sock.Open(ss, KAfInet, KSockDatagram, KProtocolInetUdp, conn));
       
   342 	CleanupClosePushL(sock);
       
   343 
       
   344 	User::LeaveIfError(sock.SetOpt(KSoReuseAddr, KSolInetIp, 1)); 
       
   345 	User::LeaveIfError(sock.SetLocalPort(KEchoPortNum)); 
       
   346 
       
   347 	dest.SetAddress(KDummyNifLocalAddressBase + 4);
       
   348 	dest.SetPort(KDummyNifCmdPort);
       
   349 
       
   350 	buffer.SetMax();
       
   351 	buffer.FillZ();
       
   352 	buffer[0] = (TUint8) KForceDisconnect;
       
   353 
       
   354 	sock.SendTo(buffer, dest, 0, status);
       
   355 	User::WaitForRequest(status);
       
   356 	User::LeaveIfError(status.Int());
       
   357 
       
   358 	buffer.Zero();
       
   359 	// I expect some sort of response
       
   360 	// this fails - possibly ok as the interface might have gone already??
       
   361 	//sock.RecvFrom(buffer, dest, 0, status);
       
   362 	//User::WaitForRequest(status);
       
   363 	//TESTEL(KErrNone == status.Int(), status.Int());
       
   364 
       
   365 	CleanupStack::PopAndDestroy(&sock);
       
   366 
       
   367 	return KErrNone;
       
   368 }
       
   369 
       
   370 /**
       
   371    Bring up a snap with two bearers, both on.
       
   372    Kill the top priority.
       
   373    Accept the migration.
       
   374    Reject the new carrier.
       
   375    Verify that the new carrier has gone away.
       
   376    The new carrier should go away because of the short idle timer. The bearers in this test have only short idle timer to verify.
       
   377 
       
   378    This test verifies DEF143172
       
   379 */   
       
   380 enum TVerdict CBearerMobilityTestStep_761404::doTestStepL()
       
   381 	{
       
   382 	const TInt KTestSnap = 20;
       
   383 	const TInt KPriority1BearerAP = 7;
       
   384 	const TInt KPriority2BearerAP = 8;
       
   385 
       
   386 	TInt error;
       
   387 	TInterfaceNotificationBuf info1;
       
   388 	TNifProgress progress;
       
   389 	TNifProgressBuf progbuf(progress);
       
   390 	TBuf8<KNotificationEventMaxSize> eventnotbuf;
       
   391 	TRequestStatus status1, status2, status3;
       
   392 	
       
   393 	RSocketServ ss;
       
   394 	RConnection connS, connAIN;
       
   395 	RCommsMobilityApiExt mobility;
       
   396 	TConnSnapPref p;
       
   397 	p.SetSnap(KTestSnap);
       
   398 
       
   399 	INFO_PRINTF1(_L("Description: "));
       
   400 	INFO_PRINTF1(_L("Bring up a snap with two bearers, both on."));
       
   401    	INFO_PRINTF1(_L("Kill the top priority."));
       
   402 	INFO_PRINTF1(_L("Accept the migration."));
       
   403 	INFO_PRINTF1(_L("Reject the new carrier."));
       
   404 	INFO_PRINTF1(_L("Verify that the new carrier has goes away."));
       
   405    	INFO_PRINTF1(_L("The new carrier should go away because of the short idle timer. The bearers in this test have only short idle timer to verify."));
       
   406 	INFO_PRINTF1(_L("============================================================================="));
       
   407 	
       
   408 	// Set both bearer to be up
       
   409 	RProperty a1;
       
   410 	error = a1.Define(KAvailabilityTestingPubSubUid, KPriority1BearerAP, RProperty::EInt);
       
   411 	if((error == KErrAlreadyExists) || (error == KErrNone))
       
   412 		{
       
   413 		error = a1.Attach(KAvailabilityTestingPubSubUid, KPriority1BearerAP);
       
   414 		ASSERT(error == KErrNone);
       
   415 		
       
   416 		a1.Set(ESock::TAvailabilityStatus::EMaxAvailabilityScore);
       
   417 		}
       
   418 	
       
   419 	RProperty a2;
       
   420 	error = a2.Define(KAvailabilityTestingPubSubUid, KPriority1BearerAP, RProperty::EInt);
       
   421 	if((error == KErrAlreadyExists) || (error == KErrNone))
       
   422 		{
       
   423 		error = a2.Attach(KAvailabilityTestingPubSubUid, KPriority1BearerAP);
       
   424 		ASSERT(error == KErrNone);
       
   425 		
       
   426 		a2.Set(ESock::TAvailabilityStatus::EMaxAvailabilityScore);
       
   427 		}
       
   428 
       
   429 	// Open session and subsessions
       
   430 	User::LeaveIfError(ss.Connect());
       
   431 	CleanupClosePushL(ss);
       
   432 
       
   433 	User::LeaveIfError(connAIN.Open(ss));
       
   434 	CleanupClosePushL(connAIN);
       
   435 
       
   436 	User::LeaveIfError(connS.Open(ss));
       
   437 	CleanupClosePushL(connS);
       
   438 
       
   439 	// Register for notification of connections going up/down
       
   440 	INFO_PRINTF1(_L("Register for notification of connections going up/down"));
       
   441 	connAIN.AllInterfaceNotification(info1, status1);
       
   442 
       
   443 	// Start the connection
       
   444 	INFO_PRINTF2(_L("Start connection (%d)"), p.Snap());
       
   445 	User::LeaveIfError(connS.Start(p));
       
   446 
       
   447 	// Check all interface notification
       
   448 	User::WaitForRequest(status1);
       
   449 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   450 	TESTL(info1().iConnectionInfo.iIapId == KPriority1BearerAP && info1().iState == 0);
       
   451 
       
   452 	// Register for notification again
       
   453 	connAIN.AllInterfaceNotification(info1, status1);
       
   454 
       
   455 	// Check the current progress
       
   456 	error = connS.Progress(progress);
       
   457 	INFO_PRINTF3(_L("Current progress iStage(%d) iError(%d)"), progress.iStage, progress.iError);
       
   458 	TESTL(error == KErrNone);
       
   459 	TESTL(progress.iStage == KLinkLayerOpen && progress.iError == KErrNone);
       
   460 
       
   461 	// open mobility
       
   462 	INFO_PRINTF1(_L("Open mobility on connection"));
       
   463 	error = mobility.Open(connS);
       
   464 	TESTL(error == KErrNone);
       
   465 	CleanupClosePushL(mobility);
       
   466 
       
   467 	// register for mobility notification
       
   468 	eventnotbuf.Zero();
       
   469 	INFO_PRINTF1(_L("Register for notification"));
       
   470 	mobility.RegisterForMobilityNotification(eventnotbuf, status2);
       
   471 
       
   472 	// Turn first priority off
       
   473 	INFO_PRINTF1(_L("Turn off highest priority bearer"));
       
   474 	a1.Set(ESock::TAvailabilityStatus::EMinAvailabilityScore);
       
   475 	RequestInterfaceDownL(connS, ss);
       
   476 	
       
   477 	// wait for all interface notification to report bearer down
       
   478 	User::WaitForRequest(status1);
       
   479 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   480 	TESTL(info1().iConnectionInfo.iIapId == KPriority1BearerAP && info1().iState == 1);
       
   481 	
       
   482 	// register for all interface notification again
       
   483 	connAIN.AllInterfaceNotification(info1, status1);
       
   484 
       
   485 	// wait for mobility notification
       
   486 	User::WaitForRequest(status2);	
       
   487 	CCommsApiExtRespMsg * msg = CCommsApiExtRespMsg::NewL(eventnotbuf);
       
   488 	CleanupStack::PushL(msg);
       
   489 	
       
   490 	ESock::CPreferredCarrierAvailable* pca = static_cast<ESock::CPreferredCarrierAvailable*>(msg);
       
   491 	INFO_PRINTF3(_L("Preferred carrier available NewAP(%d) OldAP(%d)"), pca->NewAPInfo().AccessPoint(), pca->OldAPInfo().AccessPoint());
       
   492 	TESTL(KPriority2BearerAP == pca->NewAPInfo().AccessPoint() && KPriority1BearerAP ==  pca->OldAPInfo().AccessPoint());
       
   493 
       
   494 	// register for mobility and migrate
       
   495 	mobility.RegisterForMobilityNotification(eventnotbuf, status2);
       
   496 	INFO_PRINTF1(_L("Migrate to preferred carrier"));
       
   497 	mobility.MigrateToPreferredCarrier();
       
   498 
       
   499 	// check that the expected bearer has come up
       
   500 	User::WaitForRequest(status1);
       
   501 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   502 	TESTEL(info1().iConnectionInfo.iIapId == KPriority2BearerAP && info1().iState == 0, KErrCorrupt);
       
   503 
       
   504 	// register for it again
       
   505 	connAIN.AllInterfaceNotification(info1, status1);
       
   506 
       
   507 	// register for progress notification, for KLinkLayerClosed.
       
   508 	connS.ProgressNotification(progbuf, status3, KLinkLayerClosed);
       
   509 
       
   510 	// wait for new carrier active
       
   511 	User::WaitForRequest(status2);
       
   512 	
       
   513 	CleanupStack::PopAndDestroy(msg);
       
   514 	// verify the new carrier is as expected and then reject it
       
   515 	msg = CCommsApiExtRespMsg::NewL(eventnotbuf);
       
   516 	CleanupStack::PushL(msg);
       
   517 	ESock::CNewCarrierActive* nca = static_cast<ESock::CNewCarrierActive*>(msg);
       
   518 	INFO_PRINTF2(_L("NewCarrierActive NewAP(%d)"), nca->NewAPInfo().AccessPoint());
       
   519 	TESTL(nca->NewAPInfo().AccessPoint() == KPriority2BearerAP);
       
   520 	CleanupStack::PopAndDestroy(msg);
       
   521 
       
   522 	INFO_PRINTF1(_L("Reject new carrier"));
       
   523 	mobility.NewCarrierRejected();
       
   524 
       
   525 	// wait for all interface notification to tell us connection has gone down.
       
   526 	User::WaitForRequest(status1);
       
   527 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   528 	TESTL(info1().iConnectionInfo.iIapId == KPriority2BearerAP && info1().iState == 1);
       
   529 
       
   530 	User::WaitForRequest(status3);
       
   531 	INFO_PRINTF3(_L("Progress notification received iStage(%d) iError(%d)"), progbuf().iStage, progbuf().iError);
       
   532 	TESTL(progbuf().iStage == KLinkLayerClosed);
       
   533 
       
   534 	CleanupStack::PopAndDestroy(&mobility);
       
   535 	CleanupStack::PopAndDestroy(&connS);
       
   536 	CleanupStack::PopAndDestroy(&connAIN);
       
   537 	CleanupStack::PopAndDestroy(&ss);
       
   538 	
       
   539 	return EPass;
       
   540 	}
       
   541 
       
   542 /**
       
   543    Bring up a snap with three bearers, all on.
       
   544    Kill the top priority.
       
   545    Accept the migration.
       
   546    Reject the new carrier.
       
   547    Verify that the new carrier has gone away.
       
   548    Get offered the third priority.
       
   549    Accept third priority
       
   550    Verify KLinkLayerClosed is never received.
       
   551 
       
   552    This test verifies DEF143172
       
   553 */
       
   554 enum TVerdict CBearerMobilityTestStep_761405::doTestStepL()
       
   555 	{
       
   556 	const TInt KTestSnap = 23;
       
   557 	const TInt KPriority1BearerAP = 7;
       
   558 	const TInt KPriority2BearerAP = 8;
       
   559 	const TInt KPriority3BearerAP = 4;
       
   560 
       
   561 	TInt error;
       
   562 	TInterfaceNotificationBuf info1;
       
   563 	TNifProgress progress;
       
   564 	TNifProgressBuf progbuf(progress);
       
   565 	TBuf8<KNotificationEventMaxSize> eventnotbuf;
       
   566 	TRequestStatus status1, status2, status3;
       
   567 	
       
   568 	RSocketServ ss;
       
   569 	RConnection connS, connAIN;
       
   570 	RCommsMobilityApiExt mobility;
       
   571 	TConnSnapPref p;
       
   572 	p.SetSnap(KTestSnap);
       
   573 
       
   574 	INFO_PRINTF1(_L("Description: "));
       
   575 	INFO_PRINTF1(_L("Bring up a snap with three bearers, all on."));
       
   576    	INFO_PRINTF1(_L("Kill the top priority."));
       
   577 	INFO_PRINTF1(_L("Accept the migration."));
       
   578 	INFO_PRINTF1(_L("Reject the new carrier."));
       
   579 	INFO_PRINTF1(_L("Verify that the new carrier has goes away."));
       
   580 	INFO_PRINTF1(_L("Accept the migration to the third priority."));
       
   581 	INFO_PRINTF1(_L("Accept the new carrier."));
       
   582    	INFO_PRINTF1(_L("The new carrier should go away because of the short idle timer. The bearers in this test have only short idle timer to verify."));
       
   583 	INFO_PRINTF1(_L("============================================================================="));
       
   584 	
       
   585 	// Set both bearer to be up
       
   586 	RProperty a1;
       
   587 	error = a1.Define(KAvailabilityTestingPubSubUid, KPriority1BearerAP, RProperty::EInt);
       
   588 	if((error == KErrAlreadyExists) || (error == KErrNone))
       
   589 		{
       
   590 		error = a1.Attach(KAvailabilityTestingPubSubUid, KPriority1BearerAP);
       
   591 		ASSERT(error == KErrNone);
       
   592 		
       
   593 		a1.Set(ESock::TAvailabilityStatus::EMaxAvailabilityScore);
       
   594 		}
       
   595 	
       
   596 	RProperty a2;
       
   597 	error = a2.Define(KAvailabilityTestingPubSubUid, KPriority1BearerAP, RProperty::EInt);
       
   598 	if((error == KErrAlreadyExists) || (error == KErrNone))
       
   599 		{
       
   600 		error = a2.Attach(KAvailabilityTestingPubSubUid, KPriority1BearerAP);
       
   601 		ASSERT(error == KErrNone);
       
   602 		
       
   603 		a2.Set(ESock::TAvailabilityStatus::EMaxAvailabilityScore);
       
   604 		}
       
   605 
       
   606 	RProperty a3;
       
   607 	error = a3.Define(KAvailabilityTestingPubSubUid, KPriority3BearerAP, RProperty::EInt);
       
   608 	if((error == KErrAlreadyExists) || (error == KErrNone))
       
   609 		{
       
   610 		error = a3.Attach(KAvailabilityTestingPubSubUid, KPriority3BearerAP);
       
   611 		ASSERT(error == KErrNone);
       
   612 		
       
   613 		a3.Set(ESock::TAvailabilityStatus::EMaxAvailabilityScore);
       
   614 		}
       
   615 	
       
   616 	// Open session and subsessions
       
   617 	User::LeaveIfError(ss.Connect());
       
   618 	CleanupClosePushL(ss);
       
   619 
       
   620 	User::LeaveIfError(connAIN.Open(ss));
       
   621 	CleanupClosePushL(connAIN);
       
   622 
       
   623 	User::LeaveIfError(connS.Open(ss));
       
   624 	CleanupClosePushL(connS);
       
   625 
       
   626 	// Register for notification of connections going up/down
       
   627 	INFO_PRINTF1(_L("Register for notification of connections going up/down"));
       
   628 	connAIN.AllInterfaceNotification(info1, status1);
       
   629 
       
   630 	// Start the connection
       
   631 	INFO_PRINTF2(_L("Start connection (%d)"), p.Snap());
       
   632 	User::LeaveIfError(connS.Start(p));
       
   633 
       
   634 	// Check all interface notification
       
   635 	User::WaitForRequest(status1);
       
   636 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   637 	TESTL(info1().iConnectionInfo.iIapId == KPriority1BearerAP && info1().iState == 0);
       
   638 
       
   639 	// Register for notification again
       
   640 	connAIN.AllInterfaceNotification(info1, status1);
       
   641 
       
   642 	// Check the current progress
       
   643 	error = connS.Progress(progress);
       
   644 	INFO_PRINTF3(_L("Current progress iStage(%d) iError(%d)"), progress.iStage, progress.iError);
       
   645 	TESTL(error == KErrNone);
       
   646 	TESTL(progress.iStage == KLinkLayerOpen && progress.iError == KErrNone);
       
   647 
       
   648 	// open mobility
       
   649 	INFO_PRINTF1(_L("Open mobility on connection"));
       
   650 	error = mobility.Open(connS);
       
   651 	TESTL(error == KErrNone);
       
   652 	CleanupClosePushL(mobility);
       
   653 
       
   654 	// register for mobility notification
       
   655 	eventnotbuf.Zero();
       
   656 	INFO_PRINTF1(_L("Register for notification"));
       
   657 	mobility.RegisterForMobilityNotification(eventnotbuf, status2);
       
   658 
       
   659 	// Turn first priority off
       
   660 	INFO_PRINTF1(_L("Turn off highest priority bearer"));
       
   661 	a1.Set(ESock::TAvailabilityStatus::EMinAvailabilityScore);
       
   662 	RequestInterfaceDownL(connS, ss);
       
   663 	
       
   664 	// wait for all interface notification to report bearer down
       
   665 	User::WaitForRequest(status1);
       
   666 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   667 	TESTL(info1().iConnectionInfo.iIapId == KPriority1BearerAP && info1().iState == 1);
       
   668 	
       
   669 	// register for all interface notification again
       
   670 	connAIN.AllInterfaceNotification(info1, status1);
       
   671 
       
   672 	// wait for mobility notification
       
   673 	User::WaitForRequest(status2);	
       
   674 	CCommsApiExtRespMsg * msg = CCommsApiExtRespMsg::NewL(eventnotbuf);
       
   675 	CleanupStack::PushL(msg);
       
   676 	
       
   677 	ESock::CPreferredCarrierAvailable* pca = static_cast<ESock::CPreferredCarrierAvailable*>(msg);
       
   678 	INFO_PRINTF3(_L("Preferred carrier available NewAP(%d) OldAP(%d)"), pca->NewAPInfo().AccessPoint(), pca->OldAPInfo().AccessPoint());
       
   679 	TESTL(KPriority2BearerAP == pca->NewAPInfo().AccessPoint() && KPriority1BearerAP ==  pca->OldAPInfo().AccessPoint());
       
   680 
       
   681 	// register for mobility and migrate
       
   682 	mobility.RegisterForMobilityNotification(eventnotbuf, status2);
       
   683 	INFO_PRINTF1(_L("Migrate to preferred carrier"));
       
   684 	mobility.MigrateToPreferredCarrier();
       
   685 
       
   686 	// check that the expected bearer has come up
       
   687 	User::WaitForRequest(status1);
       
   688 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   689 	TESTEL(info1().iConnectionInfo.iIapId == KPriority2BearerAP && info1().iState == 0, KErrCorrupt);
       
   690 
       
   691 	// register for it again
       
   692 	connAIN.AllInterfaceNotification(info1, status1);
       
   693 
       
   694 	// register for progress notification, for KLinkLayerClosed.
       
   695 	connS.ProgressNotification(progbuf, status3, KLinkLayerClosed);
       
   696 
       
   697 	// wait for new carrier active
       
   698 	User::WaitForRequest(status2);
       
   699 	
       
   700 	CleanupStack::PopAndDestroy(msg);
       
   701 	// verify the new carrier is as expected and then reject it
       
   702 	msg = CCommsApiExtRespMsg::NewL(eventnotbuf);
       
   703 	CleanupStack::PushL(msg);
       
   704 	ESock::CNewCarrierActive* nca = static_cast<ESock::CNewCarrierActive*>(msg);
       
   705 	INFO_PRINTF2(_L("NewCarrierActive NewAP(%d)"), nca->NewAPInfo().AccessPoint());
       
   706 	TESTL(nca->NewAPInfo().AccessPoint() == KPriority2BearerAP);
       
   707 	CleanupStack::PopAndDestroy(msg);
       
   708 
       
   709 	mobility.RegisterForMobilityNotification(eventnotbuf, status2);
       
   710 	INFO_PRINTF1(_L("Reject new carrier"));
       
   711 	mobility.NewCarrierRejected();
       
   712 
       
   713 	// wait for mobility notification
       
   714 	User::WaitForRequest(status2);	
       
   715 	msg = CCommsApiExtRespMsg::NewL(eventnotbuf);
       
   716 	CleanupStack::PushL(msg);
       
   717 	
       
   718 	pca = static_cast<ESock::CPreferredCarrierAvailable*>(msg);
       
   719 	INFO_PRINTF3(_L("Preferred carrier available NewAP(%d) OldAP(%d)"), pca->NewAPInfo().AccessPoint(), pca->OldAPInfo().AccessPoint());
       
   720 	TESTL(KPriority3BearerAP == pca->NewAPInfo().AccessPoint() && KPriority2BearerAP == pca->OldAPInfo().AccessPoint());
       
   721 
       
   722 	// register for mobility and migrate
       
   723 	mobility.RegisterForMobilityNotification(eventnotbuf, status2);
       
   724 	INFO_PRINTF1(_L("Migrate to preferred carrier"));
       
   725 	mobility.MigrateToPreferredCarrier();
       
   726 
       
   727 	// check that the expected bearer has come up
       
   728 	User::WaitForRequest(status1);
       
   729 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   730 	TESTL(info1().iConnectionInfo.iIapId == KPriority3BearerAP && info1().iState == 0);
       
   731 	
       
   732 	connAIN.AllInterfaceNotification(info1, status1);
       
   733 
       
   734 	// wait for all interface notification to tell us connection has gone down.
       
   735 	User::WaitForRequest(status1);
       
   736 	INFO_PRINTF3(_L("Interface changed IAP (%d) is in state (%d)"), info1().iConnectionInfo.iIapId, info1().iState);
       
   737 	TESTL(info1().iConnectionInfo.iIapId == KPriority2BearerAP && info1().iState == 1);
       
   738 
       
   739 	CleanupStack::PopAndDestroy(msg);
       
   740 	// verify the new carrier is as expected and then reject it
       
   741 	msg = CCommsApiExtRespMsg::NewL(eventnotbuf);
       
   742 	CleanupStack::PushL(msg);
       
   743 	nca = static_cast<ESock::CNewCarrierActive*>(msg);
       
   744 	INFO_PRINTF2(_L("NewCarrierActive NewAP(%d)"), nca->NewAPInfo().AccessPoint());
       
   745 	TESTL(nca->NewAPInfo().AccessPoint() == KPriority3BearerAP);
       
   746 	CleanupStack::PopAndDestroy(msg);
       
   747 
       
   748 	INFO_PRINTF1(_L("Accept migration"));
       
   749 	mobility.NewCarrierAccepted();
       
   750 
       
   751 	// Ensure we're never got KLinkLayerClosed
       
   752 	TESTL(status3.Int() == KRequestPending);
       
   753 	connS.CancelProgressNotification();
       
   754 	
       
   755 	CleanupStack::PopAndDestroy(&mobility);
       
   756 	CleanupStack::PopAndDestroy(&connS);
       
   757 	CleanupStack::PopAndDestroy(&connAIN);
       
   758 	CleanupStack::PopAndDestroy(&ss);
       
   759 	
       
   760 	return EPass;
       
   761 	}