c2c58496b61bcd9ccd6e95ad9265c2acc2c71813
[nonrtric.git] / test / usecases / odusliceassurance / goversion / messages / stdVesMessage.go
1 // -
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
21 package messages
22
23 type StdDefinedMessage struct {
24         Event Event `json:"event"`
25 }
26
27 type Event struct {
28         CommonEventHeader CommonEventHeader `json:"commonEventHeader"`
29         StndDefinedFields StndDefinedFields `json:"stndDefinedFields"`
30 }
31
32 type CommonEventHeader struct {
33         Domain               string `json:"domain"`
34         StndDefinedNamespace string `json:"stndDefinedNamespace"`
35 }
36
37 type StndDefinedFields struct {
38         StndDefinedFieldsVersion string `json:"stndDefinedFieldsVersion"`
39         SchemaReference          string `json:"schemaReference"`
40         Data                     Data   `json:"data"`
41 }
42
43 type Data struct {
44         DataId       string        `json:"id"`
45         Measurements []Measurement `json:"measurements"`
46 }
47
48 type Measurement struct {
49         MeasurementTypeInstanceReference string `json:"measurement-type-instance-reference"`
50         Value                            int    `json:"value"`
51         Unit                             string `json:"unit"`
52 }
53
54 func (message StdDefinedMessage) GetMeasurements() []Measurement {
55         return message.Event.StndDefinedFields.Data.Measurements
56 }