Merge "Fix MR polling bug in DMaaP Mediator"
[nonrtric.git] / test / usecases / odusliceassurance / goversion / messages / policyRatio.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 import (
24         "strconv"
25
26         "oransc.org/usecase/oduclosedloop/internal/structures"
27 )
28
29 type ORanDuRestConf struct {
30         DistributedUnitFunction DistributedUnitFunction `json:"distributed-unit-functions"`
31 }
32
33 type DistributedUnitFunction struct {
34         Id             string           `json:"id"`
35         Cell           []Cell           `json:"cell"`
36         RRMPolicyRatio []RRMPolicyRatio `json:"radio-resource-management-policy-ratio"`
37 }
38
39 type Cell struct {
40         Id        string `json:"id"`
41         AdmState  string `json:"administrative-state"`
42         OpState   string `json:"operational-state"`
43         UserLabel string `json:"user-label"`
44 }
45
46 type RRMPolicyRatio struct {
47         Id                      string            `json:"id"`
48         AdmState                string            `json:"administrative-state"`
49         UserLabel               string            `json:"user-label"`
50         RRMPolicyMaxRatio       int               `json:"radio-resource-management-policy-max-ratio"`
51         RRMPolicyMinRatio       string            `json:"radio-resource-management-policy-min-ratio"`
52         RRMPolicyDedicatedRatio string            `json:"radio-resource-management-policy-dedicated-ratio"`
53         ResourceType            string            `json:"resource-type"`
54         RRMPolicyMembers        []RRMPolicyMember `json:"radio-resource-management-policy-members"`
55 }
56
57 type RRMPolicyMember struct {
58         MobileCountryCode   string `json:"mobile-country-code"`
59         MobileNetworkCode   string `json:"mobile-network-code"`
60         SliceDifferentiator int    `json:"slice-differentiator"`
61         SliceServiceType    int    `json:"slice-service-type"`
62 }
63
64 func GetDedicatedRatioUpdateMessage(metric structures.SliceMetric, policy structures.PolicyRatio, dedicatedRatio int) RRMPolicyRatio {
65         return RRMPolicyRatio{
66                 Id:                      policy.PolicyRatioId,
67                 AdmState:                "Locked",
68                 UserLabel:               "Some user label",
69                 RRMPolicyMaxRatio:       policy.PolicyMaxRatio,
70                 RRMPolicyMinRatio:       policy.PolicyMinRatio,
71                 RRMPolicyDedicatedRatio: strconv.Itoa(dedicatedRatio),
72                 ResourceType:            "prb",
73                 RRMPolicyMembers: []RRMPolicyMember{
74                         {
75                                 MobileCountryCode:   "046",
76                                 MobileNetworkCode:   "651",
77                                 SliceDifferentiator: metric.SliceDiff,
78                                 SliceServiceType:    metric.SliceServiceType,
79                         },
80                 },
81         }
82 }