Skip to content
Snippets Groups Projects

Resolve "AddLink crashes goSDN when Link without correct port config is send."

4 files
+ 86
97
Compare changes
  • Side-by-side
  • Inline
Files
4
  • 1f4b309a
    Store for links adjusted · 1f4b309a
    Malte Bauch authored
    Handling of links with the help of a store is handled quite differently
    than how it is done in other cases (e.g., network element, user, roles).
    Therefore the methods have been adjusted to deal with this fact.
@@ -78,8 +78,19 @@ func (t *TopologyServer) AddLink(ctx context.Context, request *topopb.AddLinkReq
@@ -78,8 +78,19 @@ func (t *TopologyServer) AddLink(ctx context.Context, request *topopb.AddLinkReq
return nil, status.Errorf(codes.Aborted, "%v", err)
return nil, status.Errorf(codes.Aborted, "%v", err)
}
}
 
// check if UUID is set
 
var id uuid.UUID
 
if requestId := request.Link.Id; requestId != "" {
 
id, err = uuid.Parse(requestId)
 
if err != nil {
 
return nil, err
 
}
 
} else {
 
id = uuid.New()
 
}
 
link := links.Link{
link := links.Link{
ID: uuid.New(),
ID: id,
Name: request.Link.Name,
Name: request.Link.Name,
SourceNode: sourceNode,
SourceNode: sourceNode,
SourcePort: sourcePort,
SourcePort: sourcePort,
Loading