Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion dataplane/saiserver/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (nhg *nextHopGroup) updateNextHopGroupMember(ctx context.Context, nhgid, mi
func (nhg *nextHopGroup) RemoveNextHopGroup(_ context.Context, req *saipb.RemoveNextHopGroupRequest) (*saipb.RemoveNextHopGroupResponse, error) {
oid := req.GetOid()
if _, ok := nhg.groups[oid]; !ok {
return nil, status.Errorf(codes.FailedPrecondition, "group %d does not exist", oid)
return nil, status.Errorf(codes.NotFound, "group %d does not exist", oid)
}
delete(nhg.groups, oid)

Expand All @@ -306,6 +306,19 @@ func (nhg *nextHopGroup) RemoveNextHopGroup(_ context.Context, req *saipb.Remove
return &saipb.RemoveNextHopGroupResponse{}, nil
}

// RemoveNextHopGroups removes multiple next hop groups specified in the OID.
func (nhg *nextHopGroup) RemoveNextHopGroups(ctx context.Context, req *saipb.RemoveNextHopGroupsRequest) (*saipb.RemoveNextHopGroupsResponse, error) {
resp := &saipb.RemoveNextHopGroupsResponse{}
for _, req := range req.GetReqs() {
res, err := attrmgr.InvokeAndSave(ctx, nhg.mgr, nhg.RemoveNextHopGroup, req)
if err != nil {
return nil, err
}
resp.Resps = append(resp.Resps, res)
}
return resp, nil
}

// CreateNextHopGroupMember adds a next hop to a next hop group.
func (nhg *nextHopGroup) CreateNextHopGroupMember(ctx context.Context, req *saipb.CreateNextHopGroupMemberRequest) (*saipb.CreateNextHopGroupMemberResponse, error) {
nhgid := req.GetNextHopGroupId()
Expand Down Expand Up @@ -357,6 +370,19 @@ func (nhg *nextHopGroup) RemoveNextHopGroupMember(ctx context.Context, req *saip
return &saipb.RemoveNextHopGroupMemberResponse{}, nil
}

// RemoveNextHopGroupMembers removes multiple next hop group members specified in the OID.
func (nhg *nextHopGroup) RemoveNextHopGroupMembers(ctx context.Context, r *saipb.RemoveNextHopGroupMembersRequest) (*saipb.RemoveNextHopGroupMembersResponse, error) {
resp := &saipb.RemoveNextHopGroupMembersResponse{}
for _, req := range r.GetReqs() {
res, err := attrmgr.InvokeAndSave(ctx, nhg.mgr, nhg.RemoveNextHopGroupMember, req)
if err != nil {
return nil, err
}
resp.Resps = append(resp.Resps, res)
}
return resp, nil
}

type nextHop struct {
saipb.UnimplementedNextHopServer
mgr *attrmgr.AttrMgr
Expand Down
8 changes: 2 additions & 6 deletions dataplane/saiserver/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (t *tunnel) CreateTunnel(ctx context.Context, req *saipb.CreateTunnelReques
id := t.mgr.NextID()

tunType := req.GetType()

switch tunType {
case saipb.TunnelType_TUNNEL_TYPE_IPINIP:
default:
Expand All @@ -62,17 +63,12 @@ func (t *tunnel) CreateTunnel(ctx context.Context, req *saipb.CreateTunnelReques
if ecnMode == saipb.TunnelEncapEcnMode_TUNNEL_ENCAP_ECN_MODE_STANDARD && dscpMode == saipb.TunnelDscpMode_TUNNEL_DSCP_MODE_UNIFORM_MODEL { // Copy the QOS bits from the inner IP header.
actions = append(actions, fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_QOS).
WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_QOS).WithFieldSrcInstance(1)).Build())
} else {
return nil, status.Errorf(codes.InvalidArgument, "unsupported encap ecn mode %v and dscp mode: %v", ecnMode, dscpMode)
}

ttlMode := req.GetEncapTtlMode()
switch ttlMode {
case saipb.TunnelTtlMode_TUNNEL_TTL_MODE_UNIFORM_MODEL: // Copy the TTL from the inner IP header.
if ttlMode == saipb.TunnelTtlMode_TUNNEL_TTL_MODE_UNIFORM_MODEL { // Copy the TTL from the inner IP header.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do u need to rebase? This change already went in yesterday right?

actions = append(actions, fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_COPY, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_HOP).
WithFieldSrc(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_IP_HOP).WithFieldSrcInstance(1)).Build())
default:
return nil, status.Errorf(codes.InvalidArgument, "unsupported ttl mode: %v", ttlMode)
}

if req.GetEncapSrcIp() != nil {
Expand Down
4 changes: 2 additions & 2 deletions dataplane/standalone/sai/tunnel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ sai_status_t l_create_tunnel(sai_object_id_t *tunnel_id, sai_object_id_t switch_
lemming::dataplane::sai::CreateTunnelRequest req = convert_create_tunnel(switch_id, attr_count, attr_list);
lemming::dataplane::sai::CreateTunnelResponse resp;
grpc::ClientContext context;
req.set_switch_(switch_id);
req.set_switch_(switch_id);

grpc::Status status = tunnel->CreateTunnel(&context, req, &resp);
if (!status.ok()) {
auto it = context.GetServerTrailingMetadata().find("traceparent");
Expand Down