mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 19:47:52 +00:00
Wifi_Radio_State table updates handling. Remove temp objects, begin refactor for MQTT messages
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ package com.telecominfraproject.wlan.opensync.external.integration.models;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class OpensyncAPRadioState extends BaseJsonModel {
|
||||
public Map<String, String> channels;
|
||||
public int thermalUpgradeTemp;
|
||||
public Map<String, String> hwParams;
|
||||
public String freqBand;
|
||||
public RadioType freqBand;
|
||||
public int thermalIntegration;
|
||||
public String channelMode;
|
||||
public Uuid _uuid;
|
||||
@@ -239,11 +240,11 @@ public class OpensyncAPRadioState extends BaseJsonModel {
|
||||
this.hwParams = hwParams;
|
||||
}
|
||||
|
||||
public String getFreqBand() {
|
||||
public RadioType getFreqBand() {
|
||||
return freqBand;
|
||||
}
|
||||
|
||||
public void setFreqBand(String freqBand) {
|
||||
public void setFreqBand(RadioType freqBand) {
|
||||
this.freqBand = freqBand;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@
|
||||
<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.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 -Dssl.props=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/ssl.properties -Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/httpClientConfig.json -Djavax.net.ssl.keyStore=${connectus_certs}/client_keystore.jks -Djavax.net.ssl.keyStorePassword=mypassword -Djavax.net.ssl.trustStore=${connectus_certs}/truststore.jks -Djavax.net.ssl.trustStorePassword=mypassword -Dconnectus.ovsdb.managerAddr=${local_server_address} -Dconnectus.ovsdb.listenPort=6640 -Dconnectus.ovsdb.redirector.listenPort=6643 -Dconnectus.ovsdb.timeoutSec=30 -Dconnectus.ovsdb.trustStore=${connectus_certs}/truststore.jks -Dconnectus.ovsdb.keyStore=${connectus_certs}/server.pkcs12 -Dconnectus.mqttBroker.address=${local_server_address} -Dconnectus.mqttBroker.listenPort=1883 -Dtip.wlan.introspectTokenApi.host=localhost:9096 -Dtip.wlan.introspectTokenApi.clientToken=token_placeholder -Dtip.wlan.serviceUser=user -Dtip.wlan.servicePassword=password -Dconnectus.ovsdb.autoProvisionedCustomerId=2 -Dconnectus.ovsdb.autoProvisionedSsid=Connectus-cloud -Dconnectus.ovsdb.wifi-iface.default_radio1=home-ap-24 -Dconnectus.ovsdb.wifi-iface.default_radio2=home-ap-l50 -Dconnectus.ovsdb.wifi-iface.default_radio0=home-ap-u50	 -Dconnectus.ovsdb.wifi-device.radio0=wifi2 -Dconnectus.ovsdb.wifi-device.radio1=wifi0 -Dconnectus.ovsdb.wifi-device.radio2=wifi1 -Dspring.main.show-banner=false -Dserver.port=9096 -Dtip.wlan.secondaryPort=9097 -Dtip.wlan.csrf-enabled=false -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 -Dssl.props=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/ssl.properties -Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/httpClientConfig.json -Djavax.net.ssl.keyStore=${connectus_certs}/client_keystore.jks -Djavax.net.ssl.keyStorePassword=mypassword -Djavax.net.ssl.trustStore=${connectus_certs}/truststore.jks -Djavax.net.ssl.trustStorePassword=mypassword -Dconnectus.ovsdb.managerAddr=${local_server_address} -Dconnectus.ovsdb.listenPort=6640 -Dconnectus.ovsdb.redirector.listenPort=6643 -Dconnectus.ovsdb.timeoutSec=30 -Dconnectus.ovsdb.trustStore=${connectus_certs}/truststore.jks -Dconnectus.ovsdb.keyStore=${connectus_certs}/server.pkcs12 -Dconnectus.mqttBroker.address=${local_server_address} -Dconnectus.mqttBroker.listenPort=1883 -Dtip.wlan.introspectTokenApi.host=${local_server_address}:9096 -Dtip.wlan.introspectTokenApi.clientToken=token_placeholder -Dtip.wlan.serviceUser=user -Dtip.wlan.servicePassword=password -Dconnectus.ovsdb.autoProvisionedCustomerId=2 -Dconnectus.ovsdb.autoProvisionedSsid=Connectus-cloud -Dspring.main.show-banner=false -Dserver.port=9096 -Dtip.wlan.secondaryPort=7071 -Dtip.wlan.csrf-enabled=false -Dspring.profiles.include=opensync_cloud_config,mqtt_receiver,ovsdb_redirector,ovsdb_manager"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -76,6 +76,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
public void listenForConnections() {
|
||||
|
||||
ConnectionCallback connectionCallback = new ConnectionCallback() {
|
||||
@Override
|
||||
public void connected(OvsdbClient ovsdbClient) {
|
||||
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
||||
int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
||||
@@ -98,17 +99,17 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
String key = clientCn + "_" + connectNodeInfo.serialNumber;
|
||||
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient);
|
||||
extIntegrationInterface.apConnected(key, connectNodeInfo);
|
||||
monitorOvsdbStateTables(ovsdbClient, key);
|
||||
|
||||
// push configuration to AP
|
||||
connectNodeInfo = processConnectRequest(ovsdbClient, clientCn, connectNodeInfo);
|
||||
monitorOvsdbStateTables(ovsdbClient, key);
|
||||
|
||||
LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key);
|
||||
LOG.info("ovsdbClient connectedClients = {}",
|
||||
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("ovsdbClient error", e);
|
||||
// something is wrong with the SSL
|
||||
ovsdbClient.shutdown();
|
||||
@@ -117,6 +118,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(OvsdbClient ovsdbClient) {
|
||||
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
||||
int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
||||
@@ -124,7 +126,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
try {
|
||||
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
|
||||
.getSubjectDN().getName();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@@ -150,7 +153,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key);
|
||||
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key);
|
||||
|
||||
} catch (OvsdbClientException e) {
|
||||
}
|
||||
catch (OvsdbClientException e) {
|
||||
LOG.warn("Could not cancel Monitor {}", e.getMessage());
|
||||
}
|
||||
|
||||
@@ -193,7 +197,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
|
||||
try {
|
||||
ovsdbDao.provisionBridgePortInterface(ovsdbClient);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
// TODO: for some AP configurations this 'may' not be necessary.
|
||||
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
|
||||
}
|
||||
@@ -205,12 +210,13 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
||||
}
|
||||
|
||||
// ovsdbDao.configureWifiInet(ovsdbClient);
|
||||
// ovsdbDao.configureWifiInet(ovsdbClient);
|
||||
|
||||
LOG.debug("Client connect Done");
|
||||
return connectNodeInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getConnectedClientIds() {
|
||||
return ovsdbSessionMapInterface.getConnectedClientIds();
|
||||
}
|
||||
@@ -220,6 +226,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
* @param newRedirectorAddress
|
||||
* @return updated value of the redirector
|
||||
*/
|
||||
@Override
|
||||
public String changeRedirectorAddress(String apId, String newRedirectorAddress) {
|
||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||
if (ovsdbSession == null) {
|
||||
@@ -253,10 +260,10 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
}
|
||||
|
||||
private void monitorOvsdbStateTables(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
||||
CompletableFuture<TableUpdates> rsCf = ovsdbClient
|
||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiRadioStateDbTable + "_" + key,
|
||||
CompletableFuture<TableUpdates> rsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||
OvsdbDao.wifiRadioStateDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable,
|
||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
new MonitorRequest(new MonitorSelect(true, false, false, true)))),
|
||||
new MonitorCallback() {
|
||||
|
||||
@Override
|
||||
@@ -270,8 +277,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
extIntegrationInterface
|
||||
.wifiRadioStatusDbTableUpdate(ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key);
|
||||
|
||||
CompletableFuture<TableUpdates> isCf = ovsdbClient
|
||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiInetStateDbTable + "_" + key,
|
||||
CompletableFuture<TableUpdates> isCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||
OvsdbDao.wifiInetStateDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable,
|
||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
new MonitorCallback() {
|
||||
@@ -299,7 +306,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
// extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||
// ovsdbDao.getOpensyncAPVIFState(tableUpdates,
|
||||
// key, ovsdbClient), key);
|
||||
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<OpensyncAPVIFState>();
|
||||
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<>();
|
||||
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) {
|
||||
|
||||
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) {
|
||||
@@ -336,9 +343,10 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
if (!vifsToDelete.isEmpty()) {
|
||||
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
|
||||
}
|
||||
if (tableUpdates.getTableUpdates().entrySet().isEmpty())
|
||||
if (tableUpdates.getTableUpdates().entrySet().isEmpty()) {
|
||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -350,7 +358,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
CompletableFuture<TableUpdates> acCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||
OvsdbDao.wifiAssociatedClientsDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiAssociatedClientsDbTable,
|
||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
new MonitorRequest(new MonitorSelect(false, true, true, true)))),
|
||||
new MonitorCallback() {
|
||||
|
||||
@Override
|
||||
@@ -380,10 +388,9 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
||||
ovsdbDao.getOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key);
|
||||
|
||||
CompletableFuture<TableUpdates> awCf = ovsdbClient
|
||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.awlanNodeDbTable,
|
||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
CompletableFuture<TableUpdates> awCf = ovsdbClient.monitor(
|
||||
OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key, new MonitorRequests(ImmutableMap
|
||||
.of(OvsdbDao.awlanNodeDbTable, new MonitorRequest(new MonitorSelect(true, false, false, true)))),
|
||||
new MonitorCallback() {
|
||||
|
||||
@Override
|
||||
@@ -403,7 +410,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
try {
|
||||
session.getOvsdbClient().shutdown();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Failed to close session to " + apId + " " + e.getLocalizedMessage());
|
||||
return "Failed to close session to " + apId + " " + e.getLocalizedMessage();
|
||||
|
||||
|
||||
@@ -151,12 +151,12 @@ public class OvsdbDao {
|
||||
row = ((SelectResult) result[0]).getRows().iterator().next();
|
||||
}
|
||||
|
||||
ret.mqttSettings = (row != null) ? row.getMapColumn("mqtt_settings") : null;
|
||||
ret.redirectorAddr = (row != null) ? row.getStringColumn("redirector_addr") : null;
|
||||
ret.managerAddr = (row != null) ? row.getStringColumn("manager_addr") : null;
|
||||
ret.mqttSettings = row != null ? row.getMapColumn("mqtt_settings") : null;
|
||||
ret.redirectorAddr = row != null ? row.getStringColumn("redirector_addr") : null;
|
||||
ret.managerAddr = row != null ? row.getStringColumn("manager_addr") : null;
|
||||
|
||||
ret.platformVersion = (row != null) ? row.getStringColumn("platform_version") : null;
|
||||
ret.firmwareVersion = (row != null) ? row.getStringColumn("firmware_version") : null;
|
||||
ret.platformVersion = row != null ? row.getStringColumn("platform_version") : null;
|
||||
ret.firmwareVersion = row != null ? row.getStringColumn("firmware_version") : null;
|
||||
|
||||
ret.skuNumber = getSingleValueFromSet(row, "sku_number");
|
||||
ret.serialNumber = getSingleValueFromSet(row, "serial_number");
|
||||
@@ -170,7 +170,8 @@ public class OvsdbDao {
|
||||
fillInIpAddressAndMac(ovsdbClient, ret, "br-lan");
|
||||
}
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
}
|
||||
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -208,7 +209,8 @@ public class OvsdbDao {
|
||||
connectNodeInfo.macAddress = row.getStringColumn("hwaddr");
|
||||
}
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
}
|
||||
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -228,7 +230,7 @@ public class OvsdbDao {
|
||||
// update sku_number if it was empty
|
||||
if (ret.skuNumber == null || ret.skuNumber.isEmpty()) {
|
||||
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
|
||||
@@ -266,7 +268,8 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
}
|
||||
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -275,8 +278,9 @@ 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;
|
||||
@@ -311,7 +315,8 @@ public class OvsdbDao {
|
||||
ret);
|
||||
}
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
}
|
||||
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -320,9 +325,10 @@ 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 {
|
||||
@@ -334,9 +340,9 @@ public class OvsdbDao {
|
||||
// $ ovsh i Wifi_Stats_Config reporting_interval:=10
|
||||
// radio_type:="2.4G" stats_type:="device"
|
||||
|
||||
updateColumns.put("reporting_interval", new Atom<Integer>(10));
|
||||
updateColumns.put("radio_type", new Atom<String>("2.4G"));
|
||||
updateColumns.put("stats_type", new Atom<String>("device"));
|
||||
updateColumns.put("reporting_interval", new Atom<>(10));
|
||||
updateColumns.put("radio_type", new Atom<>("2.4G"));
|
||||
updateColumns.put("stats_type", new Atom<>("device"));
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -392,7 +399,7 @@ public class OvsdbDao {
|
||||
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");
|
||||
serialNumber = getSingleValueFromSet(row, "serial_number");
|
||||
@@ -405,7 +412,7 @@ public class OvsdbDao {
|
||||
operations.clear();
|
||||
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);
|
||||
operations.add(new Update(awlanNodeDbTable, row));
|
||||
@@ -420,7 +427,8 @@ 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);
|
||||
}
|
||||
@@ -429,15 +437,15 @@ public class OvsdbDao {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public <T> T getSingleValueFromSet(Row row, String columnName) {
|
||||
|
||||
Set<T> set = (row != null) ? row.getSetColumn(columnName) : null;
|
||||
T ret = (set != null && !set.isEmpty()) ? set.iterator().next() : null;
|
||||
Set<T> set = row != null ? row.getSetColumn(columnName) : null;
|
||||
T ret = set != null && !set.isEmpty() ? set.iterator().next() : null;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -498,7 +506,8 @@ 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);
|
||||
@@ -540,7 +549,8 @@ 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);
|
||||
}
|
||||
@@ -581,7 +591,8 @@ 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);
|
||||
}
|
||||
@@ -627,8 +638,9 @@ public class OvsdbDao {
|
||||
wifiRadioConfigInfo.uuid = row.getUuidColumn("_uuid");
|
||||
wifiRadioConfigInfo.ifName = row.getStringColumn("if_name");
|
||||
Long beaconTmp = getSingleValueFromSet(row, "bcn_int");
|
||||
if (beaconTmp == null)
|
||||
if (beaconTmp == null) {
|
||||
beaconTmp = 0L;
|
||||
}
|
||||
wifiRadioConfigInfo.beaconInterval = beaconTmp.intValue();
|
||||
Long channelTmp = getSingleValueFromSet(row, "channel");
|
||||
if (channelTmp == null) {
|
||||
@@ -650,7 +662,8 @@ 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);
|
||||
}
|
||||
@@ -711,21 +724,23 @@ public class OvsdbDao {
|
||||
wifiVifConfigInfo.ssidBroadcast = row.getStringColumn("ssid_broadcast");
|
||||
wifiVifConfigInfo.uapsdEnable = row.getBooleanColumn("uapsd_enable");
|
||||
Long radioIdxTmp = getSingleValueFromSet(row, "vif_radio_idx");
|
||||
if (radioIdxTmp == null)
|
||||
if (radioIdxTmp == null) {
|
||||
radioIdxTmp = 0L;
|
||||
}
|
||||
wifiVifConfigInfo.vifRadioIdx = radioIdxTmp.intValue();
|
||||
wifiVifConfigInfo.security = row.getMapColumn("security");
|
||||
|
||||
if (row.getColumns().get("vlan_id") != null && row.getColumns().get("vlan_id").getClass()
|
||||
.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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -781,26 +796,27 @@ public class OvsdbDao {
|
||||
wifiInetConfigInfo.network = row.getBooleanColumn("network");
|
||||
if (row.getColumns().get("inet_addr") != null && row.getColumns().get("inet_addr").getClass()
|
||||
.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()
|
||||
.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()
|
||||
.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()
|
||||
.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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -852,7 +868,8 @@ 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);
|
||||
}
|
||||
@@ -860,7 +877,8 @@ 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);
|
||||
@@ -931,7 +949,7 @@ public class OvsdbDao {
|
||||
|
||||
// portUuid = new Uuid(new UUID(System.currentTimeMillis(),
|
||||
// System.nanoTime())) ;
|
||||
updateColumns.put("name", new Atom<String>(interfaceName));
|
||||
updateColumns.put("name", new Atom<>(interfaceName));
|
||||
// updateColumns.put("_uuid", new Atom<Uuid>(portUuid));
|
||||
|
||||
Set<Uuid> portInterfacesSet = new HashSet<>();
|
||||
@@ -957,7 +975,8 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// need to update port
|
||||
PortInfo existingPort = provisionedPorts.get(interfaceName);
|
||||
portUuid = existingPort.uuid;
|
||||
@@ -1020,7 +1039,8 @@ 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());
|
||||
}
|
||||
@@ -1039,9 +1059,9 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
// public static final String homeAp24 = "home-ap-24";
|
||||
// public static final String homeApL50 = "home-ap-l50";
|
||||
// public static final String homeApU50 = "home-ap-u50";
|
||||
// public static final String homeAp24 = "home-ap-24";
|
||||
// public static final String homeApL50 = "home-ap-l50";
|
||||
// public static final String homeApU50 = "home-ap-u50";
|
||||
|
||||
public static final String brWan = "br-wan";
|
||||
public static final String brLan = "br-lan";
|
||||
@@ -1071,14 +1091,15 @@ public class OvsdbDao {
|
||||
provisionSingleBridgePortInterface(ovsdbClient, patchW2h, brWan, "patch", patchW2hOptions,
|
||||
provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
|
||||
provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzU, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces,
|
||||
provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzL, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces,
|
||||
provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, ifName2pt4GHz, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces,
|
||||
provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzU, bridgeNameVifInterfaces, "vif", null,
|
||||
provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, ifName5GHzL, bridgeNameVifInterfaces, "vif", null,
|
||||
provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
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);
|
||||
}
|
||||
@@ -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);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -1152,7 +1174,8 @@ 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);
|
||||
}
|
||||
@@ -1164,10 +1187,13 @@ public class OvsdbDao {
|
||||
Map<String, WifiRadioConfigInfo> provisionedWifiRadios = getProvisionedWifiRadioConfigs(ovsdbClient);
|
||||
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
|
||||
.getCustomerEquipment().getDetails());
|
||||
ApElementConfiguration apElementConfiguration = (ApElementConfiguration) opensyncAPConfig.getCustomerEquipment()
|
||||
.getDetails();
|
||||
|
||||
for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) {
|
||||
Map<String, String> hwConfig = new HashMap<>();
|
||||
@@ -1199,15 +1225,17 @@ public class OvsdbDao {
|
||||
boolean enabled = radioConfig.getRadioAdminState().equals(StateSetting.enabled);
|
||||
|
||||
int txPower = 0;
|
||||
if (!elementRadioConfig.getEirpTxPower().isAuto())
|
||||
if (!elementRadioConfig.getEirpTxPower().isAuto()) {
|
||||
txPower = elementRadioConfig.getEirpTxPower().getValue();
|
||||
}
|
||||
String configName = null;
|
||||
switch (radioType) {
|
||||
case is2dot4GHz:
|
||||
configName = radioName2pt4GHz;
|
||||
break;
|
||||
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
|
||||
// Must not be disabled (by law)
|
||||
// NA for 2.4GHz
|
||||
@@ -1217,7 +1245,8 @@ public class OvsdbDao {
|
||||
configName = radioName5GHzU;
|
||||
break;
|
||||
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
|
||||
// Must not be disabled (by law)
|
||||
// NA for 2.4GHz
|
||||
@@ -1227,7 +1256,8 @@ public class OvsdbDao {
|
||||
configName = radioName5GHzL;
|
||||
break;
|
||||
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
|
||||
// Must not be disabled (by law)
|
||||
// NA for 2.4GHz
|
||||
@@ -1245,18 +1275,20 @@ public class OvsdbDao {
|
||||
try {
|
||||
configureWifiRadios(ovsdbClient, configName, provisionedWifiRadios, channel, hwConfig, country,
|
||||
beaconInterval, enabled, ht_mode, txPower);
|
||||
} catch (OvsdbClientException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (TimeoutException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (OvsdbClientException e) {
|
||||
LOG.error("ConfigureWifiRadios failed with OvsdbClient exception.", e);
|
||||
}
|
||||
catch (TimeoutException e) {
|
||||
LOG.error("ConfigureWifiRadios failed with Timeout.", e);
|
||||
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
LOG.error("ConfigureWifiRadios excecution failed.", e);
|
||||
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
LOG.error("ConfigureWifiRadios interrupted.", e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1268,7 +1300,7 @@ public class OvsdbDao {
|
||||
public List<OpensyncAPRadioState> getOpensyncAPRadioState(TableUpdates tableUpdates, String apId,
|
||||
OvsdbClient ovsdbClient) {
|
||||
|
||||
List<OpensyncAPRadioState> ret = new ArrayList<OpensyncAPRadioState>();
|
||||
List<OpensyncAPRadioState> ret = new ArrayList<>();
|
||||
|
||||
try {
|
||||
|
||||
@@ -1295,7 +1327,23 @@ public class OvsdbDao {
|
||||
}
|
||||
if (map.get("freq_band") != null && map.get("freq_band").getClass()
|
||||
.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()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
@@ -1337,7 +1385,7 @@ public class OvsdbDao {
|
||||
|
||||
Set<Long> allowedChannels = getSet(row, "allowed_channels");
|
||||
|
||||
Set<Integer> allowed = new HashSet<Integer>();
|
||||
Set<Integer> allowed = new HashSet<>();
|
||||
for (Long channel : allowedChannels) {
|
||||
allowed.add(channel.intValue());
|
||||
}
|
||||
@@ -1350,10 +1398,11 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1362,7 +1411,7 @@ public class OvsdbDao {
|
||||
|
||||
public List<OpensyncAPInetState> getOpensyncAPInetState(TableUpdates tableUpdates, String apId,
|
||||
OvsdbClient ovsdbClient) {
|
||||
List<OpensyncAPInetState> ret = new ArrayList<OpensyncAPInetState>();
|
||||
List<OpensyncAPInetState> ret = new ArrayList<>();
|
||||
|
||||
try {
|
||||
|
||||
@@ -1421,10 +1470,11 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
return ret;
|
||||
@@ -1432,7 +1482,7 @@ public class OvsdbDao {
|
||||
|
||||
public List<OpensyncAPVIFState> getOpensyncAPVIFState(TableUpdates tableUpdates, String apId,
|
||||
OvsdbClient ovsdbClient) {
|
||||
List<OpensyncAPVIFState> ret = new ArrayList<OpensyncAPVIFState>();
|
||||
List<OpensyncAPVIFState> ret = new ArrayList<>();
|
||||
try {
|
||||
|
||||
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
|
||||
@@ -1507,11 +1557,13 @@ public class OvsdbDao {
|
||||
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"));
|
||||
}
|
||||
|
||||
if (map.get("security") != null)
|
||||
if (map.get("security") != null) {
|
||||
tableState.setSecurity(row.getMapColumn("security"));
|
||||
}
|
||||
|
||||
if (map.get("_version") != null && map.get("_version").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
@@ -1530,10 +1582,11 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -1542,7 +1595,7 @@ public class OvsdbDao {
|
||||
|
||||
public List<OpensyncWifiAssociatedClients> getOpensyncWifiAssociatedClients(TableUpdates tableUpdates, String apId,
|
||||
OvsdbClient ovsdbClient) {
|
||||
List<OpensyncWifiAssociatedClients> ret = new ArrayList<OpensyncWifiAssociatedClients>();
|
||||
List<OpensyncWifiAssociatedClients> ret = new ArrayList<>();
|
||||
|
||||
try {
|
||||
|
||||
@@ -1561,8 +1614,9 @@ public class OvsdbDao {
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
tableState.setMac(row.getStringColumn("mac"));
|
||||
}
|
||||
if (row.getSetColumn("capabilities") != null)
|
||||
if (row.getSetColumn("capabilities") != null) {
|
||||
tableState.setCapabilities(row.getSetColumn("capabilities"));
|
||||
}
|
||||
if (map.get("state") != null && map.get("state").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
tableState.setState(row.getStringColumn("state"));
|
||||
@@ -1582,9 +1636,10 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1629,8 +1684,9 @@ public class OvsdbDao {
|
||||
tableState.setId(row.getStringColumn("id"));
|
||||
}
|
||||
|
||||
if (map.get("version_matrix") != null)
|
||||
if (map.get("version_matrix") != null) {
|
||||
tableState.setVersionMatrix(row.getMapColumn("version_matrix"));
|
||||
}
|
||||
if (map.get("firmware_version") != null && map.get("firmware_version").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
tableState.setFirmwareVersion(row.getStringColumn("firmware_version"));
|
||||
@@ -1664,8 +1720,9 @@ public class OvsdbDao {
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
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"));
|
||||
}
|
||||
if (map.get("redirector_addr") != null && map.get("redirector_addr").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1733,19 +1791,21 @@ public class OvsdbDao {
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
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));
|
||||
@SuppressWarnings("unchecked")
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> hwConfigMap = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(hwConfig);
|
||||
updateColumns.put("hw_config", hwConfigMap);
|
||||
updateColumns.put("bcn_int", new Atom<Integer>(beaconInterval));
|
||||
updateColumns.put("enabled", new Atom<Boolean>(enabled));
|
||||
updateColumns.put("bcn_int", new Atom<>(beaconInterval));
|
||||
updateColumns.put("enabled", new Atom<>(enabled));
|
||||
updateColumns.put("ht_mode", new Atom<>(ht_mode));
|
||||
if (txPower > 0)
|
||||
updateColumns.put("tx_power", new Atom<Integer>(txPower));
|
||||
else
|
||||
if (txPower > 0) {
|
||||
updateColumns.put("tx_power", new Atom<>(txPower));
|
||||
}
|
||||
else {
|
||||
updateColumns.put("tx_power", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||
}
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
operations.add(new Update(wifiRadioConfigDbTable, conditions, row));
|
||||
@@ -1781,12 +1841,13 @@ public class OvsdbDao {
|
||||
updateColumns.put("ssid", new Atom<>(ssid));
|
||||
updateColumns.put("ssid_broadcast", new Atom<>(ssidBroadcast ? "enabled" : "disabled"));
|
||||
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("vlan_id", new Atom<Integer>(vlanId));
|
||||
updateColumns.put("group_rekey", new Atom<Integer>(keyRefresh));
|
||||
updateColumns.put("uapsd_enable", new Atom<Boolean>(uapsdEnabled));
|
||||
updateColumns.put("ap_bridge", new Atom<Boolean>(apBridge));
|
||||
updateColumns.put("vlan_id", new Atom<>(vlanId));
|
||||
updateColumns.put("group_rekey", new Atom<>(keyRefresh));
|
||||
updateColumns.put("uapsd_enable", new Atom<>(uapsdEnabled));
|
||||
updateColumns.put("ap_bridge", new Atom<>(apBridge));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
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);
|
||||
if (inetConfigs.containsKey(ifName)) {
|
||||
updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled,
|
||||
(networkForwardMode == NetworkForwardMode.NAT), "vif", gateway, inet, dns, ipAssignScheme,
|
||||
vifConfigUuid);
|
||||
} else {
|
||||
updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled, networkForwardMode == NetworkForwardMode.NAT,
|
||||
"vif", gateway, inet, dns, ipAssignScheme, vifConfigUuid);
|
||||
}
|
||||
else {
|
||||
LOG.debug("No corresponding WifiInetConfig for this Interface");
|
||||
insertWifiInetConfigForVif(ovsdbClient, vlanId, ifName, enabled,
|
||||
(networkForwardMode == NetworkForwardMode.NAT), "vif", gateway, inet, dns, ipAssignScheme,
|
||||
networkForwardMode == NetworkForwardMode.NAT, "vif", gateway, inet, dns, ipAssignScheme,
|
||||
vifConfigUuid);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1881,8 +1943,8 @@ public class OvsdbDao {
|
||||
LOG.debug("Existing WifiVifConfigs: {}", provisionedWifiVifConfigs.keySet());
|
||||
|
||||
SsidConfiguration ssidConfig = (SsidConfiguration) ssidProfile.getDetails();
|
||||
ApElementConfiguration apElementConfig = ((ApElementConfiguration) opensyncApConfig.getCustomerEquipment()
|
||||
.getDetails());
|
||||
ApElementConfiguration apElementConfig = (ApElementConfiguration) opensyncApConfig.getCustomerEquipment()
|
||||
.getDetails();
|
||||
for (RadioType radioType : ssidConfig.getAppliedRadios()) {
|
||||
|
||||
int keyRefresh = ssidConfig.getKeyRefresh();
|
||||
@@ -1896,7 +1958,8 @@ public class OvsdbDao {
|
||||
String opensyncSecurityMode = "OPEN";
|
||||
|
||||
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
|
||||
String gateway = null;
|
||||
String inet = null;
|
||||
@@ -1905,36 +1968,43 @@ public class OvsdbDao {
|
||||
ipAssignScheme = "static";
|
||||
inet = apElementConfig.getStaticIP().getHostAddress();
|
||||
gateway = apElementConfig.getStaticIpGw().getHostAddress();
|
||||
dns = new HashMap<String, String>();
|
||||
dns = new HashMap<>();
|
||||
dns.put(apElementConfig.getStaticDnsIp1().getHostName(),
|
||||
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";
|
||||
}
|
||||
|
||||
RadioConfiguration radioConfiguration = apElementConfig.getAdvancedRadioMap().get(radioType);
|
||||
if (radioConfiguration == null)
|
||||
if (radioConfiguration == null) {
|
||||
continue; // don't have a radio of this kind in the map
|
||||
}
|
||||
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 --
|
||||
if (!radioType.equals(RadioType.is2dot4GHz))
|
||||
if (!radioType.equals(RadioType.is2dot4GHz)) {
|
||||
minHwMode = "11ac";
|
||||
if (!radioType.equals(RadioType.is2dot4GHz) && radioMode.equals(RadioMode.modeX))
|
||||
}
|
||||
if (!radioType.equals(RadioType.is2dot4GHz) && radioMode.equals(RadioMode.modeX)) {
|
||||
minHwMode = "11x";
|
||||
}
|
||||
|
||||
if (ssidSecurityMode.equalsIgnoreCase("wpaPSK") || ssidSecurityMode.equalsIgnoreCase("wpa2PSK"))
|
||||
if (ssidSecurityMode.equalsIgnoreCase("wpaPSK") || ssidSecurityMode.equalsIgnoreCase("wpa2PSK")) {
|
||||
opensyncSecurityMode = "WPA-PSK";
|
||||
else if (ssidSecurityMode.equalsIgnoreCase("wep"))
|
||||
}
|
||||
else if (ssidSecurityMode.equalsIgnoreCase("wep")) {
|
||||
opensyncSecurityMode = "WEP";
|
||||
}
|
||||
|
||||
security.put("encryption", opensyncSecurityMode);
|
||||
// key and mode is N/A for OPEN security
|
||||
@@ -1951,22 +2021,25 @@ 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;
|
||||
}
|
||||
|
||||
if (!provisionedWifiVifConfigs.containsKey(ifName + "_" + ssidConfig.getSsid())) {
|
||||
try {
|
||||
configureSingleSsid(ovsdbClient, bridgeNameVifInterfaces, ifName, ssidConfig.getSsid(), ssidBroadcast, security,
|
||||
provisionedWifiRadioConfigs, radioIfName, ssidConfig.getVlanId(), rrmEnabled, minHwMode,
|
||||
enabled, keyRefresh, uapsdEnabled, apBridge, ssidConfig.getForwardMode(), gateway, inet,
|
||||
dns, ipAssignScheme);
|
||||
configureSingleSsid(ovsdbClient, bridgeNameVifInterfaces, ifName, ssidConfig.getSsid(),
|
||||
ssidBroadcast, security, provisionedWifiRadioConfigs, radioIfName,
|
||||
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);
|
||||
}
|
||||
@@ -1990,14 +2063,15 @@ public class OvsdbDao {
|
||||
/// usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true
|
||||
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none
|
||||
/// network:=true
|
||||
// dhcpd
|
||||
updateColumns.put("if_name", new Atom<String>(ifName));
|
||||
updateColumns.put("if_type", new Atom<String>(ifType));
|
||||
updateColumns.put("if_uuid", new Atom<String>(vifConfigUuid.toString()));
|
||||
updateColumns.put("enabled", new Atom<Boolean>(enabled));
|
||||
updateColumns.put("NAT", new Atom<Boolean>(isNAT));
|
||||
// dhcpd
|
||||
updateColumns.put("if_name", new Atom<>(ifName));
|
||||
updateColumns.put("if_type", new Atom<>(ifType));
|
||||
updateColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
|
||||
updateColumns.put("enabled", new Atom<>(enabled));
|
||||
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("network", new Atom<>(true));
|
||||
|
||||
@@ -2005,20 +2079,22 @@ public class OvsdbDao {
|
||||
|
||||
if (ipAssignScheme.equals("static")) {
|
||||
updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
|
||||
updateColumns.put("inet_addr", new Atom<String>(inet));
|
||||
updateColumns.put("gateway", new Atom<String>(gateway));
|
||||
// netmask
|
||||
// broadcast
|
||||
updateColumns.put("inet_addr", new Atom<>(inet));
|
||||
updateColumns.put("gateway", new Atom<>(gateway));
|
||||
// netmask
|
||||
// broadcast
|
||||
}
|
||||
if (ipAssignScheme.equals("dhcp")) {
|
||||
updateColumns.put("dhcp_sniff", new Atom<Boolean>(true));
|
||||
} else {
|
||||
updateColumns.put("dhcp_sniff", new Atom<Boolean>(false));
|
||||
updateColumns.put("dhcp_sniff", new Atom<>(true));
|
||||
}
|
||||
else {
|
||||
updateColumns.put("dhcp_sniff", new Atom<>(false));
|
||||
}
|
||||
|
||||
if (ifType.equals("vlan")) {
|
||||
updateColumns.put("vlan_id", new Atom<Integer>(vlanId));
|
||||
} else {
|
||||
updateColumns.put("vlan_id", new Atom<>(vlanId));
|
||||
}
|
||||
else {
|
||||
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||
}
|
||||
|
||||
@@ -2034,7 +2110,8 @@ 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);
|
||||
}
|
||||
@@ -2052,14 +2129,15 @@ public class OvsdbDao {
|
||||
/// usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true
|
||||
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none
|
||||
/// network:=true
|
||||
// dhcpd
|
||||
updateColumns.put("if_name", new Atom<String>(ifName));
|
||||
updateColumns.put("if_type", new Atom<String>(ifType));
|
||||
updateColumns.put("if_uuid", new Atom<String>(vifConfigUuid.toString()));
|
||||
updateColumns.put("enabled", new Atom<Boolean>(enabled));
|
||||
updateColumns.put("NAT", new Atom<Boolean>(isNAT));
|
||||
// dhcpd
|
||||
updateColumns.put("if_name", new Atom<>(ifName));
|
||||
updateColumns.put("if_type", new Atom<>(ifType));
|
||||
updateColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
|
||||
updateColumns.put("enabled", new Atom<>(enabled));
|
||||
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("network", new Atom<>(true));
|
||||
|
||||
@@ -2067,20 +2145,22 @@ public class OvsdbDao {
|
||||
|
||||
if (ipAssignScheme.equals("static")) {
|
||||
updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
|
||||
updateColumns.put("inet_addr", new Atom<String>(inet));
|
||||
updateColumns.put("gateway", new Atom<String>(gateway));
|
||||
// netmask
|
||||
// broadcast
|
||||
updateColumns.put("inet_addr", new Atom<>(inet));
|
||||
updateColumns.put("gateway", new Atom<>(gateway));
|
||||
// netmask
|
||||
// broadcast
|
||||
}
|
||||
if (ipAssignScheme.equals("dhcp")) {
|
||||
updateColumns.put("dhcp_sniff", new Atom<Boolean>(true));
|
||||
} else {
|
||||
updateColumns.put("dhcp_sniff", new Atom<Boolean>(false));
|
||||
updateColumns.put("dhcp_sniff", new Atom<>(true));
|
||||
}
|
||||
else {
|
||||
updateColumns.put("dhcp_sniff", new Atom<>(false));
|
||||
}
|
||||
|
||||
if (ifType.equals("vlan")) {
|
||||
updateColumns.put("vlan_id", new Atom<Integer>(vlanId));
|
||||
} else {
|
||||
updateColumns.put("vlan_id", new Atom<>(vlanId));
|
||||
}
|
||||
else {
|
||||
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||
}
|
||||
|
||||
@@ -2096,7 +2176,8 @@ 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);
|
||||
}
|
||||
@@ -2132,7 +2213,8 @@ 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);
|
||||
}
|
||||
@@ -2163,7 +2245,8 @@ 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);
|
||||
}
|
||||
@@ -2231,7 +2314,8 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
}
|
||||
catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user