Creating PM-producer
[nonrtric/plt/ranpm.git] / pmproducer / src / main / java / org / oran / pmproducer / filter / PmReport.java
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2023 Nordix Foundation
6  * %%
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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===================================
19  */
20
21 package org.oran.pmproducer.filter;
22
23 import com.google.gson.annotations.Expose;
24
25 import java.util.ArrayList;
26 import java.util.Collection;
27
28 import lombok.Builder;
29 import lombok.Getter;
30 import lombok.Setter;
31
32 @Builder(toBuilder = true)
33 public class PmReport {
34
35     @Expose
36     public Event event;
37
38     public static class CommonEventHeader {
39         @Expose
40         private String domain;
41
42         @Expose
43         private String eventId;
44
45         @Expose
46         private String eventName;
47
48         @Expose
49         @Getter
50         private String sourceName;
51
52         @Expose
53         private String reportingEntityName;
54
55         @Expose
56         private long startEpochMicrosec;
57
58         @Expose
59         private long lastEpochMicrosec;
60
61         @Expose
62         private String timeZoneOffset;
63
64         /* Not reported elements */
65         int sequence;
66         String priority;
67         String version;
68         String vesEventListenerVersion;
69     }
70
71     public static class MeasInfoId {
72         @Expose
73         private String sMeasInfoId = "";
74     }
75
76     public static class MeasTypes {
77         public String getMeasType(int pValue) {
78             if (pValue > sMeasTypesList.size()) {
79                 return "MeasTypeIndexOutOfBounds:" + pValue;
80             }
81             return sMeasTypesList.get(pValue - 1);
82         }
83
84         @Expose
85         protected ArrayList<String> sMeasTypesList = new ArrayList<>();
86     }
87
88     @Getter
89     @Builder(toBuilder = true)
90     public static class MeasResult {
91         @Expose
92         @Setter
93         private int p;
94
95         @Expose
96         private String sValue;
97     }
98
99     @Builder(toBuilder = true)
100     public static class MeasValuesList {
101         @Expose
102         @Getter
103         private String measObjInstId;
104
105         @Expose
106         private String suspectFlag;
107
108         @Expose
109         @Getter
110         private Collection<MeasResult> measResults;
111
112         public boolean isEmpty() {
113             return this.measResults.isEmpty();
114         }
115
116         static MeasValuesList emptyList = MeasValuesList.builder().measResults(new ArrayList<>()).build();
117
118         public static MeasValuesList empty() {
119             return emptyList;
120         }
121     }
122
123     @Getter
124     @Builder(toBuilder = true)
125     public static class MeasInfoList {
126         @Expose
127         private MeasInfoId measInfoId;
128
129         @Expose
130         private MeasTypes measTypes;
131
132         @Expose
133         private Collection<MeasValuesList> measValuesList;
134
135     }
136
137     @Builder(toBuilder = true)
138     @Getter
139     public static class MeasDataCollection {
140         @Expose
141         private int granularityPeriod;
142
143         @Expose
144         private String measuredEntityUserName;
145
146         @Expose
147         private String measuredEntityDn;
148
149         @Expose
150         private String measuredEntitySoftwareVersion;
151
152         @Expose
153         private Collection<MeasInfoList> measInfoList;
154     }
155
156     @Builder(toBuilder = true)
157     @Getter
158     public static class Perf3gppFields {
159         @Expose
160         private String perf3gppFieldsVersion;
161
162         @Expose
163         private MeasDataCollection measDataCollection;
164     }
165
166     @Getter
167     @Builder(toBuilder = true)
168     public static class Event {
169         @Expose
170         private CommonEventHeader commonEventHeader;
171
172         @Expose
173         private Perf3gppFields perf3gppFields;
174     }
175
176 }