From e9fe311bf8237191f29ffbb1370abb2105f71f4a Mon Sep 17 00:00:00 2001 From: Daniel Grau Date: Fri, 26 May 2023 21:10:05 +0000 Subject: [PATCH 1/3] Add route to dataplane service --- dataplane/handlers/routes.go | 29 +- dataplane/internal/engine/BUILD.bazel | 1 + dataplane/internal/engine/engine.go | 339 ++++++++-- dataplane/internal/engine/helpers.go | 56 -- proto/dataplane/dataplane.pb.go | 925 ++++++++++++++++++++++++-- proto/dataplane/dataplane.proto | 59 +- sysrib/server.go | 15 +- 7 files changed, 1229 insertions(+), 195 deletions(-) diff --git a/dataplane/handlers/routes.go b/dataplane/handlers/routes.go index f208286f..641c4739 100644 --- a/dataplane/handlers/routes.go +++ b/dataplane/handlers/routes.go @@ -17,16 +17,17 @@ package handlers import ( "context" "fmt" - "net" "strconv" + "github.com/openconfig/ygnmi/schemaless" + "github.com/openconfig/ygnmi/ygnmi" + "github.com/openconfig/lemming/dataplane/internal/engine" "github.com/openconfig/lemming/gnmi" "github.com/openconfig/lemming/gnmi/reconciler" - "github.com/openconfig/ygnmi/schemaless" - "github.com/openconfig/ygnmi/ygnmi" log "github.com/golang/glog" + dpb "github.com/openconfig/lemming/proto/dataplane" ) @@ -44,9 +45,7 @@ func RouteQuery(vrf uint64, prefix string) ygnmi.ConfigQuery[*dpb.Route] { return q } -var ( - routesQuery ygnmi.WildcardQuery[*dpb.Route] -) +var routesQuery ygnmi.WildcardQuery[*dpb.Route] // NewRoute returns a new route reconciler. func NewRoute(e *engine.Engine) *reconciler.BuiltReconciler { @@ -66,30 +65,18 @@ func (r *route) start(ctx context.Context, client *ygnmi.Client) error { return ygnmi.Continue } - _, ipNet, err := net.ParseCIDR(prefix) - if err != nil { - log.Warningf("failed to parse prefix: %v", err) - return ygnmi.Continue - } - ip := ipNet.IP.To4() - isIPv4 := true - if ip == nil { - ip = ipNet.IP.To16() - isIPv4 = false - } - if !present { - if err := r.e.DeleteIPRoute(ctx, isIPv4, ipNet.IP, ipNet.Mask, vrf); err != nil { + if _, err := r.e.RemoveIPRoute(ctx, &dpb.RemoveIPRouteRequest{Prefix: &dpb.RoutePrefix{Prefix: &dpb.RoutePrefix_Str{Str: prefix}, VrfId: vrf}}); err != nil { log.Warningf("failed to delete route: %v", err) return ygnmi.Continue } return ygnmi.Continue } - if len(route.NextHops) == 0 { + if route.GetNextHops() == nil || len(route.GetNextHops().GetHops()) == 0 { log.Warningf("no next hops for route insert or update") return ygnmi.Continue } - if err := r.e.AddIPRoute(ctx, isIPv4, ip, ipNet.Mask, vrf, route.GetNextHops()); err != nil { + if _, err := r.e.AddIPRoute(ctx, &dpb.AddIPRouteRequest{Route: route}); err != nil { log.Warningf("failed to add route: %v", err) } diff --git a/dataplane/internal/engine/BUILD.bazel b/dataplane/internal/engine/BUILD.bazel index 63cb635a..149d39ba 100644 --- a/dataplane/internal/engine/BUILD.bazel +++ b/dataplane/internal/engine/BUILD.bazel @@ -11,6 +11,7 @@ go_library( deps = [ "//dataplane/forwarding", "//dataplane/forwarding/attributes", + "//dataplane/forwarding/fwdbuilder", "//proto/dataplane", "//proto/forwarding", "@com_github_golang_glog//:glog", diff --git a/dataplane/internal/engine/engine.go b/dataplane/internal/engine/engine.go index 43d623ca..961128b7 100644 --- a/dataplane/internal/engine/engine.go +++ b/dataplane/internal/engine/engine.go @@ -17,10 +17,14 @@ package engine import ( "context" "encoding/binary" + "fmt" + "net" "sync" + "sync/atomic" "github.com/openconfig/lemming/dataplane/forwarding" "github.com/openconfig/lemming/dataplane/forwarding/attributes" + "github.com/openconfig/lemming/dataplane/forwarding/fwdbuilder" log "github.com/golang/glog" @@ -34,6 +38,8 @@ const ( srcMACTable = "port-mac" fibSelectorTable = "fib-selector" neighborTable = "neighbor" + nhgTable = "nhg-table" + nhTable = "nh-table" layer2PuntTable = "layer2-punt" layer3PuntTable = "layer3-punt" arpPuntTable = "arp-punt" @@ -46,7 +52,10 @@ type Engine struct { id string idToNIDMu sync.RWMutex // idToNID is map from RPC ID (proto), to internal object NID. - idToNID map[string]uint64 + idToNID map[string]uint64 + nextHopMu sync.Mutex + nextNHGID atomic.Uint64 + nextNHID atomic.Uint64 } // New creates a new engine and sets up the forwarding tables. @@ -152,6 +161,46 @@ func New(ctx context.Context) (*Engine, error) { if _, err := e.Server.TableCreate(ctx, neighbor); err != nil { return nil, err } + nh := &fwdpb.TableCreateRequest{ + ContextId: &fwdpb.ContextId{Id: e.id}, + Desc: &fwdpb.TableDesc{ + TableType: fwdpb.TableType_TABLE_TYPE_EXACT, + TableId: &fwdpb.TableId{ObjectId: &fwdpb.ObjectId{Id: nhTable}}, + Actions: []*fwdpb.ActionDesc{{ActionType: fwdpb.ActionType_ACTION_TYPE_DROP}}, + Table: &fwdpb.TableDesc_Exact{ + Exact: &fwdpb.ExactTableDesc{ + FieldIds: []*fwdpb.PacketFieldId{{ + Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID, + }, + }}, + }, + }, + }, + } + if _, err := e.Server.TableCreate(ctx, nh); err != nil { + return nil, err + } + nhg := &fwdpb.TableCreateRequest{ + ContextId: &fwdpb.ContextId{Id: e.id}, + Desc: &fwdpb.TableDesc{ + TableType: fwdpb.TableType_TABLE_TYPE_EXACT, + TableId: &fwdpb.TableId{ObjectId: &fwdpb.ObjectId{Id: nhgTable}}, + Actions: []*fwdpb.ActionDesc{{ActionType: fwdpb.ActionType_ACTION_TYPE_DROP}}, + Table: &fwdpb.TableDesc_Exact{ + Exact: &fwdpb.ExactTableDesc{ + FieldIds: []*fwdpb.PacketFieldId{{ + Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID, + }, + }}, + }, + }, + }, + } + if _, err := e.Server.TableCreate(ctx, nhg); err != nil { + return nil, err + } if err := createFIBSelector(ctx, e.id, e.Server); err != nil { return nil, err } @@ -233,45 +282,249 @@ func (e *Engine) AddLayer3PuntRule(ctx context.Context, portName string, ip []by return nil } -// AddIPRoute adds a route to the FIB with the input next hops. -func (e *Engine) AddIPRoute(ctx context.Context, v4 bool, ip, mask []byte, vrf uint64, nextHops []*dpb.NextHop) error { - fib := fibV6Table - if v4 { - fib = fibV4Table +// prefixToPrimitives returns the primitive types of the route prefix. +// ip addr bytes, ip mask bytes, is ipv4, vrf id, error. +func prefixToPrimitives(prefix *dpb.RoutePrefix) ([]byte, []byte, bool, uint64, error) { + var ip []byte + var mask []byte + var isIPv4 bool + vrf := prefix.GetVrfId() + + switch pre := prefix.GetPrefix().(type) { + case *dpb.RoutePrefix_Str: + _, ipNet, err := net.ParseCIDR(pre.Str) + if err != nil { + return ip, mask, isIPv4, vrf, fmt.Errorf("failed to parse ip prefix: %v", err) + } + ip = ipNet.IP.To4() + mask = ipNet.Mask + isIPv4 = true + if ip == nil { + ip = ipNet.IP.To16() + mask = ipNet.Mask + isIPv4 = false + } + case *dpb.RoutePrefix_Mask: + ip = pre.Mask.Addr + mask = pre.Mask.Mask + switch len(ip) { + case net.IPv4len: + isIPv4 = true + case net.IPv6len: + isIPv4 = false + default: + return ip, mask, isIPv4, vrf, fmt.Errorf("invalid ip addr length") + } + default: + return ip, mask, isIPv4, vrf, fmt.Errorf("invalid prefix type") + } + return ip, mask, isIPv4, vrf, nil +} + +// addNextHopList creates all the next hops from the message, then create a next hop group if there are multiple next hops. +func (e *Engine) addNextHopList(ctx context.Context, nhg *dpb.NextHopList) ([]*fwdpb.ActionDesc, error) { + if len(nhg.GetHops()) == 1 { + nhID := e.nextNHID.Add(1) + if err := e.addNextHop(ctx, nhID, nhg.Hops[0]); err != nil { + return nil, err + } + return []*fwdpb.ActionDesc{ + fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID).WithUint64Value(nhID)).Build(), + fwdbuilder.Action(fwdbuilder.LookupAction(nhTable)).Build(), + }, nil + } + + idList := &dpb.NextHopIDList{} + for _, hop := range nhg.GetHops() { + nhID := e.nextNHID.Add(1) + if err := e.addNextHop(ctx, nhID, hop); err != nil { + return nil, err + } + idList.Hops = append(idList.Hops, nhID) + idList.Weights = append(idList.Weights, hop.Weight) + } + nhgID := e.nextNHGID.Add(1) + if err := e.addNextHopGroupIDList(ctx, nhgID, idList); err != nil { + return nil, err + } + return []*fwdpb.ActionDesc{ + fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID).WithUint64Value(nhgID)).Build(), + fwdbuilder.Action(fwdbuilder.LookupAction(nhgTable)).Build(), + }, nil +} + +// addNextHopGroupIDList adds an entry to the next hop group table. +func (e *Engine) addNextHopGroupIDList(ctx context.Context, id uint64, nhg *dpb.NextHopIDList) error { + var actLists []*fwdpb.ActionList + for i, nh := range nhg.GetHops() { + actLists = append(actLists, &fwdpb.ActionList{ + Weight: nhg.Weights[i], + Actions: []*fwdpb.ActionDesc{{ + ActionType: fwdpb.ActionType_ACTION_TYPE_UPDATE, + Action: &fwdpb.ActionDesc_Update{ + Update: &fwdpb.UpdateActionDesc{ + FieldId: &fwdpb.PacketFieldId{ + Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID, + }, + }, + Type: fwdpb.UpdateType_UPDATE_TYPE_SET, + Value: binary.BigEndian.AppendUint64(nil, nh), + }, + }, + }}, + }) + } + actions := []*fwdpb.ActionDesc{{ + ActionType: fwdpb.ActionType_ACTION_TYPE_SELECT_ACTION_LIST, + Action: &fwdpb.ActionDesc_Select{ + Select: &fwdpb.SelectActionListActionDesc{ + SelectAlgorithm: fwdpb.SelectActionListActionDesc_SELECT_ALGORITHM_CRC32, // TODO: should algo + hash be configurable? + FieldIds: []*fwdpb.PacketFieldId{{Field: &fwdpb.PacketField{ // Hash the traffic flow, identified, IP protocol, L3 SRC, DST address, and L4 ports (if present). + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_PROTO, + }}, {Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_SRC, + }}, {Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST, + }}, {Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_L4_PORT_SRC, + }}, {Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_L4_PORT_DST, + }}}, + ActionLists: actLists, + }, + }, + }, { + ActionType: fwdpb.ActionType_ACTION_TYPE_LOOKUP, + Action: &fwdpb.ActionDesc_Lookup{ + Lookup: &fwdpb.LookupActionDesc{ + TableId: &fwdpb.TableId{ObjectId: &fwdpb.ObjectId{ + Id: nhTable, + }}, + }, + }, + }} + + entries := &fwdpb.TableEntryAddRequest{ + ContextId: &fwdpb.ContextId{Id: e.id}, + TableId: &fwdpb.TableId{ + ObjectId: &fwdpb.ObjectId{ + Id: nhgTable, + }, + }, + Entries: []*fwdpb.TableEntryAddRequest_Entry{{ + EntryDesc: &fwdpb.EntryDesc{ + Entry: &fwdpb.EntryDesc_Exact{ + Exact: &fwdpb.ExactEntryDesc{ + Fields: []*fwdpb.PacketFieldBytes{{ + Bytes: binary.BigEndian.AppendUint64(nil, id), + FieldId: &fwdpb.PacketFieldId{ + Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID, + }, + }, + }}, + }, + }, + }, + Actions: actions, + }}, + } + if _, err := e.Server.TableEntryAdd(ctx, entries); err != nil { + return err } - actions := nextHopToActions(nextHops[0]) + return nil +} - if len(nextHops) > 1 { - var actLists []*fwdpb.ActionList - for _, nh := range nextHops { - actLists = append(actLists, &fwdpb.ActionList{ - Weight: nh.GetWeight(), - Actions: nextHopToActions(nh), - }) +// addNextHop adds an entry to the next hop table. +func (e *Engine) addNextHop(ctx context.Context, id uint64, nh *dpb.NextHop) error { + var nextHopIP []byte + if nhIPStr := nh.GetIp(); nhIPStr != "" { + nextHop := net.ParseIP(nhIPStr) + nextHopIP = nextHop.To4() + if nextHopIP == nil { + nextHopIP = nextHop.To16() } + } + // Set the next hop IP in the packet's metadata. + nextHopAct := fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithValue(nextHopIP)).Build() + if nextHopIP == nil { + nextHopAct = fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST)).Build() + } + // Set the output port of the packet. + transmitAct := fwdbuilder.Action(fwdbuilder.TransmitAction(nh.GetPort())).Build() - // If there are multiple next-hops, configure the route to use ECMP or WCMP. - actions = []*fwdpb.ActionDesc{{ - ActionType: fwdpb.ActionType_ACTION_TYPE_SELECT_ACTION_LIST, - Action: &fwdpb.ActionDesc_Select{ - Select: &fwdpb.SelectActionListActionDesc{ - SelectAlgorithm: fwdpb.SelectActionListActionDesc_SELECT_ALGORITHM_CRC32, // TODO: should algo + hash be configurable? - FieldIds: []*fwdpb.PacketFieldId{{Field: &fwdpb.PacketField{ // Hash the traffic flow, identified, IP protocol, L3 SRC, DST address, and L4 ports (if present). - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_PROTO, - }}, {Field: &fwdpb.PacketField{ - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_SRC, - }}, {Field: &fwdpb.PacketField{ - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST, - }}, {Field: &fwdpb.PacketField{ - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_L4_PORT_SRC, - }}, {Field: &fwdpb.PacketField{ - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_L4_PORT_DST, - }}}, - ActionLists: actLists, + acts := append([]*fwdpb.ActionDesc{nextHopAct, transmitAct}, nh.GetPreTransmitActions()...) + entries := &fwdpb.TableEntryAddRequest{ + ContextId: &fwdpb.ContextId{Id: e.id}, + TableId: &fwdpb.TableId{ + ObjectId: &fwdpb.ObjectId{ + Id: nhTable, + }, + }, + Entries: []*fwdpb.TableEntryAddRequest_Entry{{ + EntryDesc: &fwdpb.EntryDesc{ + Entry: &fwdpb.EntryDesc_Exact{ + Exact: &fwdpb.ExactEntryDesc{ + Fields: []*fwdpb.PacketFieldBytes{{ + Bytes: binary.BigEndian.AppendUint64(nil, id), + FieldId: &fwdpb.PacketFieldId{ + Field: &fwdpb.PacketField{ + FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID, + }, + }, + }}, + }, }, }, - }} + Actions: acts, + }}, + } + if _, err := e.Server.TableEntryAdd(ctx, entries); err != nil { + return err + } + + return nil +} + +// AddIPRoute adds a route to the FIB. It operates in two modes: +// 1. Client-managed IDs: each next hop and next hop group must be created before adding to a route with user provided ids. +// 2. Server-managed IDs: each next hop and next hop group must be specified with route. The server implicitly creates ids. +func (e *Engine) AddIPRoute(ctx context.Context, req *dpb.AddIPRouteRequest) (*dpb.AddIPRouteResponse, error) { + ip, mask, isIPv4, vrf, err := prefixToPrimitives(req.GetRoute().GetPrefix()) + if err != nil { + return nil, err + } + fib := fibV6Table + if isIPv4 { + fib = fibV4Table + } + var actions []*fwdpb.ActionDesc + + switch hop := req.GetRoute().GetHop().(type) { + case *dpb.Route_PortId: + actions = []*fwdpb.ActionDesc{ + // Set the next hop IP in the packet's metadata. + fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST)).Build(), + // Set the output port. + fwdbuilder.Action(fwdbuilder.TransmitAction(hop.PortId)).Build(), + } + case *dpb.Route_NextHopId: + actions = []*fwdpb.ActionDesc{ // Set the next hop ID in the packet's metadata. + fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID).WithUint64Value(hop.NextHopId)).Build(), + fwdbuilder.Action(fwdbuilder.LookupAction(nhTable)).Build(), + } + case *dpb.Route_NextHopGroupId: + actions = []*fwdpb.ActionDesc{ // Set the next hop group ID in the packet's metadata. + fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID).WithUint64Value(hop.NextHopGroupId)).Build(), + fwdbuilder.Action(fwdbuilder.LookupAction(nhgTable)).Build(), + } + case *dpb.Route_NextHops: + actions, err = e.addNextHopList(ctx, hop.NextHops) + if err != nil { + return nil, err + } } entry := &fwdpb.TableEntryAddRequest{ @@ -294,16 +547,21 @@ func (e *Engine) AddIPRoute(ctx context.Context, v4 bool, ip, mask []byte, vrf u Actions: actions, } if _, err := e.Server.TableEntryAdd(ctx, entry); err != nil { - return err + return nil, err } - return nil + return &dpb.AddIPRouteResponse{}, nil } -// DeleteIPRoute deletes a route from the FIB. -func (e *Engine) DeleteIPRoute(ctx context.Context, v4 bool, ip, mask []byte, vrf uint64) error { +// Remove deletes a route from the FIB. +// TODO: Clean up orphaned next-hop and next-hop-groups for server managed ids. +func (e *Engine) RemoveIPRoute(ctx context.Context, req *dpb.RemoveIPRouteRequest) (*dpb.RemoveIPRouteResponse, error) { + ip, mask, isIPv4, vrf, err := prefixToPrimitives(req.GetPrefix()) + if err != nil { + return nil, err + } fib := fibV6Table - if v4 { + if isIPv4 { fib = fibV4Table } entry := &fwdpb.TableEntryRemoveRequest{ @@ -325,10 +583,9 @@ func (e *Engine) DeleteIPRoute(ctx context.Context, v4 bool, ip, mask []byte, vr }, } if _, err := e.Server.TableEntryRemove(ctx, entry); err != nil { - return err + return nil, err } - - return nil + return &dpb.RemoveIPRouteResponse{}, nil } // AddNeighbor adds a neighbor to the neighbor table. diff --git a/dataplane/internal/engine/helpers.go b/dataplane/internal/engine/helpers.go index 190ece2e..c9323f80 100644 --- a/dataplane/internal/engine/helpers.go +++ b/dataplane/internal/engine/helpers.go @@ -18,9 +18,7 @@ import ( "context" "encoding/binary" "encoding/hex" - "net" - dpb "github.com/openconfig/lemming/proto/dataplane" fwdpb "github.com/openconfig/lemming/proto/forwarding" ) @@ -283,60 +281,6 @@ func createLayer3PuntTable(ctx context.Context, ctxID string, c fwdpb.Forwarding return nil } -// nextHopToActions returns the forwarding actions for a nexthop. -func nextHopToActions(nh *dpb.NextHop) []*fwdpb.ActionDesc { - var nextHopIP []byte - if nhIPStr := nh.GetIp(); nhIPStr != "" { - nextHop := net.ParseIP(nhIPStr) - nextHopIP = nextHop.To4() - if nextHopIP == nil { - nextHopIP = nextHop.To16() - } - } - nextHopAct := &fwdpb.ActionDesc{ // Set the next hop IP in the packet's metadata. - ActionType: fwdpb.ActionType_ACTION_TYPE_UPDATE, - Action: &fwdpb.ActionDesc_Update{ - Update: &fwdpb.UpdateActionDesc{ - FieldId: &fwdpb.PacketFieldId{ - Field: &fwdpb.PacketField{ - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP, - }, - }, - Type: fwdpb.UpdateType_UPDATE_TYPE_SET, - Value: nextHopIP, - }, - }, - } - if nextHopIP == nil { - nextHopAct = &fwdpb.ActionDesc{ // Set the next hop IP in the packet's metadata. - ActionType: fwdpb.ActionType_ACTION_TYPE_UPDATE, - Action: &fwdpb.ActionDesc_Update{ - Update: &fwdpb.UpdateActionDesc{ - FieldId: &fwdpb.PacketFieldId{ - Field: &fwdpb.PacketField{ - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP, - }, - }, - Type: fwdpb.UpdateType_UPDATE_TYPE_COPY, - Field: &fwdpb.PacketFieldId{ - Field: &fwdpb.PacketField{ - FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST, - }, - }, - }, - }, - } - } - return append([]*fwdpb.ActionDesc{{ // Set the output port. - ActionType: fwdpb.ActionType_ACTION_TYPE_TRANSMIT, - Action: &fwdpb.ActionDesc_Transmit{ - Transmit: &fwdpb.TransmitActionDesc{ - PortId: &fwdpb.PortId{ObjectId: &fwdpb.ObjectId{Id: nh.GetPort()}}, - }, - }, - }, nextHopAct}, nh.GetPreTransmitActions()...) -} - // createKernelPort creates a port using the "Kernel" dataplane type (socket API). func createKernelPort(ctx context.Context, ctxID string, c fwdpb.ForwardingServer, id, devName string) (uint64, error) { port := &fwdpb.PortCreateRequest{ diff --git a/proto/dataplane/dataplane.pb.go b/proto/dataplane/dataplane.pb.go index 85eaba80..e644a268 100644 --- a/proto/dataplane/dataplane.pb.go +++ b/proto/dataplane/dataplane.pb.go @@ -25,6 +25,55 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type PacketAction int32 + +const ( + PacketAction_PACKET_ACTION_UNSPECIFIED PacketAction = 0 + PacketAction_PACKET_ACTION_DROP PacketAction = 1 + PacketAction_PACKET_ACTION_FORWARD PacketAction = 2 +) + +// Enum value maps for PacketAction. +var ( + PacketAction_name = map[int32]string{ + 0: "PACKET_ACTION_UNSPECIFIED", + 1: "PACKET_ACTION_DROP", + 2: "PACKET_ACTION_FORWARD", + } + PacketAction_value = map[string]int32{ + "PACKET_ACTION_UNSPECIFIED": 0, + "PACKET_ACTION_DROP": 1, + "PACKET_ACTION_FORWARD": 2, + } +) + +func (x PacketAction) Enum() *PacketAction { + p := new(PacketAction) + *p = x + return p +} + +func (x PacketAction) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PacketAction) Descriptor() protoreflect.EnumDescriptor { + return file_proto_dataplane_dataplane_proto_enumTypes[0].Descriptor() +} + +func (PacketAction) Type() protoreflect.EnumType { + return &file_proto_dataplane_dataplane_proto_enumTypes[0] +} + +func (x PacketAction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PacketAction.Descriptor instead. +func (PacketAction) EnumDescriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{0} +} + type NextHop struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -96,20 +145,217 @@ func (x *NextHop) GetPreTransmitActions() []*forwarding.ActionDesc { return nil } +type NextHopList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hops []*NextHop `protobuf:"bytes,1,rep,name=hops,proto3" json:"hops,omitempty"` +} + +func (x *NextHopList) Reset() { + *x = NextHopList{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NextHopList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NextHopList) ProtoMessage() {} + +func (x *NextHopList) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NextHopList.ProtoReflect.Descriptor instead. +func (*NextHopList) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{1} +} + +func (x *NextHopList) GetHops() []*NextHop { + if x != nil { + return x.Hops + } + return nil +} + +type NextHopIDList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hops []uint64 `protobuf:"varint,1,rep,packed,name=hops,proto3" json:"hops,omitempty"` + Weights []uint64 `protobuf:"varint,2,rep,packed,name=weights,proto3" json:"weights,omitempty"` +} + +func (x *NextHopIDList) Reset() { + *x = NextHopIDList{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NextHopIDList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NextHopIDList) ProtoMessage() {} + +func (x *NextHopIDList) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NextHopIDList.ProtoReflect.Descriptor instead. +func (*NextHopIDList) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{2} +} + +func (x *NextHopIDList) GetHops() []uint64 { + if x != nil { + return x.Hops + } + return nil +} + +func (x *NextHopIDList) GetWeights() []uint64 { + if x != nil { + return x.Weights + } + return nil +} + +type RoutePrefix struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Prefix: + // + // *RoutePrefix_Str + // *RoutePrefix_Mask + Prefix isRoutePrefix_Prefix `protobuf_oneof:"prefix"` + VrfId uint64 `protobuf:"varint,3,opt,name=vrf_id,json=vrfId,proto3" json:"vrf_id,omitempty"` +} + +func (x *RoutePrefix) Reset() { + *x = RoutePrefix{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RoutePrefix) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoutePrefix) ProtoMessage() {} + +func (x *RoutePrefix) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RoutePrefix.ProtoReflect.Descriptor instead. +func (*RoutePrefix) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{3} +} + +func (m *RoutePrefix) GetPrefix() isRoutePrefix_Prefix { + if m != nil { + return m.Prefix + } + return nil +} + +func (x *RoutePrefix) GetStr() string { + if x, ok := x.GetPrefix().(*RoutePrefix_Str); ok { + return x.Str + } + return "" +} + +func (x *RoutePrefix) GetMask() *IpMask { + if x, ok := x.GetPrefix().(*RoutePrefix_Mask); ok { + return x.Mask + } + return nil +} + +func (x *RoutePrefix) GetVrfId() uint64 { + if x != nil { + return x.VrfId + } + return 0 +} + +type isRoutePrefix_Prefix interface { + isRoutePrefix_Prefix() +} + +type RoutePrefix_Str struct { + Str string `protobuf:"bytes,1,opt,name=str,proto3,oneof"` +} + +type RoutePrefix_Mask struct { + Mask *IpMask `protobuf:"bytes,2,opt,name=mask,proto3,oneof"` +} + +func (*RoutePrefix_Str) isRoutePrefix_Prefix() {} + +func (*RoutePrefix_Mask) isRoutePrefix_Prefix() {} + type Route struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Vrf uint64 `protobuf:"varint,1,opt,name=vrf,proto3" json:"vrf,omitempty"` - Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` - NextHops []*NextHop `protobuf:"bytes,3,rep,name=next_hops,json=nextHops,proto3" json:"next_hops,omitempty"` + Prefix *RoutePrefix `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` + Action PacketAction `protobuf:"varint,2,opt,name=action,proto3,enum=lemming.dataplane.PacketAction" json:"action,omitempty"` + // Types that are assignable to Hop: + // + // *Route_PortId + // *Route_NextHopId + // *Route_NextHopGroupId + // *Route_NextHops + Hop isRoute_Hop `protobuf_oneof:"hop"` } func (x *Route) Reset() { *x = Route{} if protoimpl.UnsafeEnabled { - mi := &file_proto_dataplane_dataplane_proto_msgTypes[1] + mi := &file_proto_dataplane_dataplane_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122,7 +368,7 @@ func (x *Route) String() string { func (*Route) ProtoMessage() {} func (x *Route) ProtoReflect() protoreflect.Message { - mi := &file_proto_dataplane_dataplane_proto_msgTypes[1] + mi := &file_proto_dataplane_dataplane_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -135,30 +381,86 @@ func (x *Route) ProtoReflect() protoreflect.Message { // Deprecated: Use Route.ProtoReflect.Descriptor instead. func (*Route) Descriptor() ([]byte, []int) { - return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{1} + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{4} } -func (x *Route) GetVrf() uint64 { +func (x *Route) GetPrefix() *RoutePrefix { if x != nil { - return x.Vrf + return x.Prefix } - return 0 + return nil } -func (x *Route) GetPrefix() string { +func (x *Route) GetAction() PacketAction { if x != nil { - return x.Prefix + return x.Action + } + return PacketAction_PACKET_ACTION_UNSPECIFIED +} + +func (m *Route) GetHop() isRoute_Hop { + if m != nil { + return m.Hop + } + return nil +} + +func (x *Route) GetPortId() string { + if x, ok := x.GetHop().(*Route_PortId); ok { + return x.PortId } return "" } -func (x *Route) GetNextHops() []*NextHop { - if x != nil { +func (x *Route) GetNextHopId() uint64 { + if x, ok := x.GetHop().(*Route_NextHopId); ok { + return x.NextHopId + } + return 0 +} + +func (x *Route) GetNextHopGroupId() uint64 { + if x, ok := x.GetHop().(*Route_NextHopGroupId); ok { + return x.NextHopGroupId + } + return 0 +} + +func (x *Route) GetNextHops() *NextHopList { + if x, ok := x.GetHop().(*Route_NextHops); ok { return x.NextHops } return nil } +type isRoute_Hop interface { + isRoute_Hop() +} + +type Route_PortId struct { + PortId string `protobuf:"bytes,3,opt,name=port_id,json=portId,proto3,oneof"` +} + +type Route_NextHopId struct { + NextHopId uint64 `protobuf:"varint,4,opt,name=next_hop_id,json=nextHopId,proto3,oneof"` +} + +type Route_NextHopGroupId struct { + NextHopGroupId uint64 `protobuf:"varint,5,opt,name=next_hop_group_id,json=nextHopGroupId,proto3,oneof"` +} + +type Route_NextHops struct { + NextHops *NextHopList `protobuf:"bytes,6,opt,name=next_hops,json=nextHops,proto3,oneof"` +} + +func (*Route_PortId) isRoute_Hop() {} + +func (*Route_NextHopId) isRoute_Hop() {} + +func (*Route_NextHopGroupId) isRoute_Hop() {} + +func (*Route_NextHops) isRoute_Hop() {} + type CreatePortRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -176,7 +478,7 @@ type CreatePortRequest struct { func (x *CreatePortRequest) Reset() { *x = CreatePortRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_dataplane_dataplane_proto_msgTypes[2] + mi := &file_proto_dataplane_dataplane_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -189,7 +491,7 @@ func (x *CreatePortRequest) String() string { func (*CreatePortRequest) ProtoMessage() {} func (x *CreatePortRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_dataplane_dataplane_proto_msgTypes[2] + mi := &file_proto_dataplane_dataplane_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -202,7 +504,7 @@ func (x *CreatePortRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreatePortRequest.ProtoReflect.Descriptor instead. func (*CreatePortRequest) Descriptor() ([]byte, []int) { - return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{2} + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{5} } func (x *CreatePortRequest) GetType() forwarding.PortType { @@ -259,7 +561,7 @@ type CreatePortResponse struct { func (x *CreatePortResponse) Reset() { *x = CreatePortResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_dataplane_dataplane_proto_msgTypes[3] + mi := &file_proto_dataplane_dataplane_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -272,7 +574,7 @@ func (x *CreatePortResponse) String() string { func (*CreatePortResponse) ProtoMessage() {} func (x *CreatePortResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_dataplane_dataplane_proto_msgTypes[3] + mi := &file_proto_dataplane_dataplane_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -285,7 +587,232 @@ func (x *CreatePortResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreatePortResponse.ProtoReflect.Descriptor instead. func (*CreatePortResponse) Descriptor() ([]byte, []int) { - return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{3} + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{6} +} + +type IpMask struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` + Mask []byte `protobuf:"bytes,2,opt,name=mask,proto3" json:"mask,omitempty"` +} + +func (x *IpMask) Reset() { + *x = IpMask{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IpMask) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IpMask) ProtoMessage() {} + +func (x *IpMask) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IpMask.ProtoReflect.Descriptor instead. +func (*IpMask) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{7} +} + +func (x *IpMask) GetAddr() []byte { + if x != nil { + return x.Addr + } + return nil +} + +func (x *IpMask) GetMask() []byte { + if x != nil { + return x.Mask + } + return nil +} + +type AddIPRouteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Route *Route `protobuf:"bytes,1,opt,name=route,proto3" json:"route,omitempty"` +} + +func (x *AddIPRouteRequest) Reset() { + *x = AddIPRouteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddIPRouteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddIPRouteRequest) ProtoMessage() {} + +func (x *AddIPRouteRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddIPRouteRequest.ProtoReflect.Descriptor instead. +func (*AddIPRouteRequest) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{8} +} + +func (x *AddIPRouteRequest) GetRoute() *Route { + if x != nil { + return x.Route + } + return nil +} + +type AddIPRouteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AddIPRouteResponse) Reset() { + *x = AddIPRouteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddIPRouteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddIPRouteResponse) ProtoMessage() {} + +func (x *AddIPRouteResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddIPRouteResponse.ProtoReflect.Descriptor instead. +func (*AddIPRouteResponse) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{9} +} + +type RemoveIPRouteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Prefix *RoutePrefix `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` +} + +func (x *RemoveIPRouteRequest) Reset() { + *x = RemoveIPRouteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveIPRouteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveIPRouteRequest) ProtoMessage() {} + +func (x *RemoveIPRouteRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveIPRouteRequest.ProtoReflect.Descriptor instead. +func (*RemoveIPRouteRequest) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{10} +} + +func (x *RemoveIPRouteRequest) GetPrefix() *RoutePrefix { + if x != nil { + return x.Prefix + } + return nil +} + +type RemoveIPRouteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveIPRouteResponse) Reset() { + *x = RemoveIPRouteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveIPRouteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveIPRouteResponse) ProtoMessage() {} + +func (x *RemoveIPRouteResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_dataplane_dataplane_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveIPRouteResponse.ProtoReflect.Descriptor instead. +func (*RemoveIPRouteResponse) Descriptor() ([]byte, []int) { + return file_proto_dataplane_dataplane_proto_rawDescGZIP(), []int{11} } var File_proto_dataplane_dataplane_proto protoreflect.FileDescriptor @@ -308,35 +835,96 @@ var file_proto_dataplane_dataplane_proto_rawDesc = []byte{ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x52, 0x12, 0x70, 0x72, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, - 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x6a, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x72, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, - 0x76, 0x72, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x37, 0x0a, 0x09, 0x6e, - 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, + 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3d, 0x0a, 0x0b, 0x4e, 0x65, 0x78, 0x74, + 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x68, 0x6f, 0x70, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, + 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x6f, + 0x70, 0x52, 0x04, 0x68, 0x6f, 0x70, 0x73, 0x22, 0x3d, 0x0a, 0x0d, 0x4e, 0x65, 0x78, 0x74, 0x48, + 0x6f, 0x70, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x70, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x04, 0x68, 0x6f, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x77, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x22, 0x73, 0x0a, 0x0b, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x12, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x2f, 0x0a, 0x04, 0x6d, 0x61, 0x73, + 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, + 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x49, 0x70, 0x4d, 0x61, + 0x73, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x72, + 0x66, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x72, 0x66, 0x49, + 0x64, 0x42, 0x08, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0xa8, 0x02, 0x0a, 0x05, + 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, + 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x37, 0x0a, + 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, + 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, + 0x65, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x07, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x70, 0x6f, 0x72, 0x74, 0x49, + 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x5f, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, + 0x70, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x5f, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, + 0x52, 0x0e, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, + 0x12, 0x3d, 0x0a, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x4c, + 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x73, 0x42, + 0x05, 0x0a, 0x03, 0x68, 0x6f, 0x70, 0x22, 0x9a, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x66, 0x6f, 0x72, + 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0a, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, + 0x5f, 0x64, 0x65, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x65, + 0x72, 0x6e, 0x65, 0x6c, 0x44, 0x65, 0x76, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x05, 0x0a, 0x03, + 0x73, 0x72, 0x63, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x0a, 0x06, 0x49, 0x70, 0x4d, + 0x61, 0x73, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x43, 0x0a, 0x11, 0x41, + 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x2e, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, + 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, + 0x22, 0x14, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4e, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, + 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, - 0x6e, 0x65, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, - 0x48, 0x6f, 0x70, 0x73, 0x22, 0x9a, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, - 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x66, 0x6f, 0x72, 0x77, 0x61, - 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0a, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x5f, 0x64, - 0x65, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x65, 0x72, 0x6e, - 0x65, 0x6c, 0x44, 0x65, 0x76, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x72, - 0x63, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x68, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x70, - 0x6c, 0x61, 0x6e, 0x65, 0x12, 0x5b, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, - 0x72, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, - 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, - 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x6c, 0x65, 0x6d, 0x6d, 0x69, - 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, - 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x06, + 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, + 0x60, 0x0a, 0x0c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1d, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, + 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x44, 0x52, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x52, 0x57, 0x41, 0x52, 0x44, 0x10, + 0x02, 0x32, 0xab, 0x02, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x12, + 0x5b, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x24, 0x2e, + 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, + 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, + 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x0a, + 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x6c, 0x65, 0x6d, + 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x41, + 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x25, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, + 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x0d, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x6c, 0x65, 0x6d, + 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x50, + 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, + 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -351,26 +939,46 @@ func file_proto_dataplane_dataplane_proto_rawDescGZIP() []byte { return file_proto_dataplane_dataplane_proto_rawDescData } -var file_proto_dataplane_dataplane_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_proto_dataplane_dataplane_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_proto_dataplane_dataplane_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_proto_dataplane_dataplane_proto_goTypes = []interface{}{ - (*NextHop)(nil), // 0: lemming.dataplane.NextHop - (*Route)(nil), // 1: lemming.dataplane.Route - (*CreatePortRequest)(nil), // 2: lemming.dataplane.CreatePortRequest - (*CreatePortResponse)(nil), // 3: lemming.dataplane.CreatePortResponse - (*forwarding.ActionDesc)(nil), // 4: forwarding.ActionDesc - (forwarding.PortType)(0), // 5: forwarding.PortType + (PacketAction)(0), // 0: lemming.dataplane.PacketAction + (*NextHop)(nil), // 1: lemming.dataplane.NextHop + (*NextHopList)(nil), // 2: lemming.dataplane.NextHopList + (*NextHopIDList)(nil), // 3: lemming.dataplane.NextHopIDList + (*RoutePrefix)(nil), // 4: lemming.dataplane.RoutePrefix + (*Route)(nil), // 5: lemming.dataplane.Route + (*CreatePortRequest)(nil), // 6: lemming.dataplane.CreatePortRequest + (*CreatePortResponse)(nil), // 7: lemming.dataplane.CreatePortResponse + (*IpMask)(nil), // 8: lemming.dataplane.IpMask + (*AddIPRouteRequest)(nil), // 9: lemming.dataplane.AddIPRouteRequest + (*AddIPRouteResponse)(nil), // 10: lemming.dataplane.AddIPRouteResponse + (*RemoveIPRouteRequest)(nil), // 11: lemming.dataplane.RemoveIPRouteRequest + (*RemoveIPRouteResponse)(nil), // 12: lemming.dataplane.RemoveIPRouteResponse + (*forwarding.ActionDesc)(nil), // 13: forwarding.ActionDesc + (forwarding.PortType)(0), // 14: forwarding.PortType } var file_proto_dataplane_dataplane_proto_depIdxs = []int32{ - 4, // 0: lemming.dataplane.NextHop.pre_transmit_actions:type_name -> forwarding.ActionDesc - 0, // 1: lemming.dataplane.Route.next_hops:type_name -> lemming.dataplane.NextHop - 5, // 2: lemming.dataplane.CreatePortRequest.type:type_name -> forwarding.PortType - 2, // 3: lemming.dataplane.Dataplane.CreatePort:input_type -> lemming.dataplane.CreatePortRequest - 3, // 4: lemming.dataplane.Dataplane.CreatePort:output_type -> lemming.dataplane.CreatePortResponse - 4, // [4:5] is the sub-list for method output_type - 3, // [3:4] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 13, // 0: lemming.dataplane.NextHop.pre_transmit_actions:type_name -> forwarding.ActionDesc + 1, // 1: lemming.dataplane.NextHopList.hops:type_name -> lemming.dataplane.NextHop + 8, // 2: lemming.dataplane.RoutePrefix.mask:type_name -> lemming.dataplane.IpMask + 4, // 3: lemming.dataplane.Route.prefix:type_name -> lemming.dataplane.RoutePrefix + 0, // 4: lemming.dataplane.Route.action:type_name -> lemming.dataplane.PacketAction + 2, // 5: lemming.dataplane.Route.next_hops:type_name -> lemming.dataplane.NextHopList + 14, // 6: lemming.dataplane.CreatePortRequest.type:type_name -> forwarding.PortType + 5, // 7: lemming.dataplane.AddIPRouteRequest.route:type_name -> lemming.dataplane.Route + 4, // 8: lemming.dataplane.RemoveIPRouteRequest.prefix:type_name -> lemming.dataplane.RoutePrefix + 6, // 9: lemming.dataplane.Dataplane.CreatePort:input_type -> lemming.dataplane.CreatePortRequest + 9, // 10: lemming.dataplane.Dataplane.AddIPRoute:input_type -> lemming.dataplane.AddIPRouteRequest + 11, // 11: lemming.dataplane.Dataplane.RemoveIPRoute:input_type -> lemming.dataplane.RemoveIPRouteRequest + 7, // 12: lemming.dataplane.Dataplane.CreatePort:output_type -> lemming.dataplane.CreatePortResponse + 10, // 13: lemming.dataplane.Dataplane.AddIPRoute:output_type -> lemming.dataplane.AddIPRouteResponse + 12, // 14: lemming.dataplane.Dataplane.RemoveIPRoute:output_type -> lemming.dataplane.RemoveIPRouteResponse + 12, // [12:15] is the sub-list for method output_type + 9, // [9:12] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_proto_dataplane_dataplane_proto_init() } @@ -392,7 +1000,7 @@ func file_proto_dataplane_dataplane_proto_init() { } } file_proto_dataplane_dataplane_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Route); i { + switch v := v.(*NextHopList); i { case 0: return &v.state case 1: @@ -404,7 +1012,7 @@ func file_proto_dataplane_dataplane_proto_init() { } } file_proto_dataplane_dataplane_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreatePortRequest); i { + switch v := v.(*NextHopIDList); i { case 0: return &v.state case 1: @@ -416,6 +1024,42 @@ func file_proto_dataplane_dataplane_proto_init() { } } file_proto_dataplane_dataplane_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoutePrefix); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_dataplane_dataplane_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Route); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_dataplane_dataplane_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePortRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_dataplane_dataplane_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreatePortResponse); i { case 0: return &v.state @@ -427,8 +1071,78 @@ func file_proto_dataplane_dataplane_proto_init() { return nil } } + file_proto_dataplane_dataplane_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IpMask); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_dataplane_dataplane_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddIPRouteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_dataplane_dataplane_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddIPRouteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_dataplane_dataplane_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveIPRouteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_dataplane_dataplane_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveIPRouteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_proto_dataplane_dataplane_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*RoutePrefix_Str)(nil), + (*RoutePrefix_Mask)(nil), } - file_proto_dataplane_dataplane_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_proto_dataplane_dataplane_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*Route_PortId)(nil), + (*Route_NextHopId)(nil), + (*Route_NextHopGroupId)(nil), + (*Route_NextHops)(nil), + } + file_proto_dataplane_dataplane_proto_msgTypes[5].OneofWrappers = []interface{}{ (*CreatePortRequest_KernelDev)(nil), } type x struct{} @@ -436,13 +1150,14 @@ func file_proto_dataplane_dataplane_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_dataplane_dataplane_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, + NumEnums: 1, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, GoTypes: file_proto_dataplane_dataplane_proto_goTypes, DependencyIndexes: file_proto_dataplane_dataplane_proto_depIdxs, + EnumInfos: file_proto_dataplane_dataplane_proto_enumTypes, MessageInfos: file_proto_dataplane_dataplane_proto_msgTypes, }.Build() File_proto_dataplane_dataplane_proto = out.File @@ -464,6 +1179,8 @@ const _ = grpc.SupportPackageIsVersion6 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type DataplaneClient interface { CreatePort(ctx context.Context, in *CreatePortRequest, opts ...grpc.CallOption) (*CreatePortResponse, error) + AddIPRoute(ctx context.Context, in *AddIPRouteRequest, opts ...grpc.CallOption) (*AddIPRouteResponse, error) + RemoveIPRoute(ctx context.Context, in *RemoveIPRouteRequest, opts ...grpc.CallOption) (*RemoveIPRouteResponse, error) } type dataplaneClient struct { @@ -483,9 +1200,29 @@ func (c *dataplaneClient) CreatePort(ctx context.Context, in *CreatePortRequest, return out, nil } +func (c *dataplaneClient) AddIPRoute(ctx context.Context, in *AddIPRouteRequest, opts ...grpc.CallOption) (*AddIPRouteResponse, error) { + out := new(AddIPRouteResponse) + err := c.cc.Invoke(ctx, "/lemming.dataplane.Dataplane/AddIPRoute", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dataplaneClient) RemoveIPRoute(ctx context.Context, in *RemoveIPRouteRequest, opts ...grpc.CallOption) (*RemoveIPRouteResponse, error) { + out := new(RemoveIPRouteResponse) + err := c.cc.Invoke(ctx, "/lemming.dataplane.Dataplane/RemoveIPRoute", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // DataplaneServer is the server API for Dataplane service. type DataplaneServer interface { CreatePort(context.Context, *CreatePortRequest) (*CreatePortResponse, error) + AddIPRoute(context.Context, *AddIPRouteRequest) (*AddIPRouteResponse, error) + RemoveIPRoute(context.Context, *RemoveIPRouteRequest) (*RemoveIPRouteResponse, error) } // UnimplementedDataplaneServer can be embedded to have forward compatible implementations. @@ -495,6 +1232,12 @@ type UnimplementedDataplaneServer struct { func (*UnimplementedDataplaneServer) CreatePort(context.Context, *CreatePortRequest) (*CreatePortResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePort not implemented") } +func (*UnimplementedDataplaneServer) AddIPRoute(context.Context, *AddIPRouteRequest) (*AddIPRouteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddIPRoute not implemented") +} +func (*UnimplementedDataplaneServer) RemoveIPRoute(context.Context, *RemoveIPRouteRequest) (*RemoveIPRouteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveIPRoute not implemented") +} func RegisterDataplaneServer(s *grpc.Server, srv DataplaneServer) { s.RegisterService(&_Dataplane_serviceDesc, srv) @@ -518,6 +1261,42 @@ func _Dataplane_CreatePort_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Dataplane_AddIPRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddIPRouteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DataplaneServer).AddIPRoute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lemming.dataplane.Dataplane/AddIPRoute", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DataplaneServer).AddIPRoute(ctx, req.(*AddIPRouteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dataplane_RemoveIPRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveIPRouteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DataplaneServer).RemoveIPRoute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lemming.dataplane.Dataplane/RemoveIPRoute", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DataplaneServer).RemoveIPRoute(ctx, req.(*RemoveIPRouteRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Dataplane_serviceDesc = grpc.ServiceDesc{ ServiceName: "lemming.dataplane.Dataplane", HandlerType: (*DataplaneServer)(nil), @@ -526,6 +1305,14 @@ var _Dataplane_serviceDesc = grpc.ServiceDesc{ MethodName: "CreatePort", Handler: _Dataplane_CreatePort_Handler, }, + { + MethodName: "AddIPRoute", + Handler: _Dataplane_AddIPRoute_Handler, + }, + { + MethodName: "RemoveIPRoute", + Handler: _Dataplane_RemoveIPRoute_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/dataplane/dataplane.proto", diff --git a/proto/dataplane/dataplane.proto b/proto/dataplane/dataplane.proto index 2c5ace93..062a665e 100644 --- a/proto/dataplane/dataplane.proto +++ b/proto/dataplane/dataplane.proto @@ -32,13 +32,36 @@ message NextHop { repeated forwarding.ActionDesc pre_transmit_actions = 4; } -message Route { - uint64 vrf = 1; - string prefix = 2; - repeated NextHop next_hops = 3; +message NextHopList { + repeated NextHop hops = 1; +} + +message NextHopIDList { + repeated uint64 hops = 1; + repeated uint64 weights = 2; +} + +message RoutePrefix { + oneof prefix { + string str = 1; + IpMask mask = 2; + } + uint64 vrf_id = 3; } + +message Route { + RoutePrefix prefix = 1; + PacketAction action = 2; + oneof hop { + string port_id = 3; // Id of the output port. + uint64 next_hop_id = 4; // Id of the next hop + uint64 next_hop_group_id = 5; // Id of the next hop group + NextHopList next_hops = 6; // Implicitly create next hop, next hop groups. + } +} + message CreatePortRequest { forwarding.PortType type = 1; string id = 2; @@ -54,6 +77,34 @@ message CreatePortRequest { message CreatePortResponse { } +message IpMask { + bytes addr = 1; + bytes mask = 2; +} + +enum PacketAction { + PACKET_ACTION_UNSPECIFIED = 0; + PACKET_ACTION_DROP = 1; + PACKET_ACTION_FORWARD = 2; +} + +message AddIPRouteRequest{ + Route route = 1; +} + +message AddIPRouteResponse { +} + +message RemoveIPRouteRequest{ + RoutePrefix prefix = 1; +} + +message RemoveIPRouteResponse { +} + + service Dataplane { rpc CreatePort(CreatePortRequest) returns (CreatePortResponse) {} + rpc AddIPRoute(AddIPRouteRequest) returns (AddIPRouteResponse) {} + rpc RemoveIPRoute(RemoveIPRouteRequest) returns (RemoveIPRouteResponse) {} } \ No newline at end of file diff --git a/sysrib/server.go b/sysrib/server.go index 927cf7e6..15618b82 100644 --- a/sysrib/server.go +++ b/sysrib/server.go @@ -43,6 +43,7 @@ import ( "github.com/openconfig/lemming/gnmi/oc/ocpath" gpb "github.com/openconfig/gnmi/proto/gnmi" + dpb "github.com/openconfig/lemming/proto/dataplane" fwdpb "github.com/openconfig/lemming/proto/forwarding" pb "github.com/openconfig/lemming/proto/sysrib" @@ -126,7 +127,7 @@ func (d *Dataplane) ProgramRoute(r *ResolvedRoute) error { if err != nil { return err } - _, err = ygnmi.Replace(context.TODO(), d.Client, handlers.RouteQuery(rr.GetVrf(), rr.GetPrefix()), rr, ygnmi.WithSetFallbackEncoding()) + _, err = ygnmi.Replace(context.TODO(), d.Client, handlers.RouteQuery(rr.GetPrefix().GetVrfId(), rr.GetPrefix().GetStr()), rr, ygnmi.WithSetFallbackEncoding()) return err } @@ -525,9 +526,15 @@ func resolvedRouteToRouteRequest(r *ResolvedRoute) (*dpb.Route, error) { } return &dpb.Route{ - Vrf: uint64(vrfID), - Prefix: r.Prefix, - NextHops: nexthops, + Prefix: &dpb.RoutePrefix{ + VrfId: uint64(vrfID), + Prefix: &dpb.RoutePrefix_Str{ + Str: r.Prefix, + }, + }, + Hop: &dpb.Route_NextHops{ + NextHops: &dpb.NextHopList{Hops: nexthops}, + }, }, nil } From 1c0540b633bacbfac873b9081ee3474a16644f4c Mon Sep 17 00:00:00 2001 From: Daniel Grau Date: Tue, 30 May 2023 17:15:52 +0000 Subject: [PATCH 2/3] feedback --- dataplane/handlers/routes.go | 4 +- dataplane/internal/engine/BUILD.bazel | 2 +- dataplane/internal/engine/engine.go | 35 ++--- proto/dataplane/dataplane.pb.go | 180 +++++++++++++------------- proto/dataplane/dataplane.proto | 6 +- 5 files changed, 115 insertions(+), 112 deletions(-) diff --git a/dataplane/handlers/routes.go b/dataplane/handlers/routes.go index 641c4739..eb096c7d 100644 --- a/dataplane/handlers/routes.go +++ b/dataplane/handlers/routes.go @@ -66,13 +66,13 @@ func (r *route) start(ctx context.Context, client *ygnmi.Client) error { } if !present { - if _, err := r.e.RemoveIPRoute(ctx, &dpb.RemoveIPRouteRequest{Prefix: &dpb.RoutePrefix{Prefix: &dpb.RoutePrefix_Str{Str: prefix}, VrfId: vrf}}); err != nil { + if _, err := r.e.RemoveIPRoute(ctx, &dpb.RemoveIPRouteRequest{Prefix: &dpb.RoutePrefix{Prefix: &dpb.RoutePrefix_Cidr{Cidr: prefix}, VrfId: vrf}}); err != nil { log.Warningf("failed to delete route: %v", err) return ygnmi.Continue } return ygnmi.Continue } - if route.GetNextHops() == nil || len(route.GetNextHops().GetHops()) == 0 { + if len(route.GetNextHops().GetHops()) == 0 { log.Warningf("no next hops for route insert or update") return ygnmi.Continue } diff --git a/dataplane/internal/engine/BUILD.bazel b/dataplane/internal/engine/BUILD.bazel index 149d39ba..3573f590 100644 --- a/dataplane/internal/engine/BUILD.bazel +++ b/dataplane/internal/engine/BUILD.bazel @@ -11,7 +11,7 @@ go_library( deps = [ "//dataplane/forwarding", "//dataplane/forwarding/attributes", - "//dataplane/forwarding/fwdbuilder", + "//dataplane/forwarding/fwdconfig", "//proto/dataplane", "//proto/forwarding", "@com_github_golang_glog//:glog", diff --git a/dataplane/internal/engine/engine.go b/dataplane/internal/engine/engine.go index 961128b7..d93bfe1a 100644 --- a/dataplane/internal/engine/engine.go +++ b/dataplane/internal/engine/engine.go @@ -24,7 +24,7 @@ import ( "github.com/openconfig/lemming/dataplane/forwarding" "github.com/openconfig/lemming/dataplane/forwarding/attributes" - "github.com/openconfig/lemming/dataplane/forwarding/fwdbuilder" + "github.com/openconfig/lemming/dataplane/forwarding/fwdconfig" log "github.com/golang/glog" @@ -291,8 +291,8 @@ func prefixToPrimitives(prefix *dpb.RoutePrefix) ([]byte, []byte, bool, uint64, vrf := prefix.GetVrfId() switch pre := prefix.GetPrefix().(type) { - case *dpb.RoutePrefix_Str: - _, ipNet, err := net.ParseCIDR(pre.Str) + case *dpb.RoutePrefix_Cidr: + _, ipNet, err := net.ParseCIDR(pre.Cidr) if err != nil { return ip, mask, isIPv4, vrf, fmt.Errorf("failed to parse ip prefix: %v", err) } @@ -329,8 +329,8 @@ func (e *Engine) addNextHopList(ctx context.Context, nhg *dpb.NextHopList) ([]*f return nil, err } return []*fwdpb.ActionDesc{ - fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID).WithUint64Value(nhID)).Build(), - fwdbuilder.Action(fwdbuilder.LookupAction(nhTable)).Build(), + fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID).WithUint64Value(nhID)).Build(), + fwdconfig.Action(fwdconfig.LookupAction(nhTable)).Build(), }, nil } @@ -348,8 +348,8 @@ func (e *Engine) addNextHopList(ctx context.Context, nhg *dpb.NextHopList) ([]*f return nil, err } return []*fwdpb.ActionDesc{ - fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID).WithUint64Value(nhgID)).Build(), - fwdbuilder.Action(fwdbuilder.LookupAction(nhgTable)).Build(), + fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID).WithUint64Value(nhgID)).Build(), + fwdconfig.Action(fwdconfig.LookupAction(nhgTable)).Build(), }, nil } @@ -375,6 +375,7 @@ func (e *Engine) addNextHopGroupIDList(ctx context.Context, id uint64, nhg *dpb. }}, }) } + // If there are multiple next-hops, configure the route to use ECMP or WCMP. actions := []*fwdpb.ActionDesc{{ ActionType: fwdpb.ActionType_ACTION_TYPE_SELECT_ACTION_LIST, Action: &fwdpb.ActionDesc_Select{ @@ -438,6 +439,7 @@ func (e *Engine) addNextHopGroupIDList(ctx context.Context, id uint64, nhg *dpb. } // addNextHop adds an entry to the next hop table. +// TODO: Remove workaround that nexthop IP is not specified that the packet is treated as directly connected. func (e *Engine) addNextHop(ctx context.Context, id uint64, nh *dpb.NextHop) error { var nextHopIP []byte if nhIPStr := nh.GetIp(); nhIPStr != "" { @@ -448,12 +450,12 @@ func (e *Engine) addNextHop(ctx context.Context, id uint64, nh *dpb.NextHop) err } } // Set the next hop IP in the packet's metadata. - nextHopAct := fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithValue(nextHopIP)).Build() + nextHopAct := fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithValue(nextHopIP)).Build() if nextHopIP == nil { - nextHopAct = fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST)).Build() + nextHopAct = fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST)).Build() } // Set the output port of the packet. - transmitAct := fwdbuilder.Action(fwdbuilder.TransmitAction(nh.GetPort())).Build() + transmitAct := fwdconfig.Action(fwdconfig.TransmitAction(nh.GetPort())).Build() acts := append([]*fwdpb.ActionDesc{nextHopAct, transmitAct}, nh.GetPreTransmitActions()...) entries := &fwdpb.TableEntryAddRequest{ @@ -491,6 +493,7 @@ func (e *Engine) addNextHop(ctx context.Context, id uint64, nh *dpb.NextHop) err // AddIPRoute adds a route to the FIB. It operates in two modes: // 1. Client-managed IDs: each next hop and next hop group must be created before adding to a route with user provided ids. // 2. Server-managed IDs: each next hop and next hop group must be specified with route. The server implicitly creates ids. +// TODO: Enforce that only one mode can be used. func (e *Engine) AddIPRoute(ctx context.Context, req *dpb.AddIPRouteRequest) (*dpb.AddIPRouteResponse, error) { ip, mask, isIPv4, vrf, err := prefixToPrimitives(req.GetRoute().GetPrefix()) if err != nil { @@ -506,19 +509,19 @@ func (e *Engine) AddIPRoute(ctx context.Context, req *dpb.AddIPRouteRequest) (*d case *dpb.Route_PortId: actions = []*fwdpb.ActionDesc{ // Set the next hop IP in the packet's metadata. - fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST)).Build(), + fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_IP).WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_ADDR_DST)).Build(), // Set the output port. - fwdbuilder.Action(fwdbuilder.TransmitAction(hop.PortId)).Build(), + fwdconfig.Action(fwdconfig.TransmitAction(hop.PortId)).Build(), } case *dpb.Route_NextHopId: actions = []*fwdpb.ActionDesc{ // Set the next hop ID in the packet's metadata. - fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID).WithUint64Value(hop.NextHopId)).Build(), - fwdbuilder.Action(fwdbuilder.LookupAction(nhTable)).Build(), + fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_ID).WithUint64Value(hop.NextHopId)).Build(), + fwdconfig.Action(fwdconfig.LookupAction(nhTable)).Build(), } case *dpb.Route_NextHopGroupId: actions = []*fwdpb.ActionDesc{ // Set the next hop group ID in the packet's metadata. - fwdbuilder.Action(fwdbuilder.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID).WithUint64Value(hop.NextHopGroupId)).Build(), - fwdbuilder.Action(fwdbuilder.LookupAction(nhgTable)).Build(), + fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID).WithUint64Value(hop.NextHopGroupId)).Build(), + fwdconfig.Action(fwdconfig.LookupAction(nhgTable)).Build(), } case *dpb.Route_NextHops: actions, err = e.addNextHopList(ctx, hop.NextHops) diff --git a/proto/dataplane/dataplane.pb.go b/proto/dataplane/dataplane.pb.go index e644a268..429d6261 100644 --- a/proto/dataplane/dataplane.pb.go +++ b/proto/dataplane/dataplane.pb.go @@ -254,7 +254,7 @@ type RoutePrefix struct { // Types that are assignable to Prefix: // - // *RoutePrefix_Str + // *RoutePrefix_Cidr // *RoutePrefix_Mask Prefix isRoutePrefix_Prefix `protobuf_oneof:"prefix"` VrfId uint64 `protobuf:"varint,3,opt,name=vrf_id,json=vrfId,proto3" json:"vrf_id,omitempty"` @@ -299,9 +299,9 @@ func (m *RoutePrefix) GetPrefix() isRoutePrefix_Prefix { return nil } -func (x *RoutePrefix) GetStr() string { - if x, ok := x.GetPrefix().(*RoutePrefix_Str); ok { - return x.Str +func (x *RoutePrefix) GetCidr() string { + if x, ok := x.GetPrefix().(*RoutePrefix_Cidr); ok { + return x.Cidr } return "" } @@ -324,15 +324,15 @@ type isRoutePrefix_Prefix interface { isRoutePrefix_Prefix() } -type RoutePrefix_Str struct { - Str string `protobuf:"bytes,1,opt,name=str,proto3,oneof"` +type RoutePrefix_Cidr struct { + Cidr string `protobuf:"bytes,1,opt,name=cidr,proto3,oneof"` } type RoutePrefix_Mask struct { Mask *IpMask `protobuf:"bytes,2,opt,name=mask,proto3,oneof"` } -func (*RoutePrefix_Str) isRoutePrefix_Prefix() {} +func (*RoutePrefix_Cidr) isRoutePrefix_Prefix() {} func (*RoutePrefix_Mask) isRoutePrefix_Prefix() {} @@ -843,88 +843,88 @@ var file_proto_dataplane_dataplane_proto_rawDesc = []byte{ 0x6f, 0x70, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x04, 0x68, 0x6f, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x77, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x22, 0x73, 0x0a, 0x0b, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x12, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x2f, 0x0a, 0x04, 0x6d, 0x61, 0x73, - 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, - 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x49, 0x70, 0x4d, 0x61, - 0x73, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x72, - 0x66, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x72, 0x66, 0x49, - 0x64, 0x42, 0x08, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0xa8, 0x02, 0x0a, 0x05, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, - 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x37, 0x0a, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, - 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x07, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x70, 0x6f, 0x72, 0x74, 0x49, - 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x5f, 0x69, 0x64, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, - 0x70, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x5f, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, - 0x52, 0x0e, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, - 0x12, 0x3d, 0x0a, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x4c, - 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x73, 0x42, - 0x05, 0x0a, 0x03, 0x68, 0x6f, 0x70, 0x22, 0x9a, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x66, 0x6f, 0x72, - 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0a, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, - 0x5f, 0x64, 0x65, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x65, - 0x72, 0x6e, 0x65, 0x6c, 0x44, 0x65, 0x76, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x05, 0x0a, 0x03, - 0x73, 0x72, 0x63, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x0a, 0x06, 0x49, 0x70, 0x4d, - 0x61, 0x73, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x43, 0x0a, 0x11, 0x41, - 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x2e, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, - 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x22, 0x14, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4e, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, - 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, - 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x06, - 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, - 0x60, 0x0a, 0x0c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x1d, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, - 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x44, 0x52, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x52, 0x57, 0x41, 0x52, 0x44, 0x10, - 0x02, 0x32, 0xab, 0x02, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x12, - 0x5b, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x24, 0x2e, - 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, - 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x0a, - 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x6c, 0x65, 0x6d, - 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x41, - 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x25, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, - 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x0d, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x6c, 0x65, 0x6d, - 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x50, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, - 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, - 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x22, 0x75, 0x0a, 0x0b, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x14, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x12, 0x2f, 0x0a, 0x04, 0x6d, + 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, + 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x49, 0x70, + 0x4d, 0x61, 0x73, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x12, 0x15, 0x0a, 0x06, + 0x76, 0x72, 0x66, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x72, + 0x66, 0x49, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0xa8, 0x02, + 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, + 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, + 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, + 0x37, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1f, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, + 0x61, 0x6e, 0x65, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x07, 0x70, 0x6f, 0x72, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x70, 0x6f, 0x72, + 0x74, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x5f, + 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x65, 0x78, 0x74, + 0x48, 0x6f, 0x70, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, + 0x70, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, + 0x48, 0x00, 0x52, 0x0e, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, + 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x6f, + 0x70, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, + 0x73, 0x42, 0x05, 0x0a, 0x03, 0x68, 0x6f, 0x70, 0x22, 0x9a, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x66, + 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0a, 0x6b, 0x65, 0x72, 0x6e, + 0x65, 0x6c, 0x5f, 0x64, 0x65, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, + 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x44, 0x65, 0x76, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x05, + 0x0a, 0x03, 0x73, 0x72, 0x63, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x0a, 0x06, 0x49, + 0x70, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x61, 0x73, + 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x43, 0x0a, + 0x11, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, + 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x75, + 0x74, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4e, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x36, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, + 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2a, 0x60, 0x0a, 0x0c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x16, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x44, 0x52, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x52, 0x57, 0x41, 0x52, + 0x44, 0x10, 0x02, 0x32, 0xab, 0x02, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, + 0x65, 0x12, 0x5b, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, + 0x24, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, + 0x61, 0x6e, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, + 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, + 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x6c, + 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, + 0x2e, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, + 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x0d, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x6c, + 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, + 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6c, 0x65, 0x6d, 0x6d, 0x69, 0x6e, 0x67, 0x2e, + 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x49, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x6c, 0x65, 0x6d, 0x6d, 0x69, + 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, + 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1133,7 +1133,7 @@ func file_proto_dataplane_dataplane_proto_init() { } } file_proto_dataplane_dataplane_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*RoutePrefix_Str)(nil), + (*RoutePrefix_Cidr)(nil), (*RoutePrefix_Mask)(nil), } file_proto_dataplane_dataplane_proto_msgTypes[4].OneofWrappers = []interface{}{ diff --git a/proto/dataplane/dataplane.proto b/proto/dataplane/dataplane.proto index 062a665e..b3059142 100644 --- a/proto/dataplane/dataplane.proto +++ b/proto/dataplane/dataplane.proto @@ -42,8 +42,8 @@ message NextHopIDList { } message RoutePrefix { - oneof prefix { - string str = 1; + oneof prefix { // Specify either cidr string or ip and mask bytes. + string cidr = 1; IpMask mask = 2; } uint64 vrf_id = 3; @@ -56,7 +56,7 @@ message Route { PacketAction action = 2; oneof hop { string port_id = 3; // Id of the output port. - uint64 next_hop_id = 4; // Id of the next hop + uint64 next_hop_id = 4; // Id of the next hop. uint64 next_hop_group_id = 5; // Id of the next hop group NextHopList next_hops = 6; // Implicitly create next hop, next hop groups. } From f3e1dbedbface3cb59cb428637cfc406698e40c8 Mon Sep 17 00:00:00 2001 From: Daniel Grau Date: Tue, 30 May 2023 17:33:36 +0000 Subject: [PATCH 3/3] build fix --- dataplane/internal/engine/engine.go | 1 - sysrib/server.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dataplane/internal/engine/engine.go b/dataplane/internal/engine/engine.go index d93bfe1a..ef2c2c08 100644 --- a/dataplane/internal/engine/engine.go +++ b/dataplane/internal/engine/engine.go @@ -53,7 +53,6 @@ type Engine struct { idToNIDMu sync.RWMutex // idToNID is map from RPC ID (proto), to internal object NID. idToNID map[string]uint64 - nextHopMu sync.Mutex nextNHGID atomic.Uint64 nextNHID atomic.Uint64 } diff --git a/sysrib/server.go b/sysrib/server.go index 15618b82..bbaee864 100644 --- a/sysrib/server.go +++ b/sysrib/server.go @@ -127,7 +127,7 @@ func (d *Dataplane) ProgramRoute(r *ResolvedRoute) error { if err != nil { return err } - _, err = ygnmi.Replace(context.TODO(), d.Client, handlers.RouteQuery(rr.GetPrefix().GetVrfId(), rr.GetPrefix().GetStr()), rr, ygnmi.WithSetFallbackEncoding()) + _, err = ygnmi.Replace(context.TODO(), d.Client, handlers.RouteQuery(rr.GetPrefix().GetVrfId(), rr.GetPrefix().GetCidr()), rr, ygnmi.WithSetFallbackEncoding()) return err } @@ -528,8 +528,8 @@ func resolvedRouteToRouteRequest(r *ResolvedRoute) (*dpb.Route, error) { return &dpb.Route{ Prefix: &dpb.RoutePrefix{ VrfId: uint64(vrfID), - Prefix: &dpb.RoutePrefix_Str{ - Str: r.Prefix, + Prefix: &dpb.RoutePrefix_Cidr{ + Cidr: r.Prefix, }, }, Hop: &dpb.Route_NextHops{