Example #1
0
        private void SetupAccessPoints()
        {
            Log(String.Format(CultureInfo.InvariantCulture, "ASSOCIATION_VARIATION: Setup {0}", m_AssocTestOptions.ToString()));

            m_APConfigs = new Collection <APConfig>();

            // FIPS mode only phys
            if (m_AssociationConfiguration.FIPSMode)
            {
                if (m_AssociationConfiguration.TestNFIPS)
                {
                    //If TestNFIPS is set then use n phy regardless of what it was before
                    m_AP1Config24GHz.Phy = PhyType.n;
                    m_AP1Config5GHz.Phy  = PhyType.n;

                    m_AP2Config24GHz.Phy = PhyType.n;
                    m_AP2Config24GHz.Phy = PhyType.n;
                }
                else
                {
                    //If TestNFIPS not set then need to downgrade any n phy.
                    if (m_AP1Config24GHz.Phy == PhyType.n)
                    {
                        m_AP1Config24GHz.Phy = PhyType.g;
                    }
                    if (m_AP1Config5GHz.Phy == PhyType.n)
                    {
                        m_AP1Config5GHz.Phy = PhyType.a;
                    }
                    if (m_AP2Config24GHz.Phy == PhyType.n)
                    {
                        m_AP2Config24GHz.Phy = PhyType.g;
                    }
                    if (m_AP2Config5GHz.Phy == PhyType.n)
                    {
                        m_AP2Config5GHz.Phy = PhyType.a;
                    }
                }
            }


            m_APConfigs.Add(WlanAccessPointHelper.CreateWirelessAccessPoint(
                                m_AP1Config24GHz.Auth, m_AP1Config24GHz.Cipher, m_AP1Config24GHz.Phy, "1234567890",
                                m_AP1Config5GHz.Auth, m_AP1Config5GHz.Cipher, m_AP1Config5GHz.Phy, "1234567890"));

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

            m_APConfigs.Add(WlanAccessPointHelper.CreateWirelessAccessPoint(
                                m_AP2Config24GHz.Auth, m_AP2Config24GHz.Cipher, m_AP2Config24GHz.Phy, "1234567890",
                                m_AP2Config5GHz.Auth, m_AP2Config5GHz.Cipher, m_AP2Config5GHz.Phy, "1234567890"));

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

            //set hidden.
            m_APConfigs[0].BeaconEnabled_24GHZ = !m_AP1Config24GHz.IsHidden;
            m_APConfigs[0].BeaconEnabled_5GHZ  = !m_AP1Config5GHz.IsHidden;
            m_APConfigs[1].BeaconEnabled_24GHZ = !m_AP2Config24GHz.IsHidden;
            m_APConfigs[1].BeaconEnabled_5GHZ  = !m_AP2Config5GHz.IsHidden;

            // We only use Enterprise on second router. Setting both
            m_Phase1Auth[0] = m_AP2Config24GHz.EapPhase1Type;
            m_Phase2Auth[0] = m_AP2Config24GHz.EapPhase2Type;

            m_Phase1Auth[1] = m_AP2Config24GHz.EapPhase1Type;
            m_Phase2Auth[1] = m_AP2Config24GHz.EapPhase2Type;

            m_APConfigs[0].RadiusIPAddress_24GHZ = m_AssociationConfiguration.ServiceAPChannelAddress;
            m_APConfigs[1].RadiusIPAddress_24GHZ = m_AssociationConfiguration.ServiceAPChannelAddress;
            m_APConfigs[0].RadiusIPAddress_5GHZ  = m_AssociationConfiguration.ServiceAPChannelAddress;
            m_APConfigs[1].RadiusIPAddress_5GHZ  = m_AssociationConfiguration.ServiceAPChannelAddress;

            m_APConfigs[0].RadiusSecretKey_24GHZ = m_EnterpriseRadiusSecret;
            m_APConfigs[1].RadiusSecretKey_24GHZ = m_EnterpriseRadiusSecret;
            m_APConfigs[0].RadiusSecretKey_5GHZ  = m_EnterpriseRadiusSecret;
            m_APConfigs[1].RadiusSecretKey_5GHZ  = m_EnterpriseRadiusSecret;


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

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

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

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

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

            m_APConfigs[0].SSID_24GHZ = configuredSSIDs[0].TwoPoint4GhzSSID;
            m_APConfigs[0].SSID_5GHZ  = configuredSSIDs[0].FiveghzSSID;
            m_APConfigs[1].SSID_24GHZ = configuredSSIDs[1].TwoPoint4GhzSSID;
            m_APConfigs[1].SSID_5GHZ  = configuredSSIDs[1].FiveghzSSID;

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

            LogMajor("Taking the LAN ports down on both routers");
            m_ApConfigClient.SetLanPortsState(routerList[0], true);
            m_ApConfigClient.SetLanPortsState(routerList[1], true);

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

                m_APConfigs[i].BSSID_5GHZ = m_ApConfigClient.GetAccessPointBSSID(m_Routers[i], true);
                LogMajor("BSSID(" + m_APConfigs[i].SSID_5GHZ + ")=" + m_APConfigs[i].BSSID_5GHZ);
                LogMajor("AuthenticationMethod(" + m_APConfigs[i].SSID_5GHZ + ")=" + m_APConfigs[i].Authentication_5GHZ.ProfileValue);
                LogMajor("Encryption(" + m_APConfigs[i].SSID_5GHZ + ")=" + m_APConfigs[i].Encryption_5GHZ.ProfileValue);
                LogMajor("Phy(" + m_APConfigs[i].SSID_5GHZ + ")=" + m_APConfigs[i].PhyType_5GHZ.ProfileValue);
                LogMajor("Channel(" + m_APConfigs[i].SSID_5GHZ + ")=" + m_APConfigs[i].RadioChannel5Ghz);
            }
        }
        // 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);
            }
        }