Example #1
0
        public void SetRadioState(int routerIndex, bool bEnabled, bool b5Ghz)
        {
            //Log("Setting state on radio of router "+routerIndex+" to "+bEnabled + " 5 GHZ = "+b5Ghz);
            Log(String.Format(CultureInfo.InvariantCulture, "Setting state on radio of router: [{0}] to [{1}] 5GHZ = [{2}] ", routerIndex, bEnabled, b5Ghz));
            if (b5Ghz)
            {
                if (!m_ApConfigClient.SetRadio5GHzState(m_Routers[routerIndex], bEnabled))
                {
                    Log("SetRadio5GHzState returned false ignoring error");
                    //throw new Exception("SetRadio5GHzState returned false");
                }
            }
            else
            {
                if (!m_ApConfigClient.SetRadio24GHzState(m_Routers[routerIndex], bEnabled))
                {
                    Log("SetRadio24GHzState returned false ignoring error");
                    //throw new Exception("SetRadio24GHzState returned false");
                }
            }

            if (bEnabled == true)
            {
                string ssidtoscan  = GetSSID(routerIndex, b5Ghz);
                string bssidtoscan = GetBSSID(routerIndex, b5Ghz);
                Log("SetRadioState waiting for radio to appear in scan list");
                Helpers.IssueScanWaitForSSIDToAppearInScanList(m_WlanApi, m_TestInterface, ssidtoscan, bssidtoscan, 60, 500);
            }
        }
        public bool SetRadioState(int routerIndex, bool bEnabled, bool b5Ghz)
        {
            bool result = false;

            Log("Setting state on radio of router " + routerIndex + " to " + bEnabled + " 5 GHZ = " + b5Ghz);
            if (b5Ghz)
            {
                if (!AC.SetRadio5GHzState(routers[routerIndex], bEnabled))
                {
                    LogError("SetRadio5GHzState Failed to set the 5Ghz radio on router:" + routerIndex);
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            else
            {
                if (!AC.SetRadio24GHzState(routers[routerIndex], bEnabled))
                {
                    LogError("SetRadio24GHzState Failed to set the 2.4Ghz radio on router:" + routerIndex);
                    result = false;
                }
                else
                {
                    result = true;
                }
            }

            return(result);
        }
Example #3
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);
                }
            }
        }