WEP EAP encryption support

This commit is contained in:
Mike Hansen
2020-06-08 12:01:10 -04:00
parent 43edd90fef
commit ff845d6f06

View File

@@ -173,8 +173,7 @@ public class OvsdbDao {
fillInIpAddressAndMac(ovsdbClient, ret, "br-lan");
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
@@ -212,8 +211,7 @@ public class OvsdbDao {
connectNodeInfo.macAddress = row.getStringColumn("hwaddr");
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
@@ -271,8 +269,7 @@ public class OvsdbDao {
}
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
@@ -281,9 +278,8 @@ public class OvsdbDao {
/**
* @param ovsdbClient
* @return value of reporting_interval column for the stats_type=device from
* the Wifi_Stats_Config table. If value is not provisioned then
* return -1.
* @return value of reporting_interval column for the stats_type=device from the
* Wifi_Stats_Config table. If value is not provisioned then return -1.
*/
public long getDeviceStatsReportingInterval(OvsdbClient ovsdbClient) {
long ret = -1;
@@ -318,8 +314,7 @@ public class OvsdbDao {
ret);
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
@@ -328,10 +323,9 @@ public class OvsdbDao {
/**
* @param ovsdbClient
* @param value
* of reporting_interval column for the stats_type=device from
* the Wifi_Stats_Config table. If value is not provisioned then
* return -1.
* @param value of reporting_interval column for the stats_type=device
* from the Wifi_Stats_Config table. If value is not
* provisioned then return -1.
*/
public void updateDeviceStatsReportingInterval(OvsdbClient ovsdbClient, long newValue) {
try {
@@ -361,8 +355,7 @@ public class OvsdbDao {
}
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
@@ -430,8 +423,7 @@ public class OvsdbDao {
}
LOG.debug("Redirect Done");
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error when redirecting AP Node", e);
throw new RuntimeException(e);
}
@@ -509,8 +501,7 @@ public class OvsdbDao {
LOG.debug("Retrieved Interfaces: {}", ret);
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedInterfaces", e);
throw new RuntimeException(e);
@@ -552,8 +543,7 @@ public class OvsdbDao {
LOG.debug("Retrieved Ports: {}", ret);
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedPorts", e);
throw new RuntimeException(e);
}
@@ -594,8 +584,7 @@ public class OvsdbDao {
LOG.debug("Retrieved Bridges: {}", ret);
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedBridges", e);
throw new RuntimeException(e);
}
@@ -665,8 +654,7 @@ public class OvsdbDao {
LOG.debug("Retrieved WifiRadioConfig: {}", ret);
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiRadioConfigs", e);
throw new RuntimeException(e);
}
@@ -742,8 +730,7 @@ public class OvsdbDao {
LOG.debug("Retrieved WifiVifConfigs: {}", ret);
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiVifConfigs", e);
throw new RuntimeException(e);
}
@@ -818,8 +805,7 @@ public class OvsdbDao {
LOG.debug("Retrieved WifiInetConfigs: {}", ret);
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiInetConfigs", e);
throw new RuntimeException(e);
}
@@ -871,8 +857,7 @@ public class OvsdbDao {
if (wifiStatsConfigInfo.surveyType == null) {
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType, wifiStatsConfigInfo);
}
else {
} else {
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_"
+ wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo);
@@ -881,8 +866,7 @@ public class OvsdbDao {
LOG.debug("Retrieved WifiStatsConfigs: {}", ret);
}
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiStatsConfigs", e);
throw new RuntimeException(e);
@@ -979,8 +963,7 @@ public class OvsdbDao {
}
}
}
else {
} else {
// need to update port
PortInfo existingPort = provisionedPorts.get(interfaceName);
portUuid = existingPort.uuid;
@@ -1043,8 +1026,7 @@ public class OvsdbDao {
row = new Row(updateColumns);
operations.add(new Update(bridgeDbTable, row));
}
else {
} else {
LOG.warn("provisionedBridges does not have bridge {} - {} - port will be dangling", bridgeName,
provisionedBridges.keySet());
}
@@ -1102,8 +1084,7 @@ public class OvsdbDao {
provisionSingleBridgePortInterface(ovsdbClient, ifName2pt4GHz, bridgeNameVifInterfaces, "vif", null,
provisionedInterfaces, provisionedPorts, provisionedBridges);
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in provisionBridgePortInterface", e);
throw new RuntimeException(e);
}
@@ -1129,8 +1110,7 @@ public class OvsdbDao {
}
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in removeOnboardingSsids", e);
throw new RuntimeException(e);
}
@@ -1178,8 +1158,7 @@ public class OvsdbDao {
LOG.info("Removed all ssids");
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in removeAllSsids", e);
throw new RuntimeException(e);
}
@@ -1279,19 +1258,15 @@ public class OvsdbDao {
try {
configureWifiRadios(ovsdbClient, configName, provisionedWifiRadios, channel, hwConfig, country,
beaconInterval, enabled, ht_mode, txPower);
}
catch (OvsdbClientException e) {
} catch (OvsdbClientException e) {
LOG.error("ConfigureWifiRadios failed with OvsdbClient exception.", e);
}
catch (TimeoutException e) {
} catch (TimeoutException e) {
LOG.error("ConfigureWifiRadios failed with Timeout.", e);
}
catch (ExecutionException e) {
} catch (ExecutionException e) {
LOG.error("ConfigureWifiRadios excecution failed.", e);
}
catch (InterruptedException e) {
} catch (InterruptedException e) {
LOG.error("ConfigureWifiRadios interrupted.", e);
}
@@ -1405,8 +1380,7 @@ public class OvsdbDao {
LOG.debug("Wifi_Radio_State row {}", wrs);
});
}
catch (Exception e) {
} catch (Exception e) {
LOG.error("Could not parse update for Wifi_Radio_State", e);
}
@@ -1477,8 +1451,7 @@ public class OvsdbDao {
LOG.debug("Wifi_Inet_State row {}", wrs);
});
}
catch (Exception e) {
} catch (Exception e) {
LOG.error("Could not parse update for Wifi_Inet_State", e);
}
return ret;
@@ -1589,8 +1562,7 @@ public class OvsdbDao {
LOG.debug("Wifi_VIF_State row {}", wrs);
});
}
catch (Exception e) {
} catch (Exception e) {
LOG.error("Could not parse update for Wifi_VIF_State", e);
}
@@ -1642,8 +1614,7 @@ public class OvsdbDao {
ret.stream().forEach(wrs -> {
LOG.debug("Wifi_Associated_Clients row {}", wrs);
});
}
catch (Exception e) {
} catch (Exception e) {
LOG.error("Could not get Wifi_Associated_Clients list from table update", e);
}
@@ -1769,8 +1740,7 @@ public class OvsdbDao {
}
}
}
catch (Exception e) {
} catch (Exception e) {
LOG.error("Failed to handle AWLAN_Node update", e);
}
@@ -1806,8 +1776,7 @@ public class OvsdbDao {
updateColumns.put("ht_mode", new Atom<>(ht_mode));
if (txPower > 0) {
updateColumns.put("tx_power", new Atom<>(txPower));
}
else {
} else {
updateColumns.put("tx_power", new com.vmware.ovsdb.protocol.operation.notation.Set());
}
@@ -1835,7 +1804,7 @@ public class OvsdbDao {
Map<String, Value> updateColumns = new HashMap<>();
try {
updateColumns.put("bridge", new Atom<>(bridge));
updateColumns.put("bridge", new Atom<String>(bridge));
updateColumns.put("btm", new Atom<>(1));
updateColumns.put("enabled", new Atom<>(enabled));
updateColumns.put("ft_psk", new Atom<>(0));
@@ -1916,8 +1885,7 @@ public class OvsdbDao {
if (inetConfigs.containsKey(ifName)) {
updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled, networkForwardMode == NetworkForwardMode.NAT,
"vif", gateway, inet, dns, ipAssignScheme, vifConfigUuid);
}
else {
} else {
LOG.debug("No corresponding WifiInetConfig for this Interface");
insertWifiInetConfigForVif(ovsdbClient, vlanId, ifName, enabled,
networkForwardMode == NetworkForwardMode.NAT, "vif", gateway, inet, dns, ipAssignScheme,
@@ -1926,8 +1894,7 @@ public class OvsdbDao {
LOG.info("Provisioned SSID {} on interface {} / {}", ssid, ifName, radioIfName);
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureSingleSsid", e);
throw new RuntimeException(e);
}
@@ -1977,8 +1944,7 @@ public class OvsdbDao {
apElementConfig.getStaticDnsIp1().getHostAddress());
dns.put(apElementConfig.getStaticDnsIp2().getHostName(),
apElementConfig.getStaticDnsIp2().getHostAddress());
}
else if (apElementConfig.getGettingIP().equals(GettingIP.dhcp)
} else if (apElementConfig.getGettingIP().equals(GettingIP.dhcp)
|| apElementConfig.getGettingDNS().equals(GettingDNS.dhcp)) {
ipAssignScheme = "dhcp";
}
@@ -2003,18 +1969,24 @@ public class OvsdbDao {
minHwMode = "11x";
}
if (ssidSecurityMode.equalsIgnoreCase("wpaPSK") || ssidSecurityMode.equalsIgnoreCase("wpa2PSK")) {
if (ssidSecurityMode.equals("wpaPSK") || ssidSecurityMode.equals("wpa2PSK")) {
opensyncSecurityMode = "WPA-PSK";
}
else if (ssidSecurityMode.equalsIgnoreCase("wep")) {
} else if (ssidSecurityMode.equals("wep")) {
opensyncSecurityMode = "WEP";
} else if (ssidSecurityMode.equals("wepEAP")) {
opensyncSecurityMode = "WEP-EAP";
}
security.put("encryption", opensyncSecurityMode);
// key and mode is N/A for OPEN security
if (!opensyncSecurityMode.equals("OPEN")) {
security.put("key", ssidConfig.getKeyStr());
security.put("mode", Long.toString(ssidConfig.getSecureMode().getId()));
if (ssidSecurityMode.equals("wpa2PSK") || ssidSecurityMode.equals("wepEAP")
|| ssidSecurityMode.equals("wpa2OnlyPSK")) {
security.put("mode", "2");
} else {
security.put("mode", "1");
}
}
boolean enabled = ssidConfig.getSsidAdminState().equals(StateSetting.enabled);
@@ -2025,12 +1997,10 @@ public class OvsdbDao {
if (radioType == RadioType.is2dot4GHz) {
ifName = ifName2pt4GHz;
radioIfName = radioName2pt4GHz;
}
else if (radioType == RadioType.is5GHzL) {
} else if (radioType == RadioType.is5GHzL) {
ifName = ifName5GHzL;
radioIfName = radioName5GHzL;
}
else if (radioType == RadioType.is5GHzU) {
} else if (radioType == RadioType.is5GHzU) {
ifName = ifName5GHzU;
radioIfName = radioName5GHzU;
}
@@ -2042,8 +2012,7 @@ public class OvsdbDao {
ssidConfig.getVlanId(), rrmEnabled, minHwMode, enabled, keyRefresh, uapsdEnabled,
apBridge, ssidConfig.getForwardMode(), gateway, inet, dns, ipAssignScheme);
}
catch (IllegalStateException e) {
} catch (IllegalStateException e) {
// could not provision this SSID, but still can go on
LOG.warn("could not provision SSID {} on {}", ssidConfig.getSsid(), radioIfName);
}
@@ -2090,15 +2059,13 @@ public class OvsdbDao {
}
if (ipAssignScheme.equals("dhcp")) {
updateColumns.put("dhcp_sniff", new Atom<>(true));
}
else {
} else {
updateColumns.put("dhcp_sniff", new Atom<>(false));
}
if (ifType.equals("vlan")) {
updateColumns.put("vlan_id", new Atom<>(vlanId));
}
else {
} else {
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
}
@@ -2114,8 +2081,7 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res);
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e);
throw new RuntimeException(e);
}
@@ -2156,15 +2122,13 @@ public class OvsdbDao {
}
if (ipAssignScheme.equals("dhcp")) {
updateColumns.put("dhcp_sniff", new Atom<>(true));
}
else {
} else {
updateColumns.put("dhcp_sniff", new Atom<>(false));
}
if (ifType.equals("vlan")) {
updateColumns.put("vlan_id", new Atom<>(vlanId));
}
else {
} else {
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
}
@@ -2180,8 +2144,7 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res);
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e);
throw new RuntimeException(e);
}
@@ -2217,8 +2180,7 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res);
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e);
throw new RuntimeException(e);
}
@@ -2249,8 +2211,7 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res);
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInetSetNetwork", e);
throw new RuntimeException(e);
}
@@ -2318,8 +2279,7 @@ public class OvsdbDao {
}
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
}
@@ -2671,8 +2631,7 @@ public class OvsdbDao {
}
}
}
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}