SupplierS using AttributeS to replace data, updating ClueLRN data files

This commit is contained in:
DanB
2018-07-24 21:13:14 +02:00
parent ed6c02c551
commit 98fd8e1d56
5 changed files with 20 additions and 4 deletions

View File

@@ -789,7 +789,7 @@ func startSupplierService(internalSupplierSChan chan rpcclient.RpcClientConnecti
filterSChan <- filterS
var attrSConn, resourceSConn, statSConn *rpcclient.RpcClientPool
if len(cfg.SupplierSCfg().AttributeSConns) != 0 {
resourceSConn, err = engine.NewRPCPool(rpcclient.POOL_FIRST, cfg.TLSClientKey, cfg.TLSClientCerificate,
attrSConn, err = engine.NewRPCPool(rpcclient.POOL_FIRST, cfg.TLSClientKey, cfg.TLSClientCerificate,
cfg.ConnectAttempts, cfg.Reconnects, cfg.ConnectTimeout, cfg.ReplyTimeout,
cfg.SupplierSCfg().AttributeSConns, internalAttrSChan, cfg.InternalTtl)
if err != nil {

View File

@@ -45,13 +45,14 @@
"attributes": {
"enabled": true,
"process_runs": 5, // number of run loops when processing event
},
"suppliers": {
"enabled": true,
"attributes_conns": [
{"address": "*internal"}
{"address": "127.0.0.1:2012", "transport":"*json"}
],
},

View File

@@ -5,4 +5,4 @@ cgrates.org,LRN_LATA_Dst13128543000,lrn,*string:Destination:13128543000;*rsr::Or
cgrates.org,LRN_LATA_Cli9174269000,lrn,*string:Account:9174269000;*rsr::DestinationLATA(!^$),,CallerLATA,*any,132,true,false,30
cgrates.org,LRN_JURISDICTION_NY,lrn,FLTR_INTRALATA_NEWYORK,,LRNJurisdiction,*any,INTRA,true,false,50
cgrates.org,LRN_JURISDICTION_IL,lrn,FLTR_INTRALATA_ILLINOIS,,LRNJurisdiction,*any,INTRA,true,false,50
cgrates.org,LRN_JURISDICTION_INTER,lrn,*string:Destination:9174269000;*rsr::CallerLATA(!^$),,LRNJurisdiction,*any,INTER,true,false,40
cgrates.org,LRN_JURISDICTION_INTER,lrn,*string:Destination:13128543000;*rsr::CallerLATA(!^$),,LRNJurisdiction,*any,INTER,true,false,40
1 #Tenant ID Contexts FilterIDs ActivationInterval FieldName Initial Substitute Append Blocker Weight
5 cgrates.org LRN_LATA_Cli9174269000 lrn *string:Account:9174269000;*rsr::DestinationLATA(!^$) CallerLATA *any 132 true false 30
6 cgrates.org LRN_JURISDICTION_NY lrn FLTR_INTRALATA_NEWYORK LRNJurisdiction *any INTRA true false 50
7 cgrates.org LRN_JURISDICTION_IL lrn FLTR_INTRALATA_ILLINOIS LRNJurisdiction *any INTRA true false 50
8 cgrates.org LRN_JURISDICTION_INTER lrn *string:Destination:9174269000;*rsr::CallerLATA(!^$) *string:Destination:13128543000;*rsr::CallerLATA(!^$) LRNJurisdiction *any INTER true false 40

View File

@@ -1,4 +1,4 @@
#Tenant,ID,FilterIDs,ActivationInterval,Sorting,SortingParamameters,SupplierID,SupplierFilterIDs,SupplierAccountIDs,SupplierRatingPlanIDs,SupplierResourceIDs,SupplierStatIDs,SupplierWeight,SupplierBlocker,SupplierParameters,Weight
cgrates.org,SPL_CLUELRN_INTER,*string:Account:9174269000;*string:LRNJuristiction:INTER,2017-11-27T00:00:00Z,*least_cost,,LEVEL3,,,RP_LEVEL3_INTER,,,,false,,10
cgrates.org,SPL_CLUELRN_INTER,*string:Account:9174269000;*string:LRNJurisdiction:INTER,2017-11-27T00:00:00Z,*least_cost,,LEVEL3,,,RP_LEVEL3_INTER,,,,false,,10
cgrates.org,SPL_CLUELRN_INTER,,,,,TMOBILE,,,RP_TMOBILE_INTER,,,,false,,
cgrates.org,SPL_CLUELRN_INTER,,,,,COMCAST,,,RP_COMCAST_INTER,,,,false,,
1 #Tenant ID FilterIDs ActivationInterval Sorting SortingParamameters SupplierID SupplierFilterIDs SupplierAccountIDs SupplierRatingPlanIDs SupplierResourceIDs SupplierStatIDs SupplierWeight SupplierBlocker SupplierParameters Weight
2 cgrates.org SPL_CLUELRN_INTER *string:Account:9174269000;*string:LRNJuristiction:INTER *string:Account:9174269000;*string:LRNJurisdiction:INTER 2017-11-27T00:00:00Z *least_cost LEVEL3 RP_LEVEL3_INTER false 10
3 cgrates.org SPL_CLUELRN_INTER TMOBILE RP_TMOBILE_INTER false
4 cgrates.org SPL_CLUELRN_INTER COMCAST RP_COMCAST_INTER false

View File

@@ -359,6 +359,21 @@ func (spS *SupplierService) V1GetSuppliers(args *ArgsGetSuppliers, reply *Sorted
} else if args.CGREvent.Event == nil {
return utils.NewErrMandatoryIeMissing("Event")
}
if spS.attributeS != nil {
if args.CGREvent.Context == nil { // populate if not already in
args.CGREvent.Context = utils.StringPointer(utils.MetaSuppliers)
}
attrArgs := &AttrArgsProcessEvent{
CGREvent: args.CGREvent,
}
var rplyEv AttrSProcessEventReply
if err := spS.attributeS.Call(utils.AttributeSv1ProcessEvent,
attrArgs, &rplyEv); err == nil && len(rplyEv.AlteredFields) != 0 {
args.CGREvent = *rplyEv.CGREvent
} else if err.Error() != utils.ErrNotFound.Error() {
return utils.NewErrAttributeS(err)
}
}
sSps, err := spS.sortedSuppliersForEvent(args)
if err != nil {
if err != utils.ErrNotFound {