Remove ActivationInterval from RateProfile

This commit is contained in:
ionutboangiu
2021-05-14 16:42:57 +03:00
committed by Dan Christian Bogos
parent ee19822625
commit c3cd02f02b
15 changed files with 292 additions and 502 deletions

View File

@@ -899,16 +899,15 @@ type ArgCacheReplicateRemove struct {
}
type TPRateProfile struct {
TPid string
Tenant string
ID string
FilterIDs []string
ActivationInterval *TPActivationInterval
Weights string
MinCost float64
MaxCost float64
MaxCostStrategy string
Rates map[string]*TPRate
TPid string
Tenant string
ID string
FilterIDs []string
Weights string
MinCost float64
MaxCost float64
MaxCostStrategy string
Rates map[string]*TPRate
}
type TPRate struct {

View File

@@ -30,15 +30,14 @@ import (
// RateProfile represents the configuration of a Rate profile
type RateProfile struct {
Tenant string
ID string
FilterIDs []string
ActivationInterval *ActivationInterval
Weights DynamicWeights
MinCost *Decimal
MaxCost *Decimal
MaxCostStrategy string
Rates map[string]*Rate
Tenant string
ID string
FilterIDs []string
Weights DynamicWeights
MinCost *Decimal
MaxCost *Decimal
MaxCostStrategy string
Rates map[string]*Rate
}
func (rp *RateProfile) TenantID() string {
@@ -778,11 +777,10 @@ func CompressIntervals(rtIvls []*RateSInterval) {
// AsRateProfile converts APIRateProfile to RateProfile
func (ext *APIRateProfile) AsRateProfile() (rp *RateProfile, err error) {
rp = &RateProfile{
Tenant: ext.Tenant,
ID: ext.ID,
FilterIDs: ext.FilterIDs,
ActivationInterval: ext.ActivationInterval,
MaxCostStrategy: ext.MaxCostStrategy,
Tenant: ext.Tenant,
ID: ext.ID,
FilterIDs: ext.FilterIDs,
MaxCostStrategy: ext.MaxCostStrategy,
}
if ext.Weights != EmptyString {
if rp.Weights, err = NewDynamicWeightsFromString(ext.Weights, ";", "&"); err != nil {

View File

@@ -1236,11 +1236,10 @@ func TestLibratesAsRateProfile(t *testing.T) {
Weights: "testWeight",
}
rp := &RateProfile{
Tenant: ext.Tenant,
ID: ext.ID,
FilterIDs: ext.FilterIDs,
ActivationInterval: ext.ActivationInterval,
MaxCostStrategy: ext.MaxCostStrategy,
Tenant: ext.Tenant,
ID: ext.ID,
FilterIDs: ext.FilterIDs,
MaxCostStrategy: ext.MaxCostStrategy,
}
received, err := ext.AsRateProfile()
@@ -1308,11 +1307,10 @@ func TestLibratesAsRateProfileNon0Len(t *testing.T) {
},
}
rp := &RateProfile{
Tenant: ext.Tenant,
ID: ext.ID,
FilterIDs: ext.FilterIDs,
ActivationInterval: ext.ActivationInterval,
MaxCostStrategy: ext.MaxCostStrategy,
Tenant: ext.Tenant,
ID: ext.ID,
FilterIDs: ext.FilterIDs,
MaxCostStrategy: ext.MaxCostStrategy,
}
expected := rp