mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-12-01 17:53:52 +00:00
TW-208: ChannelInfoReport from Survey, RSSI metrics enable
This commit is contained in:
@@ -66,11 +66,13 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
|
||||
public void listenForConnections() {
|
||||
|
||||
// This class is only used here, therefore changed it back to an inner class,
|
||||
// This class is only used here, therefore changed it back to an inner
|
||||
// class,
|
||||
// removed the package level class.
|
||||
// All calling classes related to OVSDB are calling the MonitorCallback
|
||||
// interface, so the implementation can remain
|
||||
// hidden. This also gives handy access to the Autowired instances in the
|
||||
// hidden. This also gives handy access to the Autowired instances in
|
||||
// the
|
||||
// container class.
|
||||
|
||||
class ConnectusMonitorCallback implements MonitorCallback {
|
||||
@@ -86,29 +88,30 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
Set<String> tableNames = tableUpdates.getTableUpdates().keySet();
|
||||
|
||||
for (String name : tableNames) {
|
||||
LOG.debug("Receive update for table {}", name);
|
||||
LOG.trace("Receive update for table {}", name);
|
||||
|
||||
Map<UUID, RowUpdate> updates = tableUpdates.getTableUpdates().get(name).getRowUpdates();
|
||||
|
||||
for (UUID id : updates.keySet()) {
|
||||
|
||||
LOG.debug("Receive row update for uuid {}", id);
|
||||
LOG.trace("Receive row update for uuid {}", id);
|
||||
|
||||
RowUpdate rowUpdate = updates.get(id);
|
||||
|
||||
Row newRow = rowUpdate.getNew();
|
||||
if (newRow != null) {
|
||||
Set<String> newRowColumns = newRow.getColumns().keySet();
|
||||
|
||||
Row oldRow = rowUpdate.getOld();
|
||||
|
||||
for (String column : newRowColumns) {
|
||||
|
||||
Value oldVal = null;
|
||||
if (oldRow != null && oldRow.getColumns().containsKey(column)) oldVal = oldRow.getColumns().get(column);
|
||||
if (oldRow != null && oldRow.getColumns().containsKey(column))
|
||||
oldVal = oldRow.getColumns().get(column);
|
||||
|
||||
Value newVal = newRow.getColumns().get(column);
|
||||
|
||||
LOG.debug("For column {} previous value {} is now {}", column, oldVal, newVal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -116,18 +119,22 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
}
|
||||
|
||||
// get session information for this client
|
||||
// OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(connectedClientId);
|
||||
// OvsdbSession ovsdbSession =
|
||||
// ovsdbSessionMapInterface.getSession(connectedClientId);
|
||||
// if (ovsdbSession == null) {
|
||||
// throw new IllegalStateException("AP with id " + connectedClientId + " is not connected");
|
||||
// throw new IllegalStateException("AP with id " +
|
||||
// connectedClientId + " is not connected");
|
||||
// }
|
||||
//
|
||||
// OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient();
|
||||
// OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(connectedClientId);
|
||||
|
||||
// OpensyncAPConfig opensyncAPConfig =
|
||||
// extIntegrationInterface.getApConfig(connectedClientId);
|
||||
|
||||
// TODO:
|
||||
// example wifiVifStateDbTable get MAC ADDRESS via ovsdbClient from
|
||||
// Wifi_Associated_Clients given the associated UUID for the client
|
||||
// example wifiVifStateDbTable get MAC ADDRESS via ovsdbClient
|
||||
// from
|
||||
// Wifi_Associated_Clients given the associated UUID for the
|
||||
// client
|
||||
|
||||
// TODO:
|
||||
// Changes from other Status (Wifi, Inet, etc.) tables?
|
||||
@@ -152,9 +159,12 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
|
||||
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)
|
||||
// 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);
|
||||
@@ -197,10 +207,13 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
|
||||
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
|
||||
// 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
|
||||
// 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);
|
||||
|
||||
@@ -235,7 +248,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
|
||||
ovsdbDao.configureStats(ovsdbClient);
|
||||
|
||||
// Check if device stats is configured in Wifi_Stats_Config table, provision it
|
||||
// Check if device stats is configured in Wifi_Stats_Config table,
|
||||
// provision it
|
||||
// if needed
|
||||
if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) {
|
||||
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
||||
|
||||
@@ -105,8 +105,7 @@ public class OvsdbDao {
|
||||
columns.add("if_name");
|
||||
|
||||
MonitorRequest monitorRequest = new MonitorRequest();
|
||||
MonitorRequests monitorRequests = new MonitorRequests(
|
||||
ImmutableMap.of(wifiRouteStateDbTable, monitorRequest));
|
||||
MonitorRequests monitorRequests = new MonitorRequests(ImmutableMap.of(wifiRouteStateDbTable, monitorRequest));
|
||||
try {
|
||||
ovsdbClient.monitor(ovsdbName, wifiRouteStateDbTableMonitorId, monitorRequests, monitorCallback);
|
||||
} catch (OvsdbClientException e) {
|
||||
@@ -128,8 +127,7 @@ public class OvsdbDao {
|
||||
columns.add("port_state");
|
||||
|
||||
MonitorRequest monitorRequest = new MonitorRequest();
|
||||
MonitorRequests monitorRequests = new MonitorRequests(
|
||||
ImmutableMap.of(wifiMasterStateDbTable, monitorRequest));
|
||||
MonitorRequests monitorRequests = new MonitorRequests(ImmutableMap.of(wifiMasterStateDbTable, monitorRequest));
|
||||
|
||||
try {
|
||||
ovsdbClient.monitor(ovsdbName, wifiMasterStateDbTableMonitorId, monitorRequests, monitorCallback);
|
||||
@@ -137,6 +135,7 @@ public class OvsdbDao {
|
||||
LOG.error("Unable to add Monitor to table " + wifiMasterStateDbTable, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void monitorVIFState(OvsdbClient ovsdbClient, MonitorCallback monitorCallback) {
|
||||
List<String> columns = new ArrayList<>();
|
||||
columns.add("_uuid");
|
||||
@@ -162,8 +161,7 @@ public class OvsdbDao {
|
||||
columns.add("vif_radio_idx");
|
||||
|
||||
MonitorRequest monitorRequest = new MonitorRequest();
|
||||
MonitorRequests monitorRequests = new MonitorRequests(
|
||||
ImmutableMap.of(wifiVifStateDbTable, monitorRequest));
|
||||
MonitorRequests monitorRequests = new MonitorRequests(ImmutableMap.of(wifiVifStateDbTable, monitorRequest));
|
||||
|
||||
try {
|
||||
ovsdbClient.monitor(ovsdbName, wifiVifStateDbTableMonitorId, monitorRequests, monitorCallback);
|
||||
@@ -190,10 +188,8 @@ public class OvsdbDao {
|
||||
columns.add("netmask");
|
||||
columns.add("network");
|
||||
|
||||
|
||||
MonitorRequest monitorRequest = new MonitorRequest();
|
||||
MonitorRequests monitorRequests = new MonitorRequests(
|
||||
ImmutableMap.of(wifiInetStateDbTable, monitorRequest));
|
||||
MonitorRequests monitorRequests = new MonitorRequests(ImmutableMap.of(wifiInetStateDbTable, monitorRequest));
|
||||
|
||||
try {
|
||||
ovsdbClient.monitor(ovsdbName, wifiInetStateDbTableMonitorId, monitorRequests, monitorCallback);
|
||||
@@ -204,7 +200,8 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
//
|
||||
//Note: When talking to OVSDB always use future.get(X, TimeUnit.SECONDS); - to prevent DOS attacks with misbehaving clients
|
||||
// Note: When talking to OVSDB always use future.get(X, TimeUnit.SECONDS); -
|
||||
// to prevent DOS attacks with misbehaving clients
|
||||
//
|
||||
public void cancelMonitors(OvsdbClient ovsdbClient) {
|
||||
try {
|
||||
@@ -217,6 +214,7 @@ public class OvsdbDao {
|
||||
LOG.debug("Could not cancel Monitor. {}", e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void monitorRadioConfigState(OvsdbClient ovsdbClient, MonitorCallback monitorCallback) {
|
||||
|
||||
List<String> columns = new ArrayList<>();
|
||||
@@ -247,8 +245,6 @@ public class OvsdbDao {
|
||||
monitorRequests.put(wifiRadioStateDbTable, monitorRequest);
|
||||
MonitorRequests requests = new MonitorRequests(monitorRequests);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
ovsdbClient.monitor(ovsdbName, wifiRadioStateDbTableMonitorId, requests, monitorCallback);
|
||||
} catch (OvsdbClientException e) {
|
||||
@@ -273,7 +269,6 @@ public class OvsdbDao {
|
||||
columns.add("firmware_version");
|
||||
columns.add("platform_version");
|
||||
|
||||
|
||||
operations.add(new Select(awlanNodeDbTable, conditions, columns));
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
@@ -310,7 +305,6 @@ public class OvsdbDao {
|
||||
fillInIpAddressAndMac(ovsdbClient, ret, "br-lan");
|
||||
}
|
||||
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -334,7 +328,6 @@ public class OvsdbDao {
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Select from {}:", wifiInetStateDbTable);
|
||||
|
||||
@@ -350,14 +343,14 @@ public class OvsdbDao {
|
||||
connectNodeInfo.macAddress = row.getStringColumn("hwaddr");
|
||||
}
|
||||
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ConnectNodeInfo updateConnectNodeInfoOnConnect(OvsdbClient ovsdbClient, String clientCn, ConnectNodeInfo incomingConnectNodeInfo) {
|
||||
public ConnectNodeInfo updateConnectNodeInfoOnConnect(OvsdbClient ovsdbClient, String clientCn,
|
||||
ConnectNodeInfo incomingConnectNodeInfo) {
|
||||
ConnectNodeInfo ret = incomingConnectNodeInfo.clone();
|
||||
|
||||
try {
|
||||
@@ -374,7 +367,8 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
// Configure the MQTT connection
|
||||
//ovsh u AWLAN_Node mqtt_settings:ins:'["map",[["broker","testportal.123wlan.com"],["topics","/ap/dev-ap-0300/opensync"],["qos","0"],["port","1883"],["remote_log","1"]]]'
|
||||
// ovsh u AWLAN_Node
|
||||
// mqtt_settings:ins:'["map",[["broker","testportal.123wlan.com"],["topics","/ap/dev-ap-0300/opensync"],["qos","0"],["port","1883"],["remote_log","1"]]]'
|
||||
Map<String, String> newMqttSettings = new HashMap<>();
|
||||
newMqttSettings.put("broker", mqttBrokerAddress);
|
||||
newMqttSettings.put("topics", "/ap/" + clientCn + "_" + ret.serialNumber + "/opensync");
|
||||
@@ -385,7 +379,8 @@ public class OvsdbDao {
|
||||
|
||||
if (ret.mqttSettings == null || !ret.mqttSettings.equals(newMqttSettings)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String,String> mgttSettings = com.vmware.ovsdb.protocol.operation.notation.Map.of(newMqttSettings);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> mgttSettings = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(newMqttSettings);
|
||||
ret.mqttSettings = newMqttSettings;
|
||||
updateColumns.put("mqtt_settings", mgttSettings);
|
||||
}
|
||||
@@ -413,10 +408,11 @@ public class OvsdbDao {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
@@ -447,7 +443,8 @@ public class OvsdbDao {
|
||||
if (result != null && result.length > 0 && !((SelectResult) result[0]).getRows().isEmpty()) {
|
||||
row = ((SelectResult) result[0]).getRows().iterator().next();
|
||||
ret = row.getIntegerColumn("reporting_interval");
|
||||
LOG.info("Stats collection for stats_type=device is already configured with reporting_interval = {}", ret);
|
||||
LOG.info("Stats collection for stats_type=device is already configured with reporting_interval = {}",
|
||||
ret);
|
||||
}
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
@@ -459,15 +456,20 @@ 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 {
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
|
||||
//turn on stats collection over MQTT: (reporting_interval is in seconds?)
|
||||
//$ ovsh i Wifi_Stats_Config reporting_interval:=10 radio_type:="2.4G" stats_type:="device"
|
||||
// turn on stats collection over MQTT: (reporting_interval is in
|
||||
// seconds?)
|
||||
// $ 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"));
|
||||
@@ -493,7 +495,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void performRedirect(OvsdbClient ovsdbClient, String clientCn) {
|
||||
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
@@ -534,7 +535,8 @@ public class OvsdbDao {
|
||||
serialNumber = getSingleValueFromSet(row, "serial_number");
|
||||
model = getSingleValueFromSet(row, "model");
|
||||
|
||||
LOG.info("Redirecting AP Node: clientCn {} serialNumber {} model {} firmwareVersion {} skuNumber {}", clientCn, serialNumber, model, firmwareVersion, skuNumber);
|
||||
LOG.info("Redirecting AP Node: clientCn {} serialNumber {} model {} firmwareVersion {} skuNumber {}",
|
||||
clientCn, serialNumber, model, firmwareVersion, skuNumber);
|
||||
|
||||
// Update table AWLAN_Node - set manager_addr
|
||||
operations.clear();
|
||||
@@ -768,7 +770,6 @@ public class OvsdbDao {
|
||||
wifiRadioConfigInfo.freqBand = row.getStringColumn("freq_band");
|
||||
wifiRadioConfigInfo.hwConfig = row.getMapColumn("hw_config");
|
||||
|
||||
|
||||
ret.put(wifiRadioConfigInfo.ifName, wifiRadioConfigInfo);
|
||||
}
|
||||
|
||||
@@ -938,7 +939,8 @@ public class OvsdbDao {
|
||||
wifiStatsConfigInfo.threshold = row.getMapColumn("threshold");
|
||||
wifiStatsConfigInfo.uuid = row.getUuidColumn("_uuid");
|
||||
|
||||
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_" + wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo);
|
||||
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_"
|
||||
+ wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo);
|
||||
}
|
||||
|
||||
LOG.debug("Retrieved WifiStatsConfigs: {}", ret);
|
||||
@@ -952,7 +954,9 @@ public class OvsdbDao {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void provisionSingleBridgePortInterface(OvsdbClient ovsdbClient, String interfaceName, String bridgeName, String interfaceType, Map<String, String> interfaceOptions, Map<String, InterfaceInfo> provisionedInterfaces, Map<String, PortInfo> provisionedPorts,
|
||||
public void provisionSingleBridgePortInterface(OvsdbClient ovsdbClient, String interfaceName, String bridgeName,
|
||||
String interfaceType, Map<String, String> interfaceOptions,
|
||||
Map<String, InterfaceInfo> provisionedInterfaces, Map<String, PortInfo> provisionedPorts,
|
||||
Map<String, BridgeInfo> provisionedBridges)
|
||||
throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException {
|
||||
|
||||
@@ -962,7 +966,6 @@ public class OvsdbDao {
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
|
||||
|
||||
updateColumns.put("name", new Atom<>(interfaceName));
|
||||
if (interfaceType != null) {
|
||||
updateColumns.put("type", new Atom<>(interfaceType));
|
||||
@@ -975,11 +978,11 @@ public class OvsdbDao {
|
||||
|
||||
if (interfaceOptions != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String,String> ifOptions = com.vmware.ovsdb.protocol.operation.notation.Map.of(interfaceOptions);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> ifOptions = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(interfaceOptions);
|
||||
updateColumns.put("options", ifOptions);
|
||||
}
|
||||
|
||||
|
||||
Uuid interfaceUuid = null;
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
@@ -1010,13 +1013,15 @@ public class OvsdbDao {
|
||||
// need to create port
|
||||
updateColumns = new HashMap<>();
|
||||
|
||||
//portUuid = new Uuid(new UUID(System.currentTimeMillis(), System.nanoTime())) ;
|
||||
// portUuid = new Uuid(new UUID(System.currentTimeMillis(),
|
||||
// System.nanoTime())) ;
|
||||
updateColumns.put("name", new Atom<String>(interfaceName));
|
||||
// updateColumns.put("_uuid", new Atom<Uuid>(portUuid));
|
||||
|
||||
Set<Uuid> portInterfacesSet = new HashSet<>();
|
||||
portInterfacesSet.add(interfaceUuid);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set portInterfaces = com.vmware.ovsdb.protocol.operation.notation.Set.of(portInterfacesSet);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set portInterfaces = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(portInterfacesSet);
|
||||
updateColumns.put("interfaces", portInterfaces);
|
||||
|
||||
row = new Row(updateColumns);
|
||||
@@ -1051,7 +1056,8 @@ public class OvsdbDao {
|
||||
portInterfacesSet.addAll(existingPort.interfaceUuids);
|
||||
}
|
||||
portInterfacesSet.add(interfaceUuid);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set portInterfaces = com.vmware.ovsdb.protocol.operation.notation.Set.of(portInterfacesSet);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set portInterfaces = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(portInterfacesSet);
|
||||
updateColumns.put("interfaces", portInterfaces);
|
||||
|
||||
row = new Row(updateColumns);
|
||||
@@ -1070,12 +1076,10 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (portUuid == null) {
|
||||
throw new IllegalStateException("Port entry was not created successfully");
|
||||
}
|
||||
|
||||
|
||||
operations = new ArrayList<>();
|
||||
|
||||
// link the port to the bridge
|
||||
@@ -1087,21 +1091,22 @@ public class OvsdbDao {
|
||||
|
||||
conditions.add(new Condition("name", Function.EQUALS, new Atom<>(bridgeName)));
|
||||
|
||||
|
||||
Set<Uuid> bridgePortsSet = new HashSet<>();
|
||||
if (existingBridge.portUuids != null) {
|
||||
bridgePortsSet.addAll(existingBridge.portUuids);
|
||||
}
|
||||
|
||||
bridgePortsSet.add(portUuid);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set bridgePorts = com.vmware.ovsdb.protocol.operation.notation.Set.of(bridgePortsSet);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set bridgePorts = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(bridgePortsSet);
|
||||
updateColumns.put("ports", bridgePorts);
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Update(bridgeDbTable, row));
|
||||
|
||||
} else {
|
||||
LOG.warn("provisionedBridges does not have bridge {} - {} - port will be dangling", bridgeName, provisionedBridges.keySet());
|
||||
LOG.warn("provisionedBridges does not have bridge {} - {} - port will be dangling", bridgeName,
|
||||
provisionedBridges.keySet());
|
||||
}
|
||||
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
@@ -1143,11 +1148,15 @@ public class OvsdbDao {
|
||||
Map<String, String> patchW2hOptions = new HashMap<>();
|
||||
patchH2wOptions.put("peer", "patch-h2w");
|
||||
|
||||
provisionSingleBridgePortInterface(ovsdbClient, patchH2w, brHome, "patch", patchH2wOptions, provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, patchW2h, brWan, "patch", patchW2hOptions, provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, patchH2w, brHome, "patch", patchH2wOptions,
|
||||
provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, patchW2h, brWan, "patch", patchW2hOptions,
|
||||
provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
|
||||
provisionSingleBridgePortInterface(ovsdbClient, homeApL50, brHome, null, null, provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, homeAp24, brHome, null, null, provisionedInterfaces, provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, homeApL50, brHome, null, null, provisionedInterfaces,
|
||||
provisionedPorts, provisionedBridges);
|
||||
provisionSingleBridgePortInterface(ovsdbClient, homeAp24, brHome, null, null, provisionedInterfaces,
|
||||
provisionedPorts, provisionedBridges);
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
LOG.error("Error in provisionBridgePortInterface", e);
|
||||
@@ -1199,12 +1208,12 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now clean up references in the vif_configs columns
|
||||
operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
Set<Uuid> vifConfigsSet = new HashSet<>();
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set vifConfigs = com.vmware.ovsdb.protocol.operation.notation.Set.of(vifConfigsSet);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set vifConfigs = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(vifConfigsSet);
|
||||
updateColumns.put("vif_configs", vifConfigs);
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
@@ -1267,8 +1276,8 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
public void configureWifiRadios(OvsdbClient ovsdbClient, String configName,
|
||||
Map<String, WifiRadioConfigInfo> provisionedWifiRadios, int channel, Map<String, String> hwConfig, String country )
|
||||
throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException {
|
||||
Map<String, WifiRadioConfigInfo> provisionedWifiRadios, int channel, Map<String, String> hwConfig,
|
||||
String country) throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException {
|
||||
|
||||
WifiRadioConfigInfo existingConfig = provisionedWifiRadios.get(configName);
|
||||
|
||||
@@ -1285,7 +1294,8 @@ public class OvsdbDao {
|
||||
updateColumns.put("channel", new Atom<Integer>(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);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> hwConfigMap = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(hwConfig);
|
||||
updateColumns.put("hw_config", hwConfigMap);
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
@@ -1301,15 +1311,19 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
public void configureSingleSsid(OvsdbClient ovsdbClient, String bridge, String ifName, String ssid, boolean ssidBroadcast, Map<String, String> security, Map<String,WifiRadioConfigInfo> provisionedWifiRadioConfigs, String radioIfName) {
|
||||
public void configureSingleSsid(OvsdbClient ovsdbClient, String bridge, String ifName, String ssid,
|
||||
boolean ssidBroadcast, Map<String, String> security,
|
||||
Map<String, WifiRadioConfigInfo> provisionedWifiRadioConfigs, String radioIfName) {
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
|
||||
try {
|
||||
/// usr/plume/tools/ovsh i Wifi_VIF_Config
|
||||
// bridge:=br-home btm:=1 enabled:=true ft_psk:=0 group_rekey:=86400
|
||||
// if_name:=home-ap-24 mode:=ap rrm:=1 ssid:=ConnectUS-Plume ssid_broadcast:=enabled
|
||||
// uapsd_enable:=true vif_radio_idx:=2 security:='["map",[["encryption","WPA-PSK"],["key","12345678"],["mode","2"]]]'
|
||||
// if_name:=home-ap-24 mode:=ap rrm:=1 ssid:=ConnectUS-Plume
|
||||
/// ssid_broadcast:=enabled
|
||||
// uapsd_enable:=true vif_radio_idx:=2
|
||||
/// security:='["map",[["encryption","WPA-PSK"],["key","12345678"],["mode","2"]]]'
|
||||
|
||||
updateColumns.put("bridge", new Atom<>(bridge));
|
||||
updateColumns.put("btm", new Atom<>(1));
|
||||
@@ -1325,7 +1339,8 @@ public class OvsdbDao {
|
||||
updateColumns.put("vif_radio_idx", new Atom<>(2));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String,String> securityMap = com.vmware.ovsdb.protocol.operation.notation.Map.of(security);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> securityMap = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(security);
|
||||
updateColumns.put("security", securityMap);
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
@@ -1349,7 +1364,9 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
// update Wifi_Radio_Config here - add vifConfigUuid
|
||||
///usr/plume/tools/ovsh u Wifi_Radio_Config vif_configs:='["set",[["uuid","98e42897-b567-4186-84a6-4a4e38a51e9d"],["uuid","4314920e-c4e6-42a6-93e3-261142ed9adf"]]]' --where if_name==wifi0
|
||||
/// usr/plume/tools/ovsh u Wifi_Radio_Config
|
||||
// vif_configs:='["set",[["uuid","98e42897-b567-4186-84a6-4a4e38a51e9d"],["uuid","4314920e-c4e6-42a6-93e3-261142ed9adf"]]]'
|
||||
// --where if_name==wifi0
|
||||
updateColumns.clear();
|
||||
operations.clear();
|
||||
|
||||
@@ -1360,7 +1377,8 @@ public class OvsdbDao {
|
||||
|
||||
Set<Uuid> vifConfigsSet = new HashSet<>(wifiRadioConfigInfo.vifConfigUuids);
|
||||
vifConfigsSet.add(vifConfigUuid);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set vifConfigs = com.vmware.ovsdb.protocol.operation.notation.Set.of(vifConfigsSet);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set vifConfigs = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(vifConfigsSet);
|
||||
updateColumns.put("vif_configs", vifConfigs);
|
||||
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
@@ -1411,7 +1429,8 @@ public class OvsdbDao {
|
||||
|
||||
if (!provisionedWifiVifConfigs.containsKey(ifName + "_" + ssid)) {
|
||||
try {
|
||||
configureSingleSsid(ovsdbClient, bridge, ifName, ssid, ssidBroadcast, security, provisionedWifiRadioConfigs, radioIfName);
|
||||
configureSingleSsid(ovsdbClient, bridge, ifName, ssid, ssidBroadcast, security,
|
||||
provisionedWifiRadioConfigs, radioIfName);
|
||||
} catch (IllegalStateException e) {
|
||||
// could not provision this SSID, but still can go on
|
||||
LOG.warn("could not provision SSID {} on {}", ssid, radioIfName);
|
||||
@@ -1422,12 +1441,15 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
public void configureWifiInet(OvsdbClient ovsdbClient, Map<String, WifiInetConfigInfo> provisionedWifiInetConfigs, String ifName) {
|
||||
public void configureWifiInet(OvsdbClient ovsdbClient, Map<String, WifiInetConfigInfo> provisionedWifiInetConfigs,
|
||||
String ifName) {
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
|
||||
try {
|
||||
///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
|
||||
/// 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
|
||||
|
||||
updateColumns.put("NAT", new Atom<>(false));
|
||||
updateColumns.put("enabled", new Atom<>(true));
|
||||
@@ -1461,7 +1483,8 @@ public class OvsdbDao {
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
|
||||
try {
|
||||
///usr/plume/tools/ovsh u Wifi_Inet_Config -w if_name=="br-home" network:=true
|
||||
/// usr/plume/tools/ovsh u Wifi_Inet_Config -w if_name=="br-home"
|
||||
/// network:=true
|
||||
|
||||
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(ifName)));
|
||||
updateColumns.put("network", new Atom<>(true));
|
||||
@@ -1518,14 +1541,16 @@ public class OvsdbDao {
|
||||
channelSet.add(1);
|
||||
channelSet.add(6);
|
||||
channelSet.add(11);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set.of(channelSet);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(channelSet);
|
||||
|
||||
Map<String, Integer> thresholdMap = new HashMap<>();
|
||||
thresholdMap.put("max_delay", 600);
|
||||
thresholdMap.put("util", 10);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds = com.vmware.ovsdb.protocol.operation.notation.Map.of(thresholdMap);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(thresholdMap);
|
||||
|
||||
if (!provisionedWifiStatsConfigs.containsKey("2.4G_device_null")) {
|
||||
//
|
||||
@@ -1538,7 +1563,6 @@ public class OvsdbDao {
|
||||
// updateColumns.put("survey_type", new Atom<>("on-chan") );
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1556,7 +1580,6 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1574,7 +1597,6 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("off-chan"));
|
||||
updateColumns.put("threshold", thresholds);
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1592,7 +1614,6 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("off-chan"));
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1610,7 +1631,6 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1628,7 +1648,6 @@ public class OvsdbDao {
|
||||
// updateColumns.put("survey_type", new Atom<>("on-chan") );
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1646,7 +1665,6 @@ public class OvsdbDao {
|
||||
// updateColumns.put("survey_type", new Atom<>("on-chan") );
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1664,7 +1682,6 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1682,7 +1699,6 @@ public class OvsdbDao {
|
||||
// updateColumns.put("survey_type", new Atom<>("on-chan") );
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1700,7 +1716,6 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1718,7 +1733,6 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
@@ -1736,12 +1750,28 @@ public class OvsdbDao {
|
||||
updateColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
// updateColumns.put("threshold", thresholds );
|
||||
|
||||
|
||||
row = new Row(updateColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
//
|
||||
}
|
||||
|
||||
for (String band : new String[] { "2.4G", "5GL", "5G" }) {
|
||||
updateColumns = new HashMap<>();
|
||||
updateColumns.put("radio_type", new Atom<>(band));
|
||||
updateColumns.put("reporting_interval", new Atom<>(120));
|
||||
updateColumns.put("sampling_interval", new Atom<>(0));
|
||||
updateColumns.put("stats_type", new Atom<>("rssi"));
|
||||
updateColumns.put("survey_interval_ms", new Atom<>(0));
|
||||
updateColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
row = new Row(updateColumns);
|
||||
|
||||
if (provisionedWifiStatsConfigs.containsKey(band + "_rssi_onChannel")) {
|
||||
operations.add(new Update(wifiStatsConfigDbTable, row));
|
||||
} else {
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, row));
|
||||
}
|
||||
}
|
||||
|
||||
if (!operations.isEmpty()) {
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
@@ -1788,5 +1818,4 @@ public class OvsdbDao {
|
||||
return newRedirectorAddress;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user