br-rapp-sdk 2025.7.4.dev2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of br-rapp-sdk might be problematic. Click here for more details.

@@ -0,0 +1,4 @@
1
+ from .a1_services.a1_services import A1Services
2
+ from .monitoring_services.monitoring_services import MonitoringServices
3
+ from .oam_services.oam_services import OAMServices
4
+ from .common import create_logger
@@ -0,0 +1 @@
1
+ from .a1_policy_types import *
@@ -0,0 +1,652 @@
1
+ from typing import (
2
+ Any,
3
+ ClassVar,
4
+ List,
5
+ Literal,
6
+ Optional,
7
+ Annotated,
8
+ )
9
+ from pydantic import (
10
+ Field,
11
+ HttpUrl,
12
+ IPvAnyAddress,
13
+ validator,
14
+ model_validator,
15
+ StringConstraints,
16
+ )
17
+ from ..oam_services.network_types import FullModelName, FullNameTag, NameTag, SnakeModel, NetworkId
18
+
19
+ # === Base Identifier Types ===
20
+
21
+ PolicyTypeId = FullModelName
22
+ NearRtRicId = FullNameTag
23
+ PolicyId = NameTag
24
+ DynamicXappId = Annotated[
25
+ str,
26
+ StringConstraints(
27
+ pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?\.[a-z0-9]([-a-z0-9]*[a-z0-9])?\.[a-z0-9]([-a-z0-9]*[a-z0-9])?$',
28
+ min_length=5,
29
+ max_length=127,
30
+ ),
31
+ Field(
32
+ description=(
33
+ "Three-part lowercase identifier separated by dots in the form: name.target.network. "
34
+ "Each part must comply with DNS-1123: start and end with a letter or digit, and may contain hyphens."
35
+ )
36
+ )
37
+ ]
38
+
39
+ class SubscriptionId(SnakeModel):
40
+ id: str
41
+
42
+ # === Enum-like Filter ===
43
+
44
+ # TODO
45
+ class QueryFilter(SnakeModel):
46
+ OWN: ClassVar[str] = "OWN"
47
+ OTHERS: ClassVar[str] = "OTHERS"
48
+ ALL: ClassVar[str] = "ALL"
49
+
50
+ # === Scope Identifier ===
51
+
52
+ class PlmnId(SnakeModel):
53
+ """
54
+ Represents a Public Land Mobile Network Identifier (PLMN ID),
55
+ as defined in 3GPP TS 23.003.
56
+
57
+ Attributes:
58
+ mcc: Mobile Country Code (MCC), must be exactly 3 digits.
59
+ mnc: Mobile Network Code (MNC), must be 2 or 3 digits.
60
+ """
61
+
62
+ mcc: Optional[str] = Field(
63
+ default=None,
64
+ alias="mcc",
65
+ pattern=r"^[0-9]{3}$",
66
+ description="Mobile Country Code (3 digits, 3GPP TS 23.003)"
67
+ )
68
+
69
+ mnc: Optional[str] = Field(
70
+ default=None,
71
+ alias="mnc",
72
+ pattern=r"^[0-9]{2,3}$",
73
+ description="Mobile Network Code (2 or 3 digits, 3GPP TS 23.003)"
74
+ )
75
+
76
+
77
+ class SliceId(SnakeModel):
78
+ """
79
+ Represents a network slice identifier (S-NSSAI) as defined in 3GPP TS 23.003.
80
+
81
+ Attributes:
82
+ sst: Slice/Service Type (SST), 0–255. Applicable to 5G RAN.
83
+ sd: Slice Differentiator (SD), exactly 6 hexadecimal characters. Required if used.
84
+ plmn_id: Public Land Mobile Network Identifier (PLMN ID). Applicable to both 4G and 5G RAN.
85
+ """
86
+
87
+ sst: Optional[int] = Field(
88
+ default=None,
89
+ alias="sst",
90
+ ge=0,
91
+ le=255,
92
+ description="Slice/Service Type (0–255, 3GPP TS 23.003), applicable to 5G RAN."
93
+ )
94
+
95
+ sd: Optional[str] = Field(
96
+ default=None,
97
+ alias="sd",
98
+ pattern=r"^[A-Fa-f0-9]{6}$",
99
+ description="Slice Differentiator (exactly 6 hex characters, 3GPP TS 23.003), required if used."
100
+ )
101
+
102
+ plmn_id: Optional[PlmnId] = Field(
103
+ default=None,
104
+ alias="plmnId",
105
+ description="Public Land Mobile Network Identifier (3GPP TS 23.003), applicable to 4G and 5G RAN."
106
+ )
107
+
108
+
109
+ class QosId(SnakeModel):
110
+ """
111
+ Represents a QoS Identifier used in 4G or 5G RANs.
112
+
113
+ Exactly one of `qci` (4G) or `field_5ql` (5G) must be set.
114
+
115
+ Attributes:
116
+ qci: QoS Class Identifier for 4G (3GPP TS 23.203), range 1-256.
117
+ field_5ql: 5G QoS Identifier (5QI) as per 3GPP TS 23.501, range 1-256.
118
+ """
119
+
120
+ qci: Optional[int] = Field(
121
+ None,
122
+ alias="qci",
123
+ ge=1,
124
+ le=256,
125
+ description="4G QoS Class Identifier (3GPP TS 23.203)"
126
+ )
127
+ field_5ql: Optional[int] = Field(
128
+ None,
129
+ alias="5ql",
130
+ ge=1,
131
+ le=256,
132
+ description="5G QoS Identifier (5QI, 3GPP TS 23.501)"
133
+ )
134
+
135
+ @model_validator(mode="after")
136
+ def validate_exclusive_fields(self) -> "QosId":
137
+ if self.qci is not None and self.field_5ql is not None:
138
+ raise ValueError("Only one of 'qci' or '5ql' may be set.")
139
+ if self.qci is None and self.field_5ql is None:
140
+ raise ValueError("One of 'qci' or '5ql' must be set.")
141
+ return self
142
+
143
+
144
+ class CId(SnakeModel):
145
+ """
146
+ Represents a Cell Identifier, either for 4G (E-UTRAN) or 5G (NR),
147
+ as defined in 3GPP TS 23.003.
148
+
149
+ Exactly one of `ec_i` (for 4G) or `nc_i` (for 5G) must be set.
150
+
151
+ Attributes:
152
+ ec_i: E-UTRAN Cell Identifier (28-bit integer, 0-268435455).
153
+ nc_i: NR Cell Identifier (36-bit integer, 0-68719476735).
154
+ """
155
+
156
+ ec_i: Optional[int] = Field(
157
+ None,
158
+ alias="ecI",
159
+ ge=0,
160
+ le=268_435_455,
161
+ description="E-UTRAN Cell Identifier (4G, 28 bits)"
162
+ )
163
+ nc_i: Optional[int] = Field(
164
+ None,
165
+ alias="ncI",
166
+ ge=0,
167
+ le=68_719_476_735,
168
+ description="NR Cell Identifier (5G, 36 bits)"
169
+ )
170
+
171
+ @model_validator(mode="after")
172
+ def validate_exclusive_fields(cls, values):
173
+ ec_i, nc_i = values.get("ec_i"), values.get("nc_i")
174
+ if ec_i is not None and nc_i is not None:
175
+ raise ValueError("Only one of 'ec_i' or 'nc_i' may be set.")
176
+ if ec_i is None and nc_i is None:
177
+ raise ValueError("One of 'ec_i' or 'nc_i' must be set.")
178
+ return values
179
+
180
+
181
+ class CellId(SnakeModel):
182
+ """
183
+ Represents a global Cell Identifier based on ECGI (for 4G) or NCGI (for 5G),
184
+ as defined in 3GPP TS 23.003.
185
+
186
+ Attributes:
187
+ plmn_id: Public Land Mobile Network Identifier (PLMN ID) as per 3GPP TS 23.003.
188
+ c_id: Cell Identifier component of the global cell identity.
189
+ """
190
+
191
+ plmn_id: Optional[PlmnId] = Field(
192
+ None,
193
+ alias="plmnId",
194
+ description="PLMN Identifier (3GPP TS 23.003)"
195
+ )
196
+ c_id: Optional[CId] = Field(
197
+ None,
198
+ alias="cId",
199
+ description="Cell Identifier (3GPP TS 23.003)"
200
+ )
201
+
202
+ class GroupId(SnakeModel):
203
+ """
204
+ Represents a group identifier used to implicitly reference a dynamic set of UEs
205
+ sharing a common radio resource or subscriber profile.
206
+
207
+ Only one of the two attributes may be set, depending on the RAN type:
208
+ - `sp_id` for 4G RAN (subscriber profile ID, 3GPP TS 36.300)
209
+ - `rfsp_index` for 5G RAN (RF selection priority index, 3GPP TS 23.501)
210
+
211
+ Value range for both is 1-256.
212
+ """
213
+
214
+ sp_id: Optional[int] = Field(
215
+ None,
216
+ alias="spId",
217
+ ge=1,
218
+ le=256,
219
+ description="4G RAN: Subscriber Profile ID (3GPP TS 36.300)"
220
+ )
221
+ rfsp_index: Optional[int] = Field(
222
+ None,
223
+ alias="rfspIndex",
224
+ ge=1,
225
+ le=256,
226
+ description="5G RAN: RF selection priority index (3GPP TS 23.501)"
227
+ )
228
+
229
+ @model_validator(mode="after")
230
+ def only_one_field_must_be_set(cls, values):
231
+ sp_id, rfsp_index = values.get("sp_id"), values.get("rfsp_index")
232
+ if sp_id and rfsp_index:
233
+ raise ValueError("Only one of 'sp_id' or 'rfsp_index' may be set, not both.")
234
+ if not sp_id and not rfsp_index:
235
+ raise ValueError("One of 'sp_id' or 'rfsp_index' must be set.")
236
+ return values
237
+
238
+
239
+ class ScopeIdentifier(SnakeModel):
240
+ """
241
+ Identifies the scope in which a policy statement is applicable.
242
+
243
+ Attributes:
244
+ slice_id: Identifies the network slice the policy applies to.
245
+ ue_id: Identifies a specific UE the policy applies to.
246
+ group_id: Identifies a group of UEs to which the policy applies.
247
+ qos_id: Identifies the QoS flow the policy applies to.
248
+ cell_id: Identifies the cell the policy applies to.
249
+ targets: (Optional) List of custom target entities, if applicable.
250
+ scopes: (Optional) List of named scopes (e.g., for orchestration grouping or policy context).
251
+ """
252
+
253
+ slice_id: Optional[SliceId] = Field(None, alias="sliceid")
254
+ ue_id: Optional[str] = Field(None, alias="ueid")
255
+ group_id: Optional[GroupId] = Field(None, alias="groupid")
256
+ qos_id: Optional[QosId] = Field(None, alias="qosid")
257
+ cell_id: Optional[CellId] = Field(None, alias="cellid")
258
+ targets: Optional[List[str]] = Field(None, alias="targets")
259
+ scopes: Optional[List[str]] = Field(None, alias="scopes")
260
+
261
+
262
+ # === Objectives and Resource Statements ===
263
+
264
+ class ReliabilityType(SnakeModel):
265
+ """
266
+ Represents the reliability requirement for successful transmission of a data packet
267
+ of a given size within a user-plane latency constraint.
268
+
269
+ Attributes:
270
+ packet_size: Size of the data packet in bytes.
271
+ user_plane_latency: Maximum allowed latency in ms for delivering the packet across the radio interface.
272
+ success_probability: Probability (0–1) that the packet is successfully delivered within the latency budget.
273
+ """
274
+
275
+ packet_size: Optional[int] = Field(
276
+ None,
277
+ alias="packetSize",
278
+ ge=0,
279
+ description="Packet size in bytes"
280
+ )
281
+ user_plane_latency: Optional[int] = Field(
282
+ None,
283
+ alias="userPlaneLatency",
284
+ ge=0,
285
+ description="Latency in ms from ingress to egress of the radio interface (3GPP TS 38.314)"
286
+ )
287
+ success_probability: Optional[float] = Field(
288
+ None,
289
+ alias="successProbability",
290
+ ge=0.0,
291
+ le=1.0,
292
+ description="Probability of successful transmission (0–1)"
293
+ )
294
+ class QosObjectives(SnakeModel):
295
+ """
296
+ Represents QoS (Quality of Service) objectives as defined in 3GPP TS 23.501.
297
+
298
+ Attributes:
299
+ gfbr: Guaranteed Flow Bit Rate (GFBR) in kbps. Ensures minimum bandwidth is available.
300
+ mfbr: Maximum Flow Bit Rate (MFBR) in kbps. Upper limit of allowed bandwidth.
301
+ priority_level: QoS priority level (lower value means higher priority).
302
+ pdb: Packet Delay Budget (PDB) in milliseconds. Max tolerated delay for packet delivery.
303
+ """
304
+ gfbr: Optional[int] = Field(None, alias="gfbr")
305
+ mfbr: Optional[int] = Field(None, alias="mfbr")
306
+ priority_level: Optional[int] = Field(None, alias="priorityLevel")
307
+ pdb: Optional[int]
308
+
309
+
310
+ class QoeObjectives(SnakeModel):
311
+ """
312
+ Represents QoE (Quality of Experience) objectives for media services.
313
+
314
+ Attributes:
315
+ qoe_score: Mean Opinion Score (MOS) between 1 and 5.
316
+ Can represent video MOS (e.g., per ITU-T P.1203.3) or a custom-defined score.
317
+ initial_buffering: Initial buffering time in seconds (between user action and playback start).
318
+ re_buff_freq: Rebuffering frequency (stalling events per media duration or time window).
319
+ stall_ratio: Ratio of total stall duration to total media length.
320
+ """
321
+
322
+ qoe_score: Optional[int] = Field(None, alias="qoeScore")
323
+ initial_buffering: Optional[int] = Field(None, alias="initialBuffering")
324
+ re_buff_freq: Optional[int] = Field(None, alias="reBuffFreq")
325
+ stall_ratio: Optional[int] = Field(None, alias="stallRatio")
326
+
327
+
328
+ class UeLevelObjectives(SnakeModel):
329
+ """
330
+ Represents UE-level performance targets or RAN optimization constraints.
331
+
332
+ Attributes:
333
+ ul_throughput: Average uplink RAN UE throughput in kbps (3GPP TS 28.552).
334
+ dl_throughput: Average downlink RAN UE throughput in kbps (3GPP TS 28.552).
335
+ ul_packet_delay: Uplink packet delay in milliseconds (typically 0-1 ms) (3GPP TS 38.314, 28.552).
336
+ dl_packet_delay: Downlink packet delay in milliseconds (typically 0-1 ms) (3GPP TS 38.314, 28.552).
337
+ ul_pdcp_sdu_packet_loss_rate: Uplink PDCP SDU packet loss rate as reliability target (3GPP TS 28.552).
338
+ dl_rlc_sdu_packet_loss_rate: Downlink RLC SDU packet loss rate as reliability target (3GPP TS 38.314).
339
+ dl_reliability: Downlink reliability as performance target (3GPP TS 28.552).
340
+ ul_reliability: Uplink reliability as performance target (3GPP TS 28.552).
341
+ """
342
+
343
+ ul_throughput: Optional[int] = Field(None, alias="ulThroughput")
344
+ dl_throughput: Optional[int] = Field(None, alias="dlThroughput")
345
+ ul_packet_delay: Optional[int] = Field(None, alias="ulPacketDelay")
346
+ dl_packet_delay: Optional[int] = Field(None, alias="dlPacketDelay")
347
+ ul_pdcp_sdu_packet_loss_rate: Optional[int] = Field(None, alias="ulPdcpSduPacketLossRate")
348
+ dl_rlc_sdu_packet_loss_rate: Optional[int] = Field(None, alias="dlRlcSduPacketLossRate")
349
+ dl_reliability: Optional[ReliabilityType] = Field(None, alias="dlReliability")
350
+ ul_reliability: Optional[ReliabilityType] = Field(None, alias="ulReliability")
351
+
352
+
353
+ class SliceSlaObjectives(SnakeModel):
354
+ """
355
+ Represents the Slice Service Level Agreement (SLA) objectives for a network slice.
356
+
357
+ Attributes:
358
+ max_number_of_ues: Maximum number of RRC-connected UEs supported concurrently by the slice (see NG.116 §3.4.17).
359
+ max_number_of_pdu_sessions: Maximum number of PDU sessions supported concurrently by the slice (NG.116 §3.4.16).
360
+ gua_dl_thpt_per_slice: Guaranteed downlink throughput in kbps for the entire slice (NG.116 §3.4.5).
361
+ max_dl_thpt_per_slice: Maximum supported downlink throughput in kbps for all UEs in the slice (NG.116 §3.4.5).
362
+ max_dl_thpt_per_ue: Maximum supported downlink throughput in kbps per UE (NG.116 §3.4.6).
363
+ gua_ul_thpt_per_slice: Guaranteed uplink throughput in kbps for the entire slice (NG.116 §3.4.31).
364
+ max_ul_thpt_per_slice: Maximum supported uplink throughput in kbps for all UEs in the slice (NG.116 §3.4.31).
365
+ max_ul_thpt_per_ue: Maximum supported uplink throughput in kbps per UE (NG.116 §3.4.32).
366
+ max_dl_packet_delay_per_ue: Maximum downlink packet delay in milliseconds.
367
+ max_ul_packet_delay_per_ue: Maximum uplink packet delay in milliseconds.
368
+ max_dl_pdcp_sdu_packet_loss_rate_per_ue: Max DL PDCP SDU packet loss rate (0-1 range).
369
+ max_ul_rlc_sdu_packet_loss_rate_per_ue: Max UL RLC SDU packet loss rate (0-1 range).
370
+ min_dl_reliability_per_ue: Minimum downlink reliability requirement.
371
+ min_ul_reliability_per_ue: Minimum uplink reliability requirement.
372
+ max_dl_jitter_per_ue: Maximum downlink jitter in milliseconds.
373
+ max_ul_jitter_per_ue: Maximum uplink jitter in milliseconds.
374
+ dl_slice_priority: Downlink slice priority (1 = highest).
375
+ ul_slice_priority: Uplink slice priority (1 = highest).
376
+ slice_enforce: Custom slice enforcement policy (FlexRIC-specific).
377
+ """
378
+
379
+ max_number_of_ues: Optional[int] = Field(None, alias="maxNumberOfUes")
380
+ max_number_of_pdu_sessions: Optional[int] = Field(None, alias="maxNumberOfPduSessions")
381
+ gua_dl_thpt_per_slice: Optional[int] = Field(None, alias="guaDlThptPerSlice")
382
+ max_dl_thpt_per_slice: Optional[int] = Field(None, alias="maxDlThptPerSlice")
383
+ max_dl_thpt_per_ue: Optional[int] = Field(None, alias="maxDlThptPerUe")
384
+ gua_ul_thpt_per_slice: Optional[int] = Field(None, alias="guaUlThptPerSlice")
385
+ max_ul_thpt_per_slice: Optional[int] = Field(None, alias="maxUlThptPerSlice")
386
+ max_ul_thpt_per_ue: Optional[int] = Field(None, alias="maxUlThptPerUe")
387
+ max_dl_packet_delay_per_ue: Optional[int] = Field(None, alias="maxDlPacketDelayPerUe")
388
+ max_ul_packet_delay_per_ue: Optional[int] = Field(None, alias="maxUlPacketDelayPerUe")
389
+ max_dl_pdcp_sdu_packet_loss_rate_per_ue: Optional[int] = Field(None, alias="maxDlPdcpSduPacketLossRatePerUe")
390
+ max_ul_rlc_sdu_packet_loss_rate_per_ue: Optional[int] = Field(None, alias="maxUlRlcSduPacketLossRatePerUe")
391
+ min_dl_reliability_per_ue: Optional[ReliabilityType] = Field(None, alias="minDlReliabilityPerUe")
392
+ min_ul_reliability_per_ue: Optional[ReliabilityType] = Field(None, alias="minUlReliabilityPerUe")
393
+ max_dl_jitter_per_ue: Optional[int] = Field(None, alias="maxDlJitterPerUe")
394
+ max_ul_jitter_per_ue: Optional[int] = Field(None, alias="maxUlJitterPerUe")
395
+ dl_slice_priority: Optional[int] = Field(None, alias="dlSlicePriority")
396
+ ul_slice_priority: Optional[int] = Field(None, alias="ulSlicePriority")
397
+ slice_enforce: Optional[dict] = Field(None, alias="sliceEnforce")
398
+
399
+
400
+ class LbObjectives(SnakeModel):
401
+ """
402
+ Represents load balancing objectives related to PRB (Physical Resource Block) usage.
403
+
404
+ Attributes:
405
+ target_prb_usg (Optional[int]):
406
+ The target PRB usage in percent.
407
+ The denominator is the total number of PRBs in the cell, and the numerator is the number of PRBs
408
+ specified by `prb_usg_type`. Value range: 0-100 [%].
409
+
410
+ prb_usg_type (Optional[int]):
411
+ Specifies the PRB usage type used in the calculation of `target_prb_usg`.
412
+
413
+ Valid values (from 3GPP TS 28.552):
414
+
415
+ - 1: Mean DL PRB used for data traffic (5.1.1.2.5)
416
+ - 2: Mean UL PRB used for data traffic (5.1.1.2.7)
417
+ - 3: Peak DL PRB used for data traffic (5.1.1.2.9)
418
+ - 4: Peak UL PRB used for data traffic (5.1.1.2.10)
419
+ - 5: Mean DL PRB used for data traffic per S-NSSAI (5.1.1.2.5)
420
+ - 6: Mean UL PRB used for data traffic per S-NSSAI (5.1.1.2.7)
421
+ - 7: Peak DL PRB used for data traffic per S-NSSAI (5.1.1.2.9)
422
+ - 8: Peak UL PRB used for data traffic per S-NSSAI (5.1.1.2.10)
423
+
424
+ Applicability:
425
+ - If only `cellId` is included in the scope: valid values are 1-4.
426
+ - If both `cellId` and `sliceId` are included in the scope: valid values are 5-8.
427
+ """
428
+
429
+ target_prb_usg: Optional[int] = Field(
430
+ None,
431
+ alias="targetPrbUsg",
432
+ description="The target PRB usage in percent. Value range: 0-100 [%]."
433
+ )
434
+ prb_usg_type: Optional[int] = Field(
435
+ None,
436
+ alias="prbUsgType",
437
+ description="Specifies the PRB usage type used in the calculation of targetPrbUsg."
438
+ )
439
+
440
+ class PolicyObjectives(SnakeModel):
441
+ """
442
+ Represents the policy objectives defining various objectives based on A1TD spec.
443
+ Attributes:
444
+ qos_objectives (Optional[QosObjectives]): Objectives related to Quality of Service.
445
+ qoe_objectives (Optional[QoeObjectives]): Objectives related to Quality of Experience.
446
+ ue_level_objectives (Optional[UeLevelObjectives]): Objectives at the User Equipment level.
447
+ slice_sla_objectives (Optional[SliceSlaObjectives]): Objectives related to Slice Service Level Agreements.
448
+ lb_objectives (Optional[LbObjectives]): Objectives related to Load Balancing.
449
+ """
450
+ qos_objectives: Optional[QosObjectives] = Field(
451
+ None,
452
+ alias="qosObjectives"
453
+ )
454
+ qoe_objectives: Optional[QoeObjectives] = Field(
455
+ None,
456
+ alias="qoeObjectives"
457
+ )
458
+ ue_level_objectives: Optional[UeLevelObjectives] = Field(
459
+ None,
460
+ alias="ueLevelObjectives"
461
+ )
462
+ slice_sla_objectives: Optional[SliceSlaObjectives] = Field(
463
+ None,
464
+ alias="sliceSlaObjectives"
465
+ )
466
+ lb_objectives: Optional[LbObjectives] = Field(
467
+ None,
468
+ alias="lbObjectives"
469
+ )
470
+
471
+
472
+ # === Resources and Top Level ===
473
+
474
+ class PolicyResources(SnakeModel):
475
+ """
476
+ Represents the policy resources defining various resources based on A1TD spec.
477
+ Attributes:
478
+ tsp_resources (Optional[dict]): Resources related to Traffic Steering Policies.
479
+ slice_sla_resources (Optional[dict]): Resources related to Slice Service Level Agreements.
480
+ lb_resources (Optional[dict]): Resources related to Load Balancing.
481
+ """
482
+ tsp_resources: Optional[dict] = Field(
483
+ None,
484
+ alias="tspResources"
485
+ )
486
+ slice_sla_resources: Optional[dict] = Field(
487
+ None,
488
+ alias="sliceSlaResources"
489
+ )
490
+ lb_resources: Optional[dict] = Field(
491
+ None,
492
+ alias="lbResources"
493
+ )
494
+
495
+
496
+ class PolicyStatements(SnakeModel):
497
+ """
498
+ Represents the policy statements defining objectives and resources based on A1TD spec.
499
+
500
+ Attributes:
501
+ policy_objectives (PolicyObjectives): A statement for policy objectives expresses the goal for the policy.
502
+ policy_resources (PolicyResources): A statement for policy resources expresses the conditions for resource usage for the policy.
503
+ """
504
+ policy_objectives: Optional[PolicyObjectives] = Field(
505
+ None,
506
+ alias="policyObjectives",
507
+ description="The objectives of the policy based on A1TD spec."
508
+ )
509
+ policy_resources: Optional[PolicyResources] = Field(
510
+ None,
511
+ alias="policyResources",
512
+ description="The resources associated with the policy based on A1TD spec."
513
+ )
514
+
515
+
516
+ class PolicyObject(SnakeModel):
517
+ """
518
+ Represents a policy object containing scope and policy statements based on A1TD spec.
519
+ A PolicyObject contains a scope identifier and at least one policy statement (e.g., one or more policy objective statements and/or one or more policy resource statements)
520
+
521
+ Attributes:
522
+ scope_identifier (ScopeIdentifier): The scope of the policy; Identifier of what the statements in the policy applies to (UE, group of UEs, slice, QoS flow, network resource or combinations thereof).
523
+ policy_statements (PolicyStatements): The statements defining the policy objectives and resources.
524
+ """
525
+ scope_identifier: ScopeIdentifier = Field(
526
+ ...,
527
+ alias="scopeIdentifier",
528
+ description="The scope of the policy based on A1TD spec."
529
+ )
530
+ policy_statements: PolicyStatements = Field(
531
+ ...,
532
+ alias="policyStatements",
533
+ description="The statements defining the policy objectives and resources based on A1TD spec."
534
+ )
535
+
536
+
537
+
538
+ # === API Types ===
539
+
540
+ class Endpoint(SnakeModel):
541
+ api_path: str = Field(..., alias="apiPath")
542
+ element_name: str = Field(..., alias="elementName")
543
+ host: str
544
+ ip: IPvAnyAddress
545
+ method: Literal["GET", "POST", "PUT", "DELETE", "PATCH"]
546
+ port: int
547
+ scheme: Literal["http", "https"]
548
+ service: str
549
+
550
+ #TODO: It is better to use host instead of ip in the full_url
551
+ @property
552
+ def full_url(self) -> HttpUrl:
553
+ """Constructs the full URL from scheme, host, port, and apiPath."""
554
+ return HttpUrl(f"{self.scheme}://{self.ip}:{self.port}{self.api_path}")
555
+
556
+ @validator("port")
557
+ def port_range(cls, v):
558
+ if not (1 <= v <= 65535):
559
+ raise ValueError("Port must be between 1 and 65535")
560
+ return v
561
+
562
+
563
+ class PolicyFeedbackDestination(Endpoint):
564
+ """
565
+ Represents the endpoint for policy feedback.
566
+ Inherits from Endpoint and includes additional fields specific to policy feedback.
567
+
568
+ Attributes:
569
+ api_path (str): The API path for the feedback endpoint.
570
+ element_name (str): The name of the element for the feedback endpoint.
571
+ host (str): The host for the feedback endpoint.
572
+ ip (IPvAnyAddress): The IP address for the feedback endpoint.
573
+ method (Literal["GET", "POST", "PUT", "DELETE", "PATCH"]): The HTTP method for the feedback endpoint.
574
+ port (int): The port for the feedback endpoint.
575
+ scheme (Literal["http", "https"]): The scheme for the feedback endpoint.
576
+ service (str): The service name for the feedback endpoint.
577
+ """
578
+ pass
579
+
580
+ class PolicyTypeInformation(SnakeModel):
581
+ """
582
+ Represents the information of a policy type, including its ID and Near Real-Time RIC ID.
583
+
584
+ Attributes:
585
+ policy_type_id (PolicyTypeId): Identifier for the policy type.
586
+ near_rt_ric_id (NearRtRicId): Identifier for the Near Real-Time RIC.
587
+ """
588
+ policy_type_id: PolicyTypeId = Field(
589
+ ...,
590
+ alias="policyTypeId"
591
+ )
592
+ near_rt_ric_id: NearRtRicId = Field(
593
+ ...,
594
+ alias="nearRtRicId"
595
+ )
596
+
597
+
598
+ class PolicyInformation(SnakeModel):
599
+ """
600
+ Represents the information of a policy, including its ID and Near Real-Time RIC ID.
601
+
602
+ Attributes:
603
+ policy_id (PolicyId): Identifier for the policy.
604
+ near_rt_ric_id (NearRtRicId): Identifier for the Near Real-Time RIC.
605
+ """
606
+
607
+ policy_id: PolicyId = Field(
608
+ ...,
609
+ alias="policyId"
610
+ )
611
+ near_rt_ric_id: NearRtRicId = Field(
612
+ ...,
613
+ alias="nearRtRicId"
614
+ )
615
+
616
+
617
+ class PolicyTypeObject(SnakeModel):
618
+ # TODO: Define this based on A1TD spec content if available
619
+ name: dict
620
+
621
+ class PolicyObjectInformation(SnakeModel):
622
+ """
623
+ Represents the information of a policy object based on R1 A1-Related Services, including its target, type, and the actual policy object.
624
+
625
+ Attributes:
626
+ near_rt_ric_id (NearRtRicId): Identifier for the Near Real-Time RIC that is to be used for the policy deployment. format: <ric-name>.<network-name>
627
+ policy_type_id (PolicyTypeId): Identifier for the policy type that is to be used for the policy deployment. format: <model-name>/<deployment-mode>
628
+ policy_object (PolicyObject): Policy Object is a JSON representation of an A1 policy; the A1 policies are specified in A1TD.
629
+ """
630
+ near_rt_ric_id: NearRtRicId = Field(
631
+ ...,
632
+ alias="nearRtRicId",
633
+ description="Identifier for the Near Real-Time RIC as a target. format: <ric-name>.<network-name>"
634
+ )
635
+ policy_type_id: PolicyTypeId = Field(
636
+ ...,
637
+ alias="policyTypeId",
638
+ description="Identifier for the policy type. format: <model-name>/<deployment-mode>"
639
+ )
640
+ policy_object: PolicyObject = Field(
641
+ ...,
642
+ alias="policyObject",
643
+ description="The actual policy object containing scope and statements."
644
+ )
645
+
646
+
647
+ class PolicyStatusSubscription(SnakeModel):
648
+ subscription_scope: QueryFilter = Field(..., alias="subscriptionScope")
649
+ notification_destination: Endpoint = Field(..., alias="notificationDestination")
650
+ policy_id_list: Optional[List[PolicyId]] = Field(None, alias="policyIdList")
651
+ policy_type_id_list: Optional[List[PolicyTypeId]] = Field(None, alias="policyTypeIdList")
652
+ near_rt_ric_id_list: Optional[List[NearRtRicId]] = Field(None, alias="nearRtRicIdList")