Example #1
0
 public bool PerformEcho(Int32 AssociatedRouter, bool b5Ghz)
 {
     try
     {
         Helpers.PerformEcho(m_TestInterface.Id, m_LocalIP, m_AssociationConfiguration.ServiceAPChannelAddress, c_EchoPort, c_EchoByteStream);
     }
     catch (Exception e)
     {
         LogError("An error was encountered while testing network connectivity to the AP Server. The interface is assumed to be associated with [" + GetSSID(AssociatedRouter, b5Ghz) + "] during the test.  Error:" + e.Message);
         return(false);
         //Helpers.LogExceptionAndThrowNewException("An exception was encountered while testing network connectivity to the AP Server. The interface is assumed to be associated with "+GetSSID(AssociatedRouter,b5Ghz)+" during the test.",e);
     }
     return(true);
 }
 public bool bValidateGHZRadioAssociation(int APIndex, string expectedBssid)
 {
     for (int i = 0; i < 4; i++)
     {
         string associatedWith = Helpers.GetBSSID(Api, TestInterface);
         if (associatedWith == expectedBssid)
         {
             Log("bValidateGHZRadioAssociation Associated with Radio " + APIndex + " having bssid " + expectedBssid + " as expected");
             return(true);
         }
         Log("bValidateGHZRadioAssociation Not associated with Radio " + APIndex + " having bssid " + expectedBssid + ". Assoicated with" + associatedWith + ". Will Retry to account for propogation issues");
         Wlan.Sleep(500);
     }
     LogError("bValidateGHZRadioAssociation Giving up. Not associated with Radio " + APIndex + " having bssid " + expectedBssid);
     return(false);
 }
Example #3
0
        private void StartRadius(int routerIndex, bool b5GHZ)
        {
            AuthenticationMethod authMode;

            if (b5GHZ)
            {
                authMode = m_APConfigs[routerIndex].Authentication_5GHZ;
            }
            else
            {
                authMode = m_APConfigs[routerIndex].Authentication_24GHZ;
            }
            if (authMode == AuthenticationMethod.WPA2Enterprise)
            {
                m_ApConfigClient.StopRadiusServer();
                Log("Setting up Radius Server");
                Helpers.SetupRadius(m_ApConfigClient, m_Phase1Auth[routerIndex], m_Phase2Auth[routerIndex], m_EnterpriseDomain, m_EnterpriseUser, m_EnterprisePassword, m_EnterpriseRadiusSecret, m_EnterpriseRadiusPort);
            }
        }
Example #4
0
        public WhckScanning(RunTimeConfiguration rc,
                            APConfigParameter AP1Config24GHz,
                            APConfigParameter AP1Config5GHz,
                            APConfigParameter AP2Config24GHz,
                            APConfigParameter AP2Config5GHz,
                            SCAN_TEST_OPTIONS ScanTestOptions)
        {
            if (rc == null)
            {
                throw new ArgumentNullException("rc");
            }
            traceProvider = new TraceProvider("WhckScanning");
            this.ScanningConfiguration = rc;
            this.m_AP1Config24GHz      = AP1Config24GHz;
            this.m_AP1Config5GHz       = AP1Config5GHz;
            this.m_AP2Config24GHz      = AP2Config24GHz;
            this.m_AP2Config5GHz       = AP2Config5GHz;
            this.m_ScanTestOptions     = ScanTestOptions;

            Api = new Wlan();


            TestInterface = Helpers.GetWlanInterface(Api);
            AC            = null;
            AC            = Helpers.ConnectToService(ScanningConfiguration.ServiceBackChannelAddress);


            if (AC == null)
            {
                Log("Helpers.ConnectToService failed");
                AC = null;
                throw new Exception("Helpers.ConnectToService failed");
            }

            routers = Helpers.GetRouterCollection(AC);

            AccessPointSetup = false;
        }
        public bool ConnectToAP(string profilename)
        {
            // Before starting the connect, perform a scan
            Log("Triggering a scan");
            try
            {
                Api.Scan(TestInterface.Id, false, new TimeSpan(0, 0, 10));
            }
            catch (Exception e)
            {
                // This error is OK
                Log("Failed to do a scan. Please refer to traces for details. " + e.Message);
            }

            Log("Connecting to " + profilename);
            try
            {
                Api.ProfileConnect(TestInterface.Id, profilename, new TimeSpan(0, 0, 30));
            }
            catch (Exception e)
            {
                LogError("Failed to do a profile connect to ssid " + profilename + " with a timeout of 30s. Please refer to traces for details. " + e.Message);
                return(false);
            }
            try
            {
                Helpers.WaitForFullNetworkConnectivity(TestInterface.Id, DefaultTimeOuts.DefaultDHCPTimeout, RoamingConfiguration.ServiceAPChannelAddress, EchoPort, EchoByteStream);
            }
            catch (Exception e)
            {
                LogError("An Error was encountered when waiting for full L3 connectivity, after connecting to " + profilename + " with a timeout of " + DefaultTimeOuts.DefaultDHCPTimeout + "ms. Please refer to traces for details." + e.Message);
                return(false);
            }

            return(true);
        }
