Skip to content
Snippets Groups Projects
Unverified Commit 8b9426ff authored by takt's avatar takt Committed by GitHub
Browse files

RIS: Add VRF string to DumpRIB and make it usable from riscli (#281)

parent d0561428
No related branches found
No related tags found
No related merge requests found
......@@ -501,6 +501,7 @@ func (m *RIBUpdate) GetRoute() *api1.Route {
type DumpRIBRequest struct {
Router string `protobuf:"bytes,1,opt,name=router,proto3" json:"router,omitempty"`
VrfId uint64 `protobuf:"varint,2,opt,name=vrf_id,json=vrfId,proto3" json:"vrf_id,omitempty"`
Vrf string `protobuf:"bytes,4,opt,name=vrf,proto3" json:"vrf,omitempty"`
Afisafi DumpRIBRequest_AFISAFI `protobuf:"varint,3,opt,name=afisafi,proto3,enum=bio.ris.DumpRIBRequest_AFISAFI" json:"afisafi,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -546,6 +547,13 @@ func (m *DumpRIBRequest) GetVrfId() uint64 {
return 0
}
func (m *DumpRIBRequest) GetVrf() string {
if m != nil {
return m.Vrf
}
return ""
}
func (m *DumpRIBRequest) GetAfisafi() DumpRIBRequest_AFISAFI {
if m != nil {
return m.Afisafi
......@@ -740,49 +748,49 @@ func init() {
}
var fileDescriptor_ffe1202aa518913f = []byte{
// 670 bytes of a gzipped FileDescriptorProto
// 669 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x5d, 0x4f, 0xdb, 0x3c,
0x14, 0x26, 0x04, 0x1a, 0x7a, 0xfa, 0x42, 0x8b, 0x79, 0x79, 0x09, 0x79, 0x2f, 0xd6, 0x45, 0x13,
0x2a, 0x42, 0x4b, 0x51, 0x99, 0x98, 0xa6, 0x7d, 0x09, 0x84, 0xa8, 0x22, 0xc1, 0x56, 0x19, 0xb1,
0x8b, 0xdd, 0x54, 0x69, 0xe3, 0x30, 0x4b, 0xe4, 0x63, 0xb6, 0x1b, 0xd1, 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, 0x5d, 0x22, 0x4a, 0x98, 0xe9, 0xa4, 0x2a, 0x61, 0x4a, 0xc3, 0xc4, 0x9e, 0x43, 0x5d, 0x35,
0xcf, 0x94, 0x26, 0x64, 0xcd, 0x9c, 0x9a, 0x31, 0xd2, 0xfa, 0xff, 0xc6, 0x5c, 0x71, 0xd1, 0x11,
0x54, 0x8b, 0x57, 0x8f, 0x36, 0xcb, 0x67, 0x67, 0x26, 0x90, 0x65, 0xdd, 0x94, 0x2a, 0x6e, 0x79,
0x03, 0x30, 0x7d, 0x8d, 0x25, 0x39, 0xd7, 0x9e, 0xa8, 0x85, 0xa6, 0xc6, 0x4e, 0x9e, 0xda, 0xae,
0x86, 0x5e, 0x82, 0x91, 0xb7, 0x0e, 0xda, 0xf8, 0x45, 0x73, 0x5a, 0xeb, 0xd7, 0x13, 0xc9, 0xe5,
0x78, 0x57, 0x3b, 0xdc, 0xf9, 0xb8, 0xfd, 0xc7, 0x1f, 0xcb, 0x41, 0x45, 0x7e, 0xba, 0xf6, 0x7e,
0x04, 0x00, 0x00, 0xff, 0xff, 0x22, 0xcc, 0x06, 0xa4, 0x60, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -69,6 +69,7 @@ message RIBUpdate {
message DumpRIBRequest {
string router = 1;
uint64 vrf_id = 2;
string vrf = 4;
enum AFISAFI {
IPv4Unicast = 0;
IPv6Unicast = 1;
......
......@@ -217,6 +217,11 @@ func (s *Server) ObserveRIB(req *pb.ObserveRIBRequest, stream pb.RoutingInformat
// DumpRIB implements the DumpRIB RPC
func (s *Server) DumpRIB(req *pb.DumpRIBRequest, stream pb.RoutingInformationService_DumpRIBServer) error {
vrfID, err := getVRFID(req)
if err != nil {
return err
}
ipVersion := netapi.IP_IPv4
switch req.Afisafi {
case pb.DumpRIBRequest_IPv4Unicast:
......@@ -227,9 +232,9 @@ func (s *Server) DumpRIB(req *pb.DumpRIBRequest, stream pb.RoutingInformationSer
return fmt.Errorf("Unknown AFI/SAFI")
}
rib, err := s.getRIB(req.Router, req.VrfId, ipVersion)
rib, err := s.getRIB(req.Router, vrfID, ipVersion)
if err != nil {
return wrapGetRIBErr(err, req.Router, req.VrfId, ipVersion)
return wrapGetRIBErr(err, req.Router, vrfID, ipVersion)
}
toSend := &pb.DumpRIBReply{
......
......@@ -47,7 +47,7 @@ func NewDumpLocRIBCommand() cli.Command {
client := pb.NewRoutingInformationServiceClient(conn)
for _, afisafi := range afisafis {
fmt.Printf(" --- Dump %s ---\n", pb.DumpRIBRequest_AFISAFI_name[int32(afisafi)])
err = dumpRIB(client, c.GlobalString("router"), c.GlobalUint64("vrf_id"), afisafi)
err = dumpRIB(client, c.GlobalString("router"), c.GlobalUint64("vrf_id"), c.GlobalString("vrf"), afisafi)
if err != nil {
log.Errorf("DumpRIB failed: %v", err)
os.Exit(1)
......@@ -60,10 +60,11 @@ func NewDumpLocRIBCommand() cli.Command {
return cmd
}
func dumpRIB(c pb.RoutingInformationServiceClient, routerName string, vrfID uint64, afisafi pb.DumpRIBRequest_AFISAFI) error {
func dumpRIB(c pb.RoutingInformationServiceClient, routerName string, vrfID uint64, vrf string, afisafi pb.DumpRIBRequest_AFISAFI) error {
client, err := c.DumpRIB(context.Background(), &pb.DumpRIBRequest{
Router: routerName,
VrfId: vrfID,
Vrf: vrf,
Afisafi: afisafi,
})
if err != nil {
......
......@@ -42,7 +42,7 @@ func NewLPMCommand() cli.Command {
pfx := bnet.NewPfx(ipAddr, pfxLen)
client := pb.NewRoutingInformationServiceClient(conn)
err = lpm(client, c.GlobalString("router"), c.GlobalUint64("vrf_id"), pfx)
err = lpm(client, c.GlobalString("router"), c.GlobalUint64("vrf_id"), c.GlobalString("vrf"), pfx)
if err != nil {
log.Fatalf("LPM failed: %v", err)
}
......@@ -53,10 +53,11 @@ func NewLPMCommand() cli.Command {
return cmd
}
func lpm(c pb.RoutingInformationServiceClient, routerName string, vrfID uint64, pfx bnet.Prefix) error {
func lpm(c pb.RoutingInformationServiceClient, routerName string, vrfID uint64, vrf string, pfx bnet.Prefix) error {
resp, err := c.LPM(context.Background(), &pb.LPMRequest{
Router: routerName,
VrfId: vrfID,
Vrf: vrf,
Pfx: pfx.ToProto(),
})
if err != nil {
......
......@@ -27,6 +27,11 @@ func main() {
Usage: "VRF ID",
Value: 0,
},
cli.StringFlag{
Name: "vrf",
Usage: "VRF",
Value: "",
},
}
app.Commands = []cli.Command{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment