From 920c9dbb668a9cda2d006dc93f0642eee2c089ea Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 8 Jul 2021 17:00:42 +0300 Subject: [PATCH] Renamed attributes vars fields --- engine/attributes.go | 8 +- engine/libstats_test.go | 4 +- engine/z_attributes_test.go | 36 ++-- utils/consts.go | 350 ++++++++++++++++++------------------ 4 files changed, 199 insertions(+), 199 deletions(-) diff --git a/engine/attributes.go b/engine/attributes.go index f660d7276..deec90beb 100644 --- a/engine/attributes.go +++ b/engine/attributes.go @@ -282,7 +282,7 @@ func (alS *AttributeService) V1GetAttributeForEvent(args *AttrArgsProcessEvent, utils.MetaReq: args.CGREvent.Event, utils.MetaOpts: args.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, }, utils.EmptyString) if err != nil { @@ -319,8 +319,8 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent, utils.MetaReq: args.CGREvent.Event, utils.MetaOpts: args.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, - utils.ProcessedProfileIDs: processedPrf, + utils.MetaProcessRuns: 0, + utils.MetaProcessedProfileIDs: processedPrf, }, utils.MetaTenant: tnt, } @@ -330,7 +330,7 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent, dynDP := newDynamicDP(alS.cgrcfg.AttributeSCfg().ResourceSConns, alS.cgrcfg.AttributeSCfg().StatSConns, alS.cgrcfg.AttributeSCfg().ApierSConns, args.Tenant, eNV) for i := 0; i < processRuns; i++ { - (eNV[utils.MetaVars].(utils.MapStorage))[utils.ProcessRuns] = i + 1 + (eNV[utils.MetaVars].(utils.MapStorage))[utils.MetaProcessRuns] = i + 1 var evRply *AttrSProcessEventReply evRply, err = alS.processEvent(tnt, args, eNV, dynDP, lastID) diff --git a/engine/libstats_test.go b/engine/libstats_test.go index becca2317..ab5143b74 100644 --- a/engine/libstats_test.go +++ b/engine/libstats_test.go @@ -1160,7 +1160,7 @@ func TestLibstatsaddStatEventPassErr(t *testing.T) { }, utils.MetaOpts: nil, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } @@ -1199,7 +1199,7 @@ func TestLibstatsaddStatEventNoPass(t *testing.T) { }, utils.MetaOpts: nil, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } diff --git a/engine/z_attributes_test.go b/engine/z_attributes_test.go index 0f8a88339..126b5ee13 100644 --- a/engine/z_attributes_test.go +++ b/engine/z_attributes_test.go @@ -242,7 +242,7 @@ func TestAttributeProfileForEvent(t *testing.T) { utils.MetaReq: attrEvs[0].CGREvent.Event, utils.MetaOpts: attrEvs[0].APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, }, utils.EmptyString) if err != nil { @@ -256,7 +256,7 @@ func TestAttributeProfileForEvent(t *testing.T) { utils.MetaReq: attrEvs[1].CGREvent.Event, utils.MetaOpts: attrEvs[1].APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, }, utils.EmptyString) if err != nil { @@ -271,7 +271,7 @@ func TestAttributeProfileForEvent(t *testing.T) { utils.MetaReq: attrEvs[2].CGREvent.Event, utils.MetaOpts: attrEvs[2].APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, }, utils.EmptyString) if err != nil { @@ -293,7 +293,7 @@ func TestAttributeProcessEvent(t *testing.T) { utils.MetaReq: attrEvs[0].CGREvent.Event, utils.MetaOpts: attrEvs[0].APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } atrp, err := attrS.processEvent(attrEvs[0].Tenant, attrEvs[0], eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -311,7 +311,7 @@ func TestAttributeProcessEventWithNotFound(t *testing.T) { utils.MetaReq: attrEvs[3].CGREvent.Event, utils.MetaOpts: attrEvs[3].APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } if _, err := attrS.processEvent(attrEvs[0].Tenant, attrEvs[3], eNM, @@ -332,7 +332,7 @@ func TestAttributeProcessEventWithIDs(t *testing.T) { utils.MetaReq: attrEvs[3].CGREvent.Event, utils.MetaOpts: attrEvs[3].APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } if atrp, err := attrS.processEvent(attrEvs[0].Tenant, attrEvs[3], eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString); err != nil { @@ -1928,7 +1928,7 @@ func TestProcessAttributeConstant(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -1988,7 +1988,7 @@ func TestProcessAttributeVariable(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2055,7 +2055,7 @@ func TestProcessAttributeComposed(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2117,7 +2117,7 @@ func TestProcessAttributeUsageDifference(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2179,7 +2179,7 @@ func TestProcessAttributeSum(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2241,7 +2241,7 @@ func TestProcessAttributeDiff(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2303,7 +2303,7 @@ func TestProcessAttributeMultiply(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2365,7 +2365,7 @@ func TestProcessAttributeDivide(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2427,7 +2427,7 @@ func TestProcessAttributeValueExponent(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2489,7 +2489,7 @@ func TestProcessAttributeUnixTimeStamp(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2550,7 +2550,7 @@ func TestProcessAttributePrefix(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) @@ -2611,7 +2611,7 @@ func TestProcessAttributeSuffix(t *testing.T) { utils.MetaReq: ev.CGREvent.Event, utils.MetaOpts: ev.APIOpts, utils.MetaVars: utils.MapStorage{ - utils.ProcessRuns: 0, + utils.MetaProcessRuns: 0, }, } rcv, err := attrS.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) diff --git a/utils/consts.go b/utils/consts.go index d694ee3eb..0fed82447 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -760,181 +760,181 @@ const ( IdxEnd = "]" IdxCombination = "][" - RemoteHost = "RemoteHost" - Local = "local" - TCP = "tcp" - UDP = "udp" - CGRDebitInterval = "CGRDebitInterval" - VersionName = "Version" - MetaTenant = "*tenant" - ResourceUsage = "ResourceUsage" - MetaDuration = "*duration" - MetaLibPhoneNumber = "*libphonenumber" - MetaTimeString = "*time_string" - MetaIP2Hex = "*ip2hex" - MetaString2Hex = "*string2hex" - MetaUnixTime = "*unixtime" - MetaLen = "*len" - MetaSIPURIMethod = "*sipuri_method" - MetaSIPURIHost = "*sipuri_host" - MetaSIPURIUser = "*sipuri_user" - MetaReload = "*reload" - MetaLoad = "*load" - MetaRemove = "*remove" - MetaRemoveAll = "*removeall" - MetaStore = "*store" - MetaClear = "*clear" - MetaExport = "*export" - MetaExportID = "*export_id" - MetaTimeNow = "*time_now" - MetaFirstEventATime = "*first_event_atime" - MetaLastEventATime = "*last_event_atime" - MetaEventNumber = "*event_number" - LoadIDs = "load_ids" - DNSAgent = "DNSAgent" - TLSNoCaps = "tls" - UsageID = "UsageID" - Rcode = "Rcode" - Replacement = "Replacement" - Regexp = "Regexp" - Order = "Order" - Preference = "Preference" - Flags = "Flags" - Service = "Service" - ApierV = "ApierV" - MetaApier = "*apier" - MetaAnalyzer = "*analyzer" - CGREventString = "CGREvent" - MetaTextPlain = "*text_plain" - MetaIgnoreErrors = "*ignore_errors" - MetaRelease = "*release" - MetaAllocate = "*allocate" - MetaAuthorize = "*authorize" - MetaSTIRAuthenticate = "*stir_authenticate" - MetaSTIRInitiate = "*stir_initiate" - MetaInit = "*init" - MetaRatingPlanCost = "*rating_plan_cost" - ERs = "ERs" - EEs = "EEs" - Ratio = "Ratio" - Load = "Load" - Slash = "/" - UUID = "UUID" - ActionsID = "ActionsID" - MetaAct = "*act" - MetaAcnt = "*acnt" - DestinationPrefixName = "DestinationPrefix" - DestinationID = "DestinationID" - ExportTemplate = "ExportTemplate" - ExportFormat = "ExportFormat" - Synchronous = "Synchronous" - Attempts = "Attempts" - FieldSeparator = "FieldSeparator" - ExportPath = "ExportPath" - ExporterIDs = "ExporterIDs" - TimeNow = "TimeNow" - ExportFileName = "ExportFileName" - GroupID = "GroupID" - ThresholdType = "ThresholdType" - ThresholdValue = "ThresholdValue" - Recurrent = "Recurrent" - Executed = "Executed" - MinSleep = "MinSleep" - ActivationDate = "ActivationDate" - ExpirationDate = "ExpirationDate" - MinQueuedItems = "MinQueuedItems" - OrderIDStart = "OrderIDStart" - OrderIDEnd = "OrderIDEnd" - MinCost = "MinCost" - MaxCost = "MaxCost" - MetaLoaders = "*loaders" - TmpSuffix = ".tmp" - MetaDiamreq = "*diamreq" - MetaCost = "*cost" - MetaGroup = "*group" - InternalRPCSet = "InternalRPCSet" - FileName = "FileName" - MetaRadauth = "*radauth" - UserPassword = "UserPassword" - RadauthFailed = "RADAUTH_FAILED" - MetaPAP = "*pap" - MetaCHAP = "*chap" - MetaMSCHAPV2 = "*mschapv2" - MetaDynaprepaid = "*dynaprepaid" - MetaFD = "*fd" - SortingData = "SortingData" - Count = "Count" - ProfileID = "ProfileID" - SortedRoutes = "SortedRoutes" - EventExporterS = "EventExporterS" - MetaMonthly = "*monthly" - MetaYearly = "*yearly" - MetaDaily = "*daily" - MetaWeekly = "*weekly" - Underline = "_" - MetaPartial = "*partial" - MetaBusy = "*busy" - MetaQueue = "*queue" - MetaMonthEnd = "*month_end" - APIKey = "ApiKey" - RouteID = "RouteID" - MetaMonthlyEstimated = "*monthly_estimated" - ProcessRuns = "ProcessRuns" - ProcessedProfileIDs = "ProcessedProfileIDs" - HashtagSep = "#" - MetaRounding = "*rounding" - StatsNA = -1.0 - InvalidUsage = -1 - InvalidDuration = time.Duration(-1) - Schedule = "Schedule" - ActionFilterIDs = "ActionFilterIDs" - ActionBlocker = "ActionBlocker" - ActionTTL = "ActionTTL" - ActionOpts = "ActionOpts" - ActionPath = "ActionPath" - TPid = "TPid" - LoadId = "LoadId" - ActionPlanId = "ActionPlanId" - AccountActionsId = "AccountActionsId" - Loadid = "loadid" - AccountLowerCase = "account" - ActionPlan = "ActionPlan" - ActionsId = "ActionsId" - TimingId = "TimingId" - Prefixes = "Prefixes" - RateSlots = "RateSlots" - RatingPlanBindings = "RatingPlanBindings" - RatingPlanActivations = "RatingPlanActivations" - CategoryLowerCase = "category" - SubjectLowerCase = "subject" - RatingProfileID = "RatingProfileID" - Time = "Time" - TargetIDs = "TargetIDs" - TargetType = "TargetType" - MetaRow = "*row" - BalanceFilterIDs = "BalanceFilterIDs" - BalanceOpts = "BalanceOpts" - MetaConcrete = "*concrete" - MetaAbstract = "*abstract" - MetaBalanceLimit = "*balanceLimit" - MetaBalanceUnlimited = "*balanceUnlimited" - MetaTemplateID = "*templateID" - MetaCdrLog = "*cdrLog" - MetaCDR = "*cdr" - MetaExporterIDs = "*exporterIDs" - MetaAsync = "*async" - MetaUsage = "*usage" - Weights = "Weights" - UnitFactors = "UnitFactors" - CostIncrements = "CostIncrements" - Factor = "Factor" - Increment = "Increment" - FixedFee = "FixedFee" - RecurrentFee = "RecurrentFee" - Diktats = "Diktats" - BalanceIDs = "BalanceIDs" - MetaCostIncrement = "*costIncrement" - Length = "Length" + RemoteHost = "RemoteHost" + Local = "local" + TCP = "tcp" + UDP = "udp" + CGRDebitInterval = "CGRDebitInterval" + VersionName = "Version" + MetaTenant = "*tenant" + ResourceUsage = "ResourceUsage" + MetaDuration = "*duration" + MetaLibPhoneNumber = "*libphonenumber" + MetaTimeString = "*time_string" + MetaIP2Hex = "*ip2hex" + MetaString2Hex = "*string2hex" + MetaUnixTime = "*unixtime" + MetaLen = "*len" + MetaSIPURIMethod = "*sipuri_method" + MetaSIPURIHost = "*sipuri_host" + MetaSIPURIUser = "*sipuri_user" + MetaReload = "*reload" + MetaLoad = "*load" + MetaRemove = "*remove" + MetaRemoveAll = "*removeall" + MetaStore = "*store" + MetaClear = "*clear" + MetaExport = "*export" + MetaExportID = "*export_id" + MetaTimeNow = "*time_now" + MetaFirstEventATime = "*first_event_atime" + MetaLastEventATime = "*last_event_atime" + MetaEventNumber = "*event_number" + LoadIDs = "load_ids" + DNSAgent = "DNSAgent" + TLSNoCaps = "tls" + UsageID = "UsageID" + Rcode = "Rcode" + Replacement = "Replacement" + Regexp = "Regexp" + Order = "Order" + Preference = "Preference" + Flags = "Flags" + Service = "Service" + ApierV = "ApierV" + MetaApier = "*apier" + MetaAnalyzer = "*analyzer" + CGREventString = "CGREvent" + MetaTextPlain = "*text_plain" + MetaIgnoreErrors = "*ignore_errors" + MetaRelease = "*release" + MetaAllocate = "*allocate" + MetaAuthorize = "*authorize" + MetaSTIRAuthenticate = "*stir_authenticate" + MetaSTIRInitiate = "*stir_initiate" + MetaInit = "*init" + MetaRatingPlanCost = "*rating_plan_cost" + ERs = "ERs" + EEs = "EEs" + Ratio = "Ratio" + Load = "Load" + Slash = "/" + UUID = "UUID" + ActionsID = "ActionsID" + MetaAct = "*act" + MetaAcnt = "*acnt" + DestinationPrefixName = "DestinationPrefix" + DestinationID = "DestinationID" + ExportTemplate = "ExportTemplate" + ExportFormat = "ExportFormat" + Synchronous = "Synchronous" + Attempts = "Attempts" + FieldSeparator = "FieldSeparator" + ExportPath = "ExportPath" + ExporterIDs = "ExporterIDs" + TimeNow = "TimeNow" + ExportFileName = "ExportFileName" + GroupID = "GroupID" + ThresholdType = "ThresholdType" + ThresholdValue = "ThresholdValue" + Recurrent = "Recurrent" + Executed = "Executed" + MinSleep = "MinSleep" + ActivationDate = "ActivationDate" + ExpirationDate = "ExpirationDate" + MinQueuedItems = "MinQueuedItems" + OrderIDStart = "OrderIDStart" + OrderIDEnd = "OrderIDEnd" + MinCost = "MinCost" + MaxCost = "MaxCost" + MetaLoaders = "*loaders" + TmpSuffix = ".tmp" + MetaDiamreq = "*diamreq" + MetaCost = "*cost" + MetaGroup = "*group" + InternalRPCSet = "InternalRPCSet" + FileName = "FileName" + MetaRadauth = "*radauth" + UserPassword = "UserPassword" + RadauthFailed = "RADAUTH_FAILED" + MetaPAP = "*pap" + MetaCHAP = "*chap" + MetaMSCHAPV2 = "*mschapv2" + MetaDynaprepaid = "*dynaprepaid" + MetaFD = "*fd" + SortingData = "SortingData" + Count = "Count" + ProfileID = "ProfileID" + SortedRoutes = "SortedRoutes" + EventExporterS = "EventExporterS" + MetaMonthly = "*monthly" + MetaYearly = "*yearly" + MetaDaily = "*daily" + MetaWeekly = "*weekly" + Underline = "_" + MetaPartial = "*partial" + MetaBusy = "*busy" + MetaQueue = "*queue" + MetaMonthEnd = "*month_end" + APIKey = "ApiKey" + RouteID = "RouteID" + MetaMonthlyEstimated = "*monthly_estimated" + MetaProcessRuns = "*processRuns" // with * + MetaProcessedProfileIDs = "*processedProfileIDs" + HashtagSep = "#" + MetaRounding = "*rounding" + StatsNA = -1.0 + InvalidUsage = -1 + InvalidDuration = time.Duration(-1) + Schedule = "Schedule" + ActionFilterIDs = "ActionFilterIDs" + ActionBlocker = "ActionBlocker" + ActionTTL = "ActionTTL" + ActionOpts = "ActionOpts" + ActionPath = "ActionPath" + TPid = "TPid" + LoadId = "LoadId" + ActionPlanId = "ActionPlanId" + AccountActionsId = "AccountActionsId" + Loadid = "loadid" + AccountLowerCase = "account" + ActionPlan = "ActionPlan" + ActionsId = "ActionsId" + TimingId = "TimingId" + Prefixes = "Prefixes" + RateSlots = "RateSlots" + RatingPlanBindings = "RatingPlanBindings" + RatingPlanActivations = "RatingPlanActivations" + CategoryLowerCase = "category" + SubjectLowerCase = "subject" + RatingProfileID = "RatingProfileID" + Time = "Time" + TargetIDs = "TargetIDs" + TargetType = "TargetType" + MetaRow = "*row" + BalanceFilterIDs = "BalanceFilterIDs" + BalanceOpts = "BalanceOpts" + MetaConcrete = "*concrete" + MetaAbstract = "*abstract" + MetaBalanceLimit = "*balanceLimit" + MetaBalanceUnlimited = "*balanceUnlimited" + MetaTemplateID = "*templateID" + MetaCdrLog = "*cdrLog" + MetaCDR = "*cdr" + MetaExporterIDs = "*exporterIDs" + MetaAsync = "*async" + MetaUsage = "*usage" + Weights = "Weights" + UnitFactors = "UnitFactors" + CostIncrements = "CostIncrements" + Factor = "Factor" + Increment = "Increment" + FixedFee = "FixedFee" + RecurrentFee = "RecurrentFee" + Diktats = "Diktats" + BalanceIDs = "BalanceIDs" + MetaCostIncrement = "*costIncrement" + Length = "Length" ) // Migrator Action