Example #6
0
        public void Scan()
        {
            Log("Scan Test Configuration Parameters: ");
            Log(m_AP1Config24GHz.GetTestParameter());
            Log(m_AP1Config5GHz.GetTestParameter());
            Log(m_AP2Config24GHz.GetTestParameter());
            Log(m_AP2Config5GHz.GetTestParameter());

            SetupRouters();
            // Turn on all Radios
            Log("Turning on all radios");
            AC.SetRadio24GHzState(routers[0], true);
            AC.SetRadio24GHzState(routers[1], true);
            AC.SetRadio5GHzState(routers[0], true);
            AC.SetRadio5GHzState(routers[1], true);

            LogMajor("Turning on Airplane Mode");
            Api.SetRadioState(TestInterface, false);

            EventHandler <EventArrivedEventArgs> ETWCallback = null;

            ETWCallback = (object sender, EventArrivedEventArgs properties) =>
            {
                LogEtwEvent(properties);
            };

            var wlanEtwWatcher = new WlanEtwWatcher();

            wlanEtwWatcher.EventArrived += ETWCallback;
            Log("Start ETW Tracing");
            wlanEtwWatcher.Start();

            bool Radio_0_24Ghz_Found = false;
            bool Radio_1_24Ghz_Found = false;
            bool Radio_0_5Ghz_Found  = false;
            bool Radio_1_5Ghz_Found  = false;

            string Reason_Radio_0_24Ghz_Found = null;
            string Reason_Radio_1_24Ghz_Found = null;
            string Reason_Radio_0_5Ghz_Found  = null;
            string Reason_Radio_1_5Ghz_Found  = null;

            try
            {
                Log("Sleeping for a second");
                Wlan.Sleep(1 * 1000); // 1s

                LogMajor("Turning off Airplane Mode");
                Api.SetRadioState(TestInterface, true);

                for (int i = 0; i < 4; i++)
                {
                    Log("Scan Iteration " + i);

                    if (i == 0)
                    {
                        // First scan is always with a flush so that we dont get old data
                        LogMajor("Calling (public) scan with flush");
                        Api.Scan(TestInterface.Id, true, new TimeSpan(0, 0, 10));
                    }
                    else if (ScanningConfiguration.IssueMulitpleScans == true)
                    {
                        // Additional scans are without flush
                        LogMajor("Calling (internal) scan without flush");
                        Api.Scan(TestInterface.Id, false, new TimeSpan(0, 0, 10));
                    }

                    // If any network is marked hidden, we need to specifically search for those
                    for (int j = 0; j < 2; j++)
                    {
                        if (APConfigs[j].BeaconEnabled_24GHZ == false)
                        {
                            LogMajor("Calling (public) scan for " + APConfigs[j].SSID_24GHZ);
                            Api.Scan(TestInterface.Id, false, APConfigs[j].SSID_24GHZ, new TimeSpan(0, 0, 10));
                        }
                        if (APConfigs[j].BeaconEnabled_5GHZ == false)
                        {
                            LogMajor("Calling (public) scan for " + APConfigs[j].SSID_5GHZ);
                            Api.Scan(TestInterface.Id, false, APConfigs[j].SSID_5GHZ, new TimeSpan(0, 0, 10));
                        }
                    }

                    if (!Radio_0_24Ghz_Found)
                    {
                        LogMajor("Scan : Locating " + APConfigs[0].SSID_24GHZ + " in bssid list");
                        if (Helpers.ValidateNetworkVisible(Api, APConfigs[0], false, out Reason_Radio_0_24Ghz_Found))
                        {
                            LogMajor(APConfigs[0].SSID_24GHZ + "found in scan list ");
                            Radio_0_24Ghz_Found = true;
                        }
                        else
                        {
                            LogMajor("ValidateNetworkVisible failed for " + APConfigs[0].SSID_24GHZ);
                        }
                    }

                    if (!Radio_1_24Ghz_Found)
                    {
                        LogMajor("Scan : Locating " + APConfigs[1].SSID_24GHZ + " in bssid list");
                        if (Helpers.ValidateNetworkVisible(Api, APConfigs[1], false, out Reason_Radio_1_24Ghz_Found))
                        {
                            LogMajor(APConfigs[1].SSID_24GHZ + "found in scan list ");
                            Radio_1_24Ghz_Found = true;
                        }
                        else
                        {
                            LogMajor("ValidateNetworkVisible failed for " + APConfigs[1].SSID_24GHZ);
                        }
                    }

                    if (!ScanningConfiguration.DeviceSupports5Ghz)
                    {
                        if (Radio_0_24Ghz_Found && Radio_1_24Ghz_Found)
                        {
                            LogMajor("Scan: Located all routers");
                            return;
                        }
                        else
                        {
                            LogMajor("Scan: Not yet located all routers ");
                            LogMajor("Router 0 2.4Ghz Found =" + Radio_0_24Ghz_Found);
                            LogMajor("Router 1 2.4Ghz Found =" + Radio_1_24Ghz_Found);
                            continue; // skip 5Ghz
                        }
                    }



                    if (!Radio_0_5Ghz_Found)
                    {
                        LogMajor("Scan : Locating " + APConfigs[0].SSID_5GHZ + " in bssid list");
                        if (Helpers.ValidateNetworkVisible(Api, APConfigs[0], true, out Reason_Radio_0_5Ghz_Found))
                        {
                            LogMajor(APConfigs[0].SSID_5GHZ + " found in scan list");
                            Radio_0_5Ghz_Found = true;
                        }
                        else
                        {
                            LogMajor("ValidateNetworkVisible failed for " + APConfigs[0].SSID_5GHZ);
                        }
                    }

                    if (!Radio_1_5Ghz_Found)
                    {
                        LogMajor("Scan : Locating " + APConfigs[1].SSID_5GHZ + " in bssid list");
                        if (Helpers.ValidateNetworkVisible(Api, APConfigs[1], true, out Reason_Radio_1_5Ghz_Found))
                        {
                            LogMajor(APConfigs[1].SSID_5GHZ + " found in scan list");
                            Radio_1_5Ghz_Found = true;
                        }
                        else
                        {
                            LogMajor("ValidateNetworkVisible failed for " + APConfigs[1].SSID_5GHZ);
                        }
                    }

                    if (Radio_0_24Ghz_Found &&
                        Radio_1_24Ghz_Found &&
                        Radio_0_5Ghz_Found &&
                        Radio_1_5Ghz_Found)
                    {
                        LogMajor("Scan: Located all routers");
                        return;
                    }

                    LogMajor("Scan: Not yet located all routers ");
                    LogMajor("Router 0 2.4Ghz Found =" + Radio_0_24Ghz_Found);
                    LogMajor("Router 1 2.4Ghz Found =" + Radio_1_24Ghz_Found);
                    LogMajor("Router 0 5Ghz Found =" + Radio_0_5Ghz_Found);
                    LogMajor("Router 1 5Ghz Found =" + Radio_1_5Ghz_Found);
                }
            }
            catch (Exception error)
            {
                LogMajor(error.ToString());
                throw;
            }
            finally
            {
                wlanEtwWatcher.Dispose();
            }


            LogMajor("Error locating all routers");
            if (!Radio_0_24Ghz_Found)
            {
                LogMajor("Scanning - " + Reason_Radio_0_24Ghz_Found);
                throw new Exception(Reason_Radio_0_24Ghz_Found);
            }
            if (!Radio_1_24Ghz_Found)
            {
                LogMajor("Scanning - " + Reason_Radio_1_24Ghz_Found);
                throw new Exception(Reason_Radio_1_24Ghz_Found);
            }

            if (ScanningConfiguration.DeviceSupports5Ghz)
            {
                if (!Radio_0_5Ghz_Found)
                {
                    LogMajor("Scanning - " + Reason_Radio_0_5Ghz_Found);
                    throw new Exception(Reason_Radio_0_5Ghz_Found);
                }
                if (!Radio_1_5Ghz_Found)
                {
                    LogMajor("Scanning - " + Reason_Radio_1_5Ghz_Found);
                    throw new Exception(Reason_Radio_1_5Ghz_Found);
                }
            }
        }
