Skip to content

Commit

Permalink
Delete the NHG entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
guoshiuan committed Feb 22, 2024
1 parent 31fff5d commit aee5066
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dataplane/saiserver/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ func (nhg *nextHopGroup) RemoveNextHopGroup(_ context.Context, req *saipb.Remove
return nil, status.Errorf(codes.FailedPrecondition, "group %d does not exist", oid)
}
delete(nhg.groups, oid)

entry := fwdconfig.EntryDesc(fwdconfig.ExactEntry(
fwdconfig.PacketFieldBytes(fwdpb.PacketFieldNum_PACKET_FIELD_NUM_NEXT_HOP_GROUP_ID).WithUint64(oid))).Build()
nhReq := &fwdpb.TableEntryRemoveRequest{
ContextId: &fwdpb.ContextId{Id: nhg.dataplane.ID()},
TableId: &fwdpb.TableId{ObjectId: &fwdpb.ObjectId{Id: NHTable}},
EntryDesc: entry,
}

if _, err := nhg.dataplane.TableEntryRemove(context.Background(), nhReq); err != nil {
return nil, err
}
return &saipb.RemoveNextHopGroupResponse{}, nil
}

Expand Down

0 comments on commit aee5066

Please sign in to comment.