mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 11:37:49 +00:00
Update Wifi_Inet_Config for vlan, adding "_" to interface names.
This commit is contained in:
@@ -230,7 +230,6 @@ public class OvsdbDao {
|
||||
|
||||
public static final String StopDebugEngineApCommand = "stopSession";
|
||||
|
||||
|
||||
public static void translateDhcpFpValueToString(Entry<String, Value> c, Map<String, String> rowMap) {
|
||||
if (c.getKey().equals("manuf_id")) {
|
||||
rowMap.put(c.getKey(), DhcpFpManufId.getById(Integer.valueOf(c.getValue().toString())).getName());
|
||||
@@ -243,7 +242,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ConnectNodeInfo getConnectNodeInfo(OvsdbClient ovsdbClient) {
|
||||
|
||||
ConnectNodeInfo ret = new ConnectNodeInfo();
|
||||
@@ -314,9 +312,6 @@ public class OvsdbDao {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void fillInRadioInterfaceNames(OvsdbClient ovsdbClient, ConnectNodeInfo ret) {
|
||||
try {
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
@@ -565,7 +560,8 @@ public class OvsdbDao {
|
||||
// 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);
|
||||
String mqttClientName = OvsdbToWlanCloudTypeMappingUtility.getAlteredClientCnIfRequired(clientCn, incomingConnectNodeInfo, preventCnAlteration);
|
||||
String mqttClientName = OvsdbToWlanCloudTypeMappingUtility.getAlteredClientCnIfRequired(clientCn,
|
||||
incomingConnectNodeInfo, preventCnAlteration);
|
||||
newMqttSettings.put("topics", "/ap/" + mqttClientName + "/opensync");
|
||||
newMqttSettings.put("port", "" + mqttBrokerListenPort);
|
||||
newMqttSettings.put("compress", "zlib");
|
||||
@@ -605,9 +601,8 @@ public class OvsdbDao {
|
||||
|
||||
/**
|
||||
* @param ovsdbClient
|
||||
* @return value of reporting_interval column for the stats_type=device from
|
||||
* the Wifi_Stats_Config table. If value is not provisioned then
|
||||
* return -1.
|
||||
* @return value of reporting_interval column for the stats_type=device from the
|
||||
* Wifi_Stats_Config table. If value is not provisioned then return -1.
|
||||
*/
|
||||
public long getDeviceStatsReportingInterval(OvsdbClient ovsdbClient) {
|
||||
long ret = -1;
|
||||
@@ -651,10 +646,9 @@ 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 {
|
||||
@@ -732,7 +726,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void performRedirect(OvsdbClient ovsdbClient, String clientCn) {
|
||||
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
@@ -1074,7 +1067,6 @@ public class OvsdbDao {
|
||||
columns.add("payload");
|
||||
columns.add("timestamp");
|
||||
|
||||
|
||||
try {
|
||||
LOG.debug("Retrieving CommandConfig:");
|
||||
|
||||
@@ -1191,7 +1183,6 @@ public class OvsdbDao {
|
||||
List<String> columns = new ArrayList<>();
|
||||
columns.add("mac");
|
||||
|
||||
|
||||
try {
|
||||
LOG.debug("Retrieving WifiVifState:");
|
||||
|
||||
@@ -1205,7 +1196,6 @@ public class OvsdbDao {
|
||||
|
||||
for (Row row : ((SelectResult) result[0]).getRows()) {
|
||||
|
||||
|
||||
String mac = getSingleValueFromSet(row, "mac");
|
||||
if (mac != null) {
|
||||
ret.add(mac);
|
||||
@@ -1453,7 +1443,6 @@ public class OvsdbDao {
|
||||
List<String> columns = new ArrayList<>();
|
||||
columns.addAll(Arrays.asList(Hotspot20Config.ovsdbColumns));
|
||||
|
||||
|
||||
try {
|
||||
LOG.debug("Retrieving Hotspot20Config:");
|
||||
|
||||
@@ -1479,7 +1468,6 @@ public class OvsdbDao {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Hotspot20OsuProviders> getProvisionedHotspot20OsuProviders(OvsdbClient ovsdbClient) {
|
||||
Map<String, Hotspot20OsuProviders> ret = new HashMap<>();
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
@@ -1873,7 +1861,7 @@ public class OvsdbDao {
|
||||
|
||||
operations = new ArrayList<>();
|
||||
conditions = new ArrayList<>();
|
||||
conditions.add(new Condition("vlan_id", Function.GREATER_THAN, new Atom<>(1)));
|
||||
conditions.add(new Condition("if_type", Function.EQUALS, new Atom<>("vlan")));
|
||||
operations.add(new Delete(wifiInetConfigDbTable, conditions));
|
||||
|
||||
fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
@@ -1887,7 +1875,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOG.info("Removed all ssids");
|
||||
|
||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||
@@ -2050,7 +2037,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void configureInterfaces(OvsdbClient ovsdbClient) {
|
||||
|
||||
configureWanInterfaces(ovsdbClient);
|
||||
@@ -2068,12 +2054,10 @@ public class OvsdbDao {
|
||||
Row row = new Row(updateColumns);
|
||||
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
|
||||
|
||||
|
||||
try {
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
for (OperationResult res : result) {
|
||||
LOG.debug("Op Result {}", res);
|
||||
}
|
||||
@@ -2095,12 +2079,10 @@ public class OvsdbDao {
|
||||
Row row = new Row(updateColumns);
|
||||
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
|
||||
|
||||
|
||||
try {
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
for (OperationResult res : result) {
|
||||
LOG.debug("Op Result {}", res);
|
||||
}
|
||||
@@ -2231,7 +2213,6 @@ public class OvsdbDao {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public List<OpensyncAPInetState> getOpensyncApInetStateForRowUpdate(RowUpdate rowUpdate, String apId,
|
||||
OvsdbClient ovsdbClient) {
|
||||
List<OpensyncAPInetState> ret = new ArrayList<>();
|
||||
@@ -2511,7 +2492,6 @@ public class OvsdbDao {
|
||||
operations.add(new Insert(commandConfigDbTable, row));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
@@ -2528,7 +2508,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void configureWifiRadios(OvsdbClient ovsdbClient, String freqBand, int channel,
|
||||
@@ -2601,12 +2580,14 @@ public class OvsdbDao {
|
||||
// question
|
||||
|
||||
Map<String, WifiInetConfigInfo> wifiInetConfigInfoMap = getProvisionedWifiInetConfigs(ovsdbClient);
|
||||
String vlanIfName = bridge + vlanId;
|
||||
String vlanIfName = bridge + "_" + vlanId;
|
||||
if (!wifiInetConfigInfoMap.containsKey(vlanIfName)) {
|
||||
// we need to make a VLAN, before we do anything else
|
||||
boolean isNAT = wifiInetConfigInfoMap.get(bridge).nat;
|
||||
createInetConfigForVlan(ovsdbClient, bridge, isNAT, vlanIfName, vlanId, gateway, inet,
|
||||
ipAssignScheme, dns);
|
||||
createInetConfigForVlan(ovsdbClient, bridge, (networkForwardMode == NetworkForwardMode.NAT),
|
||||
vlanIfName, vlanId, gateway, inet, ipAssignScheme, dns, false);
|
||||
} else {
|
||||
createInetConfigForVlan(ovsdbClient, bridge, (networkForwardMode == NetworkForwardMode.NAT),
|
||||
vlanIfName, vlanId, gateway, inet, ipAssignScheme, dns, true);
|
||||
}
|
||||
|
||||
bridge = vlanIfName;
|
||||
@@ -2647,7 +2628,6 @@ public class OvsdbDao {
|
||||
|
||||
updateColumns.put("bridge", new Atom<>(bridge));
|
||||
|
||||
|
||||
if (enable80211v) {
|
||||
updateColumns.put("btm", new Atom<>(1));
|
||||
} else {
|
||||
@@ -2689,7 +2669,6 @@ public class OvsdbDao {
|
||||
// customOptions.put("frag_threshold", String.valueOf(fragThresholdBytes));
|
||||
customOptions.put("dtim_period", String.valueOf(dtimPeriod));
|
||||
|
||||
|
||||
if (enable80211k) {
|
||||
customOptions.put("ieee80211k", String.valueOf(1));
|
||||
} else {
|
||||
@@ -2952,7 +2931,7 @@ public class OvsdbDao {
|
||||
|
||||
boolean ssidBroadcast = ssidConfig.getBroadcastSsid() == StateSetting.enabled;
|
||||
|
||||
String ipAssignScheme = "none";
|
||||
String ipAssignScheme = null;
|
||||
// the following 5 attributes only applicable to static config,
|
||||
// else they are
|
||||
// ignored
|
||||
@@ -3096,7 +3075,6 @@ public class OvsdbDao {
|
||||
"Cannot provision more than " + maxInterfacesPerRadio + " interfaces per Wifi Radio");
|
||||
}
|
||||
|
||||
|
||||
if (numberOfInterfaces > 0) {
|
||||
// 1st interface has no number, 2nd has '_1', 3rd has
|
||||
// '_2' etc.
|
||||
@@ -3110,7 +3088,6 @@ public class OvsdbDao {
|
||||
rateLimitEnable, ssidDlLimit, ssidUlLimit, clientDlLimit, clientUlLimit, rtsCtsThreshold,
|
||||
fragThresholdBytes, dtimPeriod, captiveMap, walledGardenAllowlist, bonjourServiceMap);
|
||||
|
||||
|
||||
} catch (IllegalStateException e) {
|
||||
// could not provision this SSID, but still can go on
|
||||
LOG.warn("could not provision SSID {} on {}", ssidConfig.getSsid(), freqBand);
|
||||
@@ -3131,46 +3108,103 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
private void createInetConfigForVlan(OvsdbClient ovsdbClient, String parentIfName, boolean isNAT, String vlanIfName,
|
||||
int vlanId, String gateway, String inet, String ipAssignScheme, Map<String, String> dns) {
|
||||
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> insertColumns = new HashMap<>();
|
||||
|
||||
int vlanId, String gateway, String inet, String ipAssignScheme, Map<String, String> dns, boolean isUpdate) {
|
||||
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));
|
||||
insertColumns.put("dhcp_sniff", new Atom<>(true));
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> tableColumns = new HashMap<>();
|
||||
Map<String, String> parentDhcpd = null;
|
||||
String parentNetmask = null;
|
||||
|
||||
// if (ipAssignScheme == null) {
|
||||
|
||||
List<String> parentTableColumns = new ArrayList<>();
|
||||
parentTableColumns.add("gateway");
|
||||
parentTableColumns.add("if_name");
|
||||
parentTableColumns.add("if_type");
|
||||
parentTableColumns.add("inet_addr");
|
||||
parentTableColumns.add("netmask");
|
||||
parentTableColumns.add("dhcpd");
|
||||
parentTableColumns.add("dns");
|
||||
parentTableColumns.add("ip_assign_scheme");
|
||||
|
||||
List<Condition> parentTableConditions = new ArrayList<>();
|
||||
parentTableConditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(parentIfName)));
|
||||
operations.add(new Select(wifiInetStateDbTable, parentTableConditions, parentTableColumns));
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
String parentInetAddr = null;
|
||||
String parentGateway = null;
|
||||
Map<String, String> parentDns = null;
|
||||
|
||||
String parentIpAssignScheme = null;
|
||||
for (Row row : ((SelectResult) result[0]).getRows()) {
|
||||
parentGateway = getSingleValueFromSet(row, "gateway");
|
||||
if ((row.getColumns().get("inet_addr") != null) && row.getColumns().get("inet_addr").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
parentInetAddr = row.getStringColumn("inet_addr");
|
||||
}
|
||||
if ((row.getColumns().get("netmask") != null) && row.getColumns().get("netmask").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
parentNetmask = row.getStringColumn("netmask");
|
||||
}
|
||||
parentDns = row.getMapColumn("dns");
|
||||
parentDhcpd = row.getMapColumn("dhcpd");
|
||||
parentIpAssignScheme = getSingleValueFromSet(row, "ip_assign_scheme");
|
||||
|
||||
}
|
||||
|
||||
inet = parentInetAddr;
|
||||
gateway = parentGateway;
|
||||
dns = parentDns;
|
||||
ipAssignScheme = parentIpAssignScheme;
|
||||
|
||||
// }
|
||||
tableColumns.put("if_type", new Atom<>("vlan"));
|
||||
tableColumns.put("vlan_id", new Atom<>(vlanId));
|
||||
tableColumns.put("if_name", new Atom<>(vlanIfName));
|
||||
tableColumns.put("parent_ifname", new Atom<>(parentIfName));
|
||||
tableColumns.put("NAT", new Atom<>(isNAT));
|
||||
tableColumns.put("enabled", new Atom<>(true));
|
||||
tableColumns.put("network", new Atom<>(true));
|
||||
tableColumns.put("mtu", new Atom<>(1500));
|
||||
tableColumns.put("dhcp_sniff", new Atom<>(true));
|
||||
tableColumns.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));
|
||||
tableColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
|
||||
tableColumns.put("dhcpd", com.vmware.ovsdb.protocol.operation.notation.Map.of(parentDhcpd));
|
||||
if (gateway != null) {
|
||||
tableColumns.put("gateway", new Atom<>(gateway));
|
||||
}
|
||||
if (parentNetmask != null) {
|
||||
tableColumns.put("netmask", new Atom<>(parentNetmask));
|
||||
}
|
||||
if (inet != null) {
|
||||
insertColumns.put("inet_addr", new Atom<>(inet));
|
||||
String[] inetAddrOctets = inet.split("\\.");
|
||||
if (inetAddrOctets.length == 4) {
|
||||
// change the subnet octet to be the vlan
|
||||
tableColumns.put("inet_addr", new Atom<>(
|
||||
inetAddrOctets[0] + "." + inetAddrOctets[1] + "." + vlanId + "." + inetAddrOctets[3]));
|
||||
}
|
||||
}
|
||||
insertColumns.put("netmask", new Atom<>("255.255.255.0"));
|
||||
|
||||
|
||||
} else if (ipAssignScheme.equals("dhcp")) {
|
||||
insertColumns.put("ip_assign_scheme", new Atom<>("dhcp"));
|
||||
|
||||
}
|
||||
|
||||
Row row = new Row(insertColumns);
|
||||
Row row = new Row(tableColumns);
|
||||
operations.clear();
|
||||
if (isUpdate) {
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(vlanIfName)));
|
||||
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
|
||||
|
||||
} else {
|
||||
operations.add(new Insert(wifiInetConfigDbTable, row));
|
||||
}
|
||||
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
LOG.debug("Provisioned Vlan {}", vlanId);
|
||||
|
||||
@@ -3183,7 +3217,6 @@ public class OvsdbDao {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void getRadiusConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
||||
@@ -3292,7 +3325,6 @@ public class OvsdbDao {
|
||||
if ((ssidConfig.getBonjourGatewayProfileId() == profileBonjour.getId())
|
||||
&& (profileBonjour.getDetails() != null)) {
|
||||
|
||||
|
||||
BonjourGatewayProfile bonjourGatewayConfiguration = (BonjourGatewayProfile) profileBonjour
|
||||
.getDetails();
|
||||
|
||||
@@ -3307,7 +3339,6 @@ public class OvsdbDao {
|
||||
bonjourServiceMap.put(b.getVlanId(), serviceSet);
|
||||
});
|
||||
|
||||
|
||||
LOG.debug("bonjourServiceMap {}", bonjourServiceMap);
|
||||
}
|
||||
}
|
||||
@@ -3331,8 +3362,8 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
private void updateWifiInetConfig(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
|
||||
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns, String ipAssignScheme,
|
||||
Uuid vifConfigUuid) {
|
||||
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns,
|
||||
String ipAssignScheme, Uuid vifConfigUuid) {
|
||||
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
@@ -3342,7 +3373,6 @@ public class OvsdbDao {
|
||||
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
|
||||
@@ -3369,7 +3399,6 @@ public class OvsdbDao {
|
||||
// // broadcast
|
||||
// }
|
||||
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
|
||||
|
||||
@@ -3390,8 +3419,8 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
private void insertWifiInetConfigForVif(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
|
||||
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns, String ipAssignScheme,
|
||||
Uuid vifConfigUuid) {
|
||||
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns,
|
||||
String ipAssignScheme, Uuid vifConfigUuid) {
|
||||
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> insertColumns = new HashMap<>();
|
||||
@@ -3426,7 +3455,6 @@ public class OvsdbDao {
|
||||
// // broadcast
|
||||
// }
|
||||
|
||||
|
||||
Row row = new Row(insertColumns);
|
||||
operations.add(new Insert(wifiInetConfigDbTable, row));
|
||||
|
||||
@@ -3461,7 +3489,6 @@ public class OvsdbDao {
|
||||
|
||||
Hotspot2Profile hs2Profile = (Hotspot2Profile) hotspotProfile.getDetails();
|
||||
|
||||
|
||||
Profile operator = hs20cfg.getHotspot20OperatorSet().stream().filter(new Predicate<Profile>() {
|
||||
|
||||
@Override
|
||||
@@ -3486,7 +3513,6 @@ public class OvsdbDao {
|
||||
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
|
||||
|
||||
Map<String, Hotspot20OsuProviders> osuProviders = getProvisionedHotspot20OsuProviders(
|
||||
ovsdbClient);
|
||||
List<Profile> providerList = new ArrayList<>();
|
||||
@@ -3596,7 +3622,6 @@ public class OvsdbDao {
|
||||
.of(connectionCapabilities);
|
||||
rowColumns.put("connection_capability", connectionCapabilitySet);
|
||||
|
||||
|
||||
Set<Atom<String>> venueNames = new HashSet<>();
|
||||
Set<Atom<String>> venueUrls = new HashSet<>();
|
||||
int index = 1;
|
||||
@@ -3617,7 +3642,6 @@ public class OvsdbDao {
|
||||
String groupType = String.valueOf(venueTypeAssignment.getVenueGroupId()) + ":"
|
||||
+ venueTypeAssignment.getVenueTypeId();
|
||||
|
||||
|
||||
rowColumns.put("venue_group_type", new Atom<>(groupType));
|
||||
|
||||
// # format: <1-octet encoded value as hex str>
|
||||
@@ -3638,7 +3662,6 @@ public class OvsdbDao {
|
||||
rowColumns.put("ipaddr_type_availability", new Atom<>(hexString));
|
||||
}
|
||||
|
||||
|
||||
Map<String, WifiVifConfigInfo> vifConfigMap = getProvisionedWifiVifConfigs(ovsdbClient);
|
||||
|
||||
Set<Uuid> vifConfigs = new HashSet<>();
|
||||
@@ -3653,7 +3676,6 @@ public class OvsdbDao {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
List<String> vifStates = getWifiVifStates(ovsdbClient, ssid);
|
||||
for (String mac : vifStates) {
|
||||
hessids.add(new Atom<>(mac));
|
||||
@@ -3676,17 +3698,14 @@ public class OvsdbDao {
|
||||
|
||||
Row row = new Row(rowColumns);
|
||||
|
||||
|
||||
Insert newHs20Config = new Insert(hotspot20ConfigDbTable, row);
|
||||
|
||||
operations.add(newHs20Config);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
@@ -3696,7 +3715,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
LOG.info("Current Hotspot20_Config {}", hotspot20ConfigMap);
|
||||
} else {
|
||||
LOG.info("Table {} not present in {}. Cannot provision Hotspot20_Config", hotspot20ConfigDbTable,
|
||||
@@ -3720,7 +3738,6 @@ public class OvsdbDao {
|
||||
Set<Operation> operations = new HashSet<>();
|
||||
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
|
||||
|
||||
|
||||
for (Profile provider : hs20cfg.getHotspot20ProviderSet()) {
|
||||
Hotspot20IdProviderProfile providerProfile = (Hotspot20IdProviderProfile) provider.getDetails();
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
@@ -3757,7 +3774,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (operations.size() > 0) {
|
||||
@@ -3779,10 +3795,8 @@ public class OvsdbDao {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void getOsuProviderServiceDescriptions(Hotspot20IdProviderProfile providerProfile,
|
||||
Map<String, Value> rowColumns) {
|
||||
Set<Atom<String>> serviceDescriptions = new HashSet<>();
|
||||
@@ -3797,7 +3811,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void getOsuProviderMethodList(Hotspot20IdProviderProfile providerProfile, Map<String, Value> rowColumns) {
|
||||
Set<Atom<Integer>> methods = new HashSet<>();
|
||||
for (Integer method : providerProfile.getOsuMethodList()) {
|
||||
@@ -3810,7 +3823,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void getOsuProviderFriendlyNames(Hotspot20IdProviderProfile providerProfile,
|
||||
Map<String, Value> rowColumns) {
|
||||
Set<Atom<String>> providerFriendlyNames = new HashSet<>();
|
||||
@@ -3825,7 +3837,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void getOsuIconUuidsForOsuProvider(OvsdbClient ovsdbClient, Hotspot20IdProviderProfile providerProfile,
|
||||
Map<String, Value> rowColumns) {
|
||||
Map<String, Hotspot20IconConfig> osuIconsMap = getProvisionedHotspot20IconConfig(ovsdbClient);
|
||||
@@ -3845,7 +3856,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void getNaiRealms(Hotspot20IdProviderProfile providerProfile, Set<Atom<String>> naiRealms) {
|
||||
providerProfile.getNaiRealmList().stream().forEach(c -> {
|
||||
|
||||
@@ -3902,12 +3912,10 @@ public class OvsdbDao {
|
||||
naiBuffer.append(valueId);
|
||||
naiBuffer.append("]");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
naiBuffer.append(",");
|
||||
|
||||
|
||||
});
|
||||
String naiRealm = naiBuffer.toString();
|
||||
if (naiRealm.endsWith(",")) {
|
||||
@@ -3915,13 +3923,10 @@ public class OvsdbDao {
|
||||
}
|
||||
naiRealms.add(new Atom<String>(naiRealm));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void provisionHotspot2IconConfig(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
|
||||
@@ -3935,7 +3940,6 @@ public class OvsdbDao {
|
||||
Set<Operation> operations = new HashSet<>();
|
||||
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
|
||||
|
||||
|
||||
for (Profile provider : hs20cfg.getHotspot20ProviderSet()) {
|
||||
Hotspot20IdProviderProfile providerProfile = (Hotspot20IdProviderProfile) provider.getDetails();
|
||||
for (OsuIcon osuIcon : providerProfile.getOsuIconList()) {
|
||||
@@ -3968,7 +3972,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (operations.size() > 0) {
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName,
|
||||
@@ -3989,7 +3992,6 @@ public class OvsdbDao {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void removeAllHotspot20Config(OvsdbClient ovsdbClient) {
|
||||
@@ -4017,7 +4019,6 @@ public class OvsdbDao {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void removeAllHotspot20OsuProviders(OvsdbClient ovsdbClient) {
|
||||
@@ -4045,7 +4046,6 @@ public class OvsdbDao {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void removeAllHotspot20IconConfig(OvsdbClient ovsdbClient) {
|
||||
@@ -4077,7 +4077,6 @@ public class OvsdbDao {
|
||||
|
||||
public void configureStatsFromProfile(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
|
||||
|
||||
|
||||
if (opensyncApConfig.getMetricsProfiles() == null || opensyncApConfig.getMetricsProfiles().isEmpty()) {
|
||||
configureStats(ovsdbClient);
|
||||
} else {
|
||||
@@ -4086,22 +4085,18 @@ public class OvsdbDao {
|
||||
|
||||
for (Profile metricsProfile : opensyncApConfig.getMetricsProfiles()) {
|
||||
|
||||
|
||||
ServiceMetricsCollectionConfigProfile details = ((ServiceMetricsCollectionConfigProfile) metricsProfile
|
||||
.getDetails());
|
||||
|
||||
for (ServiceMetricDataType dataType : details.getMetricConfigParameterMap().keySet()) {
|
||||
|
||||
|
||||
if (dataType.equals(ServiceMetricDataType.ApNode)
|
||||
|| dataType.equals(ServiceMetricDataType.Neighbour)
|
||||
|| dataType.equals(ServiceMetricDataType.Channel)) {
|
||||
|
||||
|
||||
details.getMetricConfigParameterMap().get(dataType).stream().forEach(c -> {
|
||||
ServiceMetricSurveyConfigParameters parameters = (ServiceMetricSurveyConfigParameters) c;
|
||||
|
||||
|
||||
Map<String, Integer> thresholdMap = new HashMap<>();
|
||||
thresholdMap.put("max_delay", parameters.getDelayMillisecondsThreshold());
|
||||
thresholdMap.put("util", parameters.getPercentUtilizationThreshold());
|
||||
@@ -4110,7 +4105,6 @@ public class OvsdbDao {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(thresholdMap);
|
||||
|
||||
|
||||
RadioType radioType = parameters.getRadioType();
|
||||
ChannelUtilizationSurveyType channelType = parameters.getChannelSurveyType();
|
||||
int scanInterval = parameters.getScanIntervalMillis();
|
||||
@@ -4136,7 +4130,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else if (dataType.equals(ServiceMetricDataType.Neighbour)) {
|
||||
provisionWifiStatsConfigFromProfile("neighbor", getAllowedChannels(ovsdbClient),
|
||||
@@ -4144,10 +4137,8 @@ public class OvsdbDao {
|
||||
samplingInterval, operations, thresholds);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
} else if (dataType.equals(ServiceMetricDataType.ApSsid)
|
||||
|| dataType.equals(ServiceMetricDataType.Client)) {
|
||||
details.getMetricConfigParameterMap().get(dataType).stream().forEach(c -> {
|
||||
@@ -4160,9 +4151,8 @@ public class OvsdbDao {
|
||||
provisionWifiStatsConfigFromProfile("client", radioType, reportingInterval,
|
||||
samplingInterval, operations);
|
||||
|
||||
provisionWifiStatsConfigFromProfile("event",
|
||||
reportingInterval,
|
||||
samplingInterval, operations);
|
||||
provisionWifiStatsConfigFromProfile("event", reportingInterval, samplingInterval,
|
||||
operations);
|
||||
|
||||
provisionWifiStatsConfigFromProfile("video_voice", reportingInterval, samplingInterval,
|
||||
operations);
|
||||
@@ -4184,10 +4174,8 @@ public class OvsdbDao {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!operations.isEmpty()) {
|
||||
@@ -4209,16 +4197,13 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void provisionWifiStatsConfigFromProfile(String statsType, RadioType radioType, int reportingInterval,
|
||||
int samplingInterval, List<Operation> operations) {
|
||||
|
||||
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
rowColumns.put("radio_type",
|
||||
new Atom<>(OvsdbToWlanCloudTypeMappingUtility.getOvsdbRadioFreqBandForRadioType(radioType)));
|
||||
@@ -4234,13 +4219,11 @@ public class OvsdbDao {
|
||||
operations.add(newStatConfig);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void provisionWifiStatsConfigFromProfile(String statsType, int reportingInterval, int samplingInterval,
|
||||
List<Operation> operations) {
|
||||
|
||||
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
rowColumns.put("radio_type", new Atom<>(OvsdbStringConstants.OVSDB_FREQ_BAND_2pt4G));
|
||||
rowColumns.put("reporting_interval", new Atom<>(reportingInterval));
|
||||
@@ -4256,16 +4239,13 @@ public class OvsdbDao {
|
||||
operations.add(newStatConfig);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void provisionWifiStatsConfigFromProfile(String statsType, Map<String, Set<Integer>> allowedChannels,
|
||||
RadioType radioType, ChannelUtilizationSurveyType channelType, int scanInterval, StatsReportFormat format,
|
||||
int reportingInterval, int samplingInterval, List<Operation> operations,
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) {
|
||||
|
||||
|
||||
if (channelType.equals(ChannelUtilizationSurveyType.ON_CHANNEL)) {
|
||||
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
@@ -4288,7 +4268,6 @@ public class OvsdbDao {
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(allowedChannels
|
||||
@@ -4316,7 +4295,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -4340,7 +4318,6 @@ public class OvsdbDao {
|
||||
provisionWifiStatsConfigNeighbor(getAllowedChannels(ovsdbClient), radioConfigs,
|
||||
getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||
|
||||
|
||||
provisionWifiStatsConfigClient(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||
|
||||
if (!operations.isEmpty()) {
|
||||
@@ -4694,7 +4671,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void removeAllStatsConfigs(OvsdbClient ovsdbClient) {
|
||||
@@ -4757,28 +4733,32 @@ public class OvsdbDao {
|
||||
rfElementConfig.getRxCellSizeDb(), elementRadioConfig.getRxCellSizeDb().getValue());
|
||||
|
||||
probeResponseThresholdDb = getSourcedValue(elementRadioConfig.getProbeResponseThresholdDb().getSource(),
|
||||
rfElementConfig.getProbeResponseThresholdDb(), elementRadioConfig.getProbeResponseThresholdDb().getValue());
|
||||
rfElementConfig.getProbeResponseThresholdDb(),
|
||||
elementRadioConfig.getProbeResponseThresholdDb().getValue());
|
||||
|
||||
clientDisconnectThresholdDb = getSourcedValue(elementRadioConfig.getClientDisconnectThresholdDb().getSource(),
|
||||
rfElementConfig.getClientDisconnectThresholdDb(), elementRadioConfig.getClientDisconnectThresholdDb().getValue());
|
||||
clientDisconnectThresholdDb = getSourcedValue(
|
||||
elementRadioConfig.getClientDisconnectThresholdDb().getSource(),
|
||||
rfElementConfig.getClientDisconnectThresholdDb(),
|
||||
elementRadioConfig.getClientDisconnectThresholdDb().getValue());
|
||||
}
|
||||
|
||||
RadioConfiguration radioConfig = apElementConfig.getAdvancedRadioMap().get(radioType);
|
||||
ManagementRate managementRate = null;
|
||||
RadioBestApSettings bestApSettings = null;
|
||||
if (radioConfig != null && rfElementConfig != null) {
|
||||
managementRate = radioConfig.getManagementRate().getSource() == SourceType.profile ?
|
||||
rfElementConfig.getManagementRate() : radioConfig.getManagementRate().getValue();
|
||||
managementRate = radioConfig.getManagementRate().getSource() == SourceType.profile
|
||||
? rfElementConfig.getManagementRate()
|
||||
: radioConfig.getManagementRate().getValue();
|
||||
|
||||
bestApSettings = radioConfig.getBestApSettings().getSource() == SourceType.profile ?
|
||||
rfElementConfig.getBestApSettings() : radioConfig.getBestApSettings().getValue();
|
||||
bestApSettings = radioConfig.getBestApSettings().getSource() == SourceType.profile
|
||||
? rfElementConfig.getBestApSettings()
|
||||
: radioConfig.getBestApSettings().getValue();
|
||||
}
|
||||
|
||||
if (freqBand != null) {
|
||||
try {
|
||||
configureWifiRrm(ovsdbClient, freqBand, elementRadioConfig.getBackupChannelNumber(),
|
||||
rxCellSizeDb, probeResponseThresholdDb, clientDisconnectThresholdDb,
|
||||
managementRate, bestApSettings);
|
||||
configureWifiRrm(ovsdbClient, freqBand, elementRadioConfig.getBackupChannelNumber(), rxCellSizeDb,
|
||||
probeResponseThresholdDb, clientDisconnectThresholdDb, managementRate, bestApSettings);
|
||||
} catch (OvsdbClientException e) {
|
||||
LOG.error("configureRrm failed with OvsdbClient exception.", e);
|
||||
throw new RuntimeException(e);
|
||||
@@ -4893,7 +4873,6 @@ public class OvsdbDao {
|
||||
try {
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
|
||||
|
||||
channelMap.entrySet().stream().forEach(c -> {
|
||||
String freqBand = OvsdbToWlanCloudTypeMappingUtility.getOvsdbRadioFreqBandForRadioType(c.getKey());
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
@@ -4904,7 +4883,6 @@ public class OvsdbDao {
|
||||
operations.add(new Update(wifiRrmConfigDbTable, conditions, row));
|
||||
});
|
||||
|
||||
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
@@ -4925,7 +4903,6 @@ public class OvsdbDao {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public AutoOrManualValue getSourcedValue(SourceType source, int profileValue, int equipmentValue) {
|
||||
|
||||
Reference in New Issue
Block a user