diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-07-14 13:56:37 +0900 |
---|---|---|
committer | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-07-19 09:44:20 +0900 |
commit | 1aa5bf7f210a3361913b5b9b48b922ff1229aab4 (patch) | |
tree | fd0b267889dade31591c59028b0cbc1845152247 /api/grpc_server.go | |
parent | 810ba2f791bb9d50b3e9a2777444211ea2e6351a (diff) |
table: Include detailed information about RPKI in originInfo
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r-- | api/grpc_server.go | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index 3b8f2fe4..1d8cca6a 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -26,13 +26,14 @@ import ( "sync" "time" + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" + "google.golang.org/grpc" + "github.com/osrg/gobgp/config" "github.com/osrg/gobgp/packet/bgp" "github.com/osrg/gobgp/server" "github.com/osrg/gobgp/table" - log "github.com/sirupsen/logrus" - "golang.org/x/net/context" - "google.golang.org/grpc" ) type Server struct { @@ -345,6 +346,18 @@ func (s *Server) GetNeighbor(ctx context.Context, arg *GetNeighborRequest) (*Get return &GetNeighborResponse{Peers: p}, nil } +func NewValidationFromTableStruct(v *table.Validation) *RPKIValidation { + if v == nil { + return &RPKIValidation{} + } + return &RPKIValidation{ + Reason: RPKIValidation_Reason(v.Reason.ToInt()), + Matched: NewRoaListFromTableStructList(v.Matched), + UnmatchedAs: NewRoaListFromTableStructList(v.UnmatchedAs), + UnmatchedLength: NewRoaListFromTableStructList(v.UnmatchedLength), + } +} + func ToPathApi(path *table.Path) *Path { nlri := path.GetNlri() n, _ := nlri.Serialize() @@ -362,7 +375,8 @@ func ToPathApi(path *table.Path) *Path { Pattrs: pattrs, Age: path.GetTimestamp().Unix(), IsWithdraw: path.IsWithdraw, - Validation: int32(path.Validation().ToInt()), + Validation: int32(path.ValidationStatus().ToInt()), + ValidationDetail: NewValidationFromTableStruct(path.Validation()), Filtered: path.Filtered("") == table.POLICY_DIRECTION_IN, Family: family, Stale: path.IsStale(), |