Example #7
0
        public void BasicAssociationTest()
        {
            string variationName        = "Basic Association test";
            string variationDescription = "Associate to first AP with manual profile - Turn Off Radio - Associate to second AP with manual profile";

            Helpers.LogVariationStart(variationName, variationDescription);

            Log("Deleting all wlan profiles");
            DeleteProfiles();

            Log("Starting Echo Services");
            CreateEchoServer();

            //Radios of all APs are turned on by the SetupRoutersIfNeeded();
            Log("Setting up Routers");
            SetupRoutersIfNeeded();

            string   Profile;
            APConfig ap1Config = m_APConfigs[0];
            APConfig ap2Config = m_APConfigs[1];
            string   ap1_ssid  = ap1Config.SSID_24GHZ;
            string   ap2_ssid  = (m_DeviceSupports5GHz) ? ap2Config.SSID_5GHZ : ap2Config.SSID_24GHZ;

            //In general the typical usage pattern of radio states for APs should be that they are only turned on when needed
            // as this best matches the scenario where the user moves from location A to location B.

            //Turn off AP1 5 GHz (never used)
            SetRadioState(0, false, true);

            //Turn off AP2 (both 2.4 and 5, will be used later)
            SetRadioState(1, false, false);
            SetRadioState(1, false, true);

            LogMajor("Associate with manual profile to " + ap1_ssid + " - Turn AP off - Associate with manual profile to " + ap2_ssid);

            // Create a 2.4 GHz profile for first router.
            Log("Creating a manual profile for SSID " + ap1_ssid);
            Profile = CreateProfile(0, ConnectionMode.Manual, false);

            LogMajor("Connecting to " + ap1_ssid);
            if (!ConnectToAP(ap1_ssid))
            {
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(0, false))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(0, false))
            {
                return;
            }
            //Turn off AP1 2.4 GHz (not needed anymore)
            SetRadioState(0, false, false);

            m_WlanApi.DeleteProfile(m_TestInterface.Id, ap1_ssid);

            //AP2 next

            //Turn on AP2
            SetRadioState(1, true, m_DeviceSupports5GHz);

            // Create a profile for second router.
            Log("Creating a manual profile for SSID " + ap2_ssid);
            Profile = CreateProfile(1, ConnectionMode.Manual, m_DeviceSupports5GHz);

            LogMajor("Connecting to " + ap2_ssid);
            if (!ConnectToAP(ap2_ssid))
            {
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(1, m_DeviceSupports5GHz))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(1, m_DeviceSupports5GHz))
            {
                return;
            }

            m_WlanApi.DeleteProfile(m_TestInterface.Id, ap2_ssid);

            Helpers.LogVariationStop(variationName);
        }
