telephonyprotocols/pdplayer/umts/test/te_spudNetworkSide/src/te_spudNetworkSideSteps.cpp
branchRCL_3
changeset 82 042fd2753b8f
parent 74 9200f38b1324
equal deleted inserted replaced
74:9200f38b1324 82:042fd2753b8f
    29 #include <nifvar.h> // Nifman Progress notifications
    29 #include <nifvar.h> // Nifman Progress notifications
    30 #include <in_sock.h>
    30 #include <in_sock.h>
    31 #include <es_enum.h> 
    31 #include <es_enum.h> 
    32 #include <comms-infras/es_config.h>
    32 #include <comms-infras/es_config.h>
    33 #include <nifman.h>
    33 #include <nifman.h>
    34 
       
    35 #define SYMBIAN_COMMSFW_MBUF_GOBBLER // include MACRO defined in mbufgobblerproviders.mmp, used to differentiate the MBUFGOBBLER component from the pass through layer which it is based on.
       
    36 #include <comms-infras/mbufgobblerpubsub.h>
    34 #include <comms-infras/mbufgobblerpubsub.h>
    37 
    35 
    38 #ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
    36 #ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
    39 #include <networking/qoslib.h>
    37 #include <networking/qoslib.h>
    40 #else
    38 #else
    98 		RProperty::Define(KUidPSCsyWriteResultCategory, aPortNum, KUidPSCsyWriteResultCategoryKeyType);
    96 		RProperty::Define(KUidPSCsyWriteResultCategory, aPortNum, KUidPSCsyWriteResultCategoryKeyType);
    99 		}
    97 		}
   100 	TestL(RProperty::Set(KUidPSCsyWriteResultCategory, aPortNum, aErrorCode), _L("Set PSCsy write result"));
    98 	TestL(RProperty::Set(KUidPSCsyWriteResultCategory, aPortNum, aErrorCode), _L("Set PSCsy write result"));
   101   	INFO_PRINTF3(_L("Next write on [PKTLOOPBACK::%d] is going to fail with [%d]"), aPortNum, aErrorCode);
    99   	INFO_PRINTF3(_L("Next write on [PKTLOOPBACK::%d] is going to fail with [%d]"), aPortNum, aErrorCode);
   102   	}
   100   	}
   103 
   101 	
   104 void CSpudNetSideTestBase::ClearNextPktLoopbackCsyWriteL(TInt aPortNum)
       
   105     {
       
   106     TInt dummy(0);
       
   107     TInt ret = RProperty::Get(KUidPSCsyWriteResultCategory, aPortNum, dummy);
       
   108     if(ret != KErrNotFound)
       
   109         {
       
   110         RProperty::Set(KUidPSCsyWriteResultCategory, aPortNum, KErrNone);
       
   111         }
       
   112     INFO_PRINTF2(_L("Reset to KErrNone for the next write on [PKTLOOPBACK::%d] port"), aPortNum);
       
   113     }
       
   114 
       
   115 /**
   102 /**
   116 Blocks until Nifman progress notification is received.
   103 Blocks until Nifman progress notification is received.
   117 
   104 
   118 
   105 
   119 @param aReqStatus Request status to wait on for the notification
   106 @param aReqStatus Request status to wait on for the notification
  1647 	// We sneak in and stop the entire interface.
  1634 	// We sneak in and stop the entire interface.
  1648 	// We don't bother listening for QoS failure in this particular test.
  1635 	// We don't bother listening for QoS failure in this particular test.
  1649 	StopInterfaceL();
  1636 	StopInterfaceL();
  1650 	
  1637 	
  1651 	StopSecondaryL();
  1638 	StopSecondaryL();
  1652 
  1639 	
  1653 	ClearNextPktLoopbackCsyWriteL(loopbackPort);
       
  1654 	return EPass;
  1640 	return EPass;
  1655 	}
  1641 	}
  1656 
  1642 
  1657 /**
  1643 /**
  1658 Test RConnection:Stop on Spud, when the secondary PDP context is being deleted by GUQoS due to idle timeout.
  1644 Test RConnection:Stop on Spud, when the secondary PDP context is being deleted by GUQoS due to idle timeout.
  1721 	if(!GetIntFromConfig(ConfigSection(), _L("PrimaryLoopbackPort"), loopbackPort))
  1707 	if(!GetIntFromConfig(ConfigSection(), _L("PrimaryLoopbackPort"), loopbackPort))
  1722 		{
  1708 		{
  1723 		User::Leave(KErrNotFound);
  1709 		User::Leave(KErrNotFound);
  1724 		}
  1710 		}
  1725 	FailNextPktLoopbackCsyWriteL(loopbackPort, KErrCompletion);
  1711 	FailNextPktLoopbackCsyWriteL(loopbackPort, KErrCompletion);
  1726 
  1712 		
  1727 	TRequestStatus sendStatus;
  1713 	TRequestStatus sendStatus;
  1728 	iSocket.Send(KCommWriteData, 0, sendStatus);
  1714 	iSocket.Send(KCommWriteData, 0, sendStatus);
  1729 	User::WaitForRequest(sendStatus);
  1715 	User::WaitForRequest(sendStatus);
  1730 	TestL(sendStatus.Int(), 0, _L("Socket send status")); // cause the lower NIF send to fail.
  1716 	TestL(sendStatus.Int(), 0, _L("Socket send status")); // cause the lower NIF send to fail.
  1731 	// Keep Nifman in Long idle timeout. This is more realistic scenario.
  1717 	// Keep Nifman in Long idle timeout. This is more realistic scenario.
  1732 	// Now the lower NIF has fired LinkLayerDown, and the primary context is being deleted.
  1718 	// Now the lower NIF has fired LinkLayerDown, and the primary context is being deleted.
  1733 	// Sim TSY delays the completion of the deletion request. 
  1719 	// Sim TSY delays the completion of the deletion request. 
  1734 	// In the meanwhile, we sneak in and stop the interface.
  1720 	// In the meanwhile, we sneak in and stop the interface.
  1735 	
  1721 	
  1736 	StopInterfaceL();
  1722 	StopInterfaceL();
  1737 
       
  1738 	ClearNextPktLoopbackCsyWriteL(loopbackPort);
       
  1739 	return EPass;	
  1723 	return EPass;	
  1740 	};
  1724 	};
  1741 
  1725 
  1742 /**
  1726 /**
  1743 Test RConnection:Stop on Spud, when only the primary PDP context exists and is active (i.e. no secondaries)
  1727 Test RConnection:Stop on Spud, when only the primary PDP context exists and is active (i.e. no secondaries)
  2153 
  2137 
  2154 	// start 2 more PPP instances opposite the SPUD's primary and secondary context PPP instances
  2138 	// start 2 more PPP instances opposite the SPUD's primary and secondary context PPP instances
  2155 	CConnectionStart *primaryIfStart = CConnectionStart::NewLC(iEsock, *this, primaryIapId);
  2139 	CConnectionStart *primaryIfStart = CConnectionStart::NewLC(iEsock, *this, primaryIapId);
  2156 	CConnectionStart *secondaryIfStart = CConnectionStart::NewLC(iEsock, *this, secondaryIapId);
  2140 	CConnectionStart *secondaryIfStart = CConnectionStart::NewLC(iEsock, *this, secondaryIapId);
  2157 
  2141 
  2158     TRequestStatus progressReqSt;   
       
  2159     primaryIfStart->iInterface.ProgressNotification(iProgressBuf, progressReqSt, KConnectionUp);
       
  2160 
       
  2161     WaitForProgressNotificationL(progressReqSt, KConnectionUp, 0); // We can wait here forever. Set timeout on test step.
       
  2162 
       
  2163     secondaryIfStart->iInterface.ProgressNotification(iProgressBuf, progressReqSt, KConnectionUp);
       
  2164     WaitForProgressNotificationL(progressReqSt, KConnectionUp, 0); // We can wait here forever. Set timeout on test step.
       
  2165 
       
  2166 #ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
  2142 #ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
  2167 	WaitForQoSEventL(_L("SecondaryActivationEvent2"), _L("SecondaryActivationEvent2Reason"));
  2143 	WaitForQoSEventL(_L("SecondaryActivationEvent2"), _L("SecondaryActivationEvent2Reason"));
  2168 #else
  2144 #else
       
  2145 	User::After(2*KTimeToStartSecondary);
  2169 	VerifySubconnectionCountL(_L("SubConnectionCount2"), PDPIAP);
  2146 	VerifySubconnectionCountL(_L("SubConnectionCount2"), PDPIAP);
  2170 #endif
  2147 #endif
  2171 
  2148 
  2172 	// set up a socket from the second PPP instance (that connects to the SPUD's secondary context)
  2149 	// set up a socket from the second PPP instance (that connects to the SPUD's secondary context)
  2173 	RSocket secondPppSocket;
  2150 	RSocket secondPppSocket;
  2369     iInterface.Stop();
  2346     iInterface.Stop();
  2370     iInterface.Close(); 
  2347     iInterface.Close(); 
  2371 
  2348 
  2372     return EPass;
  2349     return EPass;
  2373     }
  2350     }
  2374 
       
  2375 enum TVerdict CRawIpMinMaxMMU::RunTestStepL()
       
  2376     {
       
  2377     //Start 1st context
       
  2378     RConnection* conn1 = new (ELeave) RConnection();
       
  2379     CleanupClosePushL<RConnection>(*conn1);
       
  2380 
       
  2381     TInt primaryIapId;
       
  2382     if (!GetIntFromConfig(ConfigSection(), _L("PrimaryIapId1"), primaryIapId))
       
  2383         {
       
  2384         User::Leave(KErrNotFound);
       
  2385         }
       
  2386 
       
  2387     TCommDbConnPref conn1Pref;
       
  2388     conn1Pref.SetIapId(primaryIapId);
       
  2389     
       
  2390     INFO_PRINTF2(_L("Test starting Interface IAP ID == %d"), primaryIapId); 
       
  2391     TestL(conn1->Open(iEsock), _L("RConnection::Open the interface"));
       
  2392     TestL(conn1->Start(conn1Pref), _L("RConnection::Start the interface"));
       
  2393 
       
  2394     //Start 2nd context
       
  2395     RConnection* conn2 = new (ELeave) RConnection();
       
  2396     CleanupClosePushL<RConnection>(*conn2);
       
  2397 
       
  2398     if (!GetIntFromConfig(ConfigSection(), _L("PrimaryIapId2"), primaryIapId))
       
  2399         {
       
  2400         User::Leave(KErrNotFound);
       
  2401         }
       
  2402 
       
  2403     TCommDbConnPref conn2Pref;
       
  2404     conn2Pref.SetIapId(primaryIapId);
       
  2405     
       
  2406     INFO_PRINTF2(_L("Test starting Interface IAP ID == %d"), primaryIapId);     
       
  2407     TestL(conn2->Open(iEsock), _L("RConnection::Open the interface"));
       
  2408     TestL(conn2->Start(conn2Pref), _L("RConnection::Start the interface"));
       
  2409 
       
  2410     //Open & Connect 1st Socket
       
  2411     RSocket sock1;
       
  2412     TestL(sock1.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp, *conn1), _L("RSocket::Open"));
       
  2413     CleanupClosePushL<RSocket>(sock1);
       
  2414     TInetAddr localAddr;
       
  2415     localAddr.SetPort(KConfiguredTftFilter1DestPort);
       
  2416     TestL(sock1.Bind(localAddr), _L("Binding the local Socket"));
       
  2417     
       
  2418     TInetAddr dstAddr;
       
  2419     dstAddr.SetPort(KConfiguredTftFilter1SrcPort);
       
  2420     dstAddr.Input(KConfiguredTftFilter1SrcAddr);
       
  2421 
       
  2422     TRequestStatus status;
       
  2423     sock1.Connect(dstAddr, status);
       
  2424     User::WaitForRequest(status);
       
  2425     TestL(status.Int(), _L("RSocket::Connect status opening 1st socket"));
       
  2426 
       
  2427     //Open & Bind 2nd Socket
       
  2428     RSocket sock2;
       
  2429     TestL(sock2.Open(iEsock, KAfInet, KSockDatagram, KProtocolInetUdp, *conn2), _L("RSocket::Open"));
       
  2430     CleanupClosePushL<RSocket>(sock2);
       
  2431     localAddr.SetPort(KConfiguredTftFilter1SrcPort);
       
  2432     TestL(sock2.Bind(localAddr), _L("Binding the local Socket"));
       
  2433 
       
  2434     //then send & receive data.
       
  2435     const TInt KMaxMMU = 4000;
       
  2436     TBuf8<KMaxMMU> *sendBuf = new(ELeave) TBuf8<KMaxMMU>();
       
  2437     CleanupStack::PushL(sendBuf);
       
  2438     
       
  2439     TBuf8<KMaxMMU> *recvBuf = new(ELeave) TBuf8<KMaxMMU>();
       
  2440     CleanupStack::PushL(recvBuf);
       
  2441 
       
  2442     TBuf8<KMaxMMU> *recvBuf2 = new(ELeave) TBuf8<KMaxMMU>();
       
  2443     CleanupStack::PushL(recvBuf2);
       
  2444 
       
  2445     TInt end;
       
  2446     if (!GetIntFromConfig(ConfigSection(), _L("TestMaxMMU"), end))
       
  2447         {
       
  2448         User::Leave(KErrNotFound);
       
  2449         }
       
  2450     
       
  2451     TInt begin;
       
  2452     if (!GetIntFromConfig(ConfigSection(), _L("TestMinMMU"), begin))
       
  2453         {
       
  2454         User::Leave(KErrNotFound);
       
  2455         }
       
  2456 
       
  2457     if (begin > end)
       
  2458         {
       
  2459         User::Leave(KErrArgument);
       
  2460         }
       
  2461 
       
  2462     INFO_PRINTF3(_L("Sending data frame size from (%d) to (%d)"), begin, end); 
       
  2463     TRequestStatus readStatus;
       
  2464 
       
  2465     for(TInt j=begin;j<=end;j++)
       
  2466         {
       
  2467         sendBuf->Zero();
       
  2468         for (TInt i=0;i<j;i++)
       
  2469             {
       
  2470             sendBuf->Append(Math::Random() & 0x7f);
       
  2471             }
       
  2472 
       
  2473         recvBuf->Zero();
       
  2474         sock2.Read(*recvBuf, readStatus);
       
  2475         sock1.Write(*sendBuf, status);
       
  2476         
       
  2477         User::WaitForRequest(status);
       
  2478         TESTL(status.Int() == 0);
       
  2479         User::WaitForRequest(readStatus);
       
  2480         TESTL(readStatus.Int() == 0);
       
  2481         if (sendBuf->Length() > recvBuf->Length())
       
  2482             {
       
  2483             recvBuf2->Zero();
       
  2484             sock2.Read(*recvBuf2, readStatus);
       
  2485             User::WaitForRequest(readStatus);
       
  2486             TESTL(readStatus.Int() == 0);
       
  2487             recvBuf->Append(*recvBuf2);
       
  2488             TESTL(sendBuf->Length() == recvBuf->Length());
       
  2489             }
       
  2490         TESTL(recvBuf->Compare(*sendBuf) == 0);
       
  2491         }
       
  2492 
       
  2493     CleanupStack::PopAndDestroy(7); //conn1, conn2, sock1, sock2, sendBuf, recvBuf, recvBuf2
       
  2494 
       
  2495     return EPass;
       
  2496     }
       
  2497 
       
  2498 
  2351 
  2499 enum TVerdict CRawIpMBufExhaustionRx::RunTestStepL()
  2352 enum TVerdict CRawIpMBufExhaustionRx::RunTestStepL()
  2500     {    
  2353     {    
  2501     /*
  2354     /*
  2502       * This test checks that the PDP flow can handle the scenario when it receives a packet but finds that
  2355       * This test checks that the PDP flow can handle the scenario when it receives a packet but finds that