Compare commits

..

1 Commits

Author SHA1 Message Date
Akshay Jagadish
aac02cb1c9 link test 2020-12-03 16:09:20 -05:00
5 changed files with 156 additions and 457 deletions

View File

@@ -1,5 +1,5 @@
# wlan-opensync-wifi-controller
# wlan-opensync-wifi-controller #TESTING
Opensync Wifi Controller - accepts connections from the access points, pushes configuration, reads metrics from the topics on MQTT broker.
Components in this repository depend on other wlan-cloud repositories.

View File

@@ -1048,7 +1048,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
LOG.debug("Received VideoVoiceReport {} for SIP call", videoVoiceReport);
processRealTimeSipCallReportEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
processRealTImeSipCallReportEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
processRealTimeSipCallStartEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
@@ -1068,65 +1068,111 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
}
protected void processRealTimeSipCallReportEvent(int customerId, long equipmentId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
protected void processRealTImeSipCallReportEvent(int customerId, long equipmentId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasCallReport()) {
CallReport callReport = videoVoiceReport.getCallReport();
List<com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats> cloudRtpFlowStatsList = new ArrayList<>();
for (RtpFlowStats apRtpFlowStats : callReport.getStatsList()) {
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats cloudRtpStats = new com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats();
if (apRtpFlowStats.hasCodec()) {
cloudRtpStats.setCodec(apRtpFlowStats.getCodec());
}
if (apRtpFlowStats.hasBlockCodecs()) {
cloudRtpStats.setBlockCodecs(apRtpFlowStats.getBlockCodecs().toByteArray());
}
if (apRtpFlowStats.hasLatency()) {
cloudRtpStats.setLatency(apRtpFlowStats.getLatency());
}
if (apRtpFlowStats.hasRtpSeqFirst()) {
cloudRtpStats.setFirstRTPSeq(apRtpFlowStats.getRtpSeqFirst());
}
if (apRtpFlowStats.hasRtpSeqLast()) {
cloudRtpStats.setLastRTPSeq(apRtpFlowStats.getRtpSeqLast());
}
if (apRtpFlowStats.hasDirection()) {
switch (apRtpFlowStats.getDirection()) {
case RTP_DOWNSTREAM:
cloudRtpStats.setDirection(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.DOWNSTREAM);
break;
case RTP_UPSTREAM:
cloudRtpStats.setDirection(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.UPSTREAM);
break;
default:
cloudRtpStats.setDirection(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.UNSUPPORTED);
}
}
if (apRtpFlowStats.hasRtpFlowType()) {
switch (apRtpFlowStats.getRtpFlowType()) {
case RTP_VIDEO:
cloudRtpStats.setFlowType(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.VIDEO);
break;
case RTP_VOICE:
cloudRtpStats.setFlowType(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.VOICE);
break;
default:
cloudRtpStats.setFlowType(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.UNSUPPORTED);
break;
}
}
if (apRtpFlowStats.hasJitter()) {
cloudRtpStats.setJitter(apRtpFlowStats.getJitter());
}
if (apRtpFlowStats.hasTotalPacketsSent()) {
cloudRtpStats.setTotalPacket(apRtpFlowStats.getTotalPacketsSent());
}
if (apRtpFlowStats.hasTotalPacketsLost()) {
cloudRtpStats.setTotalPacketLost(apRtpFlowStats.getTotalPacketsLost());
}
if (apRtpFlowStats.hasMosx100()) {
cloudRtpStats.setMosMultipliedBy100(apRtpFlowStats.getMosx100());
}
if (apRtpFlowStats.hasPacketLossConsec()) {
cloudRtpStats.setPacketLossConsecutive(apRtpFlowStats.getPacketLossConsec());
}
if (apRtpFlowStats.hasPacketLossPercent()) {
cloudRtpStats.setPacketLossPercentage(apRtpFlowStats.getPacketLossPercent());
}
cloudRtpFlowStatsList.add(cloudRtpStats);
}
RealTimeSipCallReportEvent cloudSipCallReportEvent = new RealTimeSipCallReportEvent(customerId, equipmentId,
eventTimestamp);
if (callReport.hasClientMac() && callReport.getClientMac().isValidUtf8()) {
cloudSipCallReportEvent.setClientMacAddress(MacAddress.valueOf(callReport.getClientMac().toStringUtf8()));
}
cloudSipCallReportEvent.setStatuses(processRtpFlowStats(callReport.getStatsList()));
cloudSipCallReportEvent.setClientMacAddress(MacAddress.valueOf(callReport.getClientMac()));
cloudSipCallReportEvent.setStatuses(cloudRtpFlowStatsList);
cloudSipCallReportEvent.setEventType(RealTimeEventType.SipCallReport);
cloudSipCallReportEvent.setReportReason(SIPCallReportReason.GOT_PUBLISH);
cloudSipCallReportEvent.setSipCallId(callReport.getWifiSessionId());
cloudSipCallReportEvent.setAssociationId(callReport.getSessionId());
if (callReport.hasReason()) {
cloudSipCallReportEvent.setReportReason(getCallReportReason(callReport.getReason()));
}
if (callReport.hasProviderDomain()) {
cloudSipCallReportEvent.setProviderDomain(callReport.getProviderDomain());
}
if (callReport.getCodecsCount() > 0) {
cloudSipCallReportEvent.setCodecs(callReport.getCodecsList());
}
if (callReport.hasChannel()) {
cloudSipCallReportEvent.setChannel(callReport.getChannel());
}
if (callReport.hasBand()) {
cloudSipCallReportEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility
.getRadioTypeFromOpensyncStatsRadioBandType(callReport.getBand()));
}
eventsList.add(cloudSipCallReportEvent);
}
}
private SIPCallReportReason getCallReportReason(CallReport.CallReportReason reason) {
if (reason != null) {
switch (reason) {
case ROAMED_TO:
return SIPCallReportReason.ROAMED_TO;
case GOT_PUBLISH:
return SIPCallReportReason.GOT_PUBLISH;
case ROAMED_FROM:
return SIPCallReportReason.ROAMED_FROM;
default:
return SIPCallReportReason.UNSUPPORTED;
}
}
return SIPCallReportReason.UNSUPPORTED;
}
protected void processRealTimeSipCallStartEvent(int customerId, long equipmentId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasCallStart()) {
@@ -1136,8 +1182,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
RealTimeSipCallStartEvent cloudSipCallStartEvent = new RealTimeSipCallStartEvent(customerId, equipmentId,
eventTimestamp);
if (apCallStart.hasClientMac() && apCallStart.getClientMac().isValidUtf8()) {
cloudSipCallStartEvent.setClientMacAddress(MacAddress.valueOf(apCallStart.getClientMac().toStringUtf8()));
if (apCallStart.hasClientMac()) {
cloudSipCallStartEvent.setClientMacAddress(MacAddress.valueOf(apCallStart.getClientMac()));
}
if (apCallStart.hasDeviceInfo()) {
@@ -1150,25 +1196,13 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
if (apCallStart.hasSessionId()) {
cloudSipCallStartEvent.setAssociationId(apCallStart.getSessionId());
}
if (apCallStart.hasWifiSessionId()) {
cloudSipCallStartEvent.setAssociationId(apCallStart.getWifiSessionId());
}
if (apCallStart.getCodecsCount() > 0) {
cloudSipCallStartEvent.setCodecs(apCallStart.getCodecsList());
}
if (apCallStart.hasChannel()) {
cloudSipCallStartEvent.setChannel(apCallStart.getChannel());
}
if (apCallStart.hasBand()) {
cloudSipCallStartEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility
.getRadioTypeFromOpensyncStatsRadioBandType(apCallStart.getBand()));
}
eventsList.add(cloudSipCallStartEvent);
}
@@ -1189,9 +1223,9 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
}
if (apCallStop.hasClientMac() && apCallStop.getClientMac().isValidUtf8()) {
if (apCallStop.hasClientMac()) {
cloudSipCallStopEvent.setClientMacAddress(MacAddress.valueOf(apCallStop.getClientMac().toStringUtf8()));
cloudSipCallStopEvent.setClientMacAddress(MacAddress.valueOf(apCallStop.getClientMac()));
}
@@ -1222,27 +1256,6 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
}
if (apCallStop.getStatsCount() > 0) {
cloudSipCallStopEvent.setStatuses(processRtpFlowStats(apCallStop.getStatsList()));
}
if (apCallStop.hasProviderDomain()) {
cloudSipCallStopEvent.setProviderDomain(apCallStop.getProviderDomain());
}
if (apCallStop.getCodecsCount() > 0) {
cloudSipCallStopEvent.setCodecs(apCallStop.getCodecsList());
}
if (apCallStop.hasChannel()) {
cloudSipCallStopEvent.setChannel(apCallStop.getChannel());
}
if (apCallStop.hasBand()) {
cloudSipCallStopEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility
.getRadioTypeFromOpensyncStatsRadioBandType(apCallStop.getBand()));
}
eventsList.add(cloudSipCallStopEvent);
}
@@ -1288,95 +1301,6 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
}
}
private List<com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats> processRtpFlowStats(List<OpensyncStats.RtpFlowStats> stats) {
List<com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats> cloudRtpFlowStatsList = new ArrayList<>();
for (RtpFlowStats apRtpFlowStats : stats) {
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats cloudRtpStats = new com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats();
if (apRtpFlowStats.hasCodec()) {
cloudRtpStats.setCodec(apRtpFlowStats.getCodec());
}
if (apRtpFlowStats.hasBlockCodecs()) {
cloudRtpStats.setBlockCodecs(apRtpFlowStats.getBlockCodecs().toByteArray());
}
if (apRtpFlowStats.hasLatency()) {
cloudRtpStats.setLatency(apRtpFlowStats.getLatency());
}
if (apRtpFlowStats.hasRtpSeqFirst()) {
cloudRtpStats.setFirstRTPSeq(apRtpFlowStats.getRtpSeqFirst());
}
if (apRtpFlowStats.hasRtpSeqLast()) {
cloudRtpStats.setLastRTPSeq(apRtpFlowStats.getRtpSeqLast());
}
if (apRtpFlowStats.hasDirection()) {
switch (apRtpFlowStats.getDirection()) {
case RTP_DOWNSTREAM:
cloudRtpStats.setDirection(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.DOWNSTREAM);
break;
case RTP_UPSTREAM:
cloudRtpStats.setDirection(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.UPSTREAM);
break;
default:
cloudRtpStats.setDirection(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.UNSUPPORTED);
}
}
if (apRtpFlowStats.hasRtpFlowType()) {
switch (apRtpFlowStats.getRtpFlowType()) {
case RTP_VIDEO:
cloudRtpStats.setFlowType(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.VIDEO);
break;
case RTP_VOICE:
cloudRtpStats.setFlowType(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.VOICE);
break;
default:
cloudRtpStats.setFlowType(
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.UNSUPPORTED);
break;
}
}
if (apRtpFlowStats.hasJitter()) {
cloudRtpStats.setJitter(apRtpFlowStats.getJitter());
}
if (apRtpFlowStats.hasTotalPacketsSent()) {
cloudRtpStats.setTotalPacket(apRtpFlowStats.getTotalPacketsSent());
}
if (apRtpFlowStats.hasTotalPacketsLost()) {
cloudRtpStats.setTotalPacketLost(apRtpFlowStats.getTotalPacketsLost());
}
if (apRtpFlowStats.hasMosx100()) {
cloudRtpStats.setMosMultipliedBy100(apRtpFlowStats.getMosx100());
}
if (apRtpFlowStats.hasPacketLossConsec()) {
cloudRtpStats.setPacketLossConsecutive(apRtpFlowStats.getPacketLossConsec());
}
if (apRtpFlowStats.hasPacketLossPercent()) {
cloudRtpStats.setPacketLossPercentage(apRtpFlowStats.getPacketLossPercent());
}
cloudRtpFlowStatsList.add(cloudRtpStats);
}
return cloudRtpFlowStatsList;
}
protected void processRtsStartSessionEvent(int customerId, long equipmentId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasStreamVideoSessionStart()) {
@@ -2145,9 +2069,6 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|| ssidConfig.getSecureMode().equals(SecureMode.wpa2PSK)
|| ssidConfig.getSecureMode().equals(SecureMode.wpa2OnlyPSK)) {
latestClientSessionDetails.setSecurityType(SecurityType.PSK);
} else if (ssidConfig.getSecureMode().equals(SecureMode.wpa3OnlySAE)
|| ssidConfig.getSecureMode().equals(SecureMode.wpa3MixedSAE)){
latestClientSessionDetails.setSecurityType(SecurityType.SAE);
} else if (ssidConfig.getSecureMode().equals(SecureMode.wpa2Radius)
|| ssidConfig.getSecureMode().equals(SecureMode.wpaRadius)
|| ssidConfig.getSecureMode().equals(SecureMode.wpa2OnlyRadius)) {
@@ -2155,9 +2076,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
latestClientSessionDetails.setEapDetails(new ClientEapDetails());
} else if (ssidConfig.getSecureMode().equals(SecureMode.wpaEAP)
|| ssidConfig.getSecureMode().equals(SecureMode.wpa2EAP)
|| ssidConfig.getSecureMode().equals(SecureMode.wpa2OnlyEAP)
|| ssidConfig.getSecureMode().equals(SecureMode.wpa3OnlyEAP)
|| ssidConfig.getSecureMode().equals(SecureMode.wpa3MixedEAP)) {
|| ssidConfig.getSecureMode().equals(SecureMode.wpa2OnlyEAP)) {
latestClientSessionDetails.setSecurityType(SecurityType.RADIUS);
latestClientSessionDetails.setEapDetails(new ClientEapDetails());
} else {

View File

@@ -7,7 +7,6 @@ import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
@@ -46,6 +45,9 @@ import com.telecominfraproject.wlan.firmware.FirmwareServiceInterface;
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
import com.telecominfraproject.wlan.profile.models.ProfileContainer;
import com.telecominfraproject.wlan.profile.models.ProfileType;
import com.telecominfraproject.wlan.profile.rf.models.RfConfiguration;
import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
import com.telecominfraproject.wlan.servicemetric.apnode.models.ApNodeMetrics;
import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
@@ -55,7 +57,6 @@ import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSIDs;
import com.telecominfraproject.wlan.status.models.Status;
import com.telecominfraproject.wlan.status.models.StatusDataType;
import sts.OpensyncStats;
import sts.OpensyncStats.AssocType;
import sts.OpensyncStats.ChannelSwitchReason;
import sts.OpensyncStats.Client;
@@ -259,55 +260,6 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest {
// TODO: implement me when wcs stats reports supported
}
// Verify CallStart, CallStop and CallReport are properly processed and published as
// respective events (5 events in total)
@Test
public void testProcessMqttMessageStringMultipleVideoVoiceReport() {
OpensyncStats.VideoVoiceReport.Builder callStartVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder().
setCallStart(getDefaultCallStart());
OpensyncStats.VideoVoiceReport.Builder callReportGotPublishVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder().
setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.GOT_PUBLISH, 121, 1028, 1316, 1888, 298, 2, 100, 200));
OpensyncStats.VideoVoiceReport.Builder callReportRoamedToVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder().
setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_TO, 123, 1020, 1116, 1345, 223, 0, 102, 203));
OpensyncStats.VideoVoiceReport.Builder callReportRoamedFromVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder().
setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_FROM, 122, 1029, 1300, 1234, 111, 3, 101, 201));
OpensyncStats.VideoVoiceReport.Builder callStopVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder().
setCallStop(getDefaultCallStop());
// Create report with multiple voiceReports in one
Report multipleVoiceReportsInOneReport = Report.newBuilder().addVideoVoiceReport(callStartVoiceReportBuilder).
addVideoVoiceReport(callReportGotPublishVoiceReportBuilder).
addVideoVoiceReport(callReportRoamedFromVoiceReportBuilder).
addVideoVoiceReport(callReportRoamedToVoiceReportBuilder).
addVideoVoiceReport(callStopVoiceReportBuilder).
setNodeID("1").
build();
opensyncExternalIntegrationMqttProcessor.populateSipCallReport(null, multipleVoiceReportsInOneReport, 1, 2L, "TestAP", 12L);
Mockito.verify(equipmentMetricsCollectorInterface, Mockito.times(1)).publishEventsBulk(Mockito.anyList());
}
// Create report with 1 voiceReports that contains multiple Calls
// Note that GOT_PUBLISH and ROAMED_FROM are ignored in the CallReport. ROAMED_TO overwrites them
@Test
public void testProcessMqttMessageStringOneVideoVoiceReport() {
OpensyncStats.VideoVoiceReport.Builder videoVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder().
setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.GOT_PUBLISH, 121, 1028, 1316,1888, 298, 2, 100,200)).
setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_FROM, 122, 1029, 1300,1234, 111, 3, 101,201)).
setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_TO, 123, 1020, 1116,1345, 223, 0, 102,203)).
setCallStart(getDefaultCallStart()).
setCallStop(getDefaultCallStop());
Report oneVoiceReportWithMultipleCallsInOneReport = Report.getDefaultInstance().toBuilder().
addVideoVoiceReport(videoVoiceReportBuilder).
setNodeID("1").
build();
opensyncExternalIntegrationMqttProcessor.populateSipCallReport(null, oneVoiceReportWithMultipleCallsInOneReport, 1, 2L, "TestAP", 12L);
Mockito.verify(equipmentMetricsCollectorInterface, Mockito.times(1)).publishEventsBulk(Mockito.anyList());
}
@Test
public void testpopulateNetworkProbeMetrics() throws Exception {
@@ -366,74 +318,6 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest {
return bssidList;
}
private OpensyncStats.CallStart getDefaultCallStart() {
OpensyncStats.CallStart.Builder callStartBuilder = OpensyncStats.CallStart.newBuilder();
callStartBuilder.setBand(RadioBandType.BAND5G);
callStartBuilder.setChannel(40);
callStartBuilder.addCodecs("110 opus/48000/2");
callStartBuilder.addCodecs("102 iLBC/8000");
callStartBuilder.setClientMac(ByteString.copyFrom("C0:9A:D0:76:A9:69".getBytes()));
callStartBuilder.setDeviceInfo("Test Device");
callStartBuilder.setProviderDomain("skype");
callStartBuilder.setSessionId(123L);
callStartBuilder.setWifiSessionId(1234L);
return callStartBuilder.build();
}
private OpensyncStats.CallStop getDefaultCallStop() {
OpensyncStats.CallStop.Builder callStopBuilder = OpensyncStats.CallStop.newBuilder();
callStopBuilder.setBand(RadioBandType.BAND5G);
callStopBuilder.setChannel(40);
callStopBuilder.addCodecs("110 opus/48000/2");
callStopBuilder.addCodecs("102 iLBC/8000");
callStopBuilder.setClientMac(ByteString.copyFrom("C0:9A:D0:76:A9:69".getBytes()));
callStopBuilder.setCallDuration(1230);
callStopBuilder.setProviderDomain("skype");
callStopBuilder.setSessionId(123L);
callStopBuilder.setWifiSessionId(1234L);
callStopBuilder.setReason(OpensyncStats.CallStop.CallStopReason.BYE_OK);
callStopBuilder.addStats(getRtpFlowStats(121, 1380, 1400,3000, 119, 3, 205,350));
return callStopBuilder.build();
}
private OpensyncStats.RtpFlowStats getRtpFlowStats(int codec, int jitter, int latency, int totalPackets,
int totalPacketsLost, int mos, int firstRtpSeq, int lastRtpSeq) {
OpensyncStats.RtpFlowStats.Builder rtpFlowStatsBuilder = OpensyncStats.RtpFlowStats.newBuilder();
rtpFlowStatsBuilder.setCodec(codec);
rtpFlowStatsBuilder.setBlockCodecs(ByteString.copyFrom(new byte[] { (byte) 0xe6, 0x1 }));
rtpFlowStatsBuilder.setDirection(OpensyncStats.RtpFlowStats.RtpFlowDirection.RTP_DOWNSTREAM);
rtpFlowStatsBuilder.setRtpFlowType(OpensyncStats.RtpFlowStats.RtpFlowType.RTP_VOICE);
rtpFlowStatsBuilder.setJitter(jitter);
rtpFlowStatsBuilder.setLatency(latency);
rtpFlowStatsBuilder.setTotalPacketsSent(totalPackets);
rtpFlowStatsBuilder.setTotalPacketsLost(totalPacketsLost);
rtpFlowStatsBuilder.setMosx100(mos);
rtpFlowStatsBuilder.setRtpSeqFirst(firstRtpSeq);
rtpFlowStatsBuilder.setRtpSeqLast(lastRtpSeq);
return rtpFlowStatsBuilder.build();
}
private OpensyncStats.CallReport getDefaultCallReport(OpensyncStats.CallReport.CallReportReason reason, int codec,
int jitter, int latency, int totalPackets, int totalPacketsLost,
int mos, int firstRtpSeq, int lastRtpSeq) {
OpensyncStats.CallReport.Builder callReportBuilder = OpensyncStats.CallReport.newBuilder();
callReportBuilder.setBand(RadioBandType.BAND5G);
callReportBuilder.setChannel(40);
callReportBuilder.addCodecs("110 opus/48000/2");
callReportBuilder.addCodecs("102 iLBC/8000");
callReportBuilder.setClientMac(ByteString.copyFrom("C0:9A:D0:76:A9:69".getBytes()));
callReportBuilder.setProviderDomain("skype");
callReportBuilder.setSessionId(123L);
callReportBuilder.setWifiSessionId(1234L);
callReportBuilder.setReason(reason);
callReportBuilder.addStats(getRtpFlowStats(codec, jitter, latency, totalPackets, totalPacketsLost,
mos, firstRtpSeq, lastRtpSeq));
return callReportBuilder.build();
}
private List<EventReport> getOpensyncStatsEventReportsList() {

View File

@@ -1156,11 +1156,32 @@ 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));
operations.add(new Select(wifiVifConfigDbTable, conditions, columns));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
@@ -1258,73 +1279,8 @@ 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);
@@ -3105,15 +3061,12 @@ public class OvsdbDao {
security.put("encryption", opensyncSecurityMode);
// key and mode is N/A for OPEN security
if (!opensyncSecurityMode.equals("OPEN")) {
if (ssidSecurityMode.equals("wpa2PSK") || ssidSecurityMode.equals("wpa3MixedSAE")) {
if (ssidSecurityMode.equals("wpa2PSK")) {
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");
@@ -3123,13 +3076,7 @@ public class OvsdbDao {
if (ssidConfig.getRadiusAccountingServiceName() != null) {
getRadiusAccountingConfiguration(opensyncApConfig, ssidConfig, security);
}
} 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")) {
} else if (ssidSecurityMode.equals("wpa2EAP") || ssidSecurityMode.equals("wpa2Radius")) {
security.put("mode", "mixed");
getRadiusConfiguration(opensyncApConfig, ssidConfig, security);
if (ssidConfig.getRadiusAccountingServiceName() != null) {
@@ -3160,10 +3107,6 @@ 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;
}

View File

@@ -8,11 +8,8 @@ import java.util.Set;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
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 class WifiVifConfigInfo implements Cloneable{
public String bridge;
public int btm;
public boolean enabled;
@@ -25,109 +22,65 @@ public class WifiVifConfigInfo implements Cloneable {
public String ssidBroadcast;
public boolean uapsdEnable;
public int vifRadioIdx;
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 Map<String,String> security;
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, 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);
return Objects.hash(apBridge, bridge, btm, enabled, ftMobilityDomain, ftPsk, groupRekey, ifName, macList,
macListType, minHwMode, mode, rrm, security, ssid, ssidBroadcast, uapsdEnable, uuid, vifRadioIdx,
vlanId);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
}
if (!(obj instanceof WifiVifConfigInfo)) {
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)
&& 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(minHwMode, other.minHwMode) && Objects.equals(mode, other.mode) && 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) && vifDbgLvl == other.vifDbgLvl && vifRadioIdx == other.vifRadioIdx
&& vlanId == other.vlanId && wds == other.wds && wps == other.wps && wpsPbc == other.wpsPbc
&& Objects.equals(wpsPbcKeyId, other.wpsPbcKeyId);
&& Objects.equals(uuid, other.uuid) && vifRadioIdx == other.vifRadioIdx && vlanId == other.vlanId;
}
@Override
public String toString() {
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 + "]";
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);
}
}