mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-03 20:17:53 +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.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 -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>
|
</launchConfiguration>
|
||||||
|
|||||||
@@ -45,370 +45,378 @@ import io.netty.handler.ssl.SslContext;
|
|||||||
@Component
|
@Component
|
||||||
public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ConnectusOvsdbClient.class);
|
private static final Logger LOG = LoggerFactory.getLogger(ConnectusOvsdbClient.class);
|
||||||
|
|
||||||
@org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.listenPort:6640}")
|
@org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.listenPort:6640}")
|
||||||
private int ovsdbListenPort;
|
private int ovsdbListenPort;
|
||||||
|
|
||||||
@org.springframework.beans.factory.annotation.Value("${connectus.manager.collectionIntervalSec.deviceStats:10}")
|
@org.springframework.beans.factory.annotation.Value("${connectus.manager.collectionIntervalSec.deviceStats:10}")
|
||||||
private long collectionIntervalSecDeviceStats;
|
private long collectionIntervalSecDeviceStats;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SslContext sslContext;
|
private SslContext sslContext;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OvsdbPassiveConnectionListener listener;
|
private OvsdbPassiveConnectionListener listener;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OvsdbDao ovsdbDao;
|
private OvsdbDao ovsdbDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OpensyncExternalIntegrationInterface extIntegrationInterface;
|
private OpensyncExternalIntegrationInterface extIntegrationInterface;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
private OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void postCreate() {
|
private void postCreate() {
|
||||||
listenForConnections();
|
listenForConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void listenForConnections() {
|
public void listenForConnections() {
|
||||||
|
|
||||||
ConnectionCallback connectionCallback = new ConnectionCallback() {
|
ConnectionCallback connectionCallback = new ConnectionCallback() {
|
||||||
public void connected(OvsdbClient ovsdbClient) {
|
@Override
|
||||||
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
public void connected(OvsdbClient ovsdbClient) {
|
||||||
int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
||||||
String subjectDn = null;
|
int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
||||||
try {
|
String subjectDn = null;
|
||||||
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
|
try {
|
||||||
.getSubjectDN().getName();
|
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
|
||||||
|
.getSubjectDN().getName();
|
||||||
String clientCn = SslUtil.extractCN(subjectDn);
|
|
||||||
LOG.info("ovsdbClient connecting from {} on port {} clientCn {}", remoteHost, localPort, clientCn);
|
String clientCn = SslUtil.extractCN(subjectDn);
|
||||||
|
LOG.info("ovsdbClient connecting from {} on port {} clientCn {}", remoteHost, localPort, clientCn);
|
||||||
ConnectNodeInfo connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient);
|
|
||||||
|
ConnectNodeInfo connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient);
|
||||||
// successfully connected - register it in our
|
|
||||||
// connectedClients table
|
// successfully connected - register it in our
|
||||||
// In Plume's environment clientCn is not unique that's why
|
// connectedClients table
|
||||||
// we are augmenting it
|
// In Plume's environment clientCn is not unique that's why
|
||||||
// with the serialNumber and using it as a key (equivalent
|
// we are augmenting it
|
||||||
// of KDC unique qrCode)
|
// with the serialNumber and using it as a key (equivalent
|
||||||
String key = clientCn + "_" + connectNodeInfo.serialNumber;
|
// of KDC unique qrCode)
|
||||||
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient);
|
String key = clientCn + "_" + connectNodeInfo.serialNumber;
|
||||||
extIntegrationInterface.apConnected(key, connectNodeInfo);
|
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient);
|
||||||
monitorOvsdbStateTables(ovsdbClient, key);
|
extIntegrationInterface.apConnected(key, connectNodeInfo);
|
||||||
|
|
||||||
// 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 connectedClients = {}",
|
LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key);
|
||||||
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
|
LOG.info("ovsdbClient connectedClients = {}",
|
||||||
|
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
LOG.error("ovsdbClient error", e);
|
catch (Exception e) {
|
||||||
// something is wrong with the SSL
|
LOG.error("ovsdbClient error", e);
|
||||||
ovsdbClient.shutdown();
|
// something is wrong with the SSL
|
||||||
return;
|
ovsdbClient.shutdown();
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
public void disconnected(OvsdbClient ovsdbClient) {
|
|
||||||
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
@Override
|
||||||
int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
public void disconnected(OvsdbClient ovsdbClient) {
|
||||||
String subjectDn = null;
|
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
||||||
try {
|
int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
||||||
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
|
String subjectDn = null;
|
||||||
.getSubjectDN().getName();
|
try {
|
||||||
} catch (Exception e) {
|
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
|
||||||
// do nothing
|
.getSubjectDN().getName();
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
String clientCn = SslUtil.extractCN(subjectDn);
|
// do nothing
|
||||||
|
}
|
||||||
// disconnected - deregister ovsdbClient from our
|
|
||||||
// connectedClients table
|
String clientCn = SslUtil.extractCN(subjectDn);
|
||||||
// unfortunately we only know clientCn at this point, but in
|
|
||||||
// Plume's environment
|
// disconnected - deregister ovsdbClient from our
|
||||||
// they are not unique
|
// connectedClients table
|
||||||
// so we are doing a reverse lookup here, and then if we find
|
// unfortunately we only know clientCn at this point, but in
|
||||||
// the key we will
|
// Plume's environment
|
||||||
// remove the entry from the connectedClients.
|
// they are not unique
|
||||||
String key = ConnectusOvsdbClient.this.ovsdbSessionMapInterface.lookupClientId(ovsdbClient);
|
// so we are doing a reverse lookup here, and then if we find
|
||||||
|
// the key we will
|
||||||
if (key != null) {
|
// remove the entry from the connectedClients.
|
||||||
|
String key = ConnectusOvsdbClient.this.ovsdbSessionMapInterface.lookupClientId(ovsdbClient);
|
||||||
// turn off monitor
|
|
||||||
try {
|
if (key != null) {
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiRadioStateDbTable + "_" + key);
|
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_" + key);
|
// turn off monitor
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiInetStateDbTable + "_" + key);
|
try {
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key);
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiRadioStateDbTable + "_" + key);
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key);
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_" + key);
|
||||||
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiInetStateDbTable + "_" + key);
|
||||||
} catch (OvsdbClientException e) {
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key);
|
||||||
LOG.warn("Could not cancel Monitor {}", e.getMessage());
|
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key);
|
||||||
}
|
|
||||||
|
}
|
||||||
extIntegrationInterface.apDisconnected(key);
|
catch (OvsdbClientException e) {
|
||||||
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key);
|
LOG.warn("Could not cancel Monitor {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
ovsdbClient.shutdown();
|
extIntegrationInterface.apDisconnected(key);
|
||||||
|
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key);
|
||||||
LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort,
|
}
|
||||||
clientCn, key);
|
|
||||||
LOG.info("ovsdbClient connectedClients = {}",
|
ovsdbClient.shutdown();
|
||||||
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
|
|
||||||
}
|
LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort,
|
||||||
|
clientCn, key);
|
||||||
};
|
LOG.info("ovsdbClient connectedClients = {}",
|
||||||
|
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
|
||||||
listener.startListeningWithSsl(ovsdbListenPort, sslContext, connectionCallback).join();
|
}
|
||||||
|
|
||||||
LOG.debug("manager waiting for connection on port {}...", ovsdbListenPort);
|
};
|
||||||
}
|
|
||||||
|
listener.startListeningWithSsl(ovsdbListenPort, sslContext, connectionCallback).join();
|
||||||
private ConnectNodeInfo processConnectRequest(OvsdbClient ovsdbClient, String clientCn,
|
|
||||||
ConnectNodeInfo connectNodeInfo) {
|
LOG.debug("manager waiting for connection on port {}...", ovsdbListenPort);
|
||||||
|
}
|
||||||
LOG.debug("Starting Client connect");
|
|
||||||
connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo);
|
private ConnectNodeInfo processConnectRequest(OvsdbClient ovsdbClient, String clientCn,
|
||||||
|
ConnectNodeInfo connectNodeInfo) {
|
||||||
String apId = clientCn + "_" + connectNodeInfo.serialNumber;
|
|
||||||
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
LOG.debug("Starting Client connect");
|
||||||
|
connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo);
|
||||||
ovsdbDao.configureStats(ovsdbClient);
|
|
||||||
|
String apId = clientCn + "_" + connectNodeInfo.serialNumber;
|
||||||
// Check if device stats is configured in Wifi_Stats_Config table,
|
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
||||||
// provision it
|
|
||||||
// if needed
|
ovsdbDao.configureStats(ovsdbClient);
|
||||||
if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) {
|
|
||||||
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
// Check if device stats is configured in Wifi_Stats_Config table,
|
||||||
}
|
// provision it
|
||||||
|
// if needed
|
||||||
try {
|
if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) {
|
||||||
ovsdbDao.provisionBridgePortInterface(ovsdbClient);
|
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
||||||
} catch (Exception e) {
|
}
|
||||||
// TODO: for some AP configurations this 'may' not be necessary.
|
|
||||||
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
|
try {
|
||||||
}
|
ovsdbDao.provisionBridgePortInterface(ovsdbClient);
|
||||||
|
}
|
||||||
ovsdbDao.removeAllSsids(ovsdbClient);
|
catch (Exception e) {
|
||||||
|
// TODO: for some AP configurations this 'may' not be necessary.
|
||||||
if (opensyncAPConfig != null) {
|
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
|
||||||
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
}
|
||||||
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
|
||||||
}
|
ovsdbDao.removeAllSsids(ovsdbClient);
|
||||||
|
|
||||||
// ovsdbDao.configureWifiInet(ovsdbClient);
|
if (opensyncAPConfig != null) {
|
||||||
|
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
||||||
LOG.debug("Client connect Done");
|
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
||||||
return connectNodeInfo;
|
}
|
||||||
}
|
|
||||||
|
// ovsdbDao.configureWifiInet(ovsdbClient);
|
||||||
public Set<String> getConnectedClientIds() {
|
|
||||||
return ovsdbSessionMapInterface.getConnectedClientIds();
|
LOG.debug("Client connect Done");
|
||||||
}
|
return connectNodeInfo;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @param apId
|
@Override
|
||||||
* @param newRedirectorAddress
|
public Set<String> getConnectedClientIds() {
|
||||||
* @return updated value of the redirector
|
return ovsdbSessionMapInterface.getConnectedClientIds();
|
||||||
*/
|
}
|
||||||
public String changeRedirectorAddress(String apId, String newRedirectorAddress) {
|
|
||||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
/**
|
||||||
if (ovsdbSession == null) {
|
* @param apId
|
||||||
throw new IllegalStateException("AP with id " + apId + " is not connected");
|
* @param newRedirectorAddress
|
||||||
}
|
* @return updated value of the redirector
|
||||||
|
*/
|
||||||
String ret = ovsdbDao.changeRedirectorAddress(ovsdbSession.getOvsdbClient(), apId, newRedirectorAddress);
|
@Override
|
||||||
|
public String changeRedirectorAddress(String apId, String newRedirectorAddress) {
|
||||||
return ret;
|
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||||
}
|
if (ovsdbSession == null) {
|
||||||
|
throw new IllegalStateException("AP with id " + apId + " is not connected");
|
||||||
@Override
|
}
|
||||||
public void processConfigChanged(String apId) {
|
|
||||||
LOG.debug("Starting processConfigChanged for {}", apId);
|
String ret = ovsdbDao.changeRedirectorAddress(ovsdbSession.getOvsdbClient(), apId, newRedirectorAddress);
|
||||||
|
|
||||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
return ret;
|
||||||
if (ovsdbSession == null) {
|
}
|
||||||
throw new IllegalStateException("AP with id " + apId + " is not connected");
|
|
||||||
}
|
@Override
|
||||||
|
public void processConfigChanged(String apId) {
|
||||||
OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient();
|
LOG.debug("Starting processConfigChanged for {}", apId);
|
||||||
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
|
||||||
|
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||||
if (opensyncAPConfig != null) {
|
if (ovsdbSession == null) {
|
||||||
ovsdbDao.removeAllSsids(ovsdbClient);
|
throw new IllegalStateException("AP with id " + apId + " is not connected");
|
||||||
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
}
|
||||||
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
|
||||||
}
|
OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient();
|
||||||
|
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
||||||
LOG.debug("Finished processConfigChanged for {}", apId);
|
|
||||||
}
|
if (opensyncAPConfig != null) {
|
||||||
|
ovsdbDao.removeAllSsids(ovsdbClient);
|
||||||
private void monitorOvsdbStateTables(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
||||||
CompletableFuture<TableUpdates> rsCf = ovsdbClient
|
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
||||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiRadioStateDbTable + "_" + key,
|
}
|
||||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable,
|
|
||||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
LOG.debug("Finished processConfigChanged for {}", apId);
|
||||||
new MonitorCallback() {
|
}
|
||||||
|
|
||||||
@Override
|
private void monitorOvsdbStateTables(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
||||||
public void update(TableUpdates tableUpdates) {
|
CompletableFuture<TableUpdates> rsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||||
extIntegrationInterface.wifiRadioStatusDbTableUpdate(
|
OvsdbDao.wifiRadioStateDbTable + "_" + key,
|
||||||
ovsdbDao.getOpensyncAPRadioState(tableUpdates, key, ovsdbClient), key);
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable,
|
||||||
}
|
new MonitorRequest(new MonitorSelect(true, false, false, true)))),
|
||||||
|
new MonitorCallback() {
|
||||||
});
|
|
||||||
|
@Override
|
||||||
extIntegrationInterface
|
public void update(TableUpdates tableUpdates) {
|
||||||
.wifiRadioStatusDbTableUpdate(ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key);
|
extIntegrationInterface.wifiRadioStatusDbTableUpdate(
|
||||||
|
ovsdbDao.getOpensyncAPRadioState(tableUpdates, key, ovsdbClient), 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() {
|
extIntegrationInterface
|
||||||
|
.wifiRadioStatusDbTableUpdate(ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key);
|
||||||
@Override
|
|
||||||
public void update(TableUpdates tableUpdates) {
|
CompletableFuture<TableUpdates> isCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||||
|
OvsdbDao.wifiInetStateDbTable + "_" + key,
|
||||||
extIntegrationInterface.wifiInetStateDbTableUpdate(
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable,
|
||||||
ovsdbDao.getOpensyncAPInetState(tableUpdates, key, ovsdbClient), key);
|
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||||
|
new MonitorCallback() {
|
||||||
}
|
|
||||||
|
@Override
|
||||||
});
|
public void update(TableUpdates tableUpdates) {
|
||||||
|
|
||||||
extIntegrationInterface
|
extIntegrationInterface.wifiInetStateDbTableUpdate(
|
||||||
.wifiInetStateDbTableUpdate(ovsdbDao.getOpensyncAPInetState(isCf.join(), key, ovsdbClient), key);
|
ovsdbDao.getOpensyncAPInetState(tableUpdates, key, ovsdbClient), key);
|
||||||
|
|
||||||
CompletableFuture<TableUpdates> vsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
}
|
||||||
OvsdbDao.wifiVifStateDbTable + "_" + key,
|
|
||||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable,
|
});
|
||||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
|
||||||
new MonitorCallback() {
|
extIntegrationInterface
|
||||||
@Override
|
.wifiInetStateDbTableUpdate(ovsdbDao.getOpensyncAPInetState(isCf.join(), key, ovsdbClient), key);
|
||||||
public void update(TableUpdates tableUpdates) {
|
|
||||||
// extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
CompletableFuture<TableUpdates> vsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||||
// ovsdbDao.getOpensyncAPVIFState(tableUpdates,
|
OvsdbDao.wifiVifStateDbTable + "_" + key,
|
||||||
// key, ovsdbClient), key);
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable,
|
||||||
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<OpensyncAPVIFState>();
|
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||||
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) {
|
new MonitorCallback() {
|
||||||
|
@Override
|
||||||
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) {
|
public void update(TableUpdates tableUpdates) {
|
||||||
if (rowUpdate.getValue().getOld() != null && rowUpdate.getValue().getNew() == null) {
|
// extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||||
Row row = rowUpdate.getValue().getOld();
|
// ovsdbDao.getOpensyncAPVIFState(tableUpdates,
|
||||||
String ifName = null;
|
// key, ovsdbClient), key);
|
||||||
String ssid = null;
|
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<>();
|
||||||
if (row.getColumns().get("ssid") != null && row.getColumns().get("ssid").getClass()
|
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
ssid = row.getStringColumn("ssid");
|
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) {
|
||||||
}
|
if (rowUpdate.getValue().getOld() != null && rowUpdate.getValue().getNew() == null) {
|
||||||
if (row.getColumns().get("if_name") != null
|
Row row = rowUpdate.getValue().getOld();
|
||||||
&& row.getColumns().get("if_name").getClass()
|
String ifName = null;
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
String ssid = null;
|
||||||
ifName = row.getStringColumn("if_name");
|
if (row.getColumns().get("ssid") != null && row.getColumns().get("ssid").getClass()
|
||||||
}
|
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
if (ifName != null && ssid != null) {
|
ssid = row.getStringColumn("ssid");
|
||||||
OpensyncAPVIFState toBeDeleted = new OpensyncAPVIFState();
|
}
|
||||||
toBeDeleted.setSsid(ssid);
|
if (row.getColumns().get("if_name") != null
|
||||||
toBeDeleted.setIfName(ifName);
|
&& row.getColumns().get("if_name").getClass()
|
||||||
vifsToDelete.add(toBeDeleted);
|
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
}
|
ifName = row.getStringColumn("if_name");
|
||||||
tableUpdate.getValue().getRowUpdates().remove(rowUpdate.getKey());
|
}
|
||||||
}
|
if (ifName != null && ssid != null) {
|
||||||
|
OpensyncAPVIFState toBeDeleted = new OpensyncAPVIFState();
|
||||||
}
|
toBeDeleted.setSsid(ssid);
|
||||||
|
toBeDeleted.setIfName(ifName);
|
||||||
if (tableUpdate.getValue().getRowUpdates().values().isEmpty()) {
|
vifsToDelete.add(toBeDeleted);
|
||||||
tableUpdates.getTableUpdates().remove(tableUpdate.getKey());
|
}
|
||||||
}
|
tableUpdate.getValue().getRowUpdates().remove(rowUpdate.getKey());
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
if (!vifsToDelete.isEmpty()) {
|
|
||||||
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
|
if (tableUpdate.getValue().getRowUpdates().values().isEmpty()) {
|
||||||
}
|
tableUpdates.getTableUpdates().remove(tableUpdate.getKey());
|
||||||
if (tableUpdates.getTableUpdates().entrySet().isEmpty())
|
}
|
||||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
|
||||||
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
|
}
|
||||||
|
|
||||||
}
|
if (!vifsToDelete.isEmpty()) {
|
||||||
|
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
|
||||||
});
|
}
|
||||||
|
if (tableUpdates.getTableUpdates().entrySet().isEmpty()) {
|
||||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(ovsdbDao.getOpensyncAPVIFState(vsCf.join(), key, ovsdbClient),
|
extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||||
key);
|
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
|
||||||
|
}
|
||||||
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 MonitorCallback() {
|
|
||||||
|
extIntegrationInterface.wifiVIFStateDbTableUpdate(ovsdbDao.getOpensyncAPVIFState(vsCf.join(), key, ovsdbClient),
|
||||||
@Override
|
key);
|
||||||
public void update(TableUpdates tableUpdates) {
|
|
||||||
|
CompletableFuture<TableUpdates> acCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||||
boolean insertOrModify = false;
|
OvsdbDao.wifiAssociatedClientsDbTable + "_" + key,
|
||||||
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiAssociatedClientsDbTable,
|
||||||
|
new MonitorRequest(new MonitorSelect(false, true, true, true)))),
|
||||||
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
|
new MonitorCallback() {
|
||||||
if (rowUpdate.getOld() != null && rowUpdate.getNew() == null) {
|
|
||||||
insertOrModify = false;
|
@Override
|
||||||
Row row = rowUpdate.getOld();
|
public void update(TableUpdates tableUpdates) {
|
||||||
String deletedClientMac = row.getStringColumn("mac");
|
|
||||||
extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac, key);
|
boolean insertOrModify = false;
|
||||||
}
|
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
|
||||||
}
|
|
||||||
|
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
|
||||||
}
|
if (rowUpdate.getOld() != null && rowUpdate.getNew() == null) {
|
||||||
|
insertOrModify = false;
|
||||||
if (insertOrModify) {
|
Row row = rowUpdate.getOld();
|
||||||
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
String deletedClientMac = row.getStringColumn("mac");
|
||||||
ovsdbDao.getOpensyncWifiAssociatedClients(tableUpdates, key, ovsdbClient), key);
|
extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}
|
||||||
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
|
||||||
ovsdbDao.getOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key);
|
if (insertOrModify) {
|
||||||
|
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
||||||
CompletableFuture<TableUpdates> awCf = ovsdbClient
|
ovsdbDao.getOpensyncWifiAssociatedClients(tableUpdates, key, ovsdbClient), key);
|
||||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key,
|
}
|
||||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.awlanNodeDbTable,
|
}
|
||||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
|
||||||
new MonitorCallback() {
|
});
|
||||||
|
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
||||||
@Override
|
ovsdbDao.getOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key);
|
||||||
public void update(TableUpdates tableUpdates) {
|
|
||||||
extIntegrationInterface.awlanNodeDbTableUpdate(
|
CompletableFuture<TableUpdates> awCf = ovsdbClient.monitor(
|
||||||
ovsdbDao.getOpensyncAWLANNode(tableUpdates, key, ovsdbClient), key);
|
OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key, new MonitorRequests(ImmutableMap
|
||||||
}
|
.of(OvsdbDao.awlanNodeDbTable, new MonitorRequest(new MonitorSelect(true, false, false, true)))),
|
||||||
|
new MonitorCallback() {
|
||||||
});
|
|
||||||
extIntegrationInterface.awlanNodeDbTableUpdate(ovsdbDao.getOpensyncAWLANNode(awCf.join(), key, ovsdbClient),
|
@Override
|
||||||
key);
|
public void update(TableUpdates tableUpdates) {
|
||||||
|
extIntegrationInterface.awlanNodeDbTableUpdate(
|
||||||
}
|
ovsdbDao.getOpensyncAWLANNode(tableUpdates, key, ovsdbClient), key);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public String closeSession(String apId) {
|
});
|
||||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
extIntegrationInterface.awlanNodeDbTableUpdate(ovsdbDao.getOpensyncAWLANNode(awCf.join(), key, ovsdbClient),
|
||||||
try {
|
key);
|
||||||
session.getOvsdbClient().shutdown();
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
LOG.error("Failed to close session to " + apId + " " + e.getLocalizedMessage());
|
|
||||||
return "Failed to close session to " + apId + " " + e.getLocalizedMessage();
|
@Override
|
||||||
|
public String closeSession(String apId) {
|
||||||
}
|
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||||
LOG.debug("Closed session to " + apId);
|
try {
|
||||||
return "Closed session to " + apId;
|
session.getOvsdbClient().shutdown();
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
LOG.error("Failed to close session to " + apId + " " + e.getLocalizedMessage());
|
||||||
|
return "Failed to close session to " + apId + " " + e.getLocalizedMessage();
|
||||||
|
|
||||||
|
}
|
||||||
|
LOG.debug("Closed session to " + apId);
|
||||||
|
return "Closed session to " + apId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user