private void SetupProfiles(bool b5Ghz)
        {
            string Profile = null;
            string ssid    = null;
            AuthenticationMethod authMethod;
            EncryptionMethod     encryptionMethod;

            if (b5Ghz)
            {
                ssid             = APConfigs[1].SSID_5GHZ;
                authMethod       = APConfigs[1].Authentication_5GHZ;
                encryptionMethod = APConfigs[1].Encryption_5GHZ;
            }
            else
            {
                authMethod       = APConfigs[1].Authentication_24GHZ;
                ssid             = APConfigs[1].SSID_24GHZ;
                encryptionMethod = APConfigs[1].Encryption_24GHZ;
            }
            Log("Setting up Profile SSID " + ssid + " Auth = " + authMethod + " Cipher = " + encryptionMethod + " b5GHz = " + b5Ghz);

            if (authMethod == AuthenticationMethod.WPA2Enterprise)
            {
                Profile = Helpers.CreateEnterpriseProfile(ssid, ConnectionMode.Manual, encryptionMethod, phase1Auth, phase2Auth);
            }
            else if (b5Ghz)
            {
                Profile = APConfigs[1].CreateProfile5ghz(ConnectionMode.Manual, false);
            }
            else
            {
                Profile = APConfigs[1].CreateProfile24ghz(ConnectionMode.Manual, false);
            }

            if (null == Profile)
            {
                Log("CreateProfile24ghz: null Profile");
                throw new Exception("CreateProfile24ghz ; null Profile");
            }

            Helpers.DeleteProfile(
                Api,
                TestInterface.Id,
                ssid);

            Api.CreateProfile(
                TestInterface.Id,
                Profile, Wlan.ProfileScope.AllUser);

            if (authMethod == AuthenticationMethod.WPA2Enterprise)
            {
                Helpers.SetProfileEapXmlUserDataMSChapV2(phase1Auth, phase2Auth, TestInterface.Id, Api, ssid, EnterpriseUser, EnterprisePassword, EnterpriseDomain);
            }
        }
示例#2
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);
        }