Example #8
0
        //does sleep association tests and hibernate association tests.
        public void AdvancedAssociationTests()
        {
            if (m_AssocTestOptions.HasFlag(ASSOC_TEST_OPTIONS.Sleep))
            {
                if (!(PowerManager.IsS3Supported() || PowerManager.IsAoAcCapableMachine()))
                {
                    LogError("S3 or AOAC is not supported.  At least one must be supported.  Run powercfg -a from an elevated cmd prompt to determine supported sleep states");
                }

                //test AP1 - sleep|CS - AP1 then AP1 - sleep|CS - AP2
                if (PowerManager.IsAoAcCapableMachine())
                {
                    //AP1 - CS - AP1
                    string sameAPName        = "Association sleep and resume - Same AP - Connected Standby";
                    string sameAPDescription = "Sleep and resume with manual profile - Connected device goes to CS - Test connection to same AP";

                    Helpers.LogVariationStart(sameAPName, sameAPDescription);
                    AssociateSameAP(0, false, false);
                    Helpers.LogVariationStop(sameAPName);

                    //AP1 - CS - AP2
                    string differentAPName        = "Association sleep and resume - Different AP - Connected Standby";
                    string differentAPDescription = "Sleep and resume with manual profile - Connected device goes to CS - Turn off AP radio - Turn on another AP radio - Test connection to new AP";

                    Helpers.LogVariationStart(differentAPName, differentAPDescription);
                    AssociateDifferentAP(0, 1, false, m_DeviceSupports5GHz, false);
                    Helpers.LogVariationStop(differentAPName);
                }
                else
                {
                    //AP1 - Sleep - AP1
                    string sameAPName        = "Association sleep and resume - Same AP";
                    string sameAPDescription = "Sleep and resume with manual profile - Connected device goes to sleep - Test connection to same AP";

                    Helpers.LogVariationStart(sameAPName, sameAPDescription);
                    AssociateSameAP(0, false, false);
                    Helpers.LogVariationStop(sameAPName);

                    //AP1 - Sleep - AP2
                    string differentAPName        = "Association sleep and resume - Different AP";
                    string differentAPDescription = "Sleep and resume with manual profile - Connected device goes to sleep - Turn off AP radio - Turn on another AP radio - Test connection to new AP";

                    Helpers.LogVariationStart(differentAPName, differentAPDescription);
                    AssociateDifferentAP(0, 1, false, m_DeviceSupports5GHz, false);
                    Helpers.LogVariationStop(differentAPName);
                }
            }

            if (m_AssocTestOptions.HasFlag(ASSOC_TEST_OPTIONS.Hibernate))
            {
                //test AP2 - hibernate - AP2 then AP2 - hibernate - AP1
                //AP2 - hiber - AP2
                if (PowerManager.IsS4Supported())
                {
                    string sameAPName        = "Association hibernate and resume - Same AP";
                    string sameAPDescription = "Hibernate and resume with manual profile - Connected device hibernates - Test connection to same AP";

                    Helpers.LogVariationStart(sameAPName, sameAPDescription);
                    AssociateSameAP(1, m_DeviceSupports5GHz, true);
                    Helpers.LogVariationStop(sameAPName);

                    //AP2 - hiber - AP1
                    string differentAPName        = "Association hibernate and resume - Different AP";
                    string differentAPDescription = "Hibernate and resume with manual profile - Connected device hibernates - Turn off AP radio - Turn on another AP radio - Test connection to new AP";

                    Helpers.LogVariationStart(differentAPName, differentAPDescription);
                    AssociateDifferentAP(1, 0, m_DeviceSupports5GHz, false, true);
                    Helpers.LogVariationStop(differentAPName);
                }
            }
        }
