diff --git a/routingtable/filter/term_condition.go b/routingtable/filter/term_condition.go index 92c3616a8cc55f21c73696b2f87a1b2a9cfbcbd4..8bc87485d58bd9215d122e4af9792c7c0c1c2b82 100644 --- a/routingtable/filter/term_condition.go +++ b/routingtable/filter/term_condition.go @@ -10,6 +10,13 @@ type TermCondition struct { routeFilters []*RouteFilter } +func NewTermCondition(prefixLists []*PrefixList, routeFilters []*RouteFilter) *TermCondition { + return &TermCondition{ + prefixLists: prefixLists, + routeFilters: routeFilters, + } +} + func (f *TermCondition) Matches(p net.Prefix, pa *route.Path) bool { return f.matchesAnyPrefixList(p) || f.machtchesAnyRouteFilter(p) } diff --git a/routingtable/filter/term_condition_test.go b/routingtable/filter/term_condition_test.go index 876746a240d195ee2a6612636a888a2cf41a9d25..fba97b673bea6901983e6bba509358fe8bf504f3 100644 --- a/routingtable/filter/term_condition_test.go +++ b/routingtable/filter/term_condition_test.go @@ -109,10 +109,10 @@ func TestMatches(t *testing.T) { for _, test := range tests { t.Run(test.name, func(te *testing.T) { - f := &TermCondition{ - prefixLists: test.prefixLists, - routeFilters: test.routeFilters, - } + f := NewTermCondition( + test.prefixLists, + test.routeFilters, + ) assert.Equal(te, test.expected, f.Matches(test.prefix, &route.Path{})) })