mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-12-24 14:17:00 +00:00
WIFI-1062: Add provisioning capability to OvsdbDao when configuring Ssids
This commit is contained in:
@@ -1156,32 +1156,11 @@ public class OvsdbDao {
|
||||
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
List<String> columns = new ArrayList<>();
|
||||
columns.add("bridge");
|
||||
columns.add("ap_bridge");
|
||||
columns.add("_uuid");
|
||||
columns.add("btm");
|
||||
columns.add("enabled");
|
||||
columns.add("ft_psk");
|
||||
columns.add("ft_mobility_domain");
|
||||
columns.add("group_rekey");
|
||||
columns.add("if_name");
|
||||
columns.add("min_hw_mode");
|
||||
columns.add("mode");
|
||||
columns.add("rrm");
|
||||
columns.add("ssid");
|
||||
columns.add("ssid_broadcast");
|
||||
columns.add("uapsd_enable");
|
||||
columns.add("vif_radio_idx");
|
||||
columns.add("security");
|
||||
columns.add("vlan_id");
|
||||
columns.add("mac_list");
|
||||
columns.add("mac_list_type");
|
||||
|
||||
try {
|
||||
LOG.debug("Retrieving WifiVifConfig:");
|
||||
|
||||
operations.add(new Select(wifiVifConfigDbTable, conditions, columns));
|
||||
operations.add(new Select(wifiVifConfigDbTable, conditions));
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
@@ -1279,8 +1258,73 @@ public class OvsdbDao {
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
wifiVifConfigInfo.macListType = row.getStringColumn("mac_list_type");
|
||||
}
|
||||
|
||||
|
||||
wifiVifConfigInfo.customOptions = row.getMapColumn("custom_options");
|
||||
wifiVifConfigInfo.captiveAllowlist = row.getSetColumn("captive_allowlist");
|
||||
wifiVifConfigInfo.captivePortal = row.getMapColumn("captive_portal");
|
||||
|
||||
Boolean wpsPbc = getSingleValueFromSet(row, "wps_pbc");
|
||||
if (wpsPbc != null) {
|
||||
wifiVifConfigInfo.wpsPbc = wpsPbc;
|
||||
} else {
|
||||
wifiVifConfigInfo.wpsPbc = false;
|
||||
}
|
||||
|
||||
Boolean wps = getSingleValueFromSet(row, "wps");
|
||||
if (wps != null) {
|
||||
wifiVifConfigInfo.wps = wps;
|
||||
} else {
|
||||
wifiVifConfigInfo.wps = false;
|
||||
}
|
||||
|
||||
Boolean wds = getSingleValueFromSet(row, "wds");
|
||||
if (wds != null) {
|
||||
wifiVifConfigInfo.wds = wds;
|
||||
} else {
|
||||
wifiVifConfigInfo.wds = false;
|
||||
}
|
||||
|
||||
wifiVifConfigInfo.wpsPbcKeyId = row.getStringColumn("wps_pbc_key_id");
|
||||
|
||||
Boolean mcast2ucast = getSingleValueFromSet(row, "mcast2ucast");
|
||||
if (mcast2ucast != null) {
|
||||
wifiVifConfigInfo.mcast2ucast = mcast2ucast;
|
||||
} else {
|
||||
wifiVifConfigInfo.mcast2ucast = false;
|
||||
}
|
||||
|
||||
Boolean dynamicBeacon = getSingleValueFromSet(row, "dynamic_beacon");
|
||||
if (dynamicBeacon != null) {
|
||||
wifiVifConfigInfo.dynamicBeacon = dynamicBeacon;
|
||||
} else {
|
||||
wifiVifConfigInfo.dynamicBeacon = false;
|
||||
}
|
||||
|
||||
Long vifDbgLvl = getSingleValueFromSet(row, "vif_dbg_lvl");
|
||||
if (vifDbgLvl != null) {
|
||||
wifiVifConfigInfo.vifDbgLvl = vifDbgLvl.intValue();
|
||||
} else {
|
||||
wifiVifConfigInfo.vifDbgLvl = 0;
|
||||
}
|
||||
|
||||
if (row.getColumns().containsKey("mesh_options")) {
|
||||
wifiVifConfigInfo.meshOptions = row.getMapColumn("mesh_options");
|
||||
}
|
||||
|
||||
wifiVifConfigInfo.credentialConfigs = row.getSetColumn("credential_configs");
|
||||
|
||||
String parent = getSingleValueFromSet(row, "parent");
|
||||
if (parent != null) {
|
||||
wifiVifConfigInfo.parent = parent;
|
||||
}
|
||||
|
||||
String multiAp = getSingleValueFromSet(row, "multi_ap");
|
||||
if (multiAp != null) {
|
||||
wifiVifConfigInfo.multiAp = multiAp;
|
||||
}
|
||||
|
||||
ret.put(wifiVifConfigInfo.ifName + '_' + wifiVifConfigInfo.ssid, wifiVifConfigInfo);
|
||||
|
||||
}
|
||||
|
||||
LOG.debug("Retrieved WifiVifConfigs: {}", ret);
|
||||
@@ -3061,12 +3105,15 @@ public class OvsdbDao {
|
||||
security.put("encryption", opensyncSecurityMode);
|
||||
// key and mode is N/A for OPEN security
|
||||
if (!opensyncSecurityMode.equals("OPEN")) {
|
||||
if (ssidSecurityMode.equals("wpa2PSK")) {
|
||||
if (ssidSecurityMode.equals("wpa2PSK") || ssidSecurityMode.equals("wpa3MixedSAE")) {
|
||||
security.put("key", ssidConfig.getKeyStr());
|
||||
security.put("mode", "mixed");
|
||||
} else if (ssidSecurityMode.equals("wpa2OnlyPSK")) {
|
||||
security.put("key", ssidConfig.getKeyStr());
|
||||
security.put("mode", "2");
|
||||
} else if (ssidSecurityMode.equals("wpa3OnlySAE")) {
|
||||
security.put("key", ssidConfig.getKeyStr());
|
||||
security.put("mode", "3");
|
||||
} else if (ssidSecurityMode.equals("wpaPSK")) {
|
||||
security.put("key", ssidConfig.getKeyStr());
|
||||
security.put("mode", "1");
|
||||
@@ -3076,7 +3123,13 @@ public class OvsdbDao {
|
||||
if (ssidConfig.getRadiusAccountingServiceName() != null) {
|
||||
getRadiusAccountingConfiguration(opensyncApConfig, ssidConfig, security);
|
||||
}
|
||||
} else if (ssidSecurityMode.equals("wpa2EAP") || ssidSecurityMode.equals("wpa2Radius")) {
|
||||
} else if (ssidSecurityMode.equals("wpa3OnlyEAP")) {
|
||||
security.put("mode", "3");
|
||||
getRadiusConfiguration(opensyncApConfig, ssidConfig, security);
|
||||
if (ssidConfig.getRadiusAccountingServiceName() != null) {
|
||||
getRadiusAccountingConfiguration(opensyncApConfig, ssidConfig, security);
|
||||
}
|
||||
} else if (ssidSecurityMode.equals("wpa2EAP") || ssidSecurityMode.equals("wpa2Radius") || ssidSecurityMode.equals("wpa3MixedEAP")) {
|
||||
security.put("mode", "mixed");
|
||||
getRadiusConfiguration(opensyncApConfig, ssidConfig, security);
|
||||
if (ssidConfig.getRadiusAccountingServiceName() != null) {
|
||||
@@ -3107,6 +3160,10 @@ public class OvsdbDao {
|
||||
} else if (ssidSecurityMode.equals("wpaRadius") || ssidSecurityMode.equals("wpa2OnlyRadius")
|
||||
|| ssidSecurityMode.equals("wpa2Radius")) {
|
||||
opensyncSecurityMode = "WPA-EAP";
|
||||
} else if (ssidSecurityMode.equals("wpa3OnlySAE") || ssidSecurityMode.equals("wpa3MixedSAE")) {
|
||||
opensyncSecurityMode = "WPA-SAE";
|
||||
}else if (ssidSecurityMode.equals("wpa3OnlyEAP") || ssidSecurityMode.equals("wpa3MixedEAP")) {
|
||||
opensyncSecurityMode = "WPA3-EAP";
|
||||
}
|
||||
return opensyncSecurityMode;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ import java.util.Set;
|
||||
|
||||
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
|
||||
|
||||
public class WifiVifConfigInfo implements Cloneable{
|
||||
|
||||
public class WifiVifConfigInfo implements Cloneable {
|
||||
|
||||
// multi_ap
|
||||
// {"key":{"enum":["set",["backhaul_bss","backhaul_sta","fronthaul_backhaul_bss","fronthaul_bss","none"]],"type":"string"},"min":0}
|
||||
|
||||
public String bridge;
|
||||
public int btm;
|
||||
public boolean enabled;
|
||||
@@ -22,65 +25,109 @@ public class WifiVifConfigInfo implements Cloneable{
|
||||
public String ssidBroadcast;
|
||||
public boolean uapsdEnable;
|
||||
public int vifRadioIdx;
|
||||
public Map<String,String> security;
|
||||
|
||||
public Map<String, String> security;
|
||||
public Map<String, String> captivePortal;
|
||||
public Set<String> captiveAllowlist;
|
||||
public Map<String, String> customOptions;
|
||||
public Map<String, String> meshOptions;
|
||||
|
||||
public Uuid uuid;
|
||||
public int vlanId;
|
||||
public Boolean apBridge;
|
||||
public String minHwMode;
|
||||
public Set<String> macList;
|
||||
public String macListType;
|
||||
public Boolean apBridge;
|
||||
public String minHwMode;
|
||||
public Set<String> macList;
|
||||
public String macListType;
|
||||
public int ftMobilityDomain;
|
||||
|
||||
public boolean wpsPbc;
|
||||
public boolean wps;
|
||||
public boolean wds;
|
||||
public String wpsPbcKeyId;
|
||||
public boolean mcast2ucast;
|
||||
public boolean dynamicBeacon;
|
||||
public int vifDbgLvl;
|
||||
public Set<Uuid> credentialConfigs;
|
||||
public String parent;
|
||||
public String multiAp;
|
||||
|
||||
@Override
|
||||
public WifiVifConfigInfo clone() {
|
||||
try {
|
||||
WifiVifConfigInfo ret = (WifiVifConfigInfo)super.clone();
|
||||
|
||||
if(security!=null) {
|
||||
WifiVifConfigInfo ret = (WifiVifConfigInfo) super.clone();
|
||||
|
||||
if (security != null) {
|
||||
ret.security = new HashMap<>(this.security);
|
||||
}
|
||||
if (macList!=null) {
|
||||
if (macList != null) {
|
||||
ret.macList = new HashSet<>(this.macList);
|
||||
}
|
||||
if (captivePortal != null) {
|
||||
ret.captivePortal = new HashMap<>(this.captivePortal);
|
||||
}
|
||||
if (captiveAllowlist != null) {
|
||||
ret.captiveAllowlist = new HashSet<>(this.captiveAllowlist);
|
||||
}
|
||||
if (customOptions != null) {
|
||||
ret.customOptions = new HashMap<>(this.customOptions);
|
||||
}
|
||||
if (meshOptions != null) {
|
||||
ret.meshOptions = new HashMap<>(this.meshOptions);
|
||||
}
|
||||
if (credentialConfigs != null) {
|
||||
ret.credentialConfigs = new HashSet<>(this.credentialConfigs);
|
||||
}
|
||||
return ret;
|
||||
}catch(CloneNotSupportedException e) {
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new IllegalStateException("Cannot clone ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(apBridge, bridge, btm, enabled, ftMobilityDomain, ftPsk, groupRekey, ifName, macList,
|
||||
macListType, minHwMode, mode, rrm, security, ssid, ssidBroadcast, uapsdEnable, uuid, vifRadioIdx,
|
||||
vlanId);
|
||||
return Objects.hash(apBridge, bridge, btm, captiveAllowlist, captivePortal, credentialConfigs, customOptions,
|
||||
dynamicBeacon, enabled, ftMobilityDomain, ftPsk, groupRekey, ifName, macList, macListType, mcast2ucast,
|
||||
meshOptions, minHwMode, mode, multiAp, parent, rrm, security, ssid, ssidBroadcast, uapsdEnable, uuid,
|
||||
vifDbgLvl, vifRadioIdx, vlanId, wds, wps, wpsPbc, wpsPbcKeyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof WifiVifConfigInfo)) {
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
}
|
||||
WifiVifConfigInfo other = (WifiVifConfigInfo) obj;
|
||||
return Objects.equals(apBridge, other.apBridge) && Objects.equals(bridge, other.bridge) && btm == other.btm
|
||||
&& Objects.equals(captiveAllowlist, other.captiveAllowlist)
|
||||
&& Objects.equals(captivePortal, other.captivePortal)
|
||||
&& Objects.equals(credentialConfigs, other.credentialConfigs)
|
||||
&& Objects.equals(customOptions, other.customOptions) && dynamicBeacon == other.dynamicBeacon
|
||||
&& enabled == other.enabled && ftMobilityDomain == other.ftMobilityDomain && ftPsk == other.ftPsk
|
||||
&& groupRekey == other.groupRekey && Objects.equals(ifName, other.ifName)
|
||||
&& Objects.equals(macList, other.macList) && Objects.equals(macListType, other.macListType)
|
||||
&& Objects.equals(minHwMode, other.minHwMode) && Objects.equals(mode, other.mode) && rrm == other.rrm
|
||||
&& mcast2ucast == other.mcast2ucast && Objects.equals(meshOptions, other.meshOptions)
|
||||
&& Objects.equals(minHwMode, other.minHwMode) && Objects.equals(mode, other.mode)
|
||||
&& Objects.equals(multiAp, other.multiAp) && Objects.equals(parent, other.parent) && rrm == other.rrm
|
||||
&& Objects.equals(security, other.security) && Objects.equals(ssid, other.ssid)
|
||||
&& Objects.equals(ssidBroadcast, other.ssidBroadcast) && uapsdEnable == other.uapsdEnable
|
||||
&& Objects.equals(uuid, other.uuid) && vifRadioIdx == other.vifRadioIdx && vlanId == other.vlanId;
|
||||
&& Objects.equals(uuid, other.uuid) && vifDbgLvl == other.vifDbgLvl && vifRadioIdx == other.vifRadioIdx
|
||||
&& vlanId == other.vlanId && wds == other.wds && wps == other.wps && wpsPbc == other.wpsPbc
|
||||
&& Objects.equals(wpsPbcKeyId, other.wpsPbcKeyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"WifiVifConfigInfo [bridge=%s, ap_bridge=%s, btm=%s, enabled=%s, ftPsk=%s, ftMobilityDomain=%s, groupRekey=%s, ifName=%s, minHwMode=%s, mode=%s, rrm=%s, ssid=%s, ssidBroadcast=%s, uapsdEnable=%s, vifRadioIdx=%s, security=%s, uuid=%s, vlanId=%s, macList=%s, macListType=%s]",
|
||||
bridge, apBridge, btm, enabled, ftPsk, ftMobilityDomain, groupRekey, ifName, minHwMode, mode, rrm, ssid, ssidBroadcast, uapsdEnable,
|
||||
vifRadioIdx, security, uuid, vlanId, macList, macListType);
|
||||
return "WifiVifConfigInfo [bridge=" + bridge + ", btm=" + btm + ", enabled=" + enabled + ", ftPsk=" + ftPsk
|
||||
+ ", groupRekey=" + groupRekey + ", ifName=" + ifName + ", mode=" + mode + ", rrm=" + rrm + ", ssid="
|
||||
+ ssid + ", ssidBroadcast=" + ssidBroadcast + ", uapsdEnable=" + uapsdEnable + ", vifRadioIdx="
|
||||
+ vifRadioIdx + ", security=" + security + ", captivePortal=" + captivePortal + ", captiveAllowlist="
|
||||
+ captiveAllowlist + ", customOptions=" + customOptions + ", meshOptions=" + meshOptions + ", uuid="
|
||||
+ uuid + ", vlanId=" + vlanId + ", apBridge=" + apBridge + ", minHwMode=" + minHwMode + ", macList="
|
||||
+ macList + ", macListType=" + macListType + ", ftMobilityDomain=" + ftMobilityDomain + ", wpsPbc="
|
||||
+ wpsPbc + ", wps=" + wps + ", wds=" + wds + ", wpsPbcKeyId=" + wpsPbcKeyId + ", mcast2ucast="
|
||||
+ mcast2ucast + ", dynamicBeacon=" + dynamicBeacon + ", vifDbgLvl=" + vifDbgLvl + ", credentialConfigs="
|
||||
+ credentialConfigs + ", parent=" + parent + ", multiAp=" + multiAp + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user