@@ -43,6 +43,183 @@ func (s *nudrService) getDataSubscription(uri string) *DataRepository.APIClient
43
43
return client
44
44
}
45
45
46
+ func (s * nudrService ) GetSessionManagementPolicyData (uri string ,
47
+ ueId string , sliceInfo * models.Snssai , dnn string ) (
48
+ resp * DataRepository.ReadSessionManagementPolicyDataResponse ,
49
+ problemDetails * models.ProblemDetails , err error ,
50
+ ) {
51
+ if uri == "" {
52
+ problemDetail := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
53
+ "GetSessionManagementPolicyData Can't find UDR URI" )
54
+ return nil , & problemDetail , nil
55
+ }
56
+
57
+ if ueId == "" {
58
+ problemDetail := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
59
+ "GetSessionManagementPolicyData Can't find UE ID" )
60
+ return nil , & problemDetail , nil
61
+ }
62
+
63
+ if sliceInfo == nil {
64
+ problemDetails := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
65
+ "GetSessionManagementPolicyData Can't find Slice Info" )
66
+ return nil , & problemDetails , nil
67
+ }
68
+
69
+ if dnn == "" {
70
+ problemDetails := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
71
+ "GetSessionManagementPolicyData Can't find DNN" )
72
+ return nil , & problemDetails , nil
73
+ }
74
+
75
+ ctx , pd , err := s .consumer .Context ().GetTokenCtx (models .ServiceName_NUDR_DR , models .NrfNfManagementNfType_UDR )
76
+ if err != nil {
77
+ return nil , nil , err
78
+ } else if pd != nil {
79
+ return nil , pd , nil
80
+ }
81
+
82
+ client := s .getDataSubscription (uri )
83
+ param := DataRepository.ReadSessionManagementPolicyDataRequest {
84
+ UeId : & ueId ,
85
+ Snssai : sliceInfo ,
86
+ Dnn : & dnn ,
87
+ }
88
+ resp , err = client .SessionManagementPolicyDataDocumentApi .ReadSessionManagementPolicyData (ctx , & param )
89
+ if err == nil {
90
+ return resp , nil , nil
91
+ }
92
+ problem := err .(openapi.GenericOpenAPIError ).Model ().(models.ProblemDetails )
93
+ problemDetails = & problem
94
+ return nil , problemDetails , nil
95
+ }
96
+
97
+ func (s * nudrService ) CreateBdtData (uri string , bdtData * models.BdtData ) (
98
+ problemDetails * models.ProblemDetails , err error ,
99
+ ) {
100
+ if uri == "" {
101
+ problemDetail := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
102
+ "CreateBdtData Can't find UDR URI" )
103
+ return & problemDetail , nil
104
+ }
105
+
106
+ ctx , pd , err := s .consumer .Context ().GetTokenCtx (models .ServiceName_NUDR_DR , models .NrfNfManagementNfType_UDR )
107
+ if err != nil {
108
+ return nil , err
109
+ } else if pd != nil {
110
+ return pd , nil
111
+ }
112
+
113
+ client := s .getDataSubscription (uri )
114
+ param := DataRepository.CreateIndividualBdtDataRequest {
115
+ BdtData : bdtData ,
116
+ }
117
+ _ , err = client .IndividualBdtDataDocumentApi .CreateIndividualBdtData (ctx , & param )
118
+ if err == nil {
119
+ return nil , nil
120
+ }
121
+ problem := err .(openapi.GenericOpenAPIError ).Model ().(models.ProblemDetails )
122
+ problemDetails = & problem
123
+ return problemDetails , nil
124
+ }
125
+
126
+ func (s * nudrService ) CreateBdtPolicyContext (uri string , req * DataRepository.ReadBdtDataRequest ) (
127
+ resp * DataRepository.ReadBdtDataResponse , problemDetails * models.ProblemDetails , err error ,
128
+ ) {
129
+ if uri == "" {
130
+ problemDetail := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
131
+ "CreateBdtData Can't find UDR URI" )
132
+ return nil , & problemDetail , nil
133
+ }
134
+ ctx , pd , err := s .consumer .Context ().GetTokenCtx (models .ServiceName_NUDR_DR , models .NrfNfManagementNfType_UDR )
135
+ if err != nil {
136
+ return nil , nil , err
137
+ } else if pd != nil {
138
+ return nil , pd , nil
139
+ }
140
+
141
+ client := s .getDataSubscription (uri )
142
+ resp , err = client .BdtDataStoreApi .ReadBdtData (ctx , req )
143
+ if err == nil {
144
+ return resp , nil , nil
145
+ }
146
+ problem := err .(openapi.GenericOpenAPIError ).Model ().(models.ProblemDetails )
147
+ problemDetails = & problem
148
+ return nil , problemDetails , nil
149
+ }
150
+
151
+ func (s * nudrService ) GetBdtData (uri string , bdtRefId string ) (
152
+ resp * DataRepository.ReadIndividualBdtDataResponse , problemDetails * models.ProblemDetails , err error ,
153
+ ) {
154
+ if uri == "" {
155
+ problemDetail := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
156
+ "GetBdtData Can't find UDR URI" )
157
+ return nil , & problemDetail , nil
158
+ }
159
+
160
+ if bdtRefId == "" {
161
+ problemDetail := util .GetProblemDetail ("Can't find any UDR which supported to this PCF" ,
162
+ "GetBdtData Can't find BdtRefId" )
163
+ return nil , & problemDetail , nil
164
+ }
165
+
166
+ ctx , pd , err := s .consumer .Context ().GetTokenCtx (models .ServiceName_NUDR_DR , models .NrfNfManagementNfType_UDR )
167
+ if err != nil {
168
+ return nil , nil , err
169
+ } else if pd != nil {
170
+ return nil , pd , nil
171
+ }
172
+
173
+ readBdtDataReq := DataRepository.ReadIndividualBdtDataRequest {
174
+ BdtReferenceId : & bdtRefId ,
175
+ }
176
+
177
+ client := s .getDataSubscription (uri )
178
+ resp , err = client .IndividualBdtDataDocumentApi .ReadIndividualBdtData (ctx , & readBdtDataReq )
179
+ if err == nil {
180
+ return resp , nil , nil
181
+ }
182
+ problem := err .(openapi.GenericOpenAPIError ).Model ().(models.ProblemDetails )
183
+ problemDetails = & problem
184
+ return nil , problemDetails , nil
185
+ }
186
+
187
+ func (s * nudrService ) GetAccessAndMobilityPolicyData (ue * pcf_context.UeContext ) (
188
+ resp * DataRepository.ReadAccessAndMobilityPolicyDataResponse ,
189
+ problemDetails * models.ProblemDetails , err error ,
190
+ ) {
191
+ if ue .Supi == "" {
192
+ problemDetail := util .GetProblemDetail ("Can't find corresponding SUPI with UE" , util .USER_UNKNOWN )
193
+ logger .ConsumerLog .Warn ("Can't find corresponding SUPI with UE" )
194
+ return nil , & problemDetail , nil
195
+ }
196
+
197
+ if ue .UdrUri == "" {
198
+ problemDetail := util .GetProblemDetail ("Can't find corresponding UDR with UE" , util .USER_UNKNOWN )
199
+ logger .ConsumerLog .Warnf ("Can't find corresponding UDR with UE[%s]" , ue .Supi )
200
+ return nil , & problemDetail , nil
201
+ }
202
+
203
+ ctx , pd , err := s .consumer .Context ().GetTokenCtx (models .ServiceName_NUDR_DR , models .NrfNfManagementNfType_UDR )
204
+ if err != nil {
205
+ return nil , nil , err
206
+ } else if pd != nil {
207
+ return nil , pd , nil
208
+ }
209
+
210
+ client := s .getDataSubscription (ue .UdrUri )
211
+ param := DataRepository.ReadAccessAndMobilityPolicyDataRequest {
212
+ UeId : & ue .Supi ,
213
+ }
214
+ resp , err = client .AccessAndMobilityPolicyDataDocumentApi .ReadAccessAndMobilityPolicyData (ctx , & param )
215
+ if err == nil {
216
+ return resp , nil , nil
217
+ }
218
+ problem := err .(openapi.GenericOpenAPIError ).Model ().(models.ProblemDetails )
219
+ problemDetails = & problem
220
+ return nil , problemDetails , nil
221
+ }
222
+
46
223
func (s * nudrService ) CreateInfluenceDataSubscription (ue * pcf_context.UeContext , request models.SmPolicyContextData ) (
47
224
subscriptionID string , problemDetails * models.ProblemDetails , err error ,
48
225
) {
0 commit comments