mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-05 21:18:01 +00:00
VLAN on SSID
This commit is contained in:
@@ -1634,6 +1634,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clientSession != null) {
|
||||||
|
|
||||||
ClientSessionDetails clientSessionDetails = clientSession.getDetails();
|
ClientSessionDetails clientSessionDetails = clientSession.getDetails();
|
||||||
clientSessionDetails.setRadioType(getRadioTypeFromOpensyncRadioBand(band));
|
clientSessionDetails.setRadioType(getRadioTypeFromOpensyncRadioBand(band));
|
||||||
@@ -1641,7 +1642,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
clientSessionDetails.setAssocRssi(getNegativeSignedIntFromUnsigned(client.getStats().getRssi()));
|
clientSessionDetails.setAssocRssi(getNegativeSignedIntFromUnsigned(client.getStats().getRssi()));
|
||||||
|
|
||||||
if (client.getConnected()) {
|
if (client.getConnected()) {
|
||||||
if (clientSessionDetails.getAssociationState() != null && clientSessionDetails.getAssociationState().equals(AssociationState.Disconnected)) {
|
if (clientSessionDetails.getAssociationState() != null
|
||||||
|
&& clientSessionDetails.getAssociationState().equals(AssociationState.Disconnected)) {
|
||||||
clientSessionDetails.setIsReassociation(true);
|
clientSessionDetails.setIsReassociation(true);
|
||||||
}
|
}
|
||||||
if (client.hasConnectCount()) {
|
if (client.hasConnectCount()) {
|
||||||
@@ -1752,7 +1754,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
LOG.info("handleClientSessionUpdate Updated clientSession {}", clientSession);
|
LOG.info("handleClientSessionUpdate Updated clientSession {}", clientSession);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ import com.vmware.ovsdb.service.OvsdbClient;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class OvsdbDao {
|
public class OvsdbDao {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(OvsdbDao.class);
|
private static final Logger LOG = LoggerFactory.getLogger(OvsdbDao.class);
|
||||||
|
|
||||||
public static final String wifiRouteStateDbTable = "Wifi_Route_State";
|
public static final String wifiRouteStateDbTable = "Wifi_Route_State";
|
||||||
@@ -306,20 +307,20 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
String radioFrequencyBand = getSingleValueFromSet(row, "freq_band");
|
String radioFrequencyBand = getSingleValueFromSet(row, "freq_band");
|
||||||
switch (radioFrequencyBand) {
|
switch (radioFrequencyBand) {
|
||||||
case "2.4G":
|
case "2.4G":
|
||||||
radios.add(RadioType.is2dot4GHz);
|
radios.add(RadioType.is2dot4GHz);
|
||||||
break;
|
break;
|
||||||
case "5G":
|
case "5G":
|
||||||
radios.add(RadioType.is5GHz);
|
radios.add(RadioType.is5GHz);
|
||||||
break;
|
break;
|
||||||
case "5GL":
|
case "5GL":
|
||||||
radios.add(RadioType.is5GHzL);
|
radios.add(RadioType.is5GHzL);
|
||||||
break;
|
break;
|
||||||
case "5GU":
|
case "5GU":
|
||||||
radios.add(RadioType.is5GHzU);
|
radios.add(RadioType.is5GHzU);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG.debug("Unsupported or unrecognized radio band type {}", radioFrequencyBand);
|
LOG.debug("Unsupported or unrecognized radio band type {}", radioFrequencyBand);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,7 +655,6 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void performRedirect(OvsdbClient ovsdbClient, String clientCn) {
|
public void performRedirect(OvsdbClient ovsdbClient, String clientCn) {
|
||||||
|
|
||||||
List<Operation> operations = new ArrayList<>();
|
List<Operation> operations = new ArrayList<>();
|
||||||
@@ -1589,6 +1589,23 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operations = new ArrayList<>();
|
||||||
|
conditions = new ArrayList<>();
|
||||||
|
conditions.add(new Condition("vlan_id", Function.GREATER_THAN, new Atom<>(1)));
|
||||||
|
operations.add(new Delete(wifiInetConfigDbTable, conditions));
|
||||||
|
|
||||||
|
fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
|
result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Removed all existing vlan interfaces configs from {}:", wifiInetConfigDbTable);
|
||||||
|
|
||||||
|
for (OperationResult res : result) {
|
||||||
|
LOG.debug("Op Result {}", res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LOG.info("Removed all ssids");
|
LOG.info("Removed all ssids");
|
||||||
|
|
||||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||||
@@ -1616,23 +1633,23 @@ public class OvsdbDao {
|
|||||||
ChannelBandwidth bandwidth = elementRadioConfig.getChannelBandwidth();
|
ChannelBandwidth bandwidth = elementRadioConfig.getChannelBandwidth();
|
||||||
String ht_mode = null;
|
String ht_mode = null;
|
||||||
switch (bandwidth) {
|
switch (bandwidth) {
|
||||||
case is20MHz:
|
case is20MHz:
|
||||||
ht_mode = "HT20";
|
ht_mode = "HT20";
|
||||||
break;
|
break;
|
||||||
case is40MHz:
|
case is40MHz:
|
||||||
ht_mode = "HT40";
|
ht_mode = "HT40";
|
||||||
break;
|
break;
|
||||||
case is80MHz:
|
case is80MHz:
|
||||||
ht_mode = "HT80";
|
ht_mode = "HT80";
|
||||||
break;
|
break;
|
||||||
case is160MHz:
|
case is160MHz:
|
||||||
ht_mode = "HT160";
|
ht_mode = "HT160";
|
||||||
break;
|
break;
|
||||||
case auto:
|
case auto:
|
||||||
ht_mode = "0";
|
ht_mode = "0";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ht_mode = null;
|
ht_mode = null;
|
||||||
}
|
}
|
||||||
elementRadioConfig.getAutoChannelSelection();
|
elementRadioConfig.getAutoChannelSelection();
|
||||||
|
|
||||||
@@ -1647,72 +1664,75 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
String hwMode = null;
|
String hwMode = null;
|
||||||
switch (radioConfig.getRadioMode()) {
|
switch (radioConfig.getRadioMode()) {
|
||||||
case modeA:
|
case modeA:
|
||||||
hwMode = "11a";
|
hwMode = "11a";
|
||||||
break;
|
break;
|
||||||
case modeAB:
|
case modeAB:
|
||||||
hwMode = "11ab";
|
hwMode = "11ab";
|
||||||
break;
|
break;
|
||||||
case modeAC:
|
case modeAC:
|
||||||
hwMode = "11ac";
|
hwMode = "11ac";
|
||||||
break;
|
break;
|
||||||
case modeB:
|
case modeB:
|
||||||
hwMode = "11b";
|
hwMode = "11b";
|
||||||
break;
|
break;
|
||||||
case modeG:
|
case modeG:
|
||||||
hwMode = "11g";
|
hwMode = "11g";
|
||||||
break;
|
break;
|
||||||
case modeX:
|
case modeX:
|
||||||
hwMode = "11ax";
|
hwMode = "11ax";
|
||||||
break;
|
break;
|
||||||
case modeN:
|
case modeN:
|
||||||
hwMode = "11n";
|
hwMode = "11n";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
String freqBand = null;
|
String freqBand = null;
|
||||||
switch (radioType) {
|
switch (radioType) {
|
||||||
case is2dot4GHz:
|
case is2dot4GHz:
|
||||||
freqBand = "2.4G";
|
freqBand = "2.4G";
|
||||||
break;
|
break;
|
||||||
case is5GHz:
|
case is5GHz:
|
||||||
// 802.11h dfs (Dynamic Frequency Selection) aka military and
|
// 802.11h dfs (Dynamic Frequency Selection) aka military
|
||||||
// weather radar
|
// and
|
||||||
// avoidance protocol
|
// weather radar
|
||||||
// Must not be disabled (by law)
|
// avoidance protocol
|
||||||
// NA for 2.4GHz
|
// Must not be disabled (by law)
|
||||||
hwConfig.put("dfs_enable", "1");
|
// NA for 2.4GHz
|
||||||
hwConfig.put("dfs_ignorecac", "0");
|
hwConfig.put("dfs_enable", "1");
|
||||||
hwConfig.put("dfs_usenol", "1");
|
hwConfig.put("dfs_ignorecac", "0");
|
||||||
freqBand = "5G";
|
hwConfig.put("dfs_usenol", "1");
|
||||||
|
freqBand = "5G";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case is5GHzL:
|
case is5GHzL:
|
||||||
// 802.11h dfs (Dynamic Frequency Selection) aka military and
|
// 802.11h dfs (Dynamic Frequency Selection) aka military
|
||||||
// weather radar
|
// and
|
||||||
// avoidance protocol
|
// weather radar
|
||||||
// Must not be disabled (by law)
|
// avoidance protocol
|
||||||
// NA for 2.4GHz
|
// Must not be disabled (by law)
|
||||||
hwConfig.put("dfs_enable", "1");
|
// NA for 2.4GHz
|
||||||
hwConfig.put("dfs_ignorecac", "0");
|
hwConfig.put("dfs_enable", "1");
|
||||||
hwConfig.put("dfs_usenol", "1");
|
hwConfig.put("dfs_ignorecac", "0");
|
||||||
freqBand = "5GL";
|
hwConfig.put("dfs_usenol", "1");
|
||||||
|
freqBand = "5GL";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case is5GHzU:
|
case is5GHzU:
|
||||||
// 802.11h dfs (Dynamic Frequency Selection) aka military and
|
// 802.11h dfs (Dynamic Frequency Selection) aka military
|
||||||
// weather radar
|
// and
|
||||||
// avoidance protocol
|
// weather radar
|
||||||
// Must not be disabled (by law)
|
// avoidance protocol
|
||||||
// NA for 2.4GHz
|
// Must not be disabled (by law)
|
||||||
hwConfig.put("dfs_enable", "1");
|
// NA for 2.4GHz
|
||||||
hwConfig.put("dfs_ignorecac", "0");
|
hwConfig.put("dfs_enable", "1");
|
||||||
hwConfig.put("dfs_usenol", "1");
|
hwConfig.put("dfs_ignorecac", "0");
|
||||||
freqBand = "5GU";
|
hwConfig.put("dfs_usenol", "1");
|
||||||
|
freqBand = "5GU";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default: // don't know this interface
|
default: // don't know this interface
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1776,20 +1796,20 @@ public class OvsdbDao {
|
|||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
String frequencyBand = row.getStringColumn("freq_band");
|
String frequencyBand = row.getStringColumn("freq_band");
|
||||||
switch (frequencyBand) {
|
switch (frequencyBand) {
|
||||||
case "2.4G":
|
case "2.4G":
|
||||||
tableState.setFreqBand(RadioType.is2dot4GHz);
|
tableState.setFreqBand(RadioType.is2dot4GHz);
|
||||||
break;
|
break;
|
||||||
case "5G":
|
case "5G":
|
||||||
tableState.setFreqBand(RadioType.is5GHz);
|
tableState.setFreqBand(RadioType.is5GHz);
|
||||||
break;
|
break;
|
||||||
case "5GL":
|
case "5GL":
|
||||||
tableState.setFreqBand(RadioType.is5GHzL);
|
tableState.setFreqBand(RadioType.is5GHzL);
|
||||||
break;
|
break;
|
||||||
case "5GU":
|
case "5GU":
|
||||||
tableState.setFreqBand(RadioType.is5GHzU);
|
tableState.setFreqBand(RadioType.is5GHzU);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tableState.setFreqBand(RadioType.UNSUPPORTED);
|
tableState.setFreqBand(RadioType.UNSUPPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((map.get("if_name") != null) && map.get("if_name").getClass()
|
if ((map.get("if_name") != null) && map.get("if_name").getClass()
|
||||||
@@ -1848,6 +1868,7 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret.stream().forEach(new Consumer<OpensyncAPRadioState>() {
|
ret.stream().forEach(new Consumer<OpensyncAPRadioState>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(OpensyncAPRadioState wrs) {
|
public void accept(OpensyncAPRadioState wrs) {
|
||||||
LOG.debug("Wifi_Radio_State row {}", wrs);
|
LOG.debug("Wifi_Radio_State row {}", wrs);
|
||||||
@@ -1981,6 +2002,7 @@ public class OvsdbDao {
|
|||||||
ret.add(tableState);
|
ret.add(tableState);
|
||||||
|
|
||||||
ret.stream().forEach(new Consumer<OpensyncWifiAssociatedClients>() {
|
ret.stream().forEach(new Consumer<OpensyncWifiAssociatedClients>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(OpensyncWifiAssociatedClients wrs) {
|
public void accept(OpensyncWifiAssociatedClients wrs) {
|
||||||
LOG.debug("Wifi_Associated_Clients row {}", wrs);
|
LOG.debug("Wifi_Associated_Clients row {}", wrs);
|
||||||
@@ -2118,8 +2140,9 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureWifiRadios(OvsdbClient ovsdbClient, String freqBand, int channel, Map<String, String> hwConfig,
|
private void configureWifiRadios(OvsdbClient ovsdbClient, String freqBand, int channel,
|
||||||
String country, int beaconInterval, boolean enabled, String hwMode, String ht_mode, int txPower)
|
Map<String, String> hwConfig, String country, int beaconInterval, boolean enabled, String hwMode,
|
||||||
|
String ht_mode, int txPower)
|
||||||
throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException {
|
throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException {
|
||||||
|
|
||||||
List<Operation> operations = new ArrayList<>();
|
List<Operation> operations = new ArrayList<>();
|
||||||
@@ -2173,12 +2196,41 @@ public class OvsdbDao {
|
|||||||
Map<String, Value> updateColumns = new HashMap<>();
|
Map<String, Value> updateColumns = new HashMap<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// If we are doing a NAT SSID, no bridge, else yes
|
// If we are doing a NAT SSID, no bridge, else yes
|
||||||
|
String bridge = null;
|
||||||
if (networkForwardMode == NetworkForwardMode.NAT) {
|
if (networkForwardMode == NetworkForwardMode.NAT) {
|
||||||
updateColumns.put("bridge", new Atom<>(defaultLanInterfaceName));
|
bridge = defaultLanInterfaceName;
|
||||||
} else {
|
} else {
|
||||||
updateColumns.put("bridge", new Atom<>(defaultWanInterfaceName));
|
bridge = defaultWanInterfaceName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vlanId > 1) {
|
||||||
|
// vlan config, check to see if we already have the vlan in
|
||||||
|
// question
|
||||||
|
|
||||||
|
Map<String, WifiInetConfigInfo> wifiInetConfigInfoMap = getProvisionedWifiInetConfigs(ovsdbClient);
|
||||||
|
String vlanIfName = bridge + vlanId;
|
||||||
|
if (!wifiInetConfigInfoMap.containsKey(vlanIfName)) {
|
||||||
|
// we need to make a VLAN, before we do anything else
|
||||||
|
createInetConfigForVlan(ovsdbClient, bridge, (networkForwardMode == NetworkForwardMode.NAT),
|
||||||
|
vlanIfName, vlanId, gateway, inet, ipAssignScheme);
|
||||||
|
}
|
||||||
|
|
||||||
|
bridge = vlanIfName;
|
||||||
|
|
||||||
|
updateColumns.put("vlan_id", new Atom<>(vlanId));
|
||||||
|
updateColumns.put("mode", new Atom<>("ap_vlan"));
|
||||||
|
} else {
|
||||||
|
updateColumns.put("mode", new Atom<>("ap"));
|
||||||
|
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateColumns.put("bridge", new Atom<>(bridge));
|
||||||
|
|
||||||
|
|
||||||
if (enable80211v) {
|
if (enable80211v) {
|
||||||
updateColumns.put("btm", new Atom<>(1));
|
updateColumns.put("btm", new Atom<>(1));
|
||||||
} else {
|
} else {
|
||||||
@@ -2193,21 +2245,13 @@ public class OvsdbDao {
|
|||||||
updateColumns.put("ft_mobility_domain", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
updateColumns.put("ft_mobility_domain", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||||
}
|
}
|
||||||
updateColumns.put("if_name", new Atom<>(ifName));
|
updateColumns.put("if_name", new Atom<>(ifName));
|
||||||
updateColumns.put("mode", new Atom<>("ap"));
|
|
||||||
updateColumns.put("rrm", new Atom<>(rrmEnabled ? 1 : 0));
|
updateColumns.put("rrm", new Atom<>(rrmEnabled ? 1 : 0));
|
||||||
updateColumns.put("ssid", new Atom<>(ssid));
|
updateColumns.put("ssid", new Atom<>(ssid));
|
||||||
updateColumns.put("ssid_broadcast", new Atom<>(ssidBroadcast ? "enabled" : "disabled"));
|
updateColumns.put("ssid_broadcast", new Atom<>(ssidBroadcast ? "enabled" : "disabled"));
|
||||||
updateColumns.put("uapsd_enable", new Atom<>(uapsdEnabled));
|
updateColumns.put("uapsd_enable", new Atom<>(uapsdEnabled));
|
||||||
|
|
||||||
updateColumns.put("min_hw_mode", new Atom<>(minHwMode));
|
updateColumns.put("min_hw_mode", new Atom<>(minHwMode));
|
||||||
if (vlanId > 0) {
|
|
||||||
updateColumns.put("vlan_id", new Atom<>(vlanId));
|
|
||||||
if (vlanId > 1) {
|
|
||||||
updateColumns.put("bridge", new Atom<>("vlan" + vlanId));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
|
||||||
}
|
|
||||||
updateColumns.put("group_rekey", new Atom<>(keyRefresh));
|
updateColumns.put("group_rekey", new Atom<>(keyRefresh));
|
||||||
updateColumns.put("uapsd_enable", new Atom<>(uapsdEnabled));
|
updateColumns.put("uapsd_enable", new Atom<>(uapsdEnabled));
|
||||||
updateColumns.put("ap_bridge", new Atom<>(apBridge));
|
updateColumns.put("ap_bridge", new Atom<>(apBridge));
|
||||||
@@ -2326,47 +2370,50 @@ public class OvsdbDao {
|
|||||||
private void updateVifConfigsSetForRadio(OvsdbClient ovsdbClient, String ssid, String radioFreqBand,
|
private void updateVifConfigsSetForRadio(OvsdbClient ovsdbClient, String ssid, String radioFreqBand,
|
||||||
List<Operation> operations, Map<String, Value> updateColumns, Uuid vifConfigUuid)
|
List<Operation> operations, Map<String, Value> updateColumns, Uuid vifConfigUuid)
|
||||||
throws OvsdbClientException, InterruptedException, ExecutionException, TimeoutException {
|
throws OvsdbClientException, InterruptedException, ExecutionException, TimeoutException {
|
||||||
// Row row;
|
// Row row;
|
||||||
// CompletableFuture<OperationResult[]> fResult;
|
// CompletableFuture<OperationResult[]> fResult;
|
||||||
// OperationResult[] result;
|
// OperationResult[] result;
|
||||||
List<Condition> conditions = new ArrayList<>();
|
List<Condition> conditions = new ArrayList<>();
|
||||||
conditions.add(new Condition("freq_band", Function.EQUALS, new Atom<>(radioFreqBand)));
|
conditions.add(new Condition("freq_band", Function.EQUALS, new Atom<>(radioFreqBand)));
|
||||||
|
|
||||||
// List<String> columns = new ArrayList<>();
|
// List<String> columns = new ArrayList<>();
|
||||||
// columns.add("vif_configs");
|
// columns.add("vif_configs");
|
||||||
// operations.add(new Select(wifiRadioConfigDbTable, conditions, columns));
|
// operations.add(new Select(wifiRadioConfigDbTable, conditions,
|
||||||
// fResult = ovsdbClient.transact(ovsdbName, operations);
|
// columns));
|
||||||
// result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
// fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
//
|
// result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
// Set<Uuid> vifConfigsSet = new HashSet<>();
|
//
|
||||||
//
|
// Set<Uuid> vifConfigsSet = new HashSet<>();
|
||||||
// if ((result != null) && (result.length > 0) && !((SelectResult) result[0]).getRows().isEmpty()) {
|
//
|
||||||
// row = ((SelectResult) result[0]).getRows().iterator().next();
|
// if ((result != null) && (result.length > 0) && !((SelectResult)
|
||||||
// if (row != null) {
|
// result[0]).getRows().isEmpty()) {
|
||||||
// vifConfigsSet = row.getSetColumn("vif_configs");
|
// row = ((SelectResult) result[0]).getRows().iterator().next();
|
||||||
// if (vifConfigsSet == null) {
|
// if (row != null) {
|
||||||
// vifConfigsSet = new HashSet<>();
|
// vifConfigsSet = row.getSetColumn("vif_configs");
|
||||||
// }
|
// if (vifConfigsSet == null) {
|
||||||
// }
|
// vifConfigsSet = new HashSet<>();
|
||||||
// }
|
// }
|
||||||
//
|
// }
|
||||||
// if (vifConfigUuid != null) {
|
// }
|
||||||
// vifConfigsSet.add(vifConfigUuid);
|
//
|
||||||
// }
|
// if (vifConfigUuid != null) {
|
||||||
//
|
// 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 =
|
||||||
// updateColumns.put("vif_configs", vifConfigs);
|
// com.vmware.ovsdb.protocol.operation.notation.Set
|
||||||
//
|
// .of(vifConfigsSet);
|
||||||
// row = new Row(updateColumns);
|
//
|
||||||
|
// updateColumns.put("vif_configs", vifConfigs);
|
||||||
|
//
|
||||||
|
// row = new Row(updateColumns);
|
||||||
|
|
||||||
List<Mutation> mutations = new ArrayList<>();
|
List<Mutation> mutations = new ArrayList<>();
|
||||||
Mutation mutation = new Mutation("vif_configs", Mutator.INSERT, new Atom<>(vifConfigUuid));
|
Mutation mutation = new Mutation("vif_configs", Mutator.INSERT, new Atom<>(vifConfigUuid));
|
||||||
mutations.add(mutation);
|
mutations.add(mutation);
|
||||||
operations.add(new Mutate(wifiRadioConfigDbTable, conditions, mutations));
|
operations.add(new Mutate(wifiRadioConfigDbTable, conditions, mutations));
|
||||||
|
|
||||||
// operations.add(new Update(wifiRadioConfigDbTable, conditions, row));
|
// operations.add(new Update(wifiRadioConfigDbTable, conditions, row));
|
||||||
|
|
||||||
LOG.debug("Sending batch of operations : {} ", operations);
|
LOG.debug("Sending batch of operations : {} ", operations);
|
||||||
|
|
||||||
@@ -2627,10 +2674,68 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createInetConfigForVlan(OvsdbClient ovsdbClient, String parentIfName, boolean isNAT, String vlanIfName,
|
||||||
|
int vlanId, String gateway, String inet, String ipAssignScheme) {
|
||||||
|
|
||||||
|
List<Operation> operations = new ArrayList<>();
|
||||||
|
Map<String, Value> insertColumns = new HashMap<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
insertColumns.put("if_type", new Atom<>("vlan"));
|
||||||
|
insertColumns.put("vlan_id", new Atom<>(vlanId));
|
||||||
|
insertColumns.put("if_name", new Atom<>(vlanIfName));
|
||||||
|
insertColumns.put("parent_ifname", new Atom<>(parentIfName));
|
||||||
|
insertColumns.put("NAT", new Atom<>(isNAT));
|
||||||
|
insertColumns.put("enabled", new Atom<>(true));
|
||||||
|
insertColumns.put("network", new Atom<>(true));
|
||||||
|
insertColumns.put("mtu", new Atom<>(1500));
|
||||||
|
insertColumns.put("ip_assign_scheme", new Atom<>(ipAssignScheme));
|
||||||
|
|
||||||
|
if (ipAssignScheme.equals("static")) {
|
||||||
|
|
||||||
|
Map<String, String> dhcpMap = new HashMap<>();
|
||||||
|
dhcpMap.put("start", "100");
|
||||||
|
dhcpMap.put("stop", "250");
|
||||||
|
dhcpMap.put("lease_time", "1h");
|
||||||
|
insertColumns.put("dhcpd", com.vmware.ovsdb.protocol.operation.notation.Map.of(dhcpMap));
|
||||||
|
if (inet != null) {
|
||||||
|
insertColumns.put("inet_addr", new Atom<>(inet));
|
||||||
|
}
|
||||||
|
insertColumns.put("netmask", new Atom<>("255.255.255.0"));
|
||||||
|
|
||||||
|
|
||||||
|
} else if (ipAssignScheme.equals("dhcp")) {
|
||||||
|
|
||||||
|
insertColumns.put("ip_assign_scheme", new Atom<>("dhcp"));
|
||||||
|
insertColumns.put("dhcp_sniff", new Atom<>(true));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Row row = new Row(insertColumns);
|
||||||
|
operations.add(new Insert(wifiInetConfigDbTable, row));
|
||||||
|
|
||||||
|
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
|
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
LOG.debug("Provisioned Vlan {}", vlanId);
|
||||||
|
|
||||||
|
for (OperationResult res : result) {
|
||||||
|
LOG.debug("Op Result {}", res);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||||
|
LOG.error("Error in provisioning Vlan", e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void getRadiusConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
private void getRadiusConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
||||||
Map<String, String> security) {
|
Map<String, String> security) {
|
||||||
List<Profile> radiusServiceList = new ArrayList<>();
|
List<Profile> radiusServiceList = new ArrayList<>();
|
||||||
radiusServiceList = opensyncApConfig.getRadiusProfiles().stream().filter(new Predicate<Profile>() {
|
radiusServiceList = opensyncApConfig.getRadiusProfiles().stream().filter(new Predicate<Profile>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(Profile p) {
|
public boolean test(Profile p) {
|
||||||
return p.getName().equals((ssidConfig.getRadiusServiceName()));
|
return p.getName().equals((ssidConfig.getRadiusServiceName()));
|
||||||
@@ -2666,8 +2771,8 @@ public class OvsdbDao {
|
|||||||
captiveMap.put("browser_title", captiveProfileDetails.getBrowserTitle());
|
captiveMap.put("browser_title", captiveProfileDetails.getBrowserTitle());
|
||||||
captiveMap.put("splash_page_title", captiveProfileDetails.getHeaderContent());
|
captiveMap.put("splash_page_title", captiveProfileDetails.getHeaderContent());
|
||||||
|
|
||||||
captiveMap.put("acceptance_policy", captiveProfileDetails.getUserAcceptancePolicy());
|
captiveMap.put("acceptance_policy", captiveProfileDetails.getUserAcceptancePolicy());
|
||||||
captiveMap.put("login_success_text", captiveProfileDetails.getSuccessPageMarkdownText());
|
captiveMap.put("login_success_text", captiveProfileDetails.getSuccessPageMarkdownText());
|
||||||
// captiveMap.put("externalCaptivePortalURL",
|
// captiveMap.put("externalCaptivePortalURL",
|
||||||
// captiveProfileDetails.getExternalCaptivePortalURL());
|
// captiveProfileDetails.getExternalCaptivePortalURL());
|
||||||
// captiveMap.put("backgroundPosition",
|
// captiveMap.put("backgroundPosition",
|
||||||
@@ -2743,12 +2848,6 @@ public class OvsdbDao {
|
|||||||
updateColumns.put("dhcp_sniff", new Atom<>(false));
|
updateColumns.put("dhcp_sniff", new Atom<>(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifType.equals("vlan")) {
|
|
||||||
updateColumns.put("vlan_id", new Atom<>(vlanId));
|
|
||||||
} else {
|
|
||||||
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
|
||||||
}
|
|
||||||
|
|
||||||
Row row = new Row(updateColumns);
|
Row row = new Row(updateColumns);
|
||||||
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
|
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
|
||||||
|
|
||||||
@@ -2806,12 +2905,6 @@ public class OvsdbDao {
|
|||||||
insertColumns.put("dhcp_sniff", new Atom<>(false));
|
insertColumns.put("dhcp_sniff", new Atom<>(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifType.equals("vlan")) {
|
|
||||||
insertColumns.put("vlan_id", new Atom<>(vlanId));
|
|
||||||
} else {
|
|
||||||
insertColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
|
||||||
}
|
|
||||||
|
|
||||||
Row row = new Row(insertColumns);
|
Row row = new Row(insertColumns);
|
||||||
operations.add(new Insert(wifiInetConfigDbTable, row));
|
operations.add(new Insert(wifiInetConfigDbTable, row));
|
||||||
|
|
||||||
@@ -2853,9 +2946,12 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
|
|
||||||
provisionWifiStatsConfigClient(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
provisionWifiStatsConfigClient(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||||
// provisionWifiStatsConfigSteering(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
// provisionWifiStatsConfigSteering(radioConfigs,
|
||||||
// provisionWifiStatsConfigCapacity(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
// getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||||
// provisionWifiStatsConfigRssi(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
// provisionWifiStatsConfigCapacity(radioConfigs,
|
||||||
|
// getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||||
|
// provisionWifiStatsConfigRssi(radioConfigs,
|
||||||
|
// getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||||
|
|
||||||
|
|
||||||
if (!operations.isEmpty()) {
|
if (!operations.isEmpty()) {
|
||||||
@@ -2885,6 +2981,7 @@ public class OvsdbDao {
|
|||||||
List<Operation> operations) {
|
List<Operation> operations) {
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
public void accept(WifiRadioConfigInfo rc) {
|
||||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_neighbor_off-chan")) {
|
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_neighbor_off-chan")) {
|
||||||
@@ -2910,6 +3007,7 @@ public class OvsdbDao {
|
|||||||
});
|
});
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
public void accept(WifiRadioConfigInfo rc) {
|
||||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_neighbor_on-chan")) {
|
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_neighbor_on-chan")) {
|
||||||
@@ -2934,6 +3032,7 @@ public class OvsdbDao {
|
|||||||
List<Operation> operations, com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) {
|
List<Operation> operations, com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) {
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
public void accept(WifiRadioConfigInfo rc) {
|
||||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_survey_on-chan")) {
|
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_survey_on-chan")) {
|
||||||
@@ -2955,6 +3054,7 @@ public class OvsdbDao {
|
|||||||
});
|
});
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
public void accept(WifiRadioConfigInfo rc) {
|
||||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_survey_off-chan")) {
|
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_survey_off-chan")) {
|
||||||
@@ -2988,6 +3088,7 @@ public class OvsdbDao {
|
|||||||
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
public void accept(WifiRadioConfigInfo rc) {
|
||||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_client")) {
|
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_client")) {
|
||||||
@@ -3012,6 +3113,7 @@ public class OvsdbDao {
|
|||||||
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
public void accept(WifiRadioConfigInfo rc) {
|
||||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_capacity")) {
|
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_capacity")) {
|
||||||
@@ -3036,6 +3138,7 @@ public class OvsdbDao {
|
|||||||
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
public void accept(WifiRadioConfigInfo rc) {
|
||||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_rssi")) {
|
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_rssi")) {
|
||||||
@@ -3060,18 +3163,17 @@ public class OvsdbDao {
|
|||||||
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
||||||
|
|
||||||
|
|
||||||
if (!provisionedWifiStatsConfigs.containsKey("2.4G_steering")) {
|
if (!provisionedWifiStatsConfigs.containsKey("2.4G_steering")) {
|
||||||
//
|
//
|
||||||
Map<String, Value> rowColumns = new HashMap<>();
|
Map<String, Value> rowColumns = new HashMap<>();
|
||||||
rowColumns.put("radio_type", new Atom<>("2.4G"));
|
rowColumns.put("radio_type", new Atom<>("2.4G"));
|
||||||
rowColumns.put("reporting_interval", new Atom<>(120));
|
rowColumns.put("reporting_interval", new Atom<>(120));
|
||||||
rowColumns.put("report_type", new Atom<>("raw"));
|
rowColumns.put("report_type", new Atom<>("raw"));
|
||||||
rowColumns.put("stats_type", new Atom<>("steering"));
|
rowColumns.put("stats_type", new Atom<>("steering"));
|
||||||
Row updateRow = new Row(rowColumns);
|
Row updateRow = new Row(rowColumns);
|
||||||
operations.add(new Insert(wifiStatsConfigDbTable, updateRow));
|
operations.add(new Insert(wifiStatsConfigDbTable, updateRow));
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3368,7 +3470,7 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
LOG.info("Removed Wifi_RRM_Config");
|
LOG.info("Removed Wifi_RRM_Config");
|
||||||
|
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
LOG.error("Error in removeRrm", e);
|
LOG.error("Error in removeRrm", e);
|
||||||
} catch (OvsdbClientException | TimeoutException | InterruptedException e) {
|
} catch (OvsdbClientException | TimeoutException | InterruptedException e) {
|
||||||
LOG.error("Error in removeRrm", e);
|
LOG.error("Error in removeRrm", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user