Add custom configuration-change handler to qp-d
[ric-app/qp-driver.git] / tests / conftest.py
1 # ==================================================================================
2 #       Copyright (c) 2020 AT&T Intellectual Property.
3 #
4 #   Licensed under the Apache License, Version 2.0 (the "License");
5 #   you may not use this file except in compliance with the License.
6 #   You may obtain a copy of the License at
7 #
8 #          http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #   Unless required by applicable law or agreed to in writing, software
11 #   distributed under the License is distributed on an "AS IS" BASIS,
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #   See the License for the specific language governing permissions and
14 #   limitations under the License.
15 # ==================================================================================
16 import pytest
17
18
19 @pytest.fixture
20 def ue_metrics():
21     return {
22         "UEID": "12345",
23         "ServingCellID": "310-680-200-555002",
24         "MeasTimestampUEPDCPBytes": "2020-03-18 02:23:18.220",
25         "MeasPeriodUEPDCPBytes": 20,
26         "UEPDCPBytesDL": 250000,
27         "UEPDCPBytesUL": 100000,
28         "MeasTimestampUEPRBUsage": "2020-03-18 02:23:18.220",
29         "MeasPeriodUEPRBUsage": 20,
30         "UEPRBUsageDL": 10,
31         "UEPRBUsageUL": 30,
32         "MeasTimestampRF": "2020-03-18 02:23:18.210",
33         "MeasPeriodRF": 40,
34         "ServingCellRF": {"RSRP": -115, "RSRQ": -16, "RSSINR": -5},
35         "NeighborCellRF": [
36             {"CID": "310-680-200-555001", "CellRF": {"RSRP": -90, "RSRQ": -13, "RSSINR": -2.5}},
37             {"CID": "310-680-200-555003", "CellRF": {"RSRP": -140, "RSRQ": -17, "RSSINR": -6}},
38         ],
39         "FAKE_BAD_DATA_TEST": "THIS SHOULD GET DELETED",
40     }
41
42
43 @pytest.fixture
44 def ue_metrics_with_bad_cell():
45     return {
46         "UEID": "8675309",
47         "ServingCellID": "310-680-200-555002",
48         "MeasTimestampUEPDCPBytes": "2020-03-18 02:23:18.220",
49         "MeasPeriodUEPDCPBytes": 20,
50         "UEPDCPBytesDL": 250000,
51         "UEPDCPBytesUL": 100000,
52         "MeasTimestampUEPRBUsage": "2020-03-18 02:23:18.220",
53         "MeasPeriodUEPRBUsage": 20,
54         "UEPRBUsageDL": 10,
55         "UEPRBUsageUL": 30,
56         "MeasTimestampRF": "2020-03-18 02:23:18.210",
57         "MeasPeriodRF": 40,
58         "ServingCellRF": {"RSRP": -115, "RSRQ": -16, "RSSINR": -5},
59         "NeighborCellRF": [
60             {"CID": "310-680-200-555001", "CellRF": {"RSRP": -90, "RSRQ": -13, "RSSINR": -2.5}},
61             {"CID": "CANTTOUCHTHIS", "CellRF": {"RSRP": -140, "RSRQ": -17, "RSSINR": -6}},
62         ],
63     }
64
65
66 @pytest.fixture
67 def cell_metrics_1():
68     return {
69         "CellID": "310-680-200-555001",
70         "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
71         "MeasPeriodPDCPBytes": 20,
72         "PDCPBytesDL": 2000000,
73         "PDCPBytesUL": 1200000,
74         "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
75         "MeasPeriodAvailPRB": 20,
76         "AvailPRBDL": 30,
77         "AvailPRBUL": 50,
78     }
79
80
81 @pytest.fixture
82 def cell_metrics_2():
83     return {
84         "CellID": "310-680-200-555002",
85         "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
86         "MeasPeriodPDCPBytes": 20,
87         "PDCPBytesDL": 800000,
88         "PDCPBytesUL": 400000,
89         "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
90         "MeasPeriodAvailPRB": 20,
91         "AvailPRBDL": 30,
92         "AvailPRBUL": 45,
93         "FAKE_BAD_DATA_TEST": "THIS SHOULD GET DELETED",
94     }
95
96
97 @pytest.fixture
98 def cell_metrics_3():
99     return {
100         "CellID": "310-680-200-555003",
101         "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
102         "MeasPeriodPDCPBytes": 20,
103         "PDCPBytesDL": 1900000,
104         "PDCPBytesUL": 1000000,
105         "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
106         "MeasPeriodAvailPRB": 20,
107         "AvailPRBDL": 60,
108         "AvailPRBUL": 80,
109     }
110
111
112 @pytest.fixture
113 def qpd_to_qp():
114     return {
115         "PredictionUE": "12345",
116         "UEMeasurements": {
117             "ServingCellID": "310-680-200-555002",
118             "MeasTimestampUEPDCPBytes": "2020-03-18 02:23:18.220",
119             "MeasPeriodUEPDCPBytes": 20,
120             "UEPDCPBytesDL": 250000,
121             "UEPDCPBytesUL": 100000,
122             "MeasTimestampUEPRBUsage": "2020-03-18 02:23:18.220",
123             "MeasPeriodUEPRBUsage": 20,
124             "UEPRBUsageDL": 10,
125             "UEPRBUsageUL": 30,
126         },
127         "CellMeasurements": [
128             {
129                 "CellID": "310-680-200-555001",
130                 "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
131                 "MeasPeriodPDCPBytes": 20,
132                 "PDCPBytesDL": 2000000,
133                 "PDCPBytesUL": 1200000,
134                 "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
135                 "MeasPeriodAvailPRB": 20,
136                 "AvailPRBDL": 30,
137                 "AvailPRBUL": 50,
138                 "MeasTimestampRF": "2020-03-18 02:23:18.210",
139                 "MeasPeriodRF": 40,
140                 "RFMeasurements": {"RSRP": -90, "RSRQ": -13, "RSSINR": -2.5},
141             },
142             {
143                 "CellID": "310-680-200-555003",
144                 "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
145                 "MeasPeriodPDCPBytes": 20,
146                 "PDCPBytesDL": 1900000,
147                 "PDCPBytesUL": 1000000,
148                 "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
149                 "MeasPeriodAvailPRB": 20,
150                 "AvailPRBDL": 60,
151                 "AvailPRBUL": 80,
152                 "MeasTimestampRF": "2020-03-18 02:23:18.210",
153                 "MeasPeriodRF": 40,
154                 "RFMeasurements": {"RSRP": -140, "RSRQ": -17, "RSSINR": -6},
155             },
156             {
157                 "CellID": "310-680-200-555002",
158                 "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
159                 "MeasPeriodPDCPBytes": 20,
160                 "PDCPBytesDL": 800000,
161                 "PDCPBytesUL": 400000,
162                 "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
163                 "MeasPeriodAvailPRB": 20,
164                 "AvailPRBDL": 30,
165                 "AvailPRBUL": 45,
166                 "MeasTimestampRF": "2020-03-18 02:23:18.210",
167                 "MeasPeriodRF": 40,
168                 "RFMeasurements": {"RSRP": -115, "RSRQ": -16, "RSSINR": -5},
169             },
170         ],
171     }
172
173
174 @pytest.fixture
175 def qpd_to_qp_bad_cell():
176     return {
177         "PredictionUE": "8675309",
178         "UEMeasurements": {
179             "ServingCellID": "310-680-200-555002",
180             "MeasTimestampUEPDCPBytes": "2020-03-18 02:23:18.220",
181             "MeasPeriodUEPDCPBytes": 20,
182             "UEPDCPBytesDL": 250000,
183             "UEPDCPBytesUL": 100000,
184             "MeasTimestampUEPRBUsage": "2020-03-18 02:23:18.220",
185             "MeasPeriodUEPRBUsage": 20,
186             "UEPRBUsageDL": 10,
187             "UEPRBUsageUL": 30,
188         },
189         "CellMeasurements": [
190             {
191                 "CellID": "310-680-200-555001",
192                 "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
193                 "MeasPeriodPDCPBytes": 20,
194                 "PDCPBytesDL": 2000000,
195                 "PDCPBytesUL": 1200000,
196                 "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
197                 "MeasPeriodAvailPRB": 20,
198                 "AvailPRBDL": 30,
199                 "AvailPRBUL": 50,
200                 "MeasTimestampRF": "2020-03-18 02:23:18.210",
201                 "MeasPeriodRF": 40,
202                 "RFMeasurements": {"RSRP": -90, "RSRQ": -13, "RSSINR": -2.5},
203             },
204             {
205                 "CellID": "310-680-200-555002",
206                 "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220",
207                 "MeasPeriodPDCPBytes": 20,
208                 "PDCPBytesDL": 800000,
209                 "PDCPBytesUL": 400000,
210                 "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220",
211                 "MeasPeriodAvailPRB": 20,
212                 "AvailPRBDL": 30,
213                 "AvailPRBUL": 45,
214                 "MeasTimestampRF": "2020-03-18 02:23:18.210",
215                 "MeasPeriodRF": 40,
216                 "RFMeasurements": {"RSRP": -115, "RSRQ": -16, "RSSINR": -5},
217             },
218         ],
219     }