diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-07-14 14:01:28 +0900 |
---|---|---|
committer | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-07-19 09:44:20 +0900 |
commit | c7ff8580f7cb0834680dc6a48a322c5545a22bfd (patch) | |
tree | 8243fcf926e757a5d0ff7afefe1381123dc76420 /client | |
parent | 2678142d300aea2d803d500ced865c8c89bf186b (diff) |
cli: get detailed RPKI information
This patch adds the feature in the neighbor subcommand
to get detailed information about RPKI validation.
The command receives a prefix in Adj-RIB-In,
and gives the detailed RPKI information for the route.
The informaton includes the validation status, the reason if it is invalid,
and matched/unmatched VRPs.
Example:
$ gobgp neighbor 172.17.0.3 adj-in 2.1.0.0/16 validation
Target Prefix: 2.1.0.0/16, AS: 65001
This route is invalid reason: as
No VRP ASN matches the route origin ASN.
Matched VRPs:
No Entry
Unmatched AS VRPs:
Network AS MaxLen
2.0.0.0/12 3215 16
2.1.0.0/16 3215 16
Unmatched Length VRPs:
No Entry
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'client')
-rw-r--r-- | client/client.go | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/client/client.go b/client/client.go index b9faf6ba..e8108c64 100644 --- a/client/client.go +++ b/client/client.go @@ -22,12 +22,13 @@ import ( "strconv" "time" + "golang.org/x/net/context" + "google.golang.org/grpc" + api "github.com/osrg/gobgp/api" "github.com/osrg/gobgp/config" "github.com/osrg/gobgp/packet/bgp" "github.com/osrg/gobgp/table" - "golang.org/x/net/context" - "google.golang.org/grpc" ) type Client struct { @@ -841,17 +842,7 @@ func (cli *Client) GetROA(family bgp.RouteFamily) ([]*table.ROA, error) { if err != nil { return nil, err } - roas := make([]*table.ROA, 0, len(rsp.Roas)) - for _, r := range rsp.Roas { - ip := net.ParseIP(r.Prefix) - if ip.To4() != nil { - ip = ip.To4() - } - afi, _ := bgp.RouteFamilyToAfiSafi(family) - roa := table.NewROA(int(afi), []byte(ip), uint8(r.Prefixlen), uint8(r.Maxlen), r.As, net.JoinHostPort(r.Conf.Address, r.Conf.RemotePort)) - roas = append(roas, roa) - } - return roas, nil + return api.NewROAListFromApiStructList(rsp.Roas), nil } func (cli *Client) AddRPKIServer(address string, port, lifetime int) error { |