blob: 5c4a3b0d890236424d9d52b627c7cc7a0d36d09d [file] [log] [blame]
ychacon5542d262022-02-21 14:40:38 +01001// -
2// ========================LICENSE_START=================================
3// O-RAN-SC
4// %%
5// Copyright (C) 2021: 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
21package messages
22
23type StdDefinedMessage struct {
24 Event Event `json:"event"`
25}
26
27type Event struct {
28 CommonEventHeader CommonEventHeader `json:"commonEventHeader"`
29 StndDefinedFields StndDefinedFields `json:"stndDefinedFields"`
30}
31
32type CommonEventHeader struct {
33 Domain string `json:"domain"`
34 EventId string `json:"eventId"`
35 EventName string `json:"eventName"`
36 EventType string `json:"eventType"`
37 Sequence int `json:"sequence"`
38 Priority string `json:"priority"`
39 ReportingEntityId string `json:"reportingEntityId"`
40 ReportingEntityName string `json:"reportingEntityName"`
41 SourceId string `json:"sourceId"`
42 SourceName string `json:"sourceName"`
43 StartEpochMicrosec int64 `json:"startEpochMicrosec"`
44 LastEpochMicrosec int64 `json:"lastEpochMicrosec"`
45 NfNamingCode string `json:"nfNamingCode"`
46 NfVendorName string `json:"nfVendorName"`
47 StndDefinedNamespace string `json:"stndDefinedNamespace"`
48 TimeZoneOffset string `json:"timeZoneOffset"`
49 Version string `json:"version"`
50 VesEventListenerVersion string `json:"vesEventListenerVersion"`
51}
52
53type StndDefinedFields struct {
54 StndDefinedFieldsVersion string `json:"stndDefinedFieldsVersion"`
55 SchemaReference string `json:"schemaReference"`
56 Data Data `json:"data"`
57}
58
59type Data struct {
60 DataId string `json:"id"`
61 StartTime string `json:"start-time"`
62 AdministrativeState string `json:"administrative-state"`
63 OperationalState string `json:"operational-state"`
64 UserLabel string `json:"user-label"`
65 JobTag string `json:"job-tag"`
66 GranularityPeriod int `json:"granularity-period"`
67 Measurements []Measurement `json:"measurements"`
68}
69
70type Measurement struct {
71 MeasurementTypeInstanceReference string `json:"measurement-type-instance-reference"`
72 Value int `json:"value"`
73 Unit string `json:"unit"`
74}
75
76func (message StdDefinedMessage) GetMeasurements() []Measurement {
77 return message.Event.StndDefinedFields.Data.Measurements
78}