Skip to content
Snippets Groups Projects

Add basic application framework and example application to show interaction between events an NBI

Merged Ghost User requested to merge istaester/init-application-framework into develop
3 files
+ 94
0
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -9,6 +9,7 @@ import (
"code.fbi.h-da.de/danet/gosdn/controller/topology/links"
"code.fbi.h-da.de/danet/gosdn/controller/topology/nodes"
"code.fbi.h-da.de/danet/gosdn/controller/topology/ports"
"code.fbi.h-da.de/danet/gosdn/controller/topology/store"
"github.com/google/uuid"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -103,6 +104,38 @@ func (t *Topology) GetTopology(ctx context.Context, request *apb.GetTopologyRequ
}, nil
}
// DeleteLink deletes a link
func (t *Topology) DeleteLink(ctx context.Context, request *apb.DeleteLinkRequest) (*apb.DeleteLinkResponse, error) {
linkID, err := uuid.Parse(request.Id)
if err != nil {
return &apb.DeleteLinkResponse{
Timestamp: time.Now().UnixNano(),
Status: apb.Status_STATUS_ERROR,
}, err
}
foundLink, err := t.topologyService.Get(store.Query{ID: linkID})
if err != nil {
return &apb.DeleteLinkResponse{
Timestamp: time.Now().UnixNano(),
Status: apb.Status_STATUS_ERROR,
}, err
}
err = t.topologyService.DeleteLink(foundLink)
if err != nil {
return &apb.DeleteLinkResponse{
Timestamp: time.Now().UnixNano(),
Status: apb.Status_STATUS_ERROR,
}, err
}
return &apb.DeleteLinkResponse{
Timestamp: time.Now().UnixNano(),
Status: apb.Status_STATUS_OK,
}, nil
}
func (t *Topology) ensureNodeAndPortExists(incomingNode *apb.Node, incomingPort *apb.Port) (nodes.Node, ports.Port, error) {
node, err := t.nodeService.EnsureExists(
nodes.Node{
Loading