Example #9
0
        private void AssociateDifferentAP(int firstRouterIndex, int secondRouterIndex, bool b5GhzFirstRouter, bool b5GhzSecondRouter, bool bHibernate)
        {
            Log("Deleting all wlan profiles");
            DeleteProfiles();

            Log("Starting Echo Services");
            CreateEchoServer();

            //Radios of all APs are turned on by the SetupRoutersIfNeeded();
            Log("Setting up Routers");
            SetupRoutersIfNeeded();

            string   Profile;
            APConfig ap1Config = m_APConfigs[firstRouterIndex];
            APConfig ap2Config = m_APConfigs[secondRouterIndex];
            string   ap1_ssid  = (b5GhzFirstRouter) ? ap1Config.SSID_5GHZ : ap1Config.SSID_24GHZ;
            string   ap2_ssid  = (b5GhzSecondRouter) ? ap2Config.SSID_5GHZ : ap2Config.SSID_24GHZ;
            string   ap2_bssid = (b5GhzSecondRouter) ? ap2Config.BSSID_5GHZ : ap2Config.BSSID_24GHZ;

            //Turn off all APs
            SetRadioState(0, false, false);
            SetRadioState(0, false, true);
            SetRadioState(1, false, false);
            SetRadioState(1, false, true);
            //Turn on AP used for this run
            SetRadioState(firstRouterIndex, true, b5GhzFirstRouter);

            LogMajor("Associate with manual profile to " + ap1_ssid + " - Enter lower powerstate turn off first AP and turn on second AP - Wake - Connect with manual profile to " + ap2_ssid);

            Log("Creating a manual profile for SSID " + ap1_ssid);
            Profile = CreateProfile(firstRouterIndex, ConnectionMode.Manual, b5GhzFirstRouter);

            LogMajor("Connecting to " + ap1_ssid);
            if (!ConnectToAP(ap1_ssid))
            {
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(firstRouterIndex, b5GhzFirstRouter))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(firstRouterIndex, b5GhzFirstRouter))
            {
                return;
            }

            int delayInSeconds = 30;
            int ScenarioToRun  = 1;

            //switch
            LogMajor("Putting machine into lower power state for 2 minutes. " + ap1_ssid + " will turn off and " + ap2_ssid + "will turn on");
            m_ApConfigClient.StartApScenarioAssoc(m_Routers[secondRouterIndex], m_Routers[firstRouterIndex], ScenarioToRun, delayInSeconds, b5GhzSecondRouter, b5GhzFirstRouter);

            m_ApConfigClient.Disconnect(); //must disconnect from ap controller before going to sleep
            if (bHibernate)
            {
                LogMajor("Entering hibernate");
                m_PowerManager.Sleep(120 * 1000, SleepState.S4);
            }
            else
            {
                LogMajor("Entering deepest supported sleep");
                m_PowerManager.DeepestSleep(120 * 1000);
            }
            LogMajor("Sleeping for 30 seconds after wake up");
            Wlan.Sleep(30 * 1000);      // 30s
            m_ApConfigClient.Connect(); //must reconnect to ap controller after waking up

            //scan for new AP
            Helpers.IssueScanWaitForSSIDToAppearInScanList(m_WlanApi, m_TestInterface, ap2_ssid, ap2_bssid, 60, 500);

            //connect to next AP.
            Log("Creating a manual profile for SSID " + ap2_ssid);
            Profile = CreateProfile(secondRouterIndex, ConnectionMode.Manual, b5GhzSecondRouter);

            LogMajor("Connecting to " + ap2_ssid);
            if (!ConnectToAP(ap2_ssid))
            {
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(secondRouterIndex, b5GhzSecondRouter))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(secondRouterIndex, b5GhzSecondRouter))
            {
                return;
            }

            m_WlanApi.DeleteAllProfiles(m_TestInterface.Id);
        }
