diff options
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r-- | api/grpc_server.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index c8138cef..d028674b 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -1012,6 +1012,9 @@ func toStatementApi(s *config.Statement) *Statement { Name: s.Conditions.BgpConditions.MatchExtCommunitySet.ExtCommunitySet, } } + if s.Conditions.BgpConditions.RouteType != "" { + cs.RouteType = Conditions_RouteType(s.Conditions.BgpConditions.RouteType.ToInt()) + } cs.RpkiResult = int32(s.Conditions.BgpConditions.RpkiValidationResult.ToInt()) as := &Actions{ RouteAction: func() RouteAction { @@ -1189,6 +1192,17 @@ func NewRpkiValidationConditionFromApiStruct(a int32) (*table.RpkiValidationCond return table.NewRpkiValidationCondition(config.IntToRpkiValidationResultTypeMap[int(a)]) } +func NewRouteTypeConditionFromApiStruct(a Conditions_RouteType) (*table.RouteTypeCondition, error) { + if a == 0 { + return nil, nil + } + typ, ok := config.IntToRouteTypeMap[int(a)] + if !ok { + return nil, fmt.Errorf("invalid route type: %d", a) + } + return table.NewRouteTypeCondition(typ) +} + func NewCommunityConditionFromApiStruct(a *MatchSet) (*table.CommunityCondition, error) { if a == nil { return nil, nil @@ -1322,6 +1336,9 @@ func NewStatementFromApiStruct(a *Statement) (*table.Statement, error) { return NewRpkiValidationConditionFromApiStruct(a.Conditions.RpkiResult) }, func() (table.Condition, error) { + return NewRouteTypeConditionFromApiStruct(a.Conditions.RouteType) + }, + func() (table.Condition, error) { return NewAsPathConditionFromApiStruct(a.Conditions.AsPathSet) }, func() (table.Condition, error) { |