From f3b0c0375e5a07185252c8bc6e85315b2cc13d5b Mon Sep 17 00:00:00 2001 From: Mike Hansen Date: Thu, 19 Mar 2020 10:03:51 -0400 Subject: [PATCH] TW-208: Config and Metric params --- .../ovsdb/ConnectusMonitorCallback.java | 80 ++++ .../opensync/ovsdb/ConnectusOvsdbClient.java | 345 +++++++++--------- .../wlan/opensync/ovsdb/dao/OvsdbDao.java | 46 +-- 3 files changed, 267 insertions(+), 204 deletions(-) create mode 100644 opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusMonitorCallback.java diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusMonitorCallback.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusMonitorCallback.java new file mode 100644 index 0000000..1df0f92 --- /dev/null +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusMonitorCallback.java @@ -0,0 +1,80 @@ +package com.telecominfraproject.wlan.opensync.ovsdb; + +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.telecominfraproject.wlan.opensync.ovsdb.dao.OvsdbDao; +import com.vmware.ovsdb.callback.MonitorCallback; +import com.vmware.ovsdb.protocol.methods.RowUpdate; +import com.vmware.ovsdb.protocol.methods.TableUpdates; +import com.vmware.ovsdb.protocol.operation.notation.Row; +import com.vmware.ovsdb.service.OvsdbClient; + +public class ConnectusMonitorCallback implements MonitorCallback { + + private OvsdbClient ovsdbClient; + private String connectedClientId; + + private static final Logger LOG = LoggerFactory.getLogger(ConnectusMonitorCallback.class); + + public ConnectusMonitorCallback(OvsdbClient ovsdbClient, String clientId) { + this.ovsdbClient = ovsdbClient; + this.connectedClientId = clientId; + } + + @Override + public void update(TableUpdates tableUpdates) { + for (String key : tableUpdates.getTableUpdates().keySet()) { + + LOG.debug("Received update to table {} on AP {}", key, + connectedClientId); + + if (key.equalsIgnoreCase(OvsdbDao.wifiInetStateDbTable)) { + Map rowUpdates = tableUpdates.getTableUpdates().get(OvsdbDao.wifiInetStateDbTable) + .getRowUpdates(); + + for (UUID rowId : rowUpdates.keySet()) { + + logRow(rowUpdates, rowId); + + } + + } else if (key.equalsIgnoreCase(OvsdbDao.wifiRadioStateDbTable)) { + Map rowUpdates = tableUpdates.getTableUpdates().get(OvsdbDao.wifiRadioStateDbTable) + .getRowUpdates(); + + for (UUID rowId : rowUpdates.keySet()) { + + logRow(rowUpdates, rowId); + + } + + } else if (key.equals(OvsdbDao.wifiVifStateDbTable)) { + Map rowUpdates = tableUpdates.getTableUpdates().get(OvsdbDao.wifiVifStateDbTable) + .getRowUpdates(); + + for (UUID rowId : rowUpdates.keySet()) { + + logRow(rowUpdates, rowId); + + } + + } + } + } + + private void logRow(Map rowUpdates, UUID rowId) { + RowUpdate rowUpdate = rowUpdates.get(rowId); + Row oldRow = rowUpdate.getOld(); + oldRow.getColumns().entrySet().stream() + .forEach(e -> LOG.trace("Key {} Value {}", e.getKey(), e.getValue().toString())); + Row newRow = rowUpdate.getNew(); + newRow.getColumns().entrySet().stream() + .forEach(e -> LOG.trace("Key {} Value {}", e.getKey(), e.getValue().toString())); + } + +} \ No newline at end of file diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusOvsdbClient.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusOvsdbClient.java index 113826f..308f77f 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusOvsdbClient.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/ConnectusOvsdbClient.java @@ -20,8 +20,6 @@ import com.telecominfraproject.wlan.opensync.external.integration.models.Opensyn import com.telecominfraproject.wlan.opensync.ovsdb.dao.OvsdbDao; import com.telecominfraproject.wlan.opensync.util.SslUtil; import com.vmware.ovsdb.callback.ConnectionCallback; -import com.vmware.ovsdb.callback.MonitorCallback; -import com.vmware.ovsdb.protocol.methods.TableUpdates; import com.vmware.ovsdb.service.OvsdbClient; import com.vmware.ovsdb.service.OvsdbPassiveConnectionListener; @@ -31,201 +29,192 @@ import io.netty.handler.ssl.SslContext; @Component 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}") + private int ovsdbListenPort; - @org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.listenPort:6640}") - private int ovsdbListenPort; + @org.springframework.beans.factory.annotation.Value("${connectus.manager.collectionIntervalSec.deviceStats:10}") + private long collectionIntervalSecDeviceStats; - @org.springframework.beans.factory.annotation.Value("${connectus.manager.collectionIntervalSec.deviceStats:10}") - private long collectionIntervalSecDeviceStats; + @Autowired + private SslContext sslContext; - @Autowired - private SslContext sslContext; + @Autowired + private OvsdbPassiveConnectionListener listener; - @Autowired - private OvsdbPassiveConnectionListener listener; + @Autowired + private OvsdbDao ovsdbDao; - @Autowired - private OvsdbDao ovsdbDao; - - @Autowired - private OpensyncExternalIntegrationInterface extIntegrationInterface; - - @Autowired - private OvsdbSessionMapInterface ovsdbSessionMapInterface; - - @PostConstruct - private void postCreate() { - listenForConnections(); - } - - public class ConnectusMonitorCallback implements MonitorCallback { - - String clientCNKey; - - public ConnectusMonitorCallback(String key) { - - clientCNKey = key; - - } + @Autowired + private OpensyncExternalIntegrationInterface extIntegrationInterface; - @Override - public void update(TableUpdates tableUpdates) { - LOG.info("Monitor for client key {} received table updates {}", clientCNKey, tableUpdates); - + @Autowired + private OvsdbSessionMapInterface ovsdbSessionMapInterface; + + @PostConstruct + private void postCreate() { + listenForConnections(); + } + + public void listenForConnections() { + + ConnectionCallback connectionCallback = new ConnectionCallback() { + public void connected(OvsdbClient ovsdbClient) { + String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress(); + int localPort = ovsdbClient.getConnectionInfo().getLocalPort(); + String subjectDn = null; + try { + subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate()) + .getSubjectDN().getName(); + + String clientCn = SslUtil.extractCN(subjectDn); + LOG.info("ovsdbClient connecting from {} on port {} clientCn {}", remoteHost, localPort, clientCn); + + ConnectNodeInfo connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient); + + // successfully connected - register it in our connectedClients table + // In Plume's environment clientCn is not unique that's why we are augmenting it + // with the serialNumber and using it as a key (equivalent of KDC unique qrCode) + String key = clientCn + "_" + connectNodeInfo.serialNumber; + ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient); + extIntegrationInterface.apConnected(key, connectNodeInfo); + + // push configuration to AP + connectNodeInfo = processConnectRequest(ovsdbClient, clientCn, connectNodeInfo); + LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key); + LOG.info("ovsdbClient connectedClients = {}", + ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions()); + + // monitor radio config state + ovsdbDao.monitorRadioConfigState(ovsdbClient, new ConnectusMonitorCallback(ovsdbClient, key)); + // monitor inet state + ovsdbDao.monitorInetState(ovsdbClient, new ConnectusMonitorCallback(ovsdbClient, key)); + // monitor vif state + ovsdbDao.monitorVIFState(ovsdbClient, new ConnectusMonitorCallback(ovsdbClient, key)); + // monitor Route state + ovsdbDao.monitorRouteState(ovsdbClient, new ConnectusMonitorCallback(ovsdbClient, key)); + // monitor Master State + ovsdbDao.monitorMasterState(ovsdbClient, new ConnectusMonitorCallback(ovsdbClient, key)); + } catch (Exception e) { + LOG.error("ovsdbClient error", e); + // something is wrong with the SSL + ovsdbClient.shutdown(); + return; + } + + } + + public void disconnected(OvsdbClient ovsdbClient) { + String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress(); + int localPort = ovsdbClient.getConnectionInfo().getLocalPort(); + String subjectDn = null; + try { + subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate()) + .getSubjectDN().getName(); + } catch (Exception e) { + // do nothing + } + + String clientCn = SslUtil.extractCN(subjectDn); + + // disconnected - deregister ovsdbClient from our connectedClients table + // unfortunately we only know clientCn at this point, but in Plume's environment + // they are not unique + // so we are doing a reverse lookup here, and then if we find the key we will + // remove the entry from the connectedClients. + String key = ConnectusOvsdbClient.this.ovsdbSessionMapInterface.lookupClientId(ovsdbClient); + + if (key != null) { + extIntegrationInterface.apDisconnected(key); + ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key); + } + // turn off monitor + ovsdbDao.cancelMonitors(ovsdbClient); + ovsdbClient.shutdown(); + + 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); + } + + private ConnectNodeInfo processConnectRequest(OvsdbClient ovsdbClient, String clientCn, + ConnectNodeInfo connectNodeInfo) { + + LOG.debug("Starting Client connect"); + connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo); + + String apId = clientCn + "_" + connectNodeInfo.serialNumber; + OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId); + + ovsdbDao.configureStats(ovsdbClient); + + // Check if device stats is configured in Wifi_Stats_Config table, provision it + // if needed + if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) { + ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); } - - } - - - public void listenForConnections() { - ConnectionCallback connectionCallback = new ConnectionCallback() { - public void connected(OvsdbClient ovsdbClient) { - String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress(); - int localPort = ovsdbClient.getConnectionInfo().getLocalPort(); - String subjectDn = null; - try { - subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate()).getSubjectDN().getName(); + ovsdbDao.provisionBridgePortInterface(ovsdbClient); - String clientCn = SslUtil.extractCN(subjectDn); - LOG.info("ovsdbClient connecting from {} on port {} clientCn {}", remoteHost, localPort, clientCn); - - ConnectNodeInfo connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient); - - //successfully connected - register it in our connectedClients table - //In Plume's environment clientCn is not unique that's why we are augmenting it with the serialNumber and using it as a key (equivalent of KDC unique qrCode) - String key = clientCn + "_" + connectNodeInfo.serialNumber; - ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient); - extIntegrationInterface.apConnected(key, connectNodeInfo); - - //push configuration to AP - connectNodeInfo = processConnectRequest(ovsdbClient, clientCn, connectNodeInfo); - LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key); - LOG.info("ovsdbClient connectedClients = {}", ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions()); - - // monitor radio config state - ovsdbDao.monitorRadioConfigState(ovsdbClient, new ConnectusMonitorCallback(key)); - // monitor inet state - ovsdbDao.monitorInetState(ovsdbClient, new ConnectusMonitorCallback(key)); - // monitor vif state - ovsdbDao.monitorVIFState(ovsdbClient, new ConnectusMonitorCallback(key)); - // monitor Route state - ovsdbDao.monitorRouteState(ovsdbClient, new ConnectusMonitorCallback(key)); - // monitor Master State - ovsdbDao.monitorMasterState(ovsdbClient, new ConnectusMonitorCallback(key)); - } catch (Exception e) { - LOG.error("ovsdbClient error", e); - //something is wrong with the SSL - ovsdbClient.shutdown(); - return; - } - - } - public void disconnected(OvsdbClient ovsdbClient) { - String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress(); - int localPort = ovsdbClient.getConnectionInfo().getLocalPort(); - String subjectDn = null; - try { - subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate()).getSubjectDN().getName(); - } catch (Exception e) { - //do nothing - } - - String clientCn = SslUtil.extractCN(subjectDn); - - //disconnected - deregister ovsdbClient from our connectedClients table - //unfortunately we only know clientCn at this point, but in Plume's environment they are not unique - //so we are doing a reverse lookup here, and then if we find the key we will remove the entry from the connectedClients. - String key = ConnectusOvsdbClient.this.ovsdbSessionMapInterface.lookupClientId(ovsdbClient); - - if(key!=null) { - extIntegrationInterface.apDisconnected(key); - ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key); - } - // turn off monitor - ovsdbDao.cancelMonitors(ovsdbClient); - ovsdbClient.shutdown(); - - LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort, clientCn, key); - LOG.info("ovsdbClient connectedClients = {}", ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions()); - } - }; + ovsdbDao.removeAllSsids(ovsdbClient); - listener.startListeningWithSsl(ovsdbListenPort, sslContext, connectionCallback).join(); + if (opensyncAPConfig != null) { + ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig.getRadioConfig()); + ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig.getSsidConfigs()); + } - LOG.debug("manager waiting for connection on port {}...", ovsdbListenPort); - } - - private ConnectNodeInfo processConnectRequest(OvsdbClient ovsdbClient, String clientCn, ConnectNodeInfo connectNodeInfo) { - - LOG.debug("Starting Client connect"); - connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo); + ovsdbDao.configureWifiInet(ovsdbClient); - String apId = clientCn + "_" + connectNodeInfo.serialNumber; - OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId); - - ovsdbDao.configureStats(ovsdbClient); - - //Check if device stats is configured in Wifi_Stats_Config table, provision it if needed - if(ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) { - ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); - } + LOG.debug("Client connect Done"); + return connectNodeInfo; + } - ovsdbDao.provisionBridgePortInterface(ovsdbClient); + public Set getConnectedClientIds() { + return ovsdbSessionMapInterface.getConnectedClientIds(); + } - ovsdbDao.removeAllSsids(ovsdbClient); - - if(opensyncAPConfig!=null) { - ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig.getRadioConfig()); - ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig.getSsidConfigs()); - } - - ovsdbDao.configureWifiInet(ovsdbClient); - - LOG.debug("Client connect Done"); - return connectNodeInfo; - } - - public Set getConnectedClientIds(){ - return ovsdbSessionMapInterface.getConnectedClientIds(); - } + /** + * @param apId + * @param newRedirectorAddress + * @return updated value of the redirector + */ + public String changeRedirectorAddress(String apId, String newRedirectorAddress) { + OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); + if (ovsdbSession == null) { + throw new IllegalStateException("AP with id " + apId + " is not connected"); + } - /** - * @param apId - * @param newRedirectorAddress - * @return updated value of the redirector - */ - public String changeRedirectorAddress(String apId, String newRedirectorAddress) { - OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); - if(ovsdbSession == null) { - throw new IllegalStateException("AP with id " + apId + " is not connected") ; - } - - String ret = ovsdbDao.changeRedirectorAddress(ovsdbSession.getOvsdbClient(), apId, newRedirectorAddress); + String ret = ovsdbDao.changeRedirectorAddress(ovsdbSession.getOvsdbClient(), apId, newRedirectorAddress); - return ret; - } + return ret; + } - @Override - public void processConfigChanged(String apId) { - LOG.debug("Starting processConfigChanged for {}", apId); + @Override + public void processConfigChanged(String apId) { + LOG.debug("Starting processConfigChanged for {}", apId); - OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); - if(ovsdbSession == null) { - throw new IllegalStateException("AP with id " + apId + " is not connected") ; - } + OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); + if (ovsdbSession == null) { + throw new IllegalStateException("AP with id " + apId + " is not connected"); + } - OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient(); - OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId); + OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient(); + OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId); - if(opensyncAPConfig!=null) { - ovsdbDao.removeAllSsids(ovsdbClient); - ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig.getRadioConfig()); - ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig.getSsidConfigs()); - } - - LOG.debug("Finished processConfigChanged for {}", apId); - } + if (opensyncAPConfig != null) { + ovsdbDao.removeAllSsids(ovsdbClient); + ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig.getRadioConfig()); + ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig.getSsidConfigs()); + } + + LOG.debug("Finished processConfigChanged for {}", apId); + } } diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java index 22e6e30..37f35da 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java @@ -15,6 +15,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; +import com.google.common.collect.ImmutableMap; import com.telecominfraproject.wlan.core.model.equipment.RadioType; import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo; import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioConfig; @@ -102,19 +103,16 @@ public class OvsdbDao { columns.add("gateway"); columns.add("gateway_hwaddr"); columns.add("if_name"); - - MonitorRequest monitorRequest = new MonitorRequest(columns, new MonitorSelect(true,true,true,true)); - - Map monitorRequests = new HashMap(); - monitorRequests.put(wifiRouteStateDbTable, monitorRequest); - MonitorRequests requests = new MonitorRequests(monitorRequests) ; + MonitorRequest monitorRequest = new MonitorRequest(); + MonitorRequests monitorRequests = new MonitorRequests( + ImmutableMap.of(wifiRouteStateDbTable, monitorRequest)); try { - ovsdbClient.monitor(ovsdbName, wifiRouteStateDbTableMonitorId, requests, monitorCallback); + ovsdbClient.monitor(ovsdbName, wifiRouteStateDbTableMonitorId, monitorRequests, monitorCallback); } catch (OvsdbClientException e) { LOG.error("Unable to add Monitor to table " + wifiRouteStateDbTable, e); } - + } public void monitorMasterState(OvsdbClient ovsdbClient, MonitorCallback monitorCallback) { @@ -128,15 +126,13 @@ public class OvsdbDao { columns.add("netmask"); columns.add("network_state"); columns.add("port_state"); - - MonitorRequest monitorRequest = new MonitorRequest(columns, new MonitorSelect(true,true,true,true)); - Map monitorRequests = new HashMap(); - monitorRequests.put(wifiMasterStateDbTable, monitorRequest); - MonitorRequests requests = new MonitorRequests(monitorRequests) ; + MonitorRequest monitorRequest = new MonitorRequest(); + MonitorRequests monitorRequests = new MonitorRequests( + ImmutableMap.of(wifiMasterStateDbTable, monitorRequest)); try { - ovsdbClient.monitor(ovsdbName, wifiMasterStateDbTableMonitorId, requests, monitorCallback); + ovsdbClient.monitor(ovsdbName, wifiMasterStateDbTableMonitorId, monitorRequests, monitorCallback); } catch (OvsdbClientException e) { LOG.error("Unable to add Monitor to table " + wifiMasterStateDbTable, e); } @@ -165,14 +161,12 @@ public class OvsdbDao { columns.add("vif_config"); columns.add("vif_radio_idx"); - MonitorRequest monitorRequest = new MonitorRequest(columns, new MonitorSelect(true,true,true,true)); - - Map monitorRequests = new HashMap(); - monitorRequests.put(wifiVifStateDbTable, monitorRequest); - MonitorRequests requests = new MonitorRequests(monitorRequests) ; + MonitorRequest monitorRequest = new MonitorRequest(); + MonitorRequests monitorRequests = new MonitorRequests( + ImmutableMap.of(wifiVifStateDbTable, monitorRequest)); try { - ovsdbClient.monitor(ovsdbName, wifiVifStateDbTableMonitorId, requests, monitorCallback); + ovsdbClient.monitor(ovsdbName, wifiVifStateDbTableMonitorId, monitorRequests, monitorCallback); } catch (OvsdbClientException e) { LOG.error("Unable to add Monitor to table " + wifiVifStateDbTable, e); } @@ -197,14 +191,12 @@ public class OvsdbDao { columns.add("network"); - MonitorRequest monitorRequest = new MonitorRequest(columns, new MonitorSelect(true,true,true,true)); - - Map monitorRequests = new HashMap(); - monitorRequests.put(wifiInetStateDbTable, monitorRequest); - MonitorRequests requests = new MonitorRequests(monitorRequests) ; + MonitorRequest monitorRequest = new MonitorRequest(); + MonitorRequests monitorRequests = new MonitorRequests( + ImmutableMap.of(wifiInetStateDbTable, monitorRequest)); try { - ovsdbClient.monitor(ovsdbName, wifiInetStateDbTableMonitorId, requests, monitorCallback); + ovsdbClient.monitor(ovsdbName, wifiInetStateDbTableMonitorId, monitorRequests, monitorCallback); } catch (OvsdbClientException e) { LOG.error("Unable to add Monitor to table " + wifiInetStateDbTable, e); } @@ -220,6 +212,8 @@ public class OvsdbDao { ovsdbClient.cancelMonitor(wifiVifStateDbTableMonitorId); ovsdbClient.cancelMonitor(wifiInetStateDbTableMonitorId); ovsdbClient.cancelMonitor(wifiRouteStateDbTableMonitorId); + ovsdbClient.cancelMonitor(wifiMasterStateDbTableMonitorId); + } catch (Exception e) { LOG.error("Caught Exception {}", e); }