Wifi_Radio_State table updates handling. Remove temp objects, begin refactor for MQTT messages

This commit is contained in:
Mike Hansen
2020-06-04 09:10:01 -04:00
parent 9c4e914f32
commit b91adbcd4c
5 changed files with 3995 additions and 4375 deletions

View File

@@ -6,6 +6,7 @@ package com.telecominfraproject.wlan.opensync.external.integration.models;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel; import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Uuid; import com.vmware.ovsdb.protocol.operation.notation.Uuid;
@@ -41,7 +42,7 @@ public class OpensyncAPRadioState extends BaseJsonModel {
public Map<String, String> channels; public Map<String, String> channels;
public int thermalUpgradeTemp; public int thermalUpgradeTemp;
public Map<String, String> hwParams; public Map<String, String> hwParams;
public String freqBand; public RadioType freqBand;
public int thermalIntegration; public int thermalIntegration;
public String channelMode; public String channelMode;
public Uuid _uuid; public Uuid _uuid;
@@ -239,11 +240,11 @@ public class OpensyncAPRadioState extends BaseJsonModel {
this.hwParams = hwParams; this.hwParams = hwParams;
} }
public String getFreqBand() { public RadioType getFreqBand() {
return freqBand; return freqBand;
} }
public void setFreqBand(String freqBand) { public void setFreqBand(RadioType freqBand) {
this.freqBand = freqBand; this.freqBand = freqBand;
} }

View File

@@ -20,5 +20,5 @@
<listAttribute key="org.eclipse.jdt.launching.MODULEPATH"/> <listAttribute key="org.eclipse.jdt.launching.MODULEPATH"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="opensync-gateway-cloud-process"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="opensync-gateway-cloud-process"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="--add-opens java.base/java.lang=ALL-UNNAMED&#10;&#10;-Dssl.props=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/ssl.properties&#10;-Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/httpClientConfig.json&#10;&#10;-Djavax.net.ssl.keyStore=${connectus_certs}/client_keystore.jks&#10;-Djavax.net.ssl.keyStorePassword=mypassword&#10;-Djavax.net.ssl.trustStore=${connectus_certs}/truststore.jks&#10;-Djavax.net.ssl.trustStorePassword=mypassword&#10;&#10;-Dconnectus.ovsdb.managerAddr=${local_server_address}&#10;-Dconnectus.ovsdb.listenPort=6640&#10;-Dconnectus.ovsdb.redirector.listenPort=6643&#10;-Dconnectus.ovsdb.timeoutSec=30&#10;-Dconnectus.ovsdb.trustStore=${connectus_certs}/truststore.jks&#10;-Dconnectus.ovsdb.keyStore=${connectus_certs}/server.pkcs12&#10;&#10;-Dconnectus.mqttBroker.address=${local_server_address}&#10;-Dconnectus.mqttBroker.listenPort=1883&#10;-Dtip.wlan.introspectTokenApi.host=localhost:9096&#10;-Dtip.wlan.introspectTokenApi.clientToken=token_placeholder&#10;-Dtip.wlan.serviceUser=user&#10;-Dtip.wlan.servicePassword=password&#10;-Dconnectus.ovsdb.autoProvisionedCustomerId=2&#10;-Dconnectus.ovsdb.autoProvisionedSsid=Connectus-cloud&#10;-Dconnectus.ovsdb.wifi-iface.default_radio1=home-ap-24&#10;-Dconnectus.ovsdb.wifi-iface.default_radio2=home-ap-l50&#10;-Dconnectus.ovsdb.wifi-iface.default_radio0=home-ap-u50&#9;&#10;-Dconnectus.ovsdb.wifi-device.radio0=wifi2&#10;-Dconnectus.ovsdb.wifi-device.radio1=wifi0&#10;-Dconnectus.ovsdb.wifi-device.radio2=wifi1&#10;&#10;-Dspring.main.show-banner=false&#10;-Dserver.port=9096&#10;&#10;-Dtip.wlan.secondaryPort=9097&#10;&#10;-Dtip.wlan.csrf-enabled=false&#10;-Dspring.profiles.include=opensync_cloud_config,mqtt_receiver,ovsdb_redirector,ovsdb_manager"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="--add-opens java.base/java.lang=ALL-UNNAMED&#10;&#10;-Dssl.props=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/ssl.properties&#10;-Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/httpClientConfig.json&#10;&#10;-Djavax.net.ssl.keyStore=${connectus_certs}/client_keystore.jks&#10;-Djavax.net.ssl.keyStorePassword=mypassword&#10;-Djavax.net.ssl.trustStore=${connectus_certs}/truststore.jks&#10;-Djavax.net.ssl.trustStorePassword=mypassword&#10;&#10;-Dconnectus.ovsdb.managerAddr=${local_server_address}&#10;-Dconnectus.ovsdb.listenPort=6640&#10;-Dconnectus.ovsdb.redirector.listenPort=6643&#10;-Dconnectus.ovsdb.timeoutSec=30&#10;-Dconnectus.ovsdb.trustStore=${connectus_certs}/truststore.jks&#10;-Dconnectus.ovsdb.keyStore=${connectus_certs}/server.pkcs12&#10;&#10;-Dconnectus.mqttBroker.address=${local_server_address}&#10;-Dconnectus.mqttBroker.listenPort=1883&#10;-Dtip.wlan.introspectTokenApi.host=${local_server_address}:9096&#10;-Dtip.wlan.introspectTokenApi.clientToken=token_placeholder&#10;-Dtip.wlan.serviceUser=user&#10;-Dtip.wlan.servicePassword=password&#10;-Dconnectus.ovsdb.autoProvisionedCustomerId=2&#10;-Dconnectus.ovsdb.autoProvisionedSsid=Connectus-cloud&#10;-Dspring.main.show-banner=false&#10;-Dserver.port=9096&#10;-Dtip.wlan.secondaryPort=7071&#10;-Dtip.wlan.csrf-enabled=false&#10;-Dspring.profiles.include=opensync_cloud_config,mqtt_receiver,ovsdb_redirector,ovsdb_manager"/>
</launchConfiguration> </launchConfiguration>

View File

