mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 19:17:52 +00:00
Adding translation utility to map between ovsdb and wlan cloud.
This commit is contained in:
@@ -42,6 +42,12 @@
|
||||
<artifactId>tip-wlan-opensync-protobuf</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>service-metric-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java-util -->
|
||||
<dependency>
|
||||
|
||||
@@ -29,9 +29,6 @@ import com.telecominfraproject.wlan.opensync.external.integration.models.Opensyn
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPVIFState;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncWifiAssociatedClients;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.OvsdbDao;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpDbStatus;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpDeviceType;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpManufId;
|
||||
import com.telecominfraproject.wlan.opensync.util.SslUtil;
|
||||
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
|
||||
import com.vmware.ovsdb.callback.ConnectionCallback;
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.telecominfraproject.wlan.client.models.ClientType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.AutoOrManualValue;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.ChannelBandwidth;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
@@ -186,9 +187,9 @@ public class OvsdbDao {
|
||||
|
||||
public static final String commandStateDbTable = "Command_State";
|
||||
|
||||
public static final String StartDebugEngineApCommand = "start_debug_engine";
|
||||
public static final String StartDebugEngineApCommand = "startPortForwardingSession.sh";
|
||||
|
||||
public static final String StopDebugEngineApCommand = "stop_debug_engine";
|
||||
public static final String StopDebugEngineApCommand = "stopSession.sh";
|
||||
|
||||
|
||||
public static void translateDhcpFpValueToString(Entry<String, Value> c, Map<String, String> rowMap) {
|
||||
@@ -196,7 +197,6 @@ public class OvsdbDao {
|
||||
rowMap.put(c.getKey(), DhcpFpManufId.getById(Integer.valueOf(c.getValue().toString())).getName());
|
||||
} else if (c.getKey().equals("device_type")) {
|
||||
rowMap.put(c.getKey(), DhcpFpDeviceType.getById(Integer.valueOf(c.getValue().toString())).getName());
|
||||
|
||||
} else if (c.getKey().equals("db_status")) {
|
||||
rowMap.put(c.getKey(), DhcpFpDbStatus.getById(Integer.valueOf(c.getValue().toString())).getName());
|
||||
} else {
|
||||
|
||||
@@ -16,19 +16,6 @@ public class DhcpFpDeviceType implements EnumWithId {
|
||||
private static final Map<Integer, DhcpFpDeviceType> ELEMENTS = new ConcurrentHashMap<>();
|
||||
private static final Map<String, DhcpFpDeviceType> ELEMENTS_BY_NAME = new ConcurrentHashMap<>();
|
||||
|
||||
// typedef enum {
|
||||
// DHCP_FP_DEV_TYPE_MISC = 0,
|
||||
// DHCP_FP_DEV_TYPE_MOBILE = 1,
|
||||
// DHCP_FP_DEV_TYPE_PC = 2,
|
||||
// DHCP_FP_DEV_TYPE_PRINTER = 3,
|
||||
// DHCP_FP_DEV_TYPE_VIDEO = 4,
|
||||
// DHCP_FP_DEV_TYPE_GAME = 5,
|
||||
// DHCP_FP_DEV_TYPE_VOIP = 6,
|
||||
// DHCP_FP_DEV_TYPE_MONITORING = 7,
|
||||
// DHCP_FP_DEV_TYPE_MAX = 8
|
||||
// } dhcp_fp_devicetype_t;
|
||||
|
||||
|
||||
public static final DhcpFpDeviceType DHCP_FP_DEV_TYPE_MISC = new DhcpFpDeviceType(0, "DHCP_FP_DEV_TYPE_MISC"),
|
||||
DHCP_FP_DEV_TYPE_MOBILE = new DhcpFpDeviceType(1, "DHCP_FP_DEV_TYPE_MOBILE"),
|
||||
DHCP_FP_DEV_TYPE_PC = new DhcpFpDeviceType(2, "DHCP_FP_DEV_TYPE_PC"),
|
||||
@@ -120,16 +107,5 @@ public class DhcpFpDeviceType implements EnumWithId {
|
||||
return name;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int getId() {
|
||||
// // TODO Auto-generated method stub
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// // TODO Auto-generated method stub
|
||||
// return null;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.telecominfraproject.wlan.opensync.ovsdb.dao.utilities;
|
||||
|
||||
import com.telecominfraproject.wlan.client.models.ClientType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpDeviceType;
|
||||
//import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
|
||||
|
||||
import sts.OpensyncStats.RadioBandType;
|
||||
import sts.OpensyncStats.StateUpDown;
|
||||
|
||||
public class OvsdbToWlanCloudTypeMappingUtility {
|
||||
|
||||
|
||||
public static final String OVSDB_FREQ_BAND_5G = "5G";
|
||||
public static final String OVSDB_FREQ_BAND_5GL = "5GL";
|
||||
public static final String OVSDB_FREQ_BAND_5GU = "5GU";
|
||||
public static final String OVSDB_FREQ_BAND_2pt4G = "2.4G";
|
||||
|
||||
public static ClientType getClientTypeForDhcpFpDeviceType(DhcpFpDeviceType dhcpFpDeviceType) {
|
||||
|
||||
ClientType ret = ClientType.UNSUPPORTED;
|
||||
|
||||
if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_GAME)) {
|
||||
ret = ClientType.Game;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_PC)) {
|
||||
ret = ClientType.PersonalComputer;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_MOBILE)) {
|
||||
ret = ClientType.Mobile;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_PRINTER)) {
|
||||
ret = ClientType.Printer;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_VOIP)) {
|
||||
ret = ClientType.VoIP;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_MISC)) {
|
||||
ret = ClientType.Misc;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_MONITORING)) {
|
||||
ret = ClientType.Monitoring;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_VIDEO)) {
|
||||
ret = ClientType.Video;
|
||||
} else if (dhcpFpDeviceType.equals(DhcpFpDeviceType.DHCP_FP_DEV_TYPE_MAX)) {
|
||||
ret = ClientType.Max;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static RadioType getRadioTypeForOvsdbRadioFreqBand(String ovsdbRadioFreqBand) {
|
||||
|
||||
switch (ovsdbRadioFreqBand) {
|
||||
case OVSDB_FREQ_BAND_2pt4G:
|
||||
return RadioType.is2dot4GHz;
|
||||
case OVSDB_FREQ_BAND_5G:
|
||||
return RadioType.is5GHz;
|
||||
case OVSDB_FREQ_BAND_5GL:
|
||||
return RadioType.is5GHzL;
|
||||
case OVSDB_FREQ_BAND_5GU:
|
||||
return RadioType.is5GHzU;
|
||||
default:
|
||||
return RadioType.UNSUPPORTED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static RadioType getRadioTypeFromOpensyncStatsRadioBandType(RadioBandType band) {
|
||||
switch (band) {
|
||||
case BAND2G:
|
||||
return RadioType.is2dot4GHz;
|
||||
case BAND5G:
|
||||
return RadioType.is5GHz;
|
||||
case BAND5GU:
|
||||
return RadioType.is5GHzU;
|
||||
case BAND5GL:
|
||||
return RadioType.is5GHzL;
|
||||
default:
|
||||
return RadioType.UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
public static StateUpDownError getCloudDnsStateFromOpensyncStatsStateUpDown(StateUpDown apNetworkProbeState) {
|
||||
switch (apNetworkProbeState) {
|
||||
case SUD_down:
|
||||
return StateUpDownError.disabled;
|
||||
case SUD_up:
|
||||
return StateUpDownError.enabled;
|
||||
case SUD_error:
|
||||
return StateUpDownError.error;
|
||||
|
||||
default:
|
||||
return StateUpDownError.UNSUPPORTED;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user