Skip to content
Snippets Groups Projects

Resolve "Improve security by enabling and enforcing more linting rules"

All threads resolved!
2 files
+ 44
14
Compare changes
  • Side-by-side
  • Inline
Files
2
package routingtables
import (
"code.fbi.h-da.de/danet/gosdn/controller/event"
eventInterfaces "code.fbi.h-da.de/danet/gosdn/controller/interfaces/event"
query "code.fbi.h-da.de/danet/gosdn/controller/store"
"code.fbi.h-da.de/danet/gosdn/controller/topology/nodes"
"code.fbi.h-da.de/danet/gosdn/controller/topology/ports"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
)
const (
// RoutingTableEventTopic is the used topic for routing table related entity changes
RoutingTableEventTopic = "routingTable"
)
// Service defines a interface for a RoutingTableService
@@ -18,9 +26,10 @@ type Service interface {
// RoutingTableService is a RoutingTableService
type RoutingTableService struct {
store Store
nodeService nodes.Service
portService ports.Service
store Store
nodeService nodes.Service
portService ports.Service
eventService eventInterfaces.Service
}
// NewRoutingTableService creates a RoutingTableService
@@ -28,11 +37,13 @@ func NewRoutingTableService(
store Store,
nodeService nodes.Service,
portService ports.Service,
eventService eventInterfaces.Service,
) Service {
return &RoutingTableService{
store: store,
nodeService: nodeService,
portService: portService,
store: store,
nodeService: nodeService,
portService: portService,
eventService: eventService,
}
}
@@ -57,7 +68,12 @@ func (r *RoutingTableService) createRoutingTable(routingTable RoutingTable) (Rou
return routingTable, err
}
return routingTable, err
if err := r.eventService.PublishEvent(RoutingTableEventTopic, event.NewAddEvent(routingTable.ID)); err != nil {
//TODO: improve error handling, maybe to sth like reconnect
log.Error(err)
}
return routingTable, nil
}
// Update updates an existing routingTable
@@ -67,6 +83,11 @@ func (r *RoutingTableService) Update(routingTable RoutingTable) error {
return err
}
if err := r.eventService.PublishEvent(RoutingTableEventTopic, event.NewUpdateEvent(routingTable.ID)); err != nil {
//TODO: improve error handling, maybe to sth like reconnect
log.Error(err)
}
return nil
}
@@ -77,6 +98,11 @@ func (r *RoutingTableService) Delete(routingTable RoutingTable) error {
return err
}
if err := r.eventService.PublishEvent(RoutingTableEventTopic, event.NewDeleteEvent(routingTable.ID)); err != nil {
//TODO: improve error handling, maybe to sth like reconnect
log.Error(err)
}
return nil
}
Loading