@@ -76,6 +76,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
public void listenForConnections() { public void listenForConnections() {
ConnectionCallback connectionCallback = new ConnectionCallback() { ConnectionCallback connectionCallback = new ConnectionCallback() {
@Override
public void connected(OvsdbClient ovsdbClient) { public void connected(OvsdbClient ovsdbClient) {
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress(); String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
int localPort = ovsdbClient.getConnectionInfo().getLocalPort(); int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
@@ -98,17 +99,17 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
String key = clientCn + "_" + connectNodeInfo.serialNumber; String key = clientCn + "_" + connectNodeInfo.serialNumber;
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient); ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient);
extIntegrationInterface.apConnected(key, connectNodeInfo); extIntegrationInterface.apConnected(key, connectNodeInfo);
monitorOvsdbStateTables(ovsdbClient, key);
// push configuration to AP // push configuration to AP
connectNodeInfo = processConnectRequest(ovsdbClient, clientCn, connectNodeInfo); connectNodeInfo = processConnectRequest(ovsdbClient, clientCn, connectNodeInfo);
monitorOvsdbStateTables(ovsdbClient, key);
LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key); LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key);
LOG.info("ovsdbClient connectedClients = {}", LOG.info("ovsdbClient connectedClients = {}",
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions()); ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
}
} catch (Exception e) { catch (Exception e) {
LOG.error("ovsdbClient error", e); LOG.error("ovsdbClient error", e);
// something is wrong with the SSL // something is wrong with the SSL
ovsdbClient.shutdown(); ovsdbClient.shutdown();
@@ -117,6 +118,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
} }
@Override
public void disconnected(OvsdbClient ovsdbClient) { public void disconnected(OvsdbClient ovsdbClient) {
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress(); String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
int localPort = ovsdbClient.getConnectionInfo().getLocalPort(); int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
@@ -124,7 +126,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
try { try {
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate()) subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
.getSubjectDN().getName(); .getSubjectDN().getName();
} catch (Exception e) { }
catch (Exception e) {
// do nothing // do nothing
} }
@@ -150,7 +153,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key); ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key); ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key);
} catch (OvsdbClientException e) { }
catch (OvsdbClientException e) {
LOG.warn("Could not cancel Monitor {}", e.getMessage()); LOG.warn("Could not cancel Monitor {}", e.getMessage());
} }
@@ -193,7 +197,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
try { try {
ovsdbDao.provisionBridgePortInterface(ovsdbClient); ovsdbDao.provisionBridgePortInterface(ovsdbClient);
} catch (Exception e) { }
catch (Exception e) {
// TODO: for some AP configurations this 'may' not be necessary. // TODO: for some AP configurations this 'may' not be necessary.
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e); LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
} }
@@ -211,6 +216,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
return connectNodeInfo; return connectNodeInfo;
} }
@Override
public Set<String> getConnectedClientIds() { public Set<String> getConnectedClientIds() {
return ovsdbSessionMapInterface.getConnectedClientIds(); return ovsdbSessionMapInterface.getConnectedClientIds();
} }
@@ -220,6 +226,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
* @param newRedirectorAddress * @param newRedirectorAddress
* @return updated value of the redirector * @return updated value of the redirector
*/ */
@Override
public String changeRedirectorAddress(String apId, String newRedirectorAddress) { public String changeRedirectorAddress(String apId, String newRedirectorAddress) {
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
if (ovsdbSession == null) { if (ovsdbSession == null) {
@@ -253,10 +260,10 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
} }
private void monitorOvsdbStateTables(OvsdbClient ovsdbClient, String key) throws OvsdbClientException { private void monitorOvsdbStateTables(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
CompletableFuture<TableUpdates> rsCf = ovsdbClient CompletableFuture<TableUpdates> rsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiRadioStateDbTable + "_" + key, OvsdbDao.wifiRadioStateDbTable + "_" + key,
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable, new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable,
new MonitorRequest(new MonitorSelect(true, true, true, true)))), new MonitorRequest(new MonitorSelect(true, false, false, true)))),
new MonitorCallback() { new MonitorCallback() {
@Override @Override
@@ -270,8 +277,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
extIntegrationInterface extIntegrationInterface
.wifiRadioStatusDbTableUpdate(ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key); .wifiRadioStatusDbTableUpdate(ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key);
CompletableFuture<TableUpdates> isCf = ovsdbClient CompletableFuture<TableUpdates> isCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiInetStateDbTable + "_" + key, OvsdbDao.wifiInetStateDbTable + "_" + key,
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable, new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable,
new MonitorRequest(new MonitorSelect(true, true, true, true)))), new MonitorRequest(new MonitorSelect(true, true, true, true)))),
new MonitorCallback() { new MonitorCallback() {
@@ -299,7 +306,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
// extIntegrationInterface.wifiVIFStateDbTableUpdate( // extIntegrationInterface.wifiVIFStateDbTableUpdate(
// ovsdbDao.getOpensyncAPVIFState(tableUpdates, // ovsdbDao.getOpensyncAPVIFState(tableUpdates,
// key, ovsdbClient), key); // key, ovsdbClient), key);
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<OpensyncAPVIFState>(); List<OpensyncAPVIFState> vifsToDelete = new ArrayList<>();
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) { for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) {
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) { for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) {
@@ -336,9 +343,10 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
if (!vifsToDelete.isEmpty()) { if (!vifsToDelete.isEmpty()) {
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key); extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
} }
if (tableUpdates.getTableUpdates().entrySet().isEmpty()) if (tableUpdates.getTableUpdates().entrySet().isEmpty()) {
extIntegrationInterface.wifiVIFStateDbTableUpdate( extIntegrationInterface.wifiVIFStateDbTableUpdate(
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key); ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
}
} }
@@ -350,7 +358,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
CompletableFuture<TableUpdates> acCf = ovsdbClient.monitor(OvsdbDao.ovsdbName, CompletableFuture<TableUpdates> acCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
OvsdbDao.wifiAssociatedClientsDbTable + "_" + key, OvsdbDao.wifiAssociatedClientsDbTable + "_" + key,
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiAssociatedClientsDbTable, new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiAssociatedClientsDbTable,
new MonitorRequest(new MonitorSelect(true, true, true, true)))), new MonitorRequest(new MonitorSelect(false, true, true, true)))),
new MonitorCallback() { new MonitorCallback() {
@Override @Override
@@ -380,10 +388,9 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate( extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
ovsdbDao.getOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key); ovsdbDao.getOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key);
CompletableFuture<TableUpdates> awCf = ovsdbClient CompletableFuture<TableUpdates> awCf = ovsdbClient.monitor(
.monitor(OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key, OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key, new MonitorRequests(ImmutableMap
new MonitorRequests(ImmutableMap.of(OvsdbDao.awlanNodeDbTable, .of(OvsdbDao.awlanNodeDbTable, new MonitorRequest(new MonitorSelect(true, false, false, true)))),
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
new MonitorCallback() { new MonitorCallback() {
@Override @Override
@@ -403,7 +410,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId); OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
try { try {
session.getOvsdbClient().shutdown(); session.getOvsdbClient().shutdown();
} catch (Exception e) { }
catch (Exception e) {
LOG.error("Failed to close session to " + apId + " " + e.getLocalizedMessage()); LOG.error("Failed to close session to " + apId + " " + e.getLocalizedMessage());
return "Failed to close session to " + apId + " " + e.getLocalizedMessage(); return "Failed to close session to " + apId + " " + e.getLocalizedMessage();

View File

@@ -151,12 +151,12 @@ public class OvsdbDao {
row = ((SelectResult) result[0]).getRows().iterator().next(); row = ((SelectResult) result[0]).getRows().iterator().next();
} }
ret.mqttSettings = (row != null) ? row.getMapColumn("mqtt_settings") : null; ret.mqttSettings = row != null ? row.getMapColumn("mqtt_settings") : null;
ret.redirectorAddr = (row != null) ? row.getStringColumn("redirector_addr") : null; ret.redirectorAddr = row != null ? row.getStringColumn("redirector_addr") : null;
ret.managerAddr = (row != null) ? row.getStringColumn("manager_addr") : null; ret.managerAddr = row != null ? row.getStringColumn("manager_addr") : null;
ret.platformVersion = (row != null) ? row.getStringColumn("platform_version") : null; ret.platformVersion = row != null ? row.getStringColumn("platform_version") : null;
ret.firmwareVersion = (row != null) ? row.getStringColumn("firmware_version") : null; ret.firmwareVersion = row != null ? row.getStringColumn("firmware_version") : null;
ret.skuNumber = getSingleValueFromSet(row, "sku_number"); ret.skuNumber = getSingleValueFromSet(row, "sku_number");
ret.serialNumber = getSingleValueFromSet(row, "serial_number"); ret.serialNumber = getSingleValueFromSet(row, "serial_number");
@@ -170,7 +170,8 @@ public class OvsdbDao {
fillInIpAddressAndMac(ovsdbClient, ret, "br-lan"); fillInIpAddressAndMac(ovsdbClient, ret, "br-lan");
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -208,7 +209,8 @@ public class OvsdbDao {
connectNodeInfo.macAddress = row.getStringColumn("hwaddr"); connectNodeInfo.macAddress = row.getStringColumn("hwaddr");
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -228,7 +230,7 @@ public class OvsdbDao {
// update sku_number if it was empty // update sku_number if it was empty
if (ret.skuNumber == null || ret.skuNumber.isEmpty()) { if (ret.skuNumber == null || ret.skuNumber.isEmpty()) {
ret.skuNumber = "connectus.ai_" + ret.serialNumber; ret.skuNumber = "connectus.ai_" + ret.serialNumber;
updateColumns.put("sku_number", new Atom<String>(ret.skuNumber)); updateColumns.put("sku_number", new Atom<>(ret.skuNumber));
} }
// Configure the MQTT connection // Configure the MQTT connection
@@ -266,7 +268,8 @@ public class OvsdbDao {
} }
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -275,8 +278,9 @@ public class OvsdbDao {
/** /**
* @param ovsdbClient * @param ovsdbClient
* @return value of reporting_interval column for the stats_type=device from the * @return value of reporting_interval column for the stats_type=device from
* Wifi_Stats_Config table. If value is not provisioned then return -1. * the Wifi_Stats_Config table. If value is not provisioned then
* return -1.
*/ */
public long getDeviceStatsReportingInterval(OvsdbClient ovsdbClient) { public long getDeviceStatsReportingInterval(OvsdbClient ovsdbClient) {
long ret = -1; long ret = -1;
@@ -311,7 +315,8 @@ public class OvsdbDao {
ret); ret);
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -320,9 +325,10 @@ public class OvsdbDao {
/** /**
* @param ovsdbClient * @param ovsdbClient
* @param value of reporting_interval column for the stats_type=device * @param value
* from the Wifi_Stats_Config table. If value is not * of reporting_interval column for the stats_type=device from
* provisioned then return -1. * the Wifi_Stats_Config table. If value is not provisioned then
* return -1.
*/ */
public void updateDeviceStatsReportingInterval(OvsdbClient ovsdbClient, long newValue) { public void updateDeviceStatsReportingInterval(OvsdbClient ovsdbClient, long newValue) {
try { try {
@@ -334,9 +340,9 @@ public class OvsdbDao {
// $ ovsh i Wifi_Stats_Config reporting_interval:=10 // $ ovsh i Wifi_Stats_Config reporting_interval:=10
// radio_type:="2.4G" stats_type:="device" // radio_type:="2.4G" stats_type:="device"
updateColumns.put("reporting_interval", new Atom<Integer>(10)); updateColumns.put("reporting_interval", new Atom<>(10));
updateColumns.put("radio_type", new Atom<String>("2.4G")); updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("stats_type", new Atom<String>("device")); updateColumns.put("stats_type", new Atom<>("device"));
Row row = new Row(updateColumns); Row row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row)); operations.add(new Insert(wifiStatsConfigDbTable, row));
@@ -352,7 +358,8 @@ public class OvsdbDao {
} }
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -392,7 +399,7 @@ public class OvsdbDao {
row = ((SelectResult) result[0]).getRows().iterator().next(); row = ((SelectResult) result[0]).getRows().iterator().next();
} }
firmwareVersion = (row != null) ? row.getStringColumn("firmware_version") : null; firmwareVersion = row != null ? row.getStringColumn("firmware_version") : null;
skuNumber = getSingleValueFromSet(row, "sku_number"); skuNumber = getSingleValueFromSet(row, "sku_number");
serialNumber = getSingleValueFromSet(row, "serial_number"); serialNumber = getSingleValueFromSet(row, "serial_number");
@@ -405,7 +412,7 @@ public class OvsdbDao {
operations.clear(); operations.clear();
Map<String, Value> updateColumns = new HashMap<>(); Map<String, Value> updateColumns = new HashMap<>();
updateColumns.put("manager_addr", new Atom<String>("ssl:" + managerIpAddr + ":" + ovsdbListenPort)); updateColumns.put("manager_addr", new Atom<>("ssl:" + managerIpAddr + ":" + ovsdbListenPort));
row = new Row(updateColumns); row = new Row(updateColumns);
operations.add(new Update(awlanNodeDbTable, row)); operations.add(new Update(awlanNodeDbTable, row));
@@ -420,7 +427,8 @@ public class OvsdbDao {
} }
LOG.debug("Redirect Done"); LOG.debug("Redirect Done");
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error when redirecting AP Node", e); LOG.error("Error when redirecting AP Node", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -429,15 +437,15 @@ public class OvsdbDao {
public <T> Set<T> getSet(Row row, String columnName) { public <T> Set<T> getSet(Row row, String columnName) {
Set<T> set = (row != null) ? row.getSetColumn(columnName) : null; Set<T> set = row != null ? row.getSetColumn(columnName) : null;
return set; return set;
} }
public <T> T getSingleValueFromSet(Row row, String columnName) { public <T> T getSingleValueFromSet(Row row, String columnName) {
Set<T> set = (row != null) ? row.getSetColumn(columnName) : null; Set<T> set = row != null ? row.getSetColumn(columnName) : null;
T ret = (set != null && !set.isEmpty()) ? set.iterator().next() : null; T ret = set != null && !set.isEmpty() ? set.iterator().next() : null;
return ret; return ret;
} }
@@ -498,7 +506,8 @@ public class OvsdbDao {
LOG.debug("Retrieved Interfaces: {}", ret); LOG.debug("Retrieved Interfaces: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedInterfaces", e); LOG.error("Error in getProvisionedInterfaces", e);
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -540,7 +549,8 @@ public class OvsdbDao {
LOG.debug("Retrieved Ports: {}", ret); LOG.debug("Retrieved Ports: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedPorts", e); LOG.error("Error in getProvisionedPorts", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -581,7 +591,8 @@ public class OvsdbDao {
LOG.debug("Retrieved Bridges: {}", ret); LOG.debug("Retrieved Bridges: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedBridges", e); LOG.error("Error in getProvisionedBridges", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -627,8 +638,9 @@ public class OvsdbDao {
wifiRadioConfigInfo.uuid = row.getUuidColumn("_uuid"); wifiRadioConfigInfo.uuid = row.getUuidColumn("_uuid");
wifiRadioConfigInfo.ifName = row.getStringColumn("if_name"); wifiRadioConfigInfo.ifName = row.getStringColumn("if_name");
Long beaconTmp = getSingleValueFromSet(row, "bcn_int"); Long beaconTmp = getSingleValueFromSet(row, "bcn_int");
if (beaconTmp == null) if (beaconTmp == null) {
beaconTmp = 0L; beaconTmp = 0L;
}
wifiRadioConfigInfo.beaconInterval = beaconTmp.intValue(); wifiRadioConfigInfo.beaconInterval = beaconTmp.intValue();
Long channelTmp = getSingleValueFromSet(row, "channel"); Long channelTmp = getSingleValueFromSet(row, "channel");
if (channelTmp == null) { if (channelTmp == null) {
@@ -650,7 +662,8 @@ public class OvsdbDao {
LOG.debug("Retrieved WifiRadioConfig: {}", ret); LOG.debug("Retrieved WifiRadioConfig: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiRadioConfigs", e); LOG.error("Error in getProvisionedWifiRadioConfigs", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -711,21 +724,23 @@ public class OvsdbDao {
wifiVifConfigInfo.ssidBroadcast = row.getStringColumn("ssid_broadcast"); wifiVifConfigInfo.ssidBroadcast = row.getStringColumn("ssid_broadcast");
wifiVifConfigInfo.uapsdEnable = row.getBooleanColumn("uapsd_enable"); wifiVifConfigInfo.uapsdEnable = row.getBooleanColumn("uapsd_enable");
Long radioIdxTmp = getSingleValueFromSet(row, "vif_radio_idx"); Long radioIdxTmp = getSingleValueFromSet(row, "vif_radio_idx");
if (radioIdxTmp == null) if (radioIdxTmp == null) {
radioIdxTmp = 0L; radioIdxTmp = 0L;
}
wifiVifConfigInfo.vifRadioIdx = radioIdxTmp.intValue(); wifiVifConfigInfo.vifRadioIdx = radioIdxTmp.intValue();
wifiVifConfigInfo.security = row.getMapColumn("security"); wifiVifConfigInfo.security = row.getMapColumn("security");
if (row.getColumns().get("vlan_id") != null && row.getColumns().get("vlan_id").getClass() if (row.getColumns().get("vlan_id") != null && row.getColumns().get("vlan_id").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
wifiVifConfigInfo.vlanId = (row.getIntegerColumn("vlan_id").intValue()); wifiVifConfigInfo.vlanId = row.getIntegerColumn("vlan_id").intValue();
} }
ret.put(wifiVifConfigInfo.ifName + '_' + wifiVifConfigInfo.ssid, wifiVifConfigInfo); ret.put(wifiVifConfigInfo.ifName + '_' + wifiVifConfigInfo.ssid, wifiVifConfigInfo);
} }
LOG.debug("Retrieved WifiVifConfigs: {}", ret); LOG.debug("Retrieved WifiVifConfigs: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiVifConfigs", e); LOG.error("Error in getProvisionedWifiVifConfigs", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -781,26 +796,27 @@ public class OvsdbDao {
wifiInetConfigInfo.network = row.getBooleanColumn("network"); wifiInetConfigInfo.network = row.getBooleanColumn("network");
if (row.getColumns().get("inet_addr") != null && row.getColumns().get("inet_addr").getClass() if (row.getColumns().get("inet_addr") != null && row.getColumns().get("inet_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
wifiInetConfigInfo.inetAddr = (row.getStringColumn("inet_addr")); wifiInetConfigInfo.inetAddr = row.getStringColumn("inet_addr");
} }
if (row.getColumns().get("mtu") != null && row.getColumns().get("mtu").getClass() if (row.getColumns().get("mtu") != null && row.getColumns().get("mtu").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
wifiInetConfigInfo.mtu = (row.getIntegerColumn("mtu").intValue()); wifiInetConfigInfo.mtu = row.getIntegerColumn("mtu").intValue();
} }
if (row.getColumns().get("netmask") != null && row.getColumns().get("netmask").getClass() if (row.getColumns().get("netmask") != null && row.getColumns().get("netmask").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
wifiInetConfigInfo.netmask = (row.getStringColumn("netmask")); wifiInetConfigInfo.netmask = row.getStringColumn("netmask");
} }
if (row.getColumns().get("vlan_id") != null && row.getColumns().get("vlan_id").getClass() if (row.getColumns().get("vlan_id") != null && row.getColumns().get("vlan_id").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
wifiInetConfigInfo.vlanId = (row.getIntegerColumn("vlan_id").intValue()); wifiInetConfigInfo.vlanId = row.getIntegerColumn("vlan_id").intValue();
} }
ret.put(wifiInetConfigInfo.ifName, wifiInetConfigInfo); ret.put(wifiInetConfigInfo.ifName, wifiInetConfigInfo);
} }
LOG.debug("Retrieved WifiInetConfigs: {}", ret); LOG.debug("Retrieved WifiInetConfigs: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiInetConfigs", e); LOG.error("Error in getProvisionedWifiInetConfigs", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -852,7 +868,8 @@ public class OvsdbDao {
if (wifiStatsConfigInfo.surveyType == null) { if (wifiStatsConfigInfo.surveyType == null) {
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType, wifiStatsConfigInfo); ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType, wifiStatsConfigInfo);
} else { }
else {
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_" ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_"
+ wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo); + wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo);
} }
@@ -860,7 +877,8 @@ public class OvsdbDao {
LOG.debug("Retrieved WifiStatsConfigs: {}", ret); LOG.debug("Retrieved WifiStatsConfigs: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { }
catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedWifiStatsConfigs", e); LOG.error("Error in getProvisionedWifiStatsConfigs", e);
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -931,7 +949,7 @@ public class OvsdbDao {
// portUuid = new Uuid(new UUID(System.currentTimeMillis(), // portUuid = new Uuid(new UUID(System.currentTimeMillis(),
// System.nanoTime())) ; // System.nanoTime())) ;
updateColumns.put("name", new Atom<String>(interfaceName)); updateColumns.put("name", new Atom<>(interfaceName));
// updateColumns.put("_uuid", new Atom<Uuid>(portUuid)); // updateColumns.put("_uuid", new Atom<Uuid>(portUuid));
Set<Uuid> portInterfacesSet = new HashSet<>(); Set<Uuid> portInterfacesSet = new HashSet<>();
@@ -957,7 +975,8 @@ public class OvsdbDao {
} }
} }
} else { }
else {
// need to update port // need to update port
PortInfo existingPort = provisionedPorts.get(interfaceName); PortInfo existingPort = provisionedPorts.get(interfaceName);
portUuid = existingPort.uuid; portUuid = existingPort.uuid;
@@ -1020,7 +1039,8 @@ public class OvsdbDao {
row = new Row(updateColumns); row = new Row(updateColumns);
operations.add(new Update(bridgeDbTable, row)); operations.add(new Update(bridgeDbTable, row));
} else { }
else {
LOG.warn("provisionedBridges does not have bridge {} - {} - port will be dangling", bridgeName, LOG.warn("provisionedBridges does not have bridge {} - {} - port will be dangling", bridgeName,
provisionedBridges.keySet()); provisionedBridges.keySet());
} }
@@ -1071,14 +1091,15 @@ public class OvsdbDao {
provisionSingleBridgePortInterface(ovsdbClient, patchW2h, brWan, "patch", patchW2hOptions, provisionSingleBridgePortInterface(ovsdbClient, patchW2h, brWan, "patch", patchW2hOptions,
provisionedInterfaces, provisionedPorts, provisionedBridges); provisionedInterfaces, provisionedPorts, provisionedBridges);
provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzU, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces, provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzU, bridgeNameVifInterfaces, "vif", null,
provisionedPorts, provisionedBridges); provisionedInterfaces, provisionedPorts, provisionedBridges);
provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzL, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces, provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzL, bridgeNameVifInterfaces, "vif", null,
provisionedPorts, provisionedBridges); provisionedInterfaces, provisionedPorts, provisionedBridges);
provisionSingleBridgePortInterface(ovsdbClient, ifName2pt4GHz, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces, provisionSingleBridgePortInterface(ovsdbClient, ifName2pt4GHz, bridgeNameVifInterfaces, "vif", null,
provisionedPorts, provisionedBridges); provisionedInterfaces, provisionedPorts, provisionedBridges);
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in provisionBridgePortInterface", e); LOG.error("Error in provisionBridgePortInterface", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -1104,7 +1125,8 @@ public class OvsdbDao {
} }
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in removeOnboardingSsids", e); LOG.error("Error in removeOnboardingSsids", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -1152,7 +1174,8 @@ public class OvsdbDao {
LOG.info("Removed all ssids"); LOG.info("Removed all ssids");
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in removeAllSsids", e); LOG.error("Error in removeAllSsids", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -1164,10 +1187,13 @@ public class OvsdbDao {
Map<String, WifiRadioConfigInfo> provisionedWifiRadios = getProvisionedWifiRadioConfigs(ovsdbClient); Map<String, WifiRadioConfigInfo> provisionedWifiRadios = getProvisionedWifiRadioConfigs(ovsdbClient);
LOG.debug("Existing WifiRadioConfigs: {}", provisionedWifiRadios.keySet()); LOG.debug("Existing WifiRadioConfigs: {}", provisionedWifiRadios.keySet());
String country = opensyncAPConfig.getCountryCode(); // should be the same for all radios on this AP ;-) String country = opensyncAPConfig.getCountryCode(); // should be the
// same for all
// radios on this AP
// ;-)
ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) opensyncAPConfig ApElementConfiguration apElementConfiguration = (ApElementConfiguration) opensyncAPConfig.getCustomerEquipment()
.getCustomerEquipment().getDetails()); .getDetails();
for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) { for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) {
Map<String, String> hwConfig = new HashMap<>(); Map<String, String> hwConfig = new HashMap<>();
@@ -1199,15 +1225,17 @@ public class OvsdbDao {
boolean enabled = radioConfig.getRadioAdminState().equals(StateSetting.enabled); boolean enabled = radioConfig.getRadioAdminState().equals(StateSetting.enabled);
int txPower = 0; int txPower = 0;
if (!elementRadioConfig.getEirpTxPower().isAuto()) if (!elementRadioConfig.getEirpTxPower().isAuto()) {
txPower = elementRadioConfig.getEirpTxPower().getValue(); txPower = elementRadioConfig.getEirpTxPower().getValue();
}
String configName = null; String configName = null;
switch (radioType) { switch (radioType) {
case is2dot4GHz: case is2dot4GHz:
configName = radioName2pt4GHz; configName = radioName2pt4GHz;
break; break;
case is5GHz: case is5GHz:
// 802.11h dfs (Dynamic Frequency Selection) aka military and weather radar // 802.11h dfs (Dynamic Frequency Selection) aka military and
// weather radar
// avoidance protocol // avoidance protocol
// Must not be disabled (by law) // Must not be disabled (by law)
// NA for 2.4GHz // NA for 2.4GHz
@@ -1217,7 +1245,8 @@ public class OvsdbDao {
configName = radioName5GHzU; configName = radioName5GHzU;
break; break;
case is5GHzL: case is5GHzL:
// 802.11h dfs (Dynamic Frequency Selection) aka military and weather radar // 802.11h dfs (Dynamic Frequency Selection) aka military and
// weather radar
// avoidance protocol // avoidance protocol
// Must not be disabled (by law) // Must not be disabled (by law)
// NA for 2.4GHz // NA for 2.4GHz
@@ -1227,7 +1256,8 @@ public class OvsdbDao {
configName = radioName5GHzL; configName = radioName5GHzL;
break; break;
case is5GHzU: case is5GHzU:
// 802.11h dfs (Dynamic Frequency Selection) aka military and weather radar // 802.11h dfs (Dynamic Frequency Selection) aka military and
// weather radar
// avoidance protocol // avoidance protocol
// Must not be disabled (by law) // Must not be disabled (by law)
// NA for 2.4GHz // NA for 2.4GHz
@@ -1245,18 +1275,20 @@ public class OvsdbDao {
try { try {
configureWifiRadios(ovsdbClient, configName, provisionedWifiRadios, channel, hwConfig, country, configureWifiRadios(ovsdbClient, configName, provisionedWifiRadios, channel, hwConfig, country,
beaconInterval, enabled, ht_mode, txPower); beaconInterval, enabled, ht_mode, txPower);
} catch (OvsdbClientException e) { }
// TODO Auto-generated catch block catch (OvsdbClientException e) {
e.printStackTrace(); LOG.error("ConfigureWifiRadios failed with OvsdbClient exception.", e);
} catch (TimeoutException e) { }
// TODO Auto-generated catch block catch (TimeoutException e) {
e.printStackTrace(); LOG.error("ConfigureWifiRadios failed with Timeout.", e);
} catch (ExecutionException e) {
// TODO Auto-generated catch block }
e.printStackTrace(); catch (ExecutionException e) {
} catch (InterruptedException e) { LOG.error("ConfigureWifiRadios excecution failed.", e);
// TODO Auto-generated catch block
e.printStackTrace(); }
catch (InterruptedException e) {
LOG.error("ConfigureWifiRadios interrupted.", e);
} }
} }
@@ -1268,7 +1300,7 @@ public class OvsdbDao {
public List<OpensyncAPRadioState> getOpensyncAPRadioState(TableUpdates tableUpdates, String apId, public List<OpensyncAPRadioState> getOpensyncAPRadioState(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) { OvsdbClient ovsdbClient) {
List<OpensyncAPRadioState> ret = new ArrayList<OpensyncAPRadioState>(); List<OpensyncAPRadioState> ret = new ArrayList<>();
try { try {
@@ -1295,7 +1327,23 @@ public class OvsdbDao {
} }
if (map.get("freq_band") != null && map.get("freq_band").getClass() if (map.get("freq_band") != null && map.get("freq_band").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setFreqBand(row.getStringColumn("freq_band")); String frequencyBand = row.getStringColumn("freq_band");
switch (frequencyBand) {
case "2.4G":
tableState.setFreqBand(RadioType.is2dot4GHz);
break;
case "5G":
tableState.setFreqBand(RadioType.is5GHz);
break;
case "5GL":
tableState.setFreqBand(RadioType.is5GHzL);
break;
case "5GU":
tableState.setFreqBand(RadioType.is5GHzU);
break;
default:
tableState.setFreqBand(RadioType.UNSUPPORTED);
}
} }
if (map.get("if_name") != null && map.get("if_name").getClass() if (map.get("if_name") != null && map.get("if_name").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
@@ -1337,7 +1385,7 @@ public class OvsdbDao {
Set<Long> allowedChannels = getSet(row, "allowed_channels"); Set<Long> allowedChannels = getSet(row, "allowed_channels");
Set<Integer> allowed = new HashSet<Integer>(); Set<Integer> allowed = new HashSet<>();
for (Long channel : allowedChannels) { for (Long channel : allowedChannels) {
allowed.add(channel.intValue()); allowed.add(channel.intValue());
} }
@@ -1350,10 +1398,11 @@ public class OvsdbDao {
} }
ret.stream().forEach(wrs -> { ret.stream().forEach(wrs -> {
LOG.debug("Wifi_Radio_State row {}", wrs.toPrettyString()); LOG.debug("Wifi_Radio_State row {}", wrs);
}); });
} catch (Exception e) { }
catch (Exception e) {
LOG.error("Could not parse update for Wifi_Radio_State", e); LOG.error("Could not parse update for Wifi_Radio_State", e);
} }
@@ -1362,7 +1411,7 @@ public class OvsdbDao {
public List<OpensyncAPInetState> getOpensyncAPInetState(TableUpdates tableUpdates, String apId, public List<OpensyncAPInetState> getOpensyncAPInetState(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) { OvsdbClient ovsdbClient) {
List<OpensyncAPInetState> ret = new ArrayList<OpensyncAPInetState>(); List<OpensyncAPInetState> ret = new ArrayList<>();
try { try {
@@ -1421,10 +1470,11 @@ public class OvsdbDao {
} }
ret.stream().forEach(wrs -> { ret.stream().forEach(wrs -> {
LOG.debug("Wifi_Inet_State row {}", wrs.toPrettyString()); LOG.debug("Wifi_Inet_State row {}", wrs);
}); });
} catch (Exception e) { }
catch (Exception e) {
LOG.error("Could not parse update for Wifi_Inet_State", e); LOG.error("Could not parse update for Wifi_Inet_State", e);
} }
return ret; return ret;
@@ -1432,7 +1482,7 @@ public class OvsdbDao {
public List<OpensyncAPVIFState> getOpensyncAPVIFState(TableUpdates tableUpdates, String apId, public List<OpensyncAPVIFState> getOpensyncAPVIFState(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) { OvsdbClient ovsdbClient) {
List<OpensyncAPVIFState> ret = new ArrayList<OpensyncAPVIFState>(); List<OpensyncAPVIFState> ret = new ArrayList<>();
try { try {
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) { for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
@@ -1507,11 +1557,13 @@ public class OvsdbDao {
tableState.setVifRadioIdx(row.getIntegerColumn("vif_radio_idx").intValue()); tableState.setVifRadioIdx(row.getIntegerColumn("vif_radio_idx").intValue());
} }
if (map.get("associated_clients") != null) if (map.get("associated_clients") != null) {
tableState.setAssociatedClients(row.getSetColumn("associated_clients")); tableState.setAssociatedClients(row.getSetColumn("associated_clients"));
}
if (map.get("security") != null) if (map.get("security") != null) {
tableState.setSecurity(row.getMapColumn("security")); tableState.setSecurity(row.getMapColumn("security"));
}
if (map.get("_version") != null && map.get("_version").getClass() if (map.get("_version") != null && map.get("_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
@@ -1530,10 +1582,11 @@ public class OvsdbDao {
} }
ret.stream().forEach(wrs -> { ret.stream().forEach(wrs -> {
LOG.debug("Wifi_VIF_State row {}", wrs.toPrettyString()); LOG.debug("Wifi_VIF_State row {}", wrs);
}); });
} catch (Exception e) { }
catch (Exception e) {
LOG.error("Could not parse update for Wifi_VIF_State", e); LOG.error("Could not parse update for Wifi_VIF_State", e);
} }
@@ -1542,7 +1595,7 @@ public class OvsdbDao {
public List<OpensyncWifiAssociatedClients> getOpensyncWifiAssociatedClients(TableUpdates tableUpdates, String apId, public List<OpensyncWifiAssociatedClients> getOpensyncWifiAssociatedClients(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) { OvsdbClient ovsdbClient) {
List<OpensyncWifiAssociatedClients> ret = new ArrayList<OpensyncWifiAssociatedClients>(); List<OpensyncWifiAssociatedClients> ret = new ArrayList<>();
try { try {
@@ -1561,8 +1614,9 @@ public class OvsdbDao {
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setMac(row.getStringColumn("mac")); tableState.setMac(row.getStringColumn("mac"));
} }
if (row.getSetColumn("capabilities") != null) if (row.getSetColumn("capabilities") != null) {
tableState.setCapabilities(row.getSetColumn("capabilities")); tableState.setCapabilities(row.getSetColumn("capabilities"));
}
if (map.get("state") != null && map.get("state").getClass() if (map.get("state") != null && map.get("state").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setState(row.getStringColumn("state")); tableState.setState(row.getStringColumn("state"));
@@ -1582,9 +1636,10 @@ public class OvsdbDao {
} }
} }
ret.stream().forEach(wrs -> { ret.stream().forEach(wrs -> {
LOG.debug("Wifi_Associated_Clients row {}", wrs.toPrettyString()); 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); LOG.error("Could not get Wifi_Associated_Clients list from table update", e);
} }
@@ -1629,8 +1684,9 @@ public class OvsdbDao {
tableState.setId(row.getStringColumn("id")); tableState.setId(row.getStringColumn("id"));
} }
if (map.get("version_matrix") != null) if (map.get("version_matrix") != null) {
tableState.setVersionMatrix(row.getMapColumn("version_matrix")); tableState.setVersionMatrix(row.getMapColumn("version_matrix"));
}
if (map.get("firmware_version") != null && map.get("firmware_version").getClass() if (map.get("firmware_version") != null && map.get("firmware_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setFirmwareVersion(row.getStringColumn("firmware_version")); tableState.setFirmwareVersion(row.getStringColumn("firmware_version"));
@@ -1664,8 +1720,9 @@ public class OvsdbDao {
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setMaxBackoff(row.getIntegerColumn("max_backoff").intValue()); tableState.setMaxBackoff(row.getIntegerColumn("max_backoff").intValue());
} }
if (map.get("led_config") != null) if (map.get("led_config") != null) {
tableState.setLedConfig(row.getMapColumn("led_config")); tableState.setLedConfig(row.getMapColumn("led_config"));
}
if (map.get("redirector_addr") != null && map.get("redirector_addr").getClass() if (map.get("redirector_addr") != null && map.get("redirector_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setRedirectorAddr(row.getStringColumn("redirector_addr")); tableState.setRedirectorAddr(row.getStringColumn("redirector_addr"));
@@ -1708,7 +1765,8 @@ public class OvsdbDao {
} }
} }
} catch (Exception e) { }
catch (Exception e) {
LOG.error("Failed to handle AWLAN_Node update", e); LOG.error("Failed to handle AWLAN_Node update", e);
} }
@@ -1733,19 +1791,21 @@ public class OvsdbDao {
List<Condition> conditions = new ArrayList<>(); List<Condition> conditions = new ArrayList<>();
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(configName))); conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(configName)));
updateColumns.put("channel", new Atom<Integer>(channel)); updateColumns.put("channel", new Atom<>(channel));
updateColumns.put("country", new Atom<>(country)); updateColumns.put("country", new Atom<>(country));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> hwConfigMap = com.vmware.ovsdb.protocol.operation.notation.Map com.vmware.ovsdb.protocol.operation.notation.Map<String, String> hwConfigMap = com.vmware.ovsdb.protocol.operation.notation.Map
.of(hwConfig); .of(hwConfig);
updateColumns.put("hw_config", hwConfigMap); updateColumns.put("hw_config", hwConfigMap);
updateColumns.put("bcn_int", new Atom<Integer>(beaconInterval)); updateColumns.put("bcn_int", new Atom<>(beaconInterval));
updateColumns.put("enabled", new Atom<Boolean>(enabled)); updateColumns.put("enabled", new Atom<>(enabled));
updateColumns.put("ht_mode", new Atom<>(ht_mode)); updateColumns.put("ht_mode", new Atom<>(ht_mode));
if (txPower > 0) if (txPower > 0) {
updateColumns.put("tx_power", new Atom<Integer>(txPower)); updateColumns.put("tx_power", new Atom<>(txPower));
else }
else {
updateColumns.put("tx_power", new com.vmware.ovsdb.protocol.operation.notation.Set()); updateColumns.put("tx_power", new com.vmware.ovsdb.protocol.operation.notation.Set());
}
Row row = new Row(updateColumns); Row row = new Row(updateColumns);
operations.add(new Update(wifiRadioConfigDbTable, conditions, row)); operations.add(new Update(wifiRadioConfigDbTable, conditions, row));
@@ -1781,12 +1841,13 @@ public class OvsdbDao {
updateColumns.put("ssid", new Atom<>(ssid)); updateColumns.put("ssid", new Atom<>(ssid));
updateColumns.put("ssid_broadcast", new Atom<>(ssidBroadcast ? "enabled" : "disabled")); updateColumns.put("ssid_broadcast", new Atom<>(ssidBroadcast ? "enabled" : "disabled"));
updateColumns.put("uapsd_enable", new Atom<>(true)); updateColumns.put("uapsd_enable", new Atom<>(true));
// updateColumns.put("vif_radio_idx", new Atom<Integer>(vifRadioIdx)); // updateColumns.put("vif_radio_idx", new
// Atom<Integer>(vifRadioIdx));
updateColumns.put("min_hw_mode", new Atom<>(minHwMode)); updateColumns.put("min_hw_mode", new Atom<>(minHwMode));
updateColumns.put("vlan_id", new Atom<Integer>(vlanId)); updateColumns.put("vlan_id", new Atom<>(vlanId));
updateColumns.put("group_rekey", new Atom<Integer>(keyRefresh)); updateColumns.put("group_rekey", new Atom<>(keyRefresh));
updateColumns.put("uapsd_enable", new Atom<Boolean>(uapsdEnabled)); updateColumns.put("uapsd_enable", new Atom<>(uapsdEnabled));
updateColumns.put("ap_bridge", new Atom<Boolean>(apBridge)); updateColumns.put("ap_bridge", new Atom<>(apBridge));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> securityMap = com.vmware.ovsdb.protocol.operation.notation.Map com.vmware.ovsdb.protocol.operation.notation.Map<String, String> securityMap = com.vmware.ovsdb.protocol.operation.notation.Map
@@ -1849,19 +1910,20 @@ public class OvsdbDao {
} }
Map<String, WifiInetConfigInfo> inetConfigs = getProvisionedWifiInetConfigs(ovsdbClient); Map<String, WifiInetConfigInfo> inetConfigs = getProvisionedWifiInetConfigs(ovsdbClient);
if (inetConfigs.containsKey(ifName)) { if (inetConfigs.containsKey(ifName)) {
updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled, updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled, networkForwardMode == NetworkForwardMode.NAT,
(networkForwardMode == NetworkForwardMode.NAT), "vif", gateway, inet, dns, ipAssignScheme, "vif", gateway, inet, dns, ipAssignScheme, vifConfigUuid);
vifConfigUuid); }
} else { else {
LOG.debug("No corresponding WifiInetConfig for this Interface"); LOG.debug("No corresponding WifiInetConfig for this Interface");
insertWifiInetConfigForVif(ovsdbClient, vlanId, ifName, enabled, insertWifiInetConfigForVif(ovsdbClient, vlanId, ifName, enabled,
(networkForwardMode == NetworkForwardMode.NAT), "vif", gateway, inet, dns, ipAssignScheme, networkForwardMode == NetworkForwardMode.NAT, "vif", gateway, inet, dns, ipAssignScheme,
vifConfigUuid); vifConfigUuid);
} }
LOG.info("Provisioned SSID {} on interface {} / {}", ssid, ifName, radioIfName); 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); LOG.error("Error in configureSingleSsid", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -1881,8 +1943,8 @@ public class OvsdbDao {
LOG.debug("Existing WifiVifConfigs: {}", provisionedWifiVifConfigs.keySet()); LOG.debug("Existing WifiVifConfigs: {}", provisionedWifiVifConfigs.keySet());
SsidConfiguration ssidConfig = (SsidConfiguration) ssidProfile.getDetails(); SsidConfiguration ssidConfig = (SsidConfiguration) ssidProfile.getDetails();
ApElementConfiguration apElementConfig = ((ApElementConfiguration) opensyncApConfig.getCustomerEquipment() ApElementConfiguration apElementConfig = (ApElementConfiguration) opensyncApConfig.getCustomerEquipment()
.getDetails()); .getDetails();
for (RadioType radioType : ssidConfig.getAppliedRadios()) { for (RadioType radioType : ssidConfig.getAppliedRadios()) {
int keyRefresh = ssidConfig.getKeyRefresh(); int keyRefresh = ssidConfig.getKeyRefresh();
@@ -1896,7 +1958,8 @@ public class OvsdbDao {
String opensyncSecurityMode = "OPEN"; String opensyncSecurityMode = "OPEN";
String ipAssignScheme = "none"; String ipAssignScheme = "none";
// the following 5 attributes only applicable to static config, else they are // the following 5 attributes only applicable to static config,
// else they are
// ignored // ignored
String gateway = null; String gateway = null;
String inet = null; String inet = null;
@@ -1905,36 +1968,43 @@ public class OvsdbDao {
ipAssignScheme = "static"; ipAssignScheme = "static";
inet = apElementConfig.getStaticIP().getHostAddress(); inet = apElementConfig.getStaticIP().getHostAddress();
gateway = apElementConfig.getStaticIpGw().getHostAddress(); gateway = apElementConfig.getStaticIpGw().getHostAddress();
dns = new HashMap<String, String>(); dns = new HashMap<>();
dns.put(apElementConfig.getStaticDnsIp1().getHostName(), dns.put(apElementConfig.getStaticDnsIp1().getHostName(),
apElementConfig.getStaticDnsIp1().getHostAddress()); apElementConfig.getStaticDnsIp1().getHostAddress());
dns.put(apElementConfig.getStaticDnsIp2().getHostName(), dns.put(apElementConfig.getStaticDnsIp2().getHostName(),
apElementConfig.getStaticDnsIp2().getHostAddress()); apElementConfig.getStaticDnsIp2().getHostAddress());
} else if (apElementConfig.getGettingIP().equals(GettingIP.dhcp) }
else if (apElementConfig.getGettingIP().equals(GettingIP.dhcp)
|| apElementConfig.getGettingDNS().equals(GettingDNS.dhcp)) { || apElementConfig.getGettingDNS().equals(GettingDNS.dhcp)) {
ipAssignScheme = "dhcp"; ipAssignScheme = "dhcp";
} }
RadioConfiguration radioConfiguration = apElementConfig.getAdvancedRadioMap().get(radioType); RadioConfiguration radioConfiguration = apElementConfig.getAdvancedRadioMap().get(radioType);
if (radioConfiguration == null) if (radioConfiguration == null) {
continue; // don't have a radio of this kind in the map continue; // don't have a radio of this kind in the map
}
RadioMode radioMode = radioConfiguration.getRadioMode(); RadioMode radioMode = radioConfiguration.getRadioMode();
boolean uapsdEnabled = (radioConfiguration.getUapsdState() == StateSetting.enabled); boolean uapsdEnabled = radioConfiguration.getUapsdState() == StateSetting.enabled;
boolean apBridge = (radioConfiguration.getStationIsolation() == StateSetting.enabled); // stationIsolation boolean apBridge = radioConfiguration.getStationIsolation() == StateSetting.enabled; // stationIsolation
String minHwMode = "11n"; // min_hw_mode is 11ac, wifi 5, we can also take ++ (11ax) but 2.4GHz only String minHwMode = "11n"; // min_hw_mode is 11ac, wifi 5, we can
// also take ++ (11ax) but 2.4GHz only
// Wifi4 -- // Wifi4 --
if (!radioType.equals(RadioType.is2dot4GHz)) if (!radioType.equals(RadioType.is2dot4GHz)) {
minHwMode = "11ac"; minHwMode = "11ac";
if (!radioType.equals(RadioType.is2dot4GHz) && radioMode.equals(RadioMode.modeX)) }
if (!radioType.equals(RadioType.is2dot4GHz) && radioMode.equals(RadioMode.modeX)) {
minHwMode = "11x"; minHwMode = "11x";
}
if (ssidSecurityMode.equalsIgnoreCase("wpaPSK") || ssidSecurityMode.equalsIgnoreCase("wpa2PSK")) if (ssidSecurityMode.equalsIgnoreCase("wpaPSK") || ssidSecurityMode.equalsIgnoreCase("wpa2PSK")) {
opensyncSecurityMode = "WPA-PSK"; opensyncSecurityMode = "WPA-PSK";
else if (ssidSecurityMode.equalsIgnoreCase("wep")) }
else if (ssidSecurityMode.equalsIgnoreCase("wep")) {
opensyncSecurityMode = "WEP"; opensyncSecurityMode = "WEP";
}
security.put("encryption", opensyncSecurityMode); security.put("encryption", opensyncSecurityMode);
// key and mode is N/A for OPEN security // key and mode is N/A for OPEN security
@@ -1951,22 +2021,25 @@ public class OvsdbDao {
if (radioType == RadioType.is2dot4GHz) { if (radioType == RadioType.is2dot4GHz) {
ifName = ifName2pt4GHz; ifName = ifName2pt4GHz;
radioIfName = radioName2pt4GHz; radioIfName = radioName2pt4GHz;
} else if (radioType == RadioType.is5GHzL) { }
else if (radioType == RadioType.is5GHzL) {
ifName = ifName5GHzL; ifName = ifName5GHzL;
radioIfName = radioName5GHzL; radioIfName = radioName5GHzL;
} else if (radioType == RadioType.is5GHzU) { }
else if (radioType == RadioType.is5GHzU) {
ifName = ifName5GHzU; ifName = ifName5GHzU;
radioIfName = radioName5GHzU; radioIfName = radioName5GHzU;
} }
if (!provisionedWifiVifConfigs.containsKey(ifName + "_" + ssidConfig.getSsid())) { if (!provisionedWifiVifConfigs.containsKey(ifName + "_" + ssidConfig.getSsid())) {
try { try {
configureSingleSsid(ovsdbClient, bridgeNameVifInterfaces, ifName, ssidConfig.getSsid(), ssidBroadcast, security, configureSingleSsid(ovsdbClient, bridgeNameVifInterfaces, ifName, ssidConfig.getSsid(),
provisionedWifiRadioConfigs, radioIfName, ssidConfig.getVlanId(), rrmEnabled, minHwMode, ssidBroadcast, security, provisionedWifiRadioConfigs, radioIfName,
enabled, keyRefresh, uapsdEnabled, apBridge, ssidConfig.getForwardMode(), gateway, inet, ssidConfig.getVlanId(), rrmEnabled, minHwMode, enabled, keyRefresh, uapsdEnabled,
dns, ipAssignScheme); apBridge, ssidConfig.getForwardMode(), gateway, inet, dns, ipAssignScheme);
} catch (IllegalStateException e) { }
catch (IllegalStateException e) {
// could not provision this SSID, but still can go on // could not provision this SSID, but still can go on
LOG.warn("could not provision SSID {} on {}", ssidConfig.getSsid(), radioIfName); LOG.warn("could not provision SSID {} on {}", ssidConfig.getSsid(), radioIfName);
} }
@@ -1991,13 +2064,14 @@ public class OvsdbDao {
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none /// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none
/// network:=true /// network:=true
// dhcpd // dhcpd
updateColumns.put("if_name", new Atom<String>(ifName)); updateColumns.put("if_name", new Atom<>(ifName));
updateColumns.put("if_type", new Atom<String>(ifType)); updateColumns.put("if_type", new Atom<>(ifType));
updateColumns.put("if_uuid", new Atom<String>(vifConfigUuid.toString())); updateColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
updateColumns.put("enabled", new Atom<Boolean>(enabled)); updateColumns.put("enabled", new Atom<>(enabled));
updateColumns.put("NAT", new Atom<Boolean>(isNAT)); updateColumns.put("NAT", new Atom<>(isNAT));
// mtu // specified in interface, should take that value when implemented // mtu // specified in interface, should take that value when
// implemented
updateColumns.put("mtu", new Atom<>(1500)); updateColumns.put("mtu", new Atom<>(1500));
updateColumns.put("network", new Atom<>(true)); updateColumns.put("network", new Atom<>(true));
@@ -2005,20 +2079,22 @@ public class OvsdbDao {
if (ipAssignScheme.equals("static")) { if (ipAssignScheme.equals("static")) {
updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns)); updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
updateColumns.put("inet_addr", new Atom<String>(inet)); updateColumns.put("inet_addr", new Atom<>(inet));
updateColumns.put("gateway", new Atom<String>(gateway)); updateColumns.put("gateway", new Atom<>(gateway));
// netmask // netmask
// broadcast // broadcast
} }
if (ipAssignScheme.equals("dhcp")) { if (ipAssignScheme.equals("dhcp")) {
updateColumns.put("dhcp_sniff", new Atom<Boolean>(true)); updateColumns.put("dhcp_sniff", new Atom<>(true));
} else { }
updateColumns.put("dhcp_sniff", new Atom<Boolean>(false)); else {
updateColumns.put("dhcp_sniff", new Atom<>(false));
} }
if (ifType.equals("vlan")) { if (ifType.equals("vlan")) {
updateColumns.put("vlan_id", new Atom<Integer>(vlanId)); updateColumns.put("vlan_id", new Atom<>(vlanId));
} else { }
else {
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set()); updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
} }
@@ -2034,7 +2110,8 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res); LOG.debug("Op Result {}", res);
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e); LOG.error("Error in configureWifiInet", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -2053,13 +2130,14 @@ public class OvsdbDao {
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none /// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none
/// network:=true /// network:=true
// dhcpd // dhcpd
updateColumns.put("if_name", new Atom<String>(ifName)); updateColumns.put("if_name", new Atom<>(ifName));
updateColumns.put("if_type", new Atom<String>(ifType)); updateColumns.put("if_type", new Atom<>(ifType));
updateColumns.put("if_uuid", new Atom<String>(vifConfigUuid.toString())); updateColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
updateColumns.put("enabled", new Atom<Boolean>(enabled)); updateColumns.put("enabled", new Atom<>(enabled));
updateColumns.put("NAT", new Atom<Boolean>(isNAT)); updateColumns.put("NAT", new Atom<>(isNAT));
// mtu // specified in interface, should take that value when implemented // mtu // specified in interface, should take that value when
// implemented
updateColumns.put("mtu", new Atom<>(1500)); updateColumns.put("mtu", new Atom<>(1500));
updateColumns.put("network", new Atom<>(true)); updateColumns.put("network", new Atom<>(true));
@@ -2067,20 +2145,22 @@ public class OvsdbDao {
if (ipAssignScheme.equals("static")) { if (ipAssignScheme.equals("static")) {
updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns)); updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
updateColumns.put("inet_addr", new Atom<String>(inet)); updateColumns.put("inet_addr", new Atom<>(inet));
updateColumns.put("gateway", new Atom<String>(gateway)); updateColumns.put("gateway", new Atom<>(gateway));
// netmask // netmask
// broadcast // broadcast
} }
if (ipAssignScheme.equals("dhcp")) { if (ipAssignScheme.equals("dhcp")) {
updateColumns.put("dhcp_sniff", new Atom<Boolean>(true)); updateColumns.put("dhcp_sniff", new Atom<>(true));
} else { }
updateColumns.put("dhcp_sniff", new Atom<Boolean>(false)); else {
updateColumns.put("dhcp_sniff", new Atom<>(false));
} }
if (ifType.equals("vlan")) { if (ifType.equals("vlan")) {
updateColumns.put("vlan_id", new Atom<Integer>(vlanId)); updateColumns.put("vlan_id", new Atom<>(vlanId));
} else { }
else {
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set()); updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
} }
@@ -2096,7 +2176,8 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res); LOG.debug("Op Result {}", res);
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e); LOG.error("Error in configureWifiInet", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -2132,7 +2213,8 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res); LOG.debug("Op Result {}", res);
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e); LOG.error("Error in configureWifiInet", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -2163,7 +2245,8 @@ public class OvsdbDao {
LOG.debug("Op Result {}", res); LOG.debug("Op Result {}", res);
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInetSetNetwork", e); LOG.error("Error in configureWifiInetSetNetwork", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -2231,7 +2314,8 @@ public class OvsdbDao {
} }
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@@ -2602,7 +2686,8 @@ public class OvsdbDao {
} }
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { }
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }