Beispiel #1
0
        // Here we will switch based on the router
        private void SetupAccessPoints()
        {
            bool bSameSSID = false;

            APConfigs = new List <APConfig>();

            APConfigs.Add(WlanAccessPointHelper.CreateWirelessAccessPoint(
                              m_AP1Config24GHz.Auth, m_AP1Config24GHz.Cipher, m_AP1Config24GHz.Phy, "TestPassphrase2",
                              m_AP1Config5GHz.Auth, m_AP1Config5GHz.Cipher, m_AP1Config5GHz.Phy, "TestPassphrase1"));

            if (m_ScanTestOptions.HasFlag(SCAN_TEST_OPTIONS.DuplicateSSIDs))
            {
                // Both APs should have same SSID
                APConfigs.Add(WlanAccessPointHelper.DuplicateAPForRoaming(APConfigs[0]));
                bSameSSID = true;
            }
            else
            {
                APConfigs.Add(WlanAccessPointHelper.CreateWirelessAccessPoint(
                                  m_AP2Config24GHz.Auth, m_AP2Config24GHz.Cipher, m_AP2Config24GHz.Phy, "TestPassphrase2",
                                  m_AP2Config5GHz.Auth, m_AP2Config5GHz.Cipher, m_AP2Config5GHz.Phy, "TestPassphrase1"));
            }

            APConfigs[1].BSSID_24GHZ = WlanAccessPointHelper.GenerateBSSID();
            APConfigs[1].BSSID_5GHZ  = WlanAccessPointHelper.GenerateBSSID();

            APConfigs[0].RadioChannel24Ghz = m_AP1Config24GHz.Channel;
            APConfigs[0].RadioChannel5Ghz  = m_AP1Config5GHz.Channel;

            APConfigs[1].RadioChannel24Ghz = m_AP2Config24GHz.Channel;
            APConfigs[1].RadioChannel5Ghz  = m_AP2Config5GHz.Channel;

            APConfigs[0].BeaconEnabled_24GHZ = !m_AP1Config24GHz.IsHidden;
            APConfigs[0].BeaconEnabled_5GHZ  = !m_AP1Config5GHz.IsHidden;
            APConfigs[1].BeaconEnabled_24GHZ = !m_AP2Config24GHz.IsHidden;
            APConfigs[1].BeaconEnabled_5GHZ  = !m_AP2Config5GHz.IsHidden;

            // For the same SSID case, we want the APs to be configured with the specific SSID
            if (bSameSSID)
            {
                APConfigs[0].SmartCompare = false;
                APConfigs[1].SmartCompare = false;
            }

            Guid[] routerList = new Guid[2];
            routerList[0] = routers[0];
            routerList[1] = routers[1];

            Collection <ConfiguredSSIDs> configuredSSIDs = new Collection <ConfiguredSSIDs>();

            LogMajor("Configuring Router0");
            LogMajor("Configuring Router1");

            APConfig[] apConfigArray = new APConfig[APConfigs.Count];
            for (int index = 0; index < APConfigs.Count; index++)
            {
                apConfigArray[index] = APConfigs[index];
            }

            AC.ApplyConfigurationParallel(routerList, apConfigArray, out configuredSSIDs);

            if (!bSameSSID)
            {
                APConfigs[0].SSID_24GHZ = configuredSSIDs[0].TwoPoint4GhzSSID;
                APConfigs[0].SSID_5GHZ  = configuredSSIDs[0].FiveghzSSID;
                APConfigs[1].SSID_24GHZ = configuredSSIDs[1].TwoPoint4GhzSSID;
                APConfigs[1].SSID_5GHZ  = configuredSSIDs[1].FiveghzSSID;
            }

            LogMajor("Configured Router0 SSID:" + APConfigs[0].SSID_24GHZ + "/" + APConfigs[0].SSID_5GHZ);
            LogMajor("Configured Router1 SSID:" + APConfigs[1].SSID_24GHZ + "/" + APConfigs[1].SSID_5GHZ);


            Log("Reading the BSSIDs configured on router for validation when connected");
            for (int i = 0; i < 2; i++)
            {
                APConfigs[i].BSSID_24GHZ = AC.GetAccessPointBSSID(routers[i], false);
                LogMajor("BSSID(" + APConfigs[i].SSID_24GHZ + ") = " + APConfigs[i].BSSID_24GHZ);
                LogMajor("Authentication(" + APConfigs[i].SSID_24GHZ + ") = " + APConfigs[i].Authentication_24GHZ.ProfileValue);
                LogMajor("Encryption(" + APConfigs[i].SSID_24GHZ + ") = " + APConfigs[i].Encryption_24GHZ.ProfileValue);
                LogMajor("Phy(" + APConfigs[i].SSID_24GHZ + ") = " + APConfigs[i].PhyType_24GHZ.ProfileValue);
                LogMajor("Channel(" + APConfigs[i].SSID_24GHZ + ") = " + APConfigs[i].RadioChannel24Ghz);
                LogMajor("Hidden(" + APConfigs[i].SSID_24GHZ + ") = " + ((APConfigs[i].BeaconEnabled_24GHZ == false) ? "Yes" : "No"));

                APConfigs[i].BSSID_5GHZ = AC.GetAccessPointBSSID(routers[i], true);
                LogMajor("BSSID(" + APConfigs[i].SSID_5GHZ + ")= " + APConfigs[i].BSSID_5GHZ);
                LogMajor("AuthenticationMethod(" + APConfigs[i].SSID_5GHZ + ") = " + APConfigs[i].Authentication_5GHZ.ProfileValue);
                LogMajor("Encryption(" + APConfigs[i].SSID_5GHZ + ") = " + APConfigs[i].Encryption_5GHZ.ProfileValue);
                LogMajor("Phy(" + APConfigs[i].SSID_5GHZ + ") = " + APConfigs[i].PhyType_5GHZ.ProfileValue);
                LogMajor("Channel(" + APConfigs[i].SSID_5GHZ + ") = " + APConfigs[i].RadioChannel5Ghz);
                LogMajor("Hidden(" + APConfigs[i].SSID_5GHZ + ") = " + ((APConfigs[i].BeaconEnabled_5GHZ == false) ? "Yes" : "No"));
            }
        }
        // Here we will switch based on the router
        private void SetupAccessPoints()
        {
            bool bSetupRadius = false;

            APConfigs = new List <APConfig>();

            APConfigs.Add(WlanAccessPointHelper.CreateWirelessAccessPoint(
                              m_AP1Config24GHz.Auth, m_AP1Config24GHz.Cipher, m_AP1Config24GHz.Phy, "TestPassphrase2",
                              m_AP1Config5GHz.Auth, m_AP1Config5GHz.Cipher, m_AP1Config5GHz.Phy, "TestPassphrase1"));

            APConfigs[0].RadioChannel24Ghz = m_AP1Config24GHz.Channel;
            APConfigs[0].RadioChannel5Ghz  = m_AP1Config5GHz.Channel;

            // TODO: Make this nicer
            if (m_AP1Config24GHz.Auth == AuthenticationMethod.WPA2Enterprise)
            {
                phase1Auth   = m_AP1Config24GHz.EapPhase1Type;
                phase2Auth   = m_AP1Config24GHz.EapPhase2Type;
                bSetupRadius = true;
            }
            else if (m_AP1Config5GHz.Auth == AuthenticationMethod.WPA2Enterprise)
            {
                phase1Auth   = m_AP1Config5GHz.EapPhase1Type;
                phase2Auth   = m_AP1Config5GHz.EapPhase2Type;
                bSetupRadius = true;
            }
            else if (m_AP2Config24GHz.Auth == AuthenticationMethod.WPA2Enterprise)
            {
                phase1Auth   = m_AP2Config24GHz.EapPhase1Type;
                phase2Auth   = m_AP2Config24GHz.EapPhase2Type;
                bSetupRadius = true;
            }
            else if (m_AP2Config5GHz.Auth == AuthenticationMethod.WPA2Enterprise)
            {
                phase1Auth   = m_AP2Config5GHz.EapPhase1Type;
                phase2Auth   = m_AP2Config5GHz.EapPhase2Type;
                bSetupRadius = true;
            }

            if (bSetupRadius)
            {
                APConfigs[0].RadiusIPAddress_24GHZ = RoamingConfiguration.ServiceAPChannelAddress;
                APConfigs[0].RadiusIPAddress_5GHZ  = RoamingConfiguration.ServiceAPChannelAddress;

                APConfigs[0].RadiusSecretKey_24GHZ = EnterpriseRadiusSecret;
                APConfigs[0].RadiusSecretKey_5GHZ  = EnterpriseRadiusSecret;
            }

            // Both APs should have same SSID
            APConfigs.Add(WlanAccessPointHelper.DuplicateAPForRoaming(APConfigs[0]));

            // Update stuff for second AP
            APConfigs[1].BSSID_24GHZ = WlanAccessPointHelper.GenerateBSSID();
            APConfigs[1].BSSID_5GHZ  = WlanAccessPointHelper.GenerateBSSID();

            APConfigs[1].RadioChannel24Ghz = m_AP2Config24GHz.Channel;
            APConfigs[1].RadioChannel5Ghz  = m_AP2Config5GHz.Channel;

            APConfigs[0].DHCPServerEnabled = false;
            APConfigs[0].LocalIPAddress    = Helpers.RouterAlternateLocalIPAddress;
            APConfigs[0].NATEnabled        = false; // Need this with Static route configured on AP controller machine
            APConfigs[0].SmartCompare      = false; //Since the ap's NEED the same SSID this must be false

            APConfigs[1].DHCPServerEnabled = true;
            APConfigs[1].DHCPGateway       = Helpers.RouterAlternateLocalIPAddress;
            APConfigs[1].NATEnabled        = false; // Need this with Static route configured on AP controller machine
            APConfigs[1].SmartCompare      = false; //Since the ap's NEED the same SSID this must be false

            Guid[] routerList = new Guid[2];
            routerList[0] = routers[0];
            routerList[1] = routers[1];

            Collection <ConfiguredSSIDs> configuredSSIDs = new Collection <ConfiguredSSIDs>();

            LogMajor("Configuring Router0");
            LogMajor("Configuring Router1");

            APConfig[] apConfigArray = new APConfig[APConfigs.Count];
            for (int index = 0; index < APConfigs.Count; index++)
            {
                apConfigArray[index] = APConfigs[index];
            }

            AC.ApplyConfigurationParallel(routerList, apConfigArray, out configuredSSIDs);

            LogMajor("Configured Router0 SSID:" + APConfigs[0].SSID_24GHZ + "/" + APConfigs[0].SSID_5GHZ);
            LogMajor("Configured Router1 SSID:" + APConfigs[1].SSID_24GHZ + "/" + APConfigs[1].SSID_5GHZ);

            LogMajor("Bringing up the Lan ports on both the routers");
            AC.SetLanPortsState(routerList[0], false);
            AC.SetLanPortsState(routerList[1], false);
            LogMajor("Setting up static routes from AP server to router");
            AC.SetStaticRoute(routers[1]);

            Log("Reading the BSSIDs configured on router for validation when connected");
            for (int i = 0; i < 2; i++)
            {
                APConfigs[i].BSSID_24GHZ = AC.GetAccessPointBSSID(routers[i], false);
                LogMajor("BSSID(" + APConfigs[i].SSID_24GHZ + ")=" + APConfigs[i].BSSID_24GHZ);
                LogMajor("Authentication(" + APConfigs[i].SSID_24GHZ + ")=" + APConfigs[i].Authentication_24GHZ.ProfileValue);
                LogMajor("Encryption(" + APConfigs[i].SSID_24GHZ + ")=" + APConfigs[i].Encryption_24GHZ.ProfileValue);
                LogMajor("Phy(" + APConfigs[i].SSID_24GHZ + ")=" + APConfigs[i].PhyType_24GHZ.ProfileValue);
                LogMajor("Channel(" + APConfigs[i].SSID_24GHZ + ")=" + APConfigs[i].RadioChannel24Ghz);

                APConfigs[i].BSSID_5GHZ = AC.GetAccessPointBSSID(routers[i], true);
                LogMajor("BSSID(" + APConfigs[i].SSID_5GHZ + ")=" + APConfigs[i].BSSID_5GHZ);
                LogMajor("AuthenticationMethod(" + APConfigs[i].SSID_5GHZ + ")=" + APConfigs[i].Authentication_5GHZ.ProfileValue);
                LogMajor("Encryption(" + APConfigs[i].SSID_5GHZ + ")=" + APConfigs[i].Encryption_5GHZ.ProfileValue);
                LogMajor("Phy(" + APConfigs[i].SSID_5GHZ + ")=" + APConfigs[i].PhyType_5GHZ.ProfileValue);
                LogMajor("Channel(" + APConfigs[i].SSID_5GHZ + ")=" + APConfigs[i].RadioChannel5Ghz);
            }
        }