@@ -250,6 +250,129 @@ func (c *SMContext) ApplyPccRules(
250250 return nil
251251}
252252
253+ func (c * SMContext ) ApplyDcPccRulesOnDcTunnel () error {
254+ if c .DCTunnel == nil {
255+ c .Log .Errorf ("DCTunnel is nil" )
256+ return fmt .Errorf ("DCTunnel is nil" )
257+ }
258+
259+ for id , pcc := range c .PCCRules {
260+ if pcc == nil {
261+ continue
262+ }
263+
264+ newPcc := & PCCRule {
265+ PccRule : & models.PccRule {
266+ FlowInfos : make ([]models.FlowInformation , len (pcc .FlowInfos )),
267+ AppId : pcc .AppId ,
268+ AppDescriptor : pcc .AppDescriptor ,
269+ ContVer : pcc .ContVer ,
270+ PccRuleId : pcc .PccRuleId ,
271+ Precedence : pcc .Precedence ,
272+ AfSigProtocol : pcc .AfSigProtocol ,
273+ AppReloc : pcc .AppReloc ,
274+ EasRedisInd : pcc .EasRedisInd ,
275+ RefQosData : make ([]string , len (pcc .RefQosData )),
276+ RefTcData : make ([]string , len (pcc .RefTcData )),
277+ RefChgData : make ([]string , len (pcc .RefChgData )),
278+ RefChgN3gData : make ([]string , len (pcc .RefChgN3gData )),
279+ RefUmData : make ([]string , len (pcc .RefUmData )),
280+ RefUmN3gData : make ([]string , len (pcc .RefUmN3gData )),
281+ RefCondData : pcc .RefCondData ,
282+ RefQosMon : make ([]string , len (pcc .RefQosMon )),
283+ AddrPreserInd : pcc .AddrPreserInd ,
284+ TscaiTimeDom : pcc .TscaiTimeDom ,
285+ DisUeNotif : pcc .DisUeNotif ,
286+ PackFiltAllPrec : pcc .PackFiltAllPrec ,
287+ RefAltQosParams : make ([]string , len (pcc .RefAltQosParams )),
288+ },
289+ QFI : pcc .QFI ,
290+ Datapath : nil ,
291+ }
292+
293+ if pcc .TscaiInputDl != nil {
294+ newPcc .TscaiInputDl = & models.TscaiInputContainer {
295+ Periodicity : pcc .TscaiInputDl .Periodicity ,
296+ BurstArrivalTime : pcc .TscaiInputDl .BurstArrivalTime ,
297+ SurTimeInNumMsg : pcc .TscaiInputDl .SurTimeInNumMsg ,
298+ SurTimeInTime : pcc .TscaiInputDl .SurTimeInTime ,
299+ }
300+ }
301+ if pcc .TscaiInputUl != nil {
302+ newPcc .TscaiInputUl = & models.TscaiInputContainer {
303+ Periodicity : pcc .TscaiInputUl .Periodicity ,
304+ BurstArrivalTime : pcc .TscaiInputUl .BurstArrivalTime ,
305+ SurTimeInNumMsg : pcc .TscaiInputUl .SurTimeInNumMsg ,
306+ SurTimeInTime : pcc .TscaiInputUl .SurTimeInTime ,
307+ }
308+ }
309+ copy (newPcc .FlowInfos , pcc .FlowInfos )
310+ copy (newPcc .RefQosData , pcc .RefQosData )
311+ copy (newPcc .RefTcData , pcc .RefTcData )
312+ copy (newPcc .RefChgData , pcc .RefChgData )
313+ copy (newPcc .RefChgN3gData , pcc .RefChgN3gData )
314+ copy (newPcc .RefUmData , pcc .RefUmData )
315+ copy (newPcc .RefUmN3gData , pcc .RefUmN3gData )
316+ copy (newPcc .RefQosMon , pcc .RefQosMon )
317+ copy (newPcc .RefAltQosParams , pcc .RefAltQosParams )
318+
319+ if pcc .DdNotifCtrl != nil {
320+ newPcc .DdNotifCtrl = & models.DownlinkDataNotificationControl {
321+ NotifCtrlInds : make ([]models.NotificationControlIndication , len (pcc .DdNotifCtrl .NotifCtrlInds )),
322+ TypesOfNotif : make ([]models.DlDataDeliveryStatus , len (pcc .DdNotifCtrl .TypesOfNotif )),
323+ }
324+ copy (newPcc .DdNotifCtrl .NotifCtrlInds , pcc .DdNotifCtrl .NotifCtrlInds )
325+ copy (newPcc .DdNotifCtrl .TypesOfNotif , pcc .DdNotifCtrl .TypesOfNotif )
326+ }
327+ if pcc .DdNotifCtrl2 != nil {
328+ newPcc .DdNotifCtrl2 = & models.DownlinkDataNotificationControlRm {
329+ NotifCtrlInds : make ([]models.NotificationControlIndication , len (pcc .DdNotifCtrl2 .NotifCtrlInds )),
330+ TypesOfNotif : make ([]models.DlDataDeliveryStatus , len (pcc .DdNotifCtrl2 .TypesOfNotif )),
331+ }
332+ copy (newPcc .DdNotifCtrl2 .NotifCtrlInds , pcc .DdNotifCtrl2 .NotifCtrlInds )
333+ copy (newPcc .DdNotifCtrl2 .TypesOfNotif , pcc .DdNotifCtrl2 .TypesOfNotif )
334+ }
335+
336+ c .DCPCCRules [id ] = newPcc
337+ }
338+
339+ for id , pcc := range c .DCPCCRules {
340+ if pcc == nil {
341+ c .Log .Warnf ("PCCRule[%s] is nil" , id )
342+ continue
343+ }
344+
345+ tcID := pcc .RefTcDataID ()
346+ tcData := c .TrafficControlDatas [tcID ]
347+
348+ chgID := pcc .RefChgDataID ()
349+ chgData := c .ChargingData [chgID ]
350+
351+ qosID := pcc .RefQosDataID ()
352+ qosData := c .QosDatas [qosID ]
353+
354+ if pcc .Datapath != nil {
355+ c .PreRemoveDataPath (pcc .Datapath )
356+ }
357+
358+ if err := c .CreateDcPccRuleDataPathOnDcTunnel (pcc , tcData , qosData , chgData ); err != nil {
359+ c .Log .Errorf ("CreatePccRuleDataPathOnDcTunnel for PCCRule[%s] failed: %v" , id , err )
360+ continue
361+ }
362+
363+ if err := applyFlowInfoOrPFD (pcc ); err != nil {
364+ c .Log .Errorf ("applyFlowInfoOrPFD for PCCRule[%s] failed: %v" , id , err )
365+ continue
366+ }
367+
368+ c .Log .Infof ("Applied PCCRule[%s] to DCTunnel" , id )
369+ }
370+
371+ c .addPduLevelChargingRuleToFlow (c .DCPCCRules )
372+
373+ return nil
374+ }
375+
253376func (c * SMContext ) getSrcTgtTcData (
254377 decisionTcDecs map [string ]* models.TrafficControlData ,
255378 tcID string ,
0 commit comments