mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-22 12:55:02 +00:00
WIFI-1084: Opensync Gateway occasionally creates new Ssid with existing if_name
This commit is contained in:
@@ -66,10 +66,10 @@ import com.telecominfraproject.wlan.profile.bonjour.models.BonjourGatewayProfile
|
|||||||
import com.telecominfraproject.wlan.profile.bonjour.models.BonjourServiceSet;
|
import com.telecominfraproject.wlan.profile.bonjour.models.BonjourServiceSet;
|
||||||
import com.telecominfraproject.wlan.profile.captiveportal.models.CaptivePortalAuthenticationType;
|
import com.telecominfraproject.wlan.profile.captiveportal.models.CaptivePortalAuthenticationType;
|
||||||
import com.telecominfraproject.wlan.profile.captiveportal.models.CaptivePortalConfiguration;
|
import com.telecominfraproject.wlan.profile.captiveportal.models.CaptivePortalConfiguration;
|
||||||
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricsChannelUtilizationSurveyType;
|
|
||||||
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricConfigParameters;
|
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricConfigParameters;
|
||||||
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricRadioConfigParameters;
|
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricRadioConfigParameters;
|
||||||
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricSurveyConfigParameters;
|
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricSurveyConfigParameters;
|
||||||
|
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricsChannelUtilizationSurveyType;
|
||||||
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricsCollectionConfigProfile;
|
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricsCollectionConfigProfile;
|
||||||
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricsStatsReportFormat;
|
import com.telecominfraproject.wlan.profile.metrics.ServiceMetricsStatsReportFormat;
|
||||||
import com.telecominfraproject.wlan.profile.models.Profile;
|
import com.telecominfraproject.wlan.profile.models.Profile;
|
||||||
@@ -87,8 +87,8 @@ import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointN
|
|||||||
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointNaiRealmEapCredType;
|
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointNaiRealmEapCredType;
|
||||||
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuIcon;
|
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuIcon;
|
||||||
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuProviderProfile;
|
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuProviderProfile;
|
||||||
import com.telecominfraproject.wlan.profile.passpoint.models.venue.PasspointVenueProfile;
|
|
||||||
import com.telecominfraproject.wlan.profile.passpoint.models.venue.PasspointVenueName;
|
import com.telecominfraproject.wlan.profile.passpoint.models.venue.PasspointVenueName;
|
||||||
|
import com.telecominfraproject.wlan.profile.passpoint.models.venue.PasspointVenueProfile;
|
||||||
import com.telecominfraproject.wlan.profile.passpoint.models.venue.ProfileVenueTypeAssignment;
|
import com.telecominfraproject.wlan.profile.passpoint.models.venue.ProfileVenueTypeAssignment;
|
||||||
import com.telecominfraproject.wlan.profile.radius.models.RadiusProfile;
|
import com.telecominfraproject.wlan.profile.radius.models.RadiusProfile;
|
||||||
import com.telecominfraproject.wlan.profile.radius.models.RadiusServer;
|
import com.telecominfraproject.wlan.profile.radius.models.RadiusServer;
|
||||||
@@ -103,15 +103,12 @@ import com.vmware.ovsdb.protocol.methods.TableUpdate;
|
|||||||
import com.vmware.ovsdb.protocol.methods.TableUpdates;
|
import com.vmware.ovsdb.protocol.methods.TableUpdates;
|
||||||
import com.vmware.ovsdb.protocol.operation.Delete;
|
import com.vmware.ovsdb.protocol.operation.Delete;
|
||||||
import com.vmware.ovsdb.protocol.operation.Insert;
|
import com.vmware.ovsdb.protocol.operation.Insert;
|
||||||
import com.vmware.ovsdb.protocol.operation.Mutate;
|
|
||||||
import com.vmware.ovsdb.protocol.operation.Operation;
|
import com.vmware.ovsdb.protocol.operation.Operation;
|
||||||
import com.vmware.ovsdb.protocol.operation.Select;
|
import com.vmware.ovsdb.protocol.operation.Select;
|
||||||
import com.vmware.ovsdb.protocol.operation.Update;
|
import com.vmware.ovsdb.protocol.operation.Update;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Atom;
|
import com.vmware.ovsdb.protocol.operation.notation.Atom;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Condition;
|
import com.vmware.ovsdb.protocol.operation.notation.Condition;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Function;
|
import com.vmware.ovsdb.protocol.operation.notation.Function;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Mutation;
|
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Mutator;
|
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Row;
|
import com.vmware.ovsdb.protocol.operation.notation.Row;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
|
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Value;
|
import com.vmware.ovsdb.protocol.operation.notation.Value;
|
||||||
@@ -126,6 +123,8 @@ import com.vmware.ovsdb.service.OvsdbClient;
|
|||||||
@Component
|
@Component
|
||||||
public class OvsdbDao {
|
public class OvsdbDao {
|
||||||
|
|
||||||
|
private static final int MAX_VIF_PER_FREQ = 8;
|
||||||
|
|
||||||
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";
|
||||||
@@ -1758,79 +1757,85 @@ public class OvsdbDao {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAllSsids(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) {
|
public void removeAllSsids(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) {
|
||||||
Map<String, WifiVifConfigInfo> currentWifiVifConfigInfo = getProvisionedWifiVifConfigs(ovsdbClient);
|
|
||||||
Map<String, WifiRadioConfigInfo> currentWifiRadioConfigInfo = getProvisionedWifiRadioConfigs(ovsdbClient);
|
|
||||||
List<WifiVifConfigInfo> vifConfigsToDelete = new ArrayList<>();
|
|
||||||
|
|
||||||
// This is essentially a cleanup call, if there are multiple same ssid's
|
|
||||||
// under a single radio we will remove them, and re-create them only
|
|
||||||
// according to the profiles
|
|
||||||
Map<String, WifiVifConfigInfo> vifConfigsBySsid = new HashMap<>();
|
|
||||||
currentWifiVifConfigInfo.entrySet().stream().forEach(e -> {
|
|
||||||
if (vifConfigsBySsid.containsKey(e.getValue().ssid)) {
|
|
||||||
vifConfigsToDelete.add(e.getValue());
|
|
||||||
vifConfigsToDelete.add(vifConfigsBySsid.get(e.getValue().ssid));
|
|
||||||
} else {
|
|
||||||
vifConfigsBySsid.put(e.getKey(), e.getValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
LOG.debug("VifConfigs by SSID {}", vifConfigsBySsid);
|
|
||||||
LOG.debug("vifConfigsToDelete {}", vifConfigsToDelete);
|
|
||||||
// Now add any VIFs we have configurations for that are not in the new
|
|
||||||
// Profiles to the delete list
|
|
||||||
for (Entry<String, WifiVifConfigInfo> vifConfigInfo : currentWifiVifConfigInfo.entrySet()) {
|
|
||||||
LOG.debug("Checking {}", vifConfigInfo.getKey());
|
|
||||||
WifiRadioConfigInfo radioConfigInfo = null;
|
|
||||||
if (vifConfigInfo.getValue().ifName.startsWith(defaultRadio0)) {
|
|
||||||
radioConfigInfo = currentWifiRadioConfigInfo.get(radio0);
|
|
||||||
} else if (vifConfigInfo.getValue().ifName.startsWith(defaultRadio1)) {
|
|
||||||
radioConfigInfo = currentWifiRadioConfigInfo.get(radio1);
|
|
||||||
} else if (vifConfigInfo.getValue().ifName.startsWith(defaultRadio2)) {
|
|
||||||
radioConfigInfo = currentWifiRadioConfigInfo.get(radio2);
|
|
||||||
}
|
|
||||||
boolean delete = true;
|
|
||||||
if (radioConfigInfo != null) {
|
|
||||||
final String freqBand = radioConfigInfo.freqBand;
|
|
||||||
if (radioConfigInfo.vifConfigUuids.contains(vifConfigInfo.getValue().uuid)) {
|
|
||||||
if (opensyncAPConfig.getSsidProfile().stream().anyMatch(new Predicate<Profile>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean test(Profile t) {
|
|
||||||
SsidConfiguration ssidConfig = (SsidConfiguration) t.getDetails();
|
|
||||||
return (ssidConfig.getSsid().equals(vifConfigInfo.getValue().ssid))
|
|
||||||
&& (ssidConfig.getAppliedRadios().contains(OvsdbToWlanCloudTypeMappingUtility
|
|
||||||
.getRadioTypeForOvsdbRadioFreqBand(freqBand)));
|
|
||||||
}
|
|
||||||
|
|
||||||
})) {
|
|
||||||
delete = false;
|
|
||||||
LOG.debug("Do not delete vif {}", vifConfigInfo.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (delete) {
|
|
||||||
vifConfigsToDelete.add(vifConfigInfo.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG.debug("The following VIFs should be deleted {}", vifConfigsToDelete);
|
|
||||||
|
|
||||||
|
|
||||||
|
final Map<String, WifiVifConfigInfo> currentWifiVifConfigInfo = getProvisionedWifiVifConfigs(ovsdbClient);
|
||||||
|
final Map<String, WifiRadioConfigInfo> currentWifiRadioConfigInfo = getProvisionedWifiRadioConfigs(ovsdbClient);
|
||||||
|
Map<RadioType, String> ifNameByFreqBand = new HashMap<>();
|
||||||
|
Set<String> keysToKeep = new HashSet<>();
|
||||||
|
Set<Integer> vlansToKeep = new HashSet<>();
|
||||||
|
List<String> vifConfigsToDelete = new ArrayList<>();
|
||||||
List<Operation> operations = new ArrayList<>();
|
List<Operation> operations = new ArrayList<>();
|
||||||
|
|
||||||
for (WifiVifConfigInfo vifConfigInfo : vifConfigsToDelete) {
|
for (WifiRadioConfigInfo radioConfig : currentWifiRadioConfigInfo.values()) {
|
||||||
List<Condition> conditions = new ArrayList<>();
|
|
||||||
conditions.add(new Condition("ssid", Function.EQUALS, new Atom<>(vifConfigInfo.ssid)));
|
|
||||||
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(vifConfigInfo.ifName)));
|
|
||||||
|
|
||||||
|
RadioType key = OvsdbToWlanCloudTypeMappingUtility.getRadioTypeForOvsdbRadioFreqBand(radioConfig.freqBand);
|
||||||
|
String ifName = null;
|
||||||
|
|
||||||
|
if (radioConfig.ifName.equals(radio0)) {
|
||||||
|
ifName = defaultRadio0;
|
||||||
|
} else if (radioConfig.ifName.equals(radio1)) {
|
||||||
|
ifName = defaultRadio1;
|
||||||
|
} else if (radioConfig.ifName.equals(radio2)) {
|
||||||
|
ifName = defaultRadio2;
|
||||||
|
}
|
||||||
|
if (ifName == null) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Invalid radio if_name " + radioConfig.ifName + " reported for " + radioConfig.freqBand);
|
||||||
|
}
|
||||||
|
|
||||||
|
ifNameByFreqBand.put(key, ifName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
opensyncAPConfig.getSsidProfile().stream().forEach(p -> {
|
||||||
|
SsidConfiguration ssidConfig = (SsidConfiguration) p.getDetails();
|
||||||
|
String ssid = ssidConfig.getSsid();
|
||||||
|
Set<RadioType> appliedRadios = ssidConfig.getAppliedRadios();
|
||||||
|
|
||||||
|
if (ssidConfig.getVlanId() != null && ssidConfig.getVlanId() > 1) {
|
||||||
|
vlansToKeep.add(ssidConfig.getVlanId());
|
||||||
|
}
|
||||||
|
|
||||||
|
keysToKeep.addAll(currentWifiVifConfigInfo.keySet().stream().filter(new Predicate<String>() {
|
||||||
|
@Override
|
||||||
|
public boolean test(String t) {
|
||||||
|
|
||||||
|
return t.contains(ssid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}).filter(new Predicate<String>() {
|
||||||
|
@Override
|
||||||
|
public boolean test(String t) {
|
||||||
|
|
||||||
|
for (RadioType radioType : appliedRadios) {
|
||||||
|
if (t.contains(ifNameByFreqBand.get(radioType))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toSet()));
|
||||||
|
});
|
||||||
|
|
||||||
|
for (String vifConfigKey : currentWifiVifConfigInfo.keySet()) {
|
||||||
|
if (!keysToKeep.contains(vifConfigKey)) {
|
||||||
|
vifConfigsToDelete.add(currentWifiVifConfigInfo.get(vifConfigKey).ifName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String interfaceName : vifConfigsToDelete) {
|
||||||
|
List<Condition> conditions = new ArrayList<>();
|
||||||
|
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(interfaceName)));
|
||||||
operations.add(new Delete(wifiVifConfigDbTable, conditions));
|
operations.add(new Delete(wifiVifConfigDbTable, conditions));
|
||||||
|
operations.add(new Delete(wifiInetConfigDbTable, conditions));
|
||||||
|
LOG.info("Vif {} to be deleted from {} and {} ovsdb tables", interfaceName, wifiVifConfigDbTable,
|
||||||
|
wifiInetConfigDbTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1838,36 +1843,23 @@ public class OvsdbDao {
|
|||||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Removed SSIDs no longer in use from {}:", wifiVifConfigDbTable);
|
LOG.info("Removed VIF and Inet Configurations no longer in use from {} and {}", wifiVifConfigDbTable,
|
||||||
|
wifiInetConfigDbTable);
|
||||||
|
|
||||||
for (OperationResult res : result) {
|
for (OperationResult res : result) {
|
||||||
LOG.debug("Op Result {}", res);
|
LOG.info("Op Result {}", res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the new list of configured VIFs (these are what remain after
|
|
||||||
// the deletes)
|
|
||||||
// we want to see if any of these VIFs has a Vlan that we want to
|
|
||||||
// save if that Vlan was also used by other VIFs that have been
|
|
||||||
// deleted
|
|
||||||
currentWifiVifConfigInfo = getProvisionedWifiVifConfigs(ovsdbClient);
|
|
||||||
Set<Integer> configuredVlanIds = new HashSet<>();
|
|
||||||
for (WifiVifConfigInfo vifConfig : currentWifiVifConfigInfo.values()) {
|
|
||||||
if (vifConfig.vlanId > 1)
|
|
||||||
configuredVlanIds.add(vifConfig.vlanId);
|
|
||||||
}
|
|
||||||
operations = new ArrayList<>();
|
operations = new ArrayList<>();
|
||||||
// Add if_names from the vifs to delete, and from any vlans not in
|
// Add if_names from the vifs to delete, and from any vlans not in
|
||||||
// the configuredVlanId list above
|
// the configuredVlanId list above
|
||||||
for (WifiVifConfigInfo vifConfigInfo : vifConfigsToDelete) {
|
for (WifiInetConfigInfo inetConfigInfo : getProvisionedWifiInetConfigs(ovsdbClient).values()) {
|
||||||
|
if (inetConfigInfo.vlanId > 1 && !vlansToKeep.contains(inetConfigInfo.vlanId)) {
|
||||||
List<Condition> conditions = new ArrayList<>();
|
List<Condition> conditions = new ArrayList<>();
|
||||||
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(vifConfigInfo.ifName)));
|
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(inetConfigInfo.ifName)));
|
||||||
operations.add(new Delete(wifiInetConfigDbTable, conditions));
|
|
||||||
// remove any vlans that are no longer used by other vif configs
|
|
||||||
if (vifConfigInfo.vlanId > 1 && !configuredVlanIds.contains(vifConfigInfo.vlanId)) {
|
|
||||||
conditions = new ArrayList<>();
|
|
||||||
conditions.add(new Condition("vlan_id", Function.EQUALS, new Atom<>(vifConfigInfo.vlanId)));
|
|
||||||
operations.add(new Delete(wifiInetConfigDbTable, conditions));
|
operations.add(new Delete(wifiInetConfigDbTable, conditions));
|
||||||
|
LOG.info("Vlan {} to be deleted from {} ovsdb table", inetConfigInfo.ifName, wifiInetConfigDbTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1875,20 +1867,18 @@ public class OvsdbDao {
|
|||||||
result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Removed existing InetConfigs from {}:", wifiInetConfigDbTable);
|
LOG.info("Removed vlan interfaces no longer in use from {} ", wifiInetConfigDbTable);
|
||||||
|
|
||||||
for (OperationResult res : result) {
|
for (OperationResult res : result) {
|
||||||
LOG.debug("Op Result {}", res);
|
LOG.info("Op Result {}", res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (OvsdbClientException | InterruptedException | ExecutionException | TimeoutException e) {
|
} catch (OvsdbClientException | InterruptedException | ExecutionException | TimeoutException e) {
|
||||||
LOG.error("Error in removeAllSsids", e);
|
LOG.error("Error in removeAllSsids", e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAllSsids(OvsdbClient ovsdbClient) {
|
public void removeAllSsids(OvsdbClient ovsdbClient) {
|
||||||
@@ -1953,6 +1943,37 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeInvalidInterfaceConfigurations(OvsdbClient ovsdbClient, List<String> invalidInterfaces) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<Operation> operations = new ArrayList<>();
|
||||||
|
|
||||||
|
operations = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String invalidInterface : invalidInterfaces) {
|
||||||
|
List<Condition> conditions = new ArrayList<>();
|
||||||
|
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(invalidInterface)));
|
||||||
|
operations.add(new Delete(wifiInetConfigDbTable, conditions));
|
||||||
|
operations.add(new Delete(wifiVifConfigDbTable, conditions));
|
||||||
|
}
|
||||||
|
|
||||||
|
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
|
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Removed all existing vif interfaces configs from {}:", wifiInetConfigDbTable);
|
||||||
|
|
||||||
|
for (OperationResult res : result) {
|
||||||
|
LOG.debug("Op Result {}", res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (OvsdbClientException | InterruptedException | ExecutionException | TimeoutException e) {
|
||||||
|
LOG.error("Error removing invalid interfaces", e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void removeAllPasspointConfigs(OvsdbClient ovsdbClient) {
|
public void removeAllPasspointConfigs(OvsdbClient ovsdbClient) {
|
||||||
removeAllHotspot20Config(ovsdbClient);
|
removeAllHotspot20Config(ovsdbClient);
|
||||||
removeAllHotspot20OsuProviders(ovsdbClient);
|
removeAllHotspot20OsuProviders(ovsdbClient);
|
||||||
@@ -2787,7 +2808,6 @@ public class OvsdbDao {
|
|||||||
updateBlockList(updateColumns, macBlockList);
|
updateBlockList(updateColumns, macBlockList);
|
||||||
Row row = new Row(updateColumns);
|
Row row = new Row(updateColumns);
|
||||||
|
|
||||||
|
|
||||||
//////
|
//////
|
||||||
|
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
@@ -2803,7 +2823,6 @@ public class OvsdbDao {
|
|||||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
for (OperationResult res : result) {
|
for (OperationResult res : result) {
|
||||||
LOG.debug("Op Result {}", res);
|
LOG.debug("Op Result {}", res);
|
||||||
@@ -2822,7 +2841,6 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
updateColumns.clear();
|
updateColumns.clear();
|
||||||
operations.clear();
|
operations.clear();
|
||||||
updateVifConfigsSetForRadio(ovsdbClient, ssid, radioFreqBand, operations, updateColumns, vifConfigUuid);
|
|
||||||
LOG.info("Provisioned SSID {} on interface {} / {}", ssid, vifInterfaceName, radioFreqBand);
|
LOG.info("Provisioned SSID {} on interface {} / {}", ssid, vifInterfaceName, radioFreqBand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2891,68 +2909,6 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVifConfigsSetForRadio(OvsdbClient ovsdbClient, String ssid, String radioFreqBand,
|
|
||||||
List<Operation> operations, Map<String, Value> updateColumns, Uuid vifConfigUuid)
|
|
||||||
throws OvsdbClientException, InterruptedException, ExecutionException, TimeoutException {
|
|
||||||
// Row row;
|
|
||||||
// CompletableFuture<OperationResult[]> fResult;
|
|
||||||
// OperationResult[] result;
|
|
||||||
List<Condition> conditions = new ArrayList<>();
|
|
||||||
conditions.add(new Condition("freq_band", Function.EQUALS, new Atom<>(radioFreqBand)));
|
|
||||||
|
|
||||||
// List<String> columns = new ArrayList<>();
|
|
||||||
// columns.add("vif_configs");
|
|
||||||
// operations.add(new Select(wifiRadioConfigDbTable, conditions,
|
|
||||||
// columns));
|
|
||||||
// fResult = ovsdbClient.transact(ovsdbName, operations);
|
|
||||||
// result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
|
||||||
//
|
|
||||||
// Set<Uuid> vifConfigsSet = new HashSet<>();
|
|
||||||
//
|
|
||||||
// if ((result != null) && (result.length > 0) && !((SelectResult)
|
|
||||||
// result[0]).getRows().isEmpty()) {
|
|
||||||
// row = ((SelectResult) result[0]).getRows().iterator().next();
|
|
||||||
// if (row != null) {
|
|
||||||
// vifConfigsSet = row.getSetColumn("vif_configs");
|
|
||||||
// if (vifConfigsSet == null) {
|
|
||||||
// vifConfigsSet = new HashSet<>();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (vifConfigUuid != null) {
|
|
||||||
// vifConfigsSet.add(vifConfigUuid);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// com.vmware.ovsdb.protocol.operation.notation.Set vifConfigs =
|
|
||||||
// com.vmware.ovsdb.protocol.operation.notation.Set
|
|
||||||
// .of(vifConfigsSet);
|
|
||||||
//
|
|
||||||
// updateColumns.put("vif_configs", vifConfigs);
|
|
||||||
//
|
|
||||||
// row = new Row(updateColumns);
|
|
||||||
|
|
||||||
List<Mutation> mutations = new ArrayList<>();
|
|
||||||
Mutation mutation = new Mutation("vif_configs", Mutator.INSERT, new Atom<>(vifConfigUuid));
|
|
||||||
mutations.add(mutation);
|
|
||||||
operations.add(new Mutate(wifiRadioConfigDbTable, conditions, mutations));
|
|
||||||
|
|
||||||
// operations.add(new Update(wifiRadioConfigDbTable, conditions, row));
|
|
||||||
|
|
||||||
LOG.debug("Sending batch of operations : {} ", operations);
|
|
||||||
|
|
||||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
|
||||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
|
||||||
LOG.debug("Updated WifiRadioConfig {} for SSID {}:", radioFreqBand, ssid);
|
|
||||||
|
|
||||||
for (OperationResult res : result) {
|
|
||||||
LOG.debug("Op Result {}", res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void configureSsids(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
|
public void configureSsids(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
|
||||||
|
|
||||||
boolean rrmEnabled = false;
|
boolean rrmEnabled = false;
|
||||||
@@ -3187,42 +3143,70 @@ public class OvsdbDao {
|
|||||||
boolean enabled = ssidConfig.getSsidAdminState().equals(StateSetting.enabled);
|
boolean enabled = ssidConfig.getSsidAdminState().equals(StateSetting.enabled);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
boolean isUpdate = false;
|
||||||
|
|
||||||
Map<String, WifiVifConfigInfo> provisionedVifs = getProvisionedWifiVifConfigs(ovsdbClient);
|
Map<String, WifiVifConfigInfo> provisionedVifs = getProvisionedWifiVifConfigs(ovsdbClient);
|
||||||
|
final String ifPrefix = ifName;
|
||||||
|
|
||||||
|
List<String> filteredKeyList = provisionedVifs.keySet().stream().filter(new Predicate<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean test(String t) {
|
||||||
|
LOG.info("Checking for Ssid {} in Key {}", ssidConfig.getSsid(), t);
|
||||||
|
return t.contains(ssidConfig.getSsid());
|
||||||
|
}
|
||||||
|
|
||||||
|
}).filter(new Predicate<String>() {
|
||||||
|
@Override
|
||||||
|
public boolean test(String t) {
|
||||||
|
LOG.info("Checking for ifPrefix {} in Key {}", ifPrefix, t);
|
||||||
|
return t.contains(ifPrefix);
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (filteredKeyList.size() > 1) {
|
||||||
|
LOG.warn(
|
||||||
|
"Current configuration has multiple interfaces present on the same frequency band with the same Ssid. This is invalid, deleting these configurations and re-creating.");
|
||||||
|
List<String> invalidIfNames = new ArrayList<>();
|
||||||
|
for (String key : filteredKeyList) {
|
||||||
|
invalidIfNames.add(provisionedVifs.get(key).ifName);
|
||||||
|
}
|
||||||
|
removeInvalidInterfaceConfigurations(ovsdbClient, invalidIfNames);
|
||||||
|
} else if (filteredKeyList.size() == 1) {
|
||||||
|
ifName = provisionedVifs.get(filteredKeyList.get(0)).ifName;
|
||||||
|
isUpdate = true;
|
||||||
|
LOG.info("Update pre-existing Wifi_VIF_Config for ssid {} with if_name {}",
|
||||||
|
ssidConfig.getSsid(), ifName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isUpdate) {
|
||||||
|
provisionedVifs = getProvisionedWifiVifConfigs(ovsdbClient);
|
||||||
|
|
||||||
List<String> interfaces = new ArrayList<>();
|
List<String> interfaces = new ArrayList<>();
|
||||||
interfaces.add(ifName);
|
interfaces.add(ifName);
|
||||||
for (int i = 1; i <= 7; ++i) {
|
for (int i = 1; i < MAX_VIF_PER_FREQ; i++) {
|
||||||
interfaces.add(ifName + "_" + Integer.toString(i));
|
interfaces.add(ifName + "_" + Integer.toString(i));
|
||||||
}
|
}
|
||||||
for (String key : provisionedVifs.keySet()) {
|
for (String key : provisionedVifs.keySet()) {
|
||||||
if (key.contains(ifName)) {
|
if (key.contains(ifName)) {
|
||||||
interfaces.remove(provisionedVifs.get(key).ifName);
|
String provisionedIfName = provisionedVifs.get(key).ifName;
|
||||||
|
if (interfaces.remove(provisionedIfName)) {
|
||||||
|
LOG.info(
|
||||||
|
"Interface {} already in use on Radio {}, cannot be used for new Wifi_VIF_Config.",
|
||||||
|
provisionedIfName, freqBand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isUpdate = false;
|
|
||||||
for (String key : provisionedVifs.keySet()) {
|
|
||||||
if (key.contains(ifName) && key.contains(ssidConfig.getSsid())) {
|
|
||||||
isUpdate = true;
|
|
||||||
ifName = provisionedVifs.get(key).ifName;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!isUpdate) {
|
|
||||||
if (interfaces.isEmpty()) {
|
if (interfaces.isEmpty()) {
|
||||||
// this cannot occur, log error, do not try to
|
throw new RuntimeException("No more available interfaces on AP "
|
||||||
// provision
|
+ opensyncApConfig.getCustomerEquipment().getName() + " for frequency band "
|
||||||
throw new IllegalStateException("Cannot provision more than " + maxInterfacesPerRadio
|
+ freqBand);
|
||||||
+ " interfaces per Wifi Radio");
|
|
||||||
} else {
|
} else {
|
||||||
// for a new interface, take the lowest available
|
// take the first available interface for this band
|
||||||
// interface for this radio type.
|
|
||||||
Collections.sort(interfaces);
|
|
||||||
LOG.debug("Available VIF Interfaces for freqBand {} sorted {}", freqBand, interfaces);
|
|
||||||
ifName = interfaces.get(0);
|
ifName = interfaces.get(0);
|
||||||
LOG.debug("Select ifName {} for new VIF on freqBand {} ", ifName, freqBand);
|
LOG.info("Configuring new Wifi_VIF_Config for ssid {} with if_name {}",
|
||||||
|
ssidConfig.getSsid(), ifName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3419,7 +3403,6 @@ public class OvsdbDao {
|
|||||||
private void getRadiusAccountingConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
private void getRadiusAccountingConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
||||||
Map<String, String> security) {
|
Map<String, String> security) {
|
||||||
|
|
||||||
|
|
||||||
LOG.debug("getRadiusAccountingConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig,
|
LOG.debug("getRadiusAccountingConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig,
|
||||||
opensyncApConfig.getRadiusProfiles());
|
opensyncApConfig.getRadiusProfiles());
|
||||||
|
|
||||||
@@ -3677,7 +3660,8 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
}).findFirst().get();
|
}).findFirst().get();
|
||||||
|
|
||||||
PasspointOperatorProfile passpointOperatorProfile = (PasspointOperatorProfile) operator.getDetails();
|
PasspointOperatorProfile passpointOperatorProfile = (PasspointOperatorProfile) operator
|
||||||
|
.getDetails();
|
||||||
|
|
||||||
Profile venue = hs20cfg.getHotspot20VenueSet().stream().filter(new Predicate<Profile>() {
|
Profile venue = hs20cfg.getHotspot20VenueSet().stream().filter(new Predicate<Profile>() {
|
||||||
|
|
||||||
@@ -3817,7 +3801,8 @@ public class OvsdbDao {
|
|||||||
rowColumns.put("venue_name", venueNameSet);
|
rowColumns.put("venue_name", venueNameSet);
|
||||||
rowColumns.put("venue_url", venueUrlSet);
|
rowColumns.put("venue_url", venueUrlSet);
|
||||||
|
|
||||||
ProfileVenueTypeAssignment profileVenueTypeAssignment = passpointVenueProfile.getVenueTypeAssignment();
|
ProfileVenueTypeAssignment profileVenueTypeAssignment = passpointVenueProfile
|
||||||
|
.getVenueTypeAssignment();
|
||||||
String groupType = String.valueOf(profileVenueTypeAssignment.getVenueGroupId()) + ":"
|
String groupType = String.valueOf(profileVenueTypeAssignment.getVenueGroupId()) + ":"
|
||||||
+ profileVenueTypeAssignment.getVenueTypeId();
|
+ profileVenueTypeAssignment.getVenueTypeId();
|
||||||
|
|
||||||
@@ -3918,7 +3903,8 @@ public class OvsdbDao {
|
|||||||
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
|
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
|
||||||
|
|
||||||
for (Profile provider : hs20cfg.getHotspot20ProviderSet()) {
|
for (Profile provider : hs20cfg.getHotspot20ProviderSet()) {
|
||||||
PasspointOsuProviderProfile providerProfile = (PasspointOsuProviderProfile) provider.getDetails();
|
PasspointOsuProviderProfile providerProfile = (PasspointOsuProviderProfile) provider
|
||||||
|
.getDetails();
|
||||||
Map<String, Value> rowColumns = new HashMap<>();
|
Map<String, Value> rowColumns = new HashMap<>();
|
||||||
rowColumns.put("osu_nai", new Atom<>(providerProfile.getOsuNaiStandalone()));
|
rowColumns.put("osu_nai", new Atom<>(providerProfile.getOsuNaiStandalone()));
|
||||||
// TODO: temporary check schema until AP has delivered
|
// TODO: temporary check schema until AP has delivered
|
||||||
@@ -3990,7 +3976,8 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void getOsuProviderMethodList(PasspointOsuProviderProfile providerProfile, Map<String, Value> rowColumns) {
|
protected void getOsuProviderMethodList(PasspointOsuProviderProfile providerProfile,
|
||||||
|
Map<String, Value> rowColumns) {
|
||||||
Set<Atom<Integer>> methods = new HashSet<>();
|
Set<Atom<Integer>> methods = new HashSet<>();
|
||||||
for (Integer method : providerProfile.getOsuMethodList()) {
|
for (Integer method : providerProfile.getOsuMethodList()) {
|
||||||
methods.add(new Atom<Integer>(method));
|
methods.add(new Atom<Integer>(method));
|
||||||
@@ -4069,9 +4056,11 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
String[] keyValue = credential.split(":");
|
String[] keyValue = credential.split(":");
|
||||||
String keyId = String.valueOf(PasspointNaiRealmEapAuthParam.getByName(keyValue[0]).getId());
|
String keyId = String.valueOf(PasspointNaiRealmEapAuthParam.getByName(keyValue[0]).getId());
|
||||||
if (keyValue[0].equals(PasspointNaiRealmEapAuthParam.NAI_REALM_EAP_AUTH_NON_EAP_INNER_AUTH.getName())) {
|
if (keyValue[0].equals(
|
||||||
|
PasspointNaiRealmEapAuthParam.NAI_REALM_EAP_AUTH_NON_EAP_INNER_AUTH.getName())) {
|
||||||
|
|
||||||
String valueId = String.valueOf(PasspointNaiRealmEapAuthInnerNonEap.getByName(keyValue[1]).getId());
|
String valueId = String
|
||||||
|
.valueOf(PasspointNaiRealmEapAuthInnerNonEap.getByName(keyValue[1]).getId());
|
||||||
|
|
||||||
naiBuffer.append("[");
|
naiBuffer.append("[");
|
||||||
naiBuffer.append(keyId);
|
naiBuffer.append(keyId);
|
||||||
@@ -4079,11 +4068,14 @@ public class OvsdbDao {
|
|||||||
naiBuffer.append(valueId);
|
naiBuffer.append(valueId);
|
||||||
naiBuffer.append("]");
|
naiBuffer.append("]");
|
||||||
|
|
||||||
} else if (keyValue[0].equals(PasspointNaiRealmEapAuthParam.NAI_REALM_EAP_AUTH_CRED_TYPE.getName())
|
} else if (keyValue[0]
|
||||||
|
.equals(PasspointNaiRealmEapAuthParam.NAI_REALM_EAP_AUTH_CRED_TYPE.getName())
|
||||||
|| keyValue[0]
|
|| keyValue[0]
|
||||||
.equals(PasspointNaiRealmEapAuthParam.NAI_REALM_EAP_AUTH_TUNNELED_CRED_TYPE.getName())) {
|
.equals(PasspointNaiRealmEapAuthParam.NAI_REALM_EAP_AUTH_TUNNELED_CRED_TYPE
|
||||||
|
.getName())) {
|
||||||
|
|
||||||
String valueId = String.valueOf(PasspointNaiRealmEapCredType.getByName(keyValue[1]).getId());
|
String valueId = String
|
||||||
|
.valueOf(PasspointNaiRealmEapCredType.getByName(keyValue[1]).getId());
|
||||||
|
|
||||||
naiBuffer.append("[");
|
naiBuffer.append("[");
|
||||||
naiBuffer.append(keyId);
|
naiBuffer.append(keyId);
|
||||||
@@ -4120,7 +4112,8 @@ public class OvsdbDao {
|
|||||||
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
|
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
|
||||||
|
|
||||||
for (Profile provider : hs20cfg.getHotspot20ProviderSet()) {
|
for (Profile provider : hs20cfg.getHotspot20ProviderSet()) {
|
||||||
PasspointOsuProviderProfile providerProfile = (PasspointOsuProviderProfile) provider.getDetails();
|
PasspointOsuProviderProfile providerProfile = (PasspointOsuProviderProfile) provider
|
||||||
|
.getDetails();
|
||||||
for (PasspointOsuIcon passpointOsuIcon : providerProfile.getOsuIconList()) {
|
for (PasspointOsuIcon passpointOsuIcon : providerProfile.getOsuIconList()) {
|
||||||
// ovsdbColumns = { "name", "path", "url",
|
// ovsdbColumns = { "name", "path", "url",
|
||||||
// "lang_code", "height", "img_type", "width" };
|
// "lang_code", "height", "img_type", "width" };
|
||||||
@@ -4142,8 +4135,8 @@ public class OvsdbDao {
|
|||||||
operations.add(newHs20Config);
|
operations.add(newHs20Config);
|
||||||
} else {
|
} else {
|
||||||
List<Condition> conditions = new ArrayList<>();
|
List<Condition> conditions = new ArrayList<>();
|
||||||
conditions
|
conditions.add(new Condition("name", Function.EQUALS,
|
||||||
.add(new Condition("name", Function.EQUALS, new Atom<>(passpointOsuIcon.getIconName())));
|
new Atom<>(passpointOsuIcon.getIconName())));
|
||||||
Update newHs20Config = new Update(hotspot20IconConfigDbTable, conditions, row);
|
Update newHs20Config = new Update(hotspot20IconConfigDbTable, conditions, row);
|
||||||
operations.add(newHs20Config);
|
operations.add(newHs20Config);
|
||||||
}
|
}
|
||||||
@@ -4421,9 +4414,9 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void provisionWifiStatsConfigFromProfile(String statsType, Map<String, Set<Integer>> allowedChannels,
|
private void provisionWifiStatsConfigFromProfile(String statsType, Map<String, Set<Integer>> allowedChannels,
|
||||||
RadioType radioType, ServiceMetricsChannelUtilizationSurveyType channelType, int scanInterval, ServiceMetricsStatsReportFormat format,
|
RadioType radioType, ServiceMetricsChannelUtilizationSurveyType channelType, int scanInterval,
|
||||||
int reportingInterval, int samplingInterval, List<Operation> operations,
|
ServiceMetricsStatsReportFormat format, int reportingInterval, int samplingInterval,
|
||||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) {
|
List<Operation> operations, com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) {
|
||||||
|
|
||||||
if (channelType.equals(ServiceMetricsChannelUtilizationSurveyType.ON_CHANNEL)) {
|
if (channelType.equals(ServiceMetricsChannelUtilizationSurveyType.ON_CHANNEL)) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user