Commit a901ffa9 authored by pneubeck's avatar pneubeck Committed by Commit bot

Add Wimax to ONC.

This adds the object "WiMAX" to ONC, which contains the basic properties
 AutoConnect (read/write)
 EAP (write-only)
 SignalStrength (read-only).
Also all general network properties like Name or ConnectionState are supported.

BUG=414417

Review URL: https://codereview.chromium.org/578823003

Cr-Commit-Position: refs/heads/master@{#295467}
parent ffe70eca
......@@ -268,6 +268,9 @@ class ExtensionNetworkingPrivateApiTest
// Sends a notification about the added profile.
profile_test->AddProfile(kUser1ProfilePath, userhash_);
// Enable technologies.
manager_test_->AddTechnology("wimax", true);
// Add IPConfigs
base::DictionaryValue ipconfig;
ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, "0.0.0.0");
......@@ -335,6 +338,18 @@ class ExtensionNetworkingPrivateApiTest
shill::kConnectableProperty,
base::FundamentalValue(true));
AddService("stub_wimax", "wimax", shill::kTypeWimax, shill::kStateOnline);
service_test_->SetServiceProperty("stub_wimax",
shill::kSignalStrengthProperty,
base::FundamentalValue(40));
service_test_->SetServiceProperty("stub_wimax",
shill::kProfileProperty,
base::StringValue(kUser1ProfilePath));
service_test_->SetServiceProperty("stub_wimax",
shill::kConnectableProperty,
base::FundamentalValue(true));
profile_test->AddService(kUser1ProfilePath, "stub_wimax");
base::ListValue frequencies2;
frequencies2.AppendInteger(2400);
frequencies2.AppendInteger(5000);
......
......@@ -203,6 +203,16 @@ var availableTests = [
"SignalStrength": 40
}
},
{
"Connectable": true,
"ConnectionState": "Connected",
"GUID": "stub_wimax_guid",
"Name": "wimax",
"Type": "WiMAX",
"WiMAX": {
"SignalStrength": 40
}
},
{
"ConnectionState": "Connected",
"GUID": "stub_vpn1_guid",
......@@ -255,6 +265,7 @@ var availableTests = [
// Connected or Connecting networks should be listed first, sorted by type.
var expected = ["stub_ethernet_guid",
"stub_wifi1_guid",
"stub_wimax_guid",
"stub_vpn1_guid",
"stub_wifi2_guid"];
var done = chrome.test.callbackAdded();
......@@ -425,6 +436,7 @@ var availableTests = [
// networks should be listed first, sorted by type.
var expected = ["stub_ethernet_guid",
"stub_wifi2_guid",
"stub_wimax_guid",
"stub_vpn1_guid",
"stub_wifi1_guid"];
var done = chrome.test.callbackAdded();
......
......@@ -163,9 +163,10 @@ bool NetworkState::InitialPropertiesReceived(
has_ca_cert_nss_ = IsCaCertNssSet(properties);
changed |= had_ca_cert_nss != has_ca_cert_nss_;
// By convention, all visible WiFi networks have a SignalStrength > 0.
if (visible() && type() == shill::kTypeWifi) {
if (signal_strength_ <= 0)
// By convention, all visible WiFi and WiMAX networks have a
// SignalStrength > 0.
if ((type() == shill::kTypeWifi || type() == shill::kTypeWimax) &&
visible() && signal_strength_ <= 0) {
signal_strength_ = 1;
}
......
......@@ -216,6 +216,16 @@ const OncFieldSignature wifi_with_state_fields[] = {
{ ::onc::wifi::kSignalStrength, &kIntegerSignature},
{NULL}};
const OncFieldSignature wimax_fields[] = {
{ ::onc::kRecommended, &kRecommendedSignature},
{ ::onc::wimax::kAutoConnect, &kBoolSignature},
{ ::onc::wimax::kEAP, &kEAPSignature},
{NULL}};
const OncFieldSignature wimax_with_state_fields[] = {
{ ::onc::wimax::kSignalStrength, &kIntegerSignature},
{NULL}};
const OncFieldSignature cellular_provider_fields[] = {
{ ::onc::cellular_provider::kCode, &kStringSignature},
{ ::onc::cellular_provider::kCountry, &kStringSignature},
......@@ -305,6 +315,7 @@ const OncFieldSignature network_configuration_fields[] = {
{ ::onc::network_config::kType, &kStringSignature},
{ ::onc::network_config::kVPN, &kVPNSignature},
{ ::onc::network_config::kWiFi, &kWiFiSignature},
{ ::onc::network_config::kWimax, &kWiMAXSignature},
{NULL}};
const OncFieldSignature network_with_state_fields[] = {
......@@ -318,6 +329,7 @@ const OncFieldSignature network_with_state_fields[] = {
{ ::onc::network_config::kSavedIPConfig, &kSavedIPConfigSignature},
{ ::onc::network_config::kSource, &kStringSignature},
{ ::onc::network_config::kWiFi, &kWiFiWithStateSignature},
{ ::onc::network_config::kWimax, &kWiMAXWithStateSignature},
{NULL}};
const OncFieldSignature global_network_configuration_fields[] = {
......@@ -406,6 +418,9 @@ const OncValueSignature kProxySettingsSignature = {
const OncValueSignature kWiFiSignature = {
base::Value::TYPE_DICTIONARY, wifi_fields, NULL
};
const OncValueSignature kWiMAXSignature = {
base::Value::TYPE_DICTIONARY, wimax_fields, NULL
};
const OncValueSignature kCertificateSignature = {
base::Value::TYPE_DICTIONARY, certificate_fields, NULL
};
......@@ -433,6 +448,9 @@ const OncValueSignature kNetworkWithStateSignature = {
const OncValueSignature kWiFiWithStateSignature = {
base::Value::TYPE_DICTIONARY, wifi_with_state_fields, NULL, &kWiFiSignature
};
const OncValueSignature kWiMAXWithStateSignature = {
base::Value::TYPE_DICTIONARY, wimax_with_state_fields, NULL, &kWiMAXSignature
};
const OncValueSignature kCellularSignature = {
base::Value::TYPE_DICTIONARY, cellular_fields, NULL
};
......
......@@ -53,6 +53,7 @@ CHROMEOS_EXPORT extern const OncValueSignature kProxyLocationSignature;
CHROMEOS_EXPORT extern const OncValueSignature kProxyManualSignature;
CHROMEOS_EXPORT extern const OncValueSignature kProxySettingsSignature;
CHROMEOS_EXPORT extern const OncValueSignature kWiFiSignature;
CHROMEOS_EXPORT extern const OncValueSignature kWiMAXSignature;
CHROMEOS_EXPORT extern const OncValueSignature kCertificateSignature;
CHROMEOS_EXPORT extern const OncValueSignature kNetworkConfigurationSignature;
CHROMEOS_EXPORT extern const OncValueSignature
......@@ -65,6 +66,7 @@ CHROMEOS_EXPORT extern const OncValueSignature kToplevelConfigurationSignature;
// Derived "ONC with State" signatures.
CHROMEOS_EXPORT extern const OncValueSignature kNetworkWithStateSignature;
CHROMEOS_EXPORT extern const OncValueSignature kWiFiWithStateSignature;
CHROMEOS_EXPORT extern const OncValueSignature kWiMAXWithStateSignature;
CHROMEOS_EXPORT extern const OncValueSignature kCellularSignature;
CHROMEOS_EXPORT extern const OncValueSignature kCellularWithStateSignature;
CHROMEOS_EXPORT extern const OncValueSignature kCellularProviderSignature;
......
......@@ -119,6 +119,11 @@ const FieldTranslationEntry wifi_fields[] = {
{ ::onc::wifi::kSignalStrength, shill::kSignalStrengthProperty},
{NULL}};
const FieldTranslationEntry wimax_fields[] = {
{ ::onc::wimax::kAutoConnect, shill::kAutoConnectProperty},
{ ::onc::wimax::kSignalStrength, shill::kSignalStrengthProperty},
{NULL}};
const FieldTranslationEntry cellular_apn_fields[] = {
{ ::onc::cellular_apn::kAccessPointName, shill::kApnProperty},
{ ::onc::cellular_apn::kName, shill::kApnNameProperty},
......@@ -226,6 +231,8 @@ const OncValueTranslationEntry onc_value_translation_table[] = {
{ &kVPNSignature, vpn_fields },
{ &kWiFiSignature, wifi_fields },
{ &kWiFiWithStateSignature, wifi_fields },
{ &kWiMAXSignature, wimax_fields },
{ &kWiMAXWithStateSignature, wimax_fields },
{ &kCellularApnSignature, cellular_apn_fields },
{ &kCellularFoundNetworkSignature, cellular_found_network_fields },
{ &kCellularProviderSignature, cellular_provider_fields },
......
......@@ -393,9 +393,6 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
if (!onc_network_type.empty()) {
onc_object_->SetStringWithoutPathExpansion(::onc::network_config::kType,
onc_network_type);
// Wimax is not supported by ONC, yet.
// TOOD(pneubeck): Wimax support is required, see https://crbug.com/414417 .
if (onc_network_type != ::onc::network_type::kWimax)
TranslateAndAddNestedObject(onc_network_type);
}
......
......@@ -56,8 +56,8 @@ INSTANTIATE_TEST_CASE_P(
"shill_openvpn.json"),
std::make_pair("openvpn_clientcert_with_cert_pems.onc",
"shill_openvpn_clientcert.json"),
std::make_pair("cellular.onc",
"shill_cellular.json")));
std::make_pair("cellular.onc", "shill_cellular.json"),
std::make_pair("wimax.onc", "shill_wimax.json")));
// First parameter: Filename of source Shill json.
// Second parameter: Filename of expected translated ONC network part.
......@@ -107,7 +107,9 @@ INSTANTIATE_TEST_CASE_P(
std::make_pair("shill_wifi_with_state.json",
"translation_of_shill_wifi_with_state.onc"),
std::make_pair("shill_cellular_with_state.json",
"translation_of_shill_cellular_with_state.onc")));
"translation_of_shill_cellular_with_state.onc"),
std::make_pair("shill_wimax_with_state.json",
"translation_of_shill_wimax_with_state.onc")));
} // namespace onc
} // namespace chromeos
{
"AutoConnect": true,
"EAP.EAP": "TLS",
"EAP.Identity": "${LOGIN_ID}@my.domain.com",
"EAP.UseSystemCAs": true,
"GUID": "{77db0089-0bc8-4358-929c-123xcv}",
"SaveCredentials": true,
"Type": "wimax"
}
{
"AutoConnect": true,
"Connectable": true,
"Name": "SomeWiMAX",
"EAP.EAP": "TLS",
"EAP.Identity": "${LOGIN_ID}@my.domain.com",
"EAP.UseSystemCAs": true,
"GUID": "{77db0089-0bc8-4358-929c-123xcv}",
"Profile": "/profile/someuser",
"SaveCredentials": true,
"State": "idle",
"Strength": 10,
"Type": "wimax"
}
{
"Connectable": true,
"ConnectionState": "NotConnected",
"GUID": "{77db0089-0bc8-4358-929c-123xcv}",
"Type": "WiMAX",
"Name": "SomeWiMAX",
"WiMAX": {
"AutoConnect": true,
"SignalStrength": 10
},
"Source":"User"
}
{
"GUID": "{77db0089-0bc8-4358-929c-123xcv}",
"Type": "WiMAX",
"Name": "SomeWiMAX",
"WiMAX": {
"AutoConnect": true,
"EAP": {
"Outer": "EAP-TLS",
"Identity": "${LOGIN_ID}@my.domain.com",
"UseSystemCAs": true,
"Recommended": [ "Identity" ],
"SaveCredentials": true
},
"Recommended": [ "AutoConnect" ]
}
}
......@@ -58,6 +58,7 @@ const char kStaticIPConfig[] = "StaticIPConfig";
const char kType[] = "Type";
const char kVPN[] = "VPN";
const char kWiFi[] = "WiFi";
const char kWimax[] = "WiMAX";
std::string CellularProperty(const std::string& property) {
return std::string(kCellular) + "." + property;
......@@ -79,7 +80,7 @@ const char kCellular[] = "Cellular";
const char kEthernet[] = "Ethernet";
const char kVPN[] = "VPN";
const char kWiFi[] = "WiFi";
const char kWimax[] = "Wimax";
const char kWimax[] = "WiMAX";
const char kWireless[] = "Wireless";
} // namespace network_type
......@@ -183,7 +184,6 @@ const char kFrequency[] = "Frequency";
const char kFrequencyList[] = "FrequencyList";
const char kHiddenSSID[] = "HiddenSSID";
const char kPassphrase[] = "Passphrase";
const char kProxyURL[] = "ProxyURL";
const char kSSID[] = "SSID";
const char kSecurity[] = "Security";
const char kSecurityNone[] = "None";
......@@ -195,6 +195,12 @@ const char kWPA_PSK[] = "WPA-PSK";
const char kWPA2_PSK[] = "WPA2-PSK";
} // namespace wifi
namespace wimax {
const char kAutoConnect[] = "AutoConnect";
const char kEAP[] = "EAP";
const char kSignalStrength[] = "SignalStrength";
} // namespace wimax
namespace client_cert {
const char kClientCertPattern[] = "ClientCertPattern";
const char kClientCertRef[] = "ClientCertRef";
......
......@@ -83,6 +83,7 @@ ONC_EXPORT extern const char kErrorState[];
ONC_EXPORT extern const char kType[];
ONC_EXPORT extern const char kVPN[];
ONC_EXPORT extern const char kWiFi[];
ONC_EXPORT extern const char kWimax[];
ONC_EXPORT extern std::string CellularProperty(const std::string& property);
ONC_EXPORT extern std::string VpnProperty(const std::string& property);
......@@ -201,7 +202,6 @@ ONC_EXPORT extern const char kFrequency[];
ONC_EXPORT extern const char kFrequencyList[];
ONC_EXPORT extern const char kHiddenSSID[];
ONC_EXPORT extern const char kPassphrase[];
ONC_EXPORT extern const char kProxyURL[];
ONC_EXPORT extern const char kSSID[];
ONC_EXPORT extern const char kSecurity[];
ONC_EXPORT extern const char kSecurityNone[];
......@@ -213,6 +213,12 @@ ONC_EXPORT extern const char kWPA2_PSK[];
ONC_EXPORT extern const char kWPA_EAP[];
} // namespace wifi
namespace wimax {
ONC_EXPORT extern const char kAutoConnect[];
ONC_EXPORT extern const char kEAP[];
ONC_EXPORT extern const char kSignalStrength[];
} // namespace wimax
namespace client_cert {
ONC_EXPORT extern const char kClientCertPattern[];
ONC_EXPORT extern const char kClientCertRef[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment