2 * ========================LICENSE_START=================================
5 * Copyright (C) 2023 Nordix Foundation
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
21 package org.oran.pmlog;
23 import com.google.gson.annotations.Expose;
25 import java.util.ArrayList;
26 import java.util.Collection;
28 import lombok.Builder;
33 @Builder(toBuilder = true)
34 public class PmReport {
36 private static com.google.gson.Gson gson = new com.google.gson.GsonBuilder() //
37 .disableHtmlEscaping() //
40 public static PmReport parse(DataFromKafkaTopic data) {
41 return gson.fromJson(data.valueAsString(), PmReport.class);
44 public long lastTimeEpochMili() {
45 return event.commonEventHeader.lastEpochMicrosec / 1000;
51 public static class CommonEventHeader {
53 private String domain;
56 private String eventId;
59 private String eventName;
63 private String sourceName;
66 private String reportingEntityName;
69 private long startEpochMicrosec;
73 private long lastEpochMicrosec;
76 private String timeZoneOffset;
78 /* Not reported elements */
82 String vesEventListenerVersion;
85 public static class MeasInfoId {
87 private String sMeasInfoId = "";
90 public static class MeasTypes {
91 public String getMeasType(int pValue) {
92 if (pValue > sMeasTypesList.size()) {
93 return "MeasTypeIndexOutOfBounds:" + pValue;
95 return sMeasTypesList.get(pValue - 1);
99 protected ArrayList<String> sMeasTypesList = new ArrayList<>();
103 @Builder(toBuilder = true)
104 public static class MeasResult {
111 private String sValue;
114 @Builder(toBuilder = true)
115 public static class MeasValuesList {
118 private String measObjInstId;
122 private String suspectFlag;
126 private Collection<MeasResult> measResults;
128 public boolean isEmpty() {
129 return this.measResults.isEmpty();
132 static MeasValuesList emptyList = MeasValuesList.builder().measResults(new ArrayList<>()).build();
134 public static MeasValuesList empty() {
140 @Builder(toBuilder = true)
141 public static class MeasInfoList {
143 private MeasInfoId measInfoId;
146 private MeasTypes measTypes;
149 private Collection<MeasValuesList> measValuesList;
153 @Builder(toBuilder = true)
155 public static class MeasDataCollection {
157 private int granularityPeriod;
160 private String measuredEntityUserName;
163 private String measuredEntityDn;
166 private String measuredEntitySoftwareVersion;
169 private Collection<MeasInfoList> measInfoList;
172 @Builder(toBuilder = true)
174 public static class Perf3gppFields {
176 private String perf3gppFieldsVersion;
179 private MeasDataCollection measDataCollection;
183 @Builder(toBuilder = true)
184 public static class Event {
186 private CommonEventHeader commonEventHeader;
189 private Perf3gppFields perf3gppFields;