Example #10
0
        private void AssociateSameAP(int routerIndex, bool b5Ghz, bool bHibernate)
        {
            Log("Deleting all wlan profiles");
            DeleteProfiles();

            Log("Starting Echo Services");
            CreateEchoServer();

            //Radios of all APs are turned on by the SetupRoutersIfNeeded();
            Log("Setting up Routers");
            SetupRoutersIfNeeded();

            string   Profile;
            APConfig apConfig = m_APConfigs[routerIndex];
            string   ap_ssid  = (b5Ghz) ? apConfig.SSID_5GHZ : apConfig.SSID_24GHZ;

            //Turn off all APs
            SetRadioState(0, false, false);
            SetRadioState(0, false, true);
            SetRadioState(1, false, false);
            SetRadioState(1, false, true);
            //Turn on AP used for this run
            SetRadioState(routerIndex, true, b5Ghz);

            LogMajor("Associate with manual profile to " + ap_ssid + " - Enter lower powerstate - Wake - Verify connectivity to same AP");

            Log("Creating a manual profile for SSID " + ap_ssid);
            Profile = CreateProfile(routerIndex, ConnectionMode.Manual, b5Ghz);

            LogMajor("Connecting to " + ap_ssid);
            if (!ConnectToAP(ap_ssid))
            {
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(routerIndex, b5Ghz))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(routerIndex, b5Ghz))
            {
                return;
            }

            m_ApConfigClient.Disconnect(); //must disconnect from ap controller before going to sleep
            if (bHibernate)
            {
                LogMajor("Entering hibernate");
                m_PowerManager.Sleep(120 * 1000, SleepState.S4);
            }
            else
            {
                LogMajor("Entering deepest supported sleep");
                m_PowerManager.DeepestSleep(120 * 1000);
            }
            LogMajor("Sleeping for 30 seconds after wake up");
            Wlan.Sleep(30 * 1000);      // 30s
            m_ApConfigClient.Connect(); //must reconnect to ap controller after waking up

            if (!Helpers.IsConnected(m_WlanApi, m_TestInterface))
            {
                LogError("After resuming system not connected to " + ap_ssid);
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(routerIndex, b5Ghz))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(routerIndex, b5Ghz))
            {
                return;
            }

            m_WlanApi.DeleteAllProfiles(m_TestInterface.Id);
        }
Example #11
0
        private string CreateProfile(int RouterIndex, ConnectionMode mode, bool b5GHZ)
        {
            string Profile = null;
            string ssid    = null;
            AuthenticationMethod authMethod;
            EncryptionMethod     encryptionMethod;

            // Create  a Radius Server if needed first
            StartRadius(RouterIndex, b5GHZ);

            if (b5GHZ)
            {
                ssid             = m_APConfigs[RouterIndex].SSID_5GHZ;
                authMethod       = m_APConfigs[RouterIndex].Authentication_5GHZ;
                encryptionMethod = m_APConfigs[RouterIndex].Encryption_5GHZ;
            }
            else
            {
                authMethod       = m_APConfigs[RouterIndex].Authentication_24GHZ;
                ssid             = m_APConfigs[RouterIndex].SSID_24GHZ;
                encryptionMethod = m_APConfigs[RouterIndex].Encryption_24GHZ;
            }

            if (authMethod == AuthenticationMethod.WPA2Enterprise)
            {
                bool FIPSMode = false;

                // The FIPS Mode parameter will only be honored  for AES + WPA2 profiles
                if (encryptionMethod == EncryptionMethod.AES)
                {
                    FIPSMode = m_AssociationConfiguration.FIPSMode;
                }
                Profile = Helpers.CreateEnterpriseProfile(ssid, mode, encryptionMethod, m_Phase1Auth[RouterIndex], m_Phase2Auth[RouterIndex], FIPSMode);
            }
            else if (b5GHZ)
            {
                Profile = m_APConfigs[RouterIndex].CreateProfile5ghz(mode, false);
            }
            else
            {
                Profile = m_APConfigs[RouterIndex].CreateProfile24ghz(mode, false);
            }
            if (null == Profile)
            {
                Log("CreateProfile24ghz: null Profile");
                throw new Exception("CreateProfile24ghz ; null Profile");
            }

            Helpers.DeleteProfile(
                m_WlanApi,
                m_TestInterface.Id,
                ssid);

            Log(String.Format(CultureInfo.InvariantCulture, "Create profile for ssid: {0}", ssid));

            m_WlanApi.CreateProfile(
                m_TestInterface.Id,
                Profile, Wlan.ProfileScope.AllUser);

            if (authMethod == AuthenticationMethod.WPA2Enterprise)
            {
                Log(String.Format(CultureInfo.InvariantCulture, "Adding EAP Data for MSCHAPV2 for ssid: {0}", ssid));
                Helpers.SetProfileEapXmlUserDataMSChapV2(m_Phase1Auth[RouterIndex], m_Phase2Auth[RouterIndex], m_TestInterface.Id, m_WlanApi, ssid, m_EnterpriseUser, m_EnterprisePassword, m_EnterpriseDomain);

                if (mode == ConnectionMode.Auto) //must issue a connect after updating the eap data in the profile after an auto connect
                {
                    m_WlanApi.ProfileConnect(m_TestInterface.Id, ssid);
                }
            }
            return(Profile);
        }
        public void GradualLossOfSignal(bool b5Ghz)
        {
            LogMajor("Scenario - Gradual loss of signal starts");

            LogMajor("Resetting Wlan Adaptor");
            ToggleAdapter();

            SetupRoutersAndProfilesIfNeeded();

            string profilename = null;

            if (b5Ghz)
            {
                profilename = APConfigs[0].SSID_5GHZ;
            }
            else
            {
                profilename = APConfigs[0].SSID_24GHZ;
            }

            LogMajor("Testing Roaming with router " + profilename);

            LogMajor("Turning Router 0 on");
            if (!SetRadioState(0, true, b5Ghz))
            {
                return;
            }
            LogMajor("Turning Router 1 on");
            if (!SetRadioState(1, true, b5Ghz))
            {
                return;
            }

            LogMajor("Calling WlanConnect using a Wlan Profile " + profilename);
            if (!ConnectToAP(profilename))
            {
                return;
            }

            LogMajor("Making a TCP connection to Echo Services");
            if (!ConnectToEchoServer())
            {
                return;
            }


            LogMajor("Turning Router 0 on");
            if (!SetRadioState(0, true, b5Ghz))
            {
                return;
            }
            LogMajor("Turning Router 1 on");
            if (!SetRadioState(1, true, b5Ghz))
            {
                return;
            }


            for (int power0 = 84, power1 = 4; power0 >= 4 && power1 <= 84;)
            {
                if (power0 < 4)
                {
                    power0 = 4;
                }
                if (power1 > 84)
                {
                    power1 = 84;
                }

                if (power0 == 4)
                {
                    LogMajor("Turning Router 0 off");
                    if (!SetRadioState(0, false, b5Ghz))
                    {
                        return;
                    }
                }
                LogMajor("Setting txPower on Router 0 to " + power0);
                SetRadioPower(0, power0, b5Ghz);
                LogMajor("Setting txPower on Router 1 to " + power1);
                SetRadioPower(1, power1, b5Ghz);

                Wlan.Sleep(500);

                LogMajor("Currently Associated with " + Helpers.GetBSSID(Api, TestInterface));
                LogMajor("Ensuring echo Network session is alive and functional by performing echo");
                PerformEcho();


                power0 -= 10;
                power1 += 10;

                Wlan.Sleep(500);
            }
            LogMajor("Scenario - Sudden loss of signal ends");
        }
        public void SuddenDropOfSignal(bool b5Ghz)
        {
            LogMajor("Starting - Scenario Sudden Drop of Signal");

            LogMajor("Resetting Wlan Adaptor");
            ToggleAdapter();

            SetupRoutersAndProfilesIfNeeded();

            string profilename = null;

            if (b5Ghz)
            {
                profilename = APConfigs[0].SSID_5GHZ;
            }
            else
            {
                profilename = APConfigs[0].SSID_24GHZ;
            }


            LogMajor("Testing Roaming with router " + profilename);

            LogMajor("Turning Router 0 on");
            if (!SetRadioState(0, true, b5Ghz))
            {
                return;
            }
            LogMajor("Turning Router 1 on");
            if (!SetRadioState(1, true, b5Ghz))
            {
                return;
            }

            LogMajor("Calling WlanConnect using a Wlan Profile " + profilename);
            if (!ConnectToAP(profilename))
            {
                return;
            }

            LogMajor("Turning Router 0 on");
            if (!SetRadioState(0, true, b5Ghz))
            {
                return;
            }
            LogMajor("Turning Router 1 off");
            if (!SetRadioState(1, false, b5Ghz))
            {
                return;
            }
            LogMajor("Setting txPower on Router 0 to 84");
            SetRadioPower(0, 84, b5Ghz);
            LogMajor("Setting txPower on Router 1 to 84");
            SetRadioPower(1, 84, b5Ghz);

            LogMajor("Making a TCP connection to Echo Services");
            if (!ConnectToEchoServer())
            {
                return;
            }

            Log("Ensuring echo Network session is alive and functional");
            PerformEcho();


            LogMajor("Turning Router 1 on");
            if (!SetRadioState(1, true, b5Ghz))
            {
                return;
            }
            LogMajor("Turning Router 0 off");
            if (!SetRadioState(0, false, b5Ghz))
            {
                return;
            }
            LogMajor("Currently associated with " + Helpers.GetBSSID(Api, TestInterface));

            LogMajor("Ensuring echo Network session is alive and functional by performing echo");
            PerformEcho();
            LogMajor("Ensuring associated with AP 1");
            if (!ValidateRadioAssociation(1, b5Ghz))
            {
                return;
            }


            LogMajor("Turning Router 1 on");
            if (!SetRadioState(0, true, b5Ghz))
            {
                return;
            }
            LogMajor("Turning Router 1 on");
            if (!SetRadioState(1, true, b5Ghz))
            {
                return;
            }
            LogMajor("Currently associated with " + Helpers.GetBSSID(Api, TestInterface));
            LogMajor("Ensuring echo Network session is alive and functiona by performing echol");
            PerformEcho();

            LogMajor("Setting txPower on Router 0 to 84");
            SetRadioPower(0, 84, b5Ghz);
            LogMajor("Setting txPower on Router 1 to 4");
            SetRadioPower(1, 4, b5Ghz);
            LogMajor("Currently associated with " + Helpers.GetBSSID(Api, TestInterface));
            LogMajor("Ensuring echo Network session is alive and functional by performing echo");
            PerformEcho();

            LogMajor("Scenario - Sudden drop of signal ends");
        }
        public static void Roam(RunTimeConfiguration rc,
                                APConfigParameter AP1Config24GHz,
                                APConfigParameter AP1Config5GHz,
                                APConfigParameter AP2Config24GHz,
                                APConfigParameter AP2Config5GHz,
                                ROAM_TEST_OPTIONS RoamTestOptions)
        {
            WlanHckTestLogger traceProvider = new WlanHckTestLogger("RoamingDriver");

            using (UsingGroup g = new UsingGroup())
            {
                traceProvider.LogComment("Roaming Scenarios Begin");

                try
                {
                    WhckRoaming hckRoaming = new WhckRoaming(rc,
                                                             AP1Config24GHz,
                                                             AP1Config5GHz,
                                                             AP2Config24GHz,
                                                             AP2Config5GHz,
                                                             RoamTestOptions);

                    g.Add(hckRoaming);


                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.SuddenLossOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.SuddenLossOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing sudden loss of Signal");
                        hckRoaming.SuddenLossOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }

                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.SuddenDropOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.SuddenDropOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing sudden drop of Signal");
                        hckRoaming.SuddenDropOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }

                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.GradualDropOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.GradualDropOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing gradual drop of Signal");
                        hckRoaming.GradualDropOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }

                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.GradualLossOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.GradualLossOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing gradual loss of Signal");
                        hckRoaming.GradualLossOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }
                }
                catch (Exception e)
                {
                    traceProvider.LogError("Error - " + e.Message);
                    throw;
                }
            }
        }