Skip to content
Snippets Groups Projects

Resolve "Update gRPC abstraction API with missing calls and refactoring"

Merged Fabian Seidl requested to merge 359-update-grpc-abstraction-api-with-missing-calls into master
All threads resolved!
1 file
+ 27
0
Compare changes
  • Side-by-side
  • Inline
@@ -6,6 +6,7 @@ import (
"io"
"time"
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/conflict"
mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement"
pipb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/plugin-internal"
spb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
@@ -250,3 +251,29 @@ func DeleteNetworkElement(ctx context.Context, addr, pid, mneid string) (*mnepb.
return client.Delete(ctx, req)
}
// UpdateNetworkElement changes the metadata of the network element which is stored in the controller storage.
// Correct resource version needs to be provided to allow a change of the object in the storage.
func UpdateNetworkElement(ctx context.Context, addr, mneid, updatedName, updatedTransportAddress, updatedPid string, resourceVersion *conflict.Metadata) (*mnepb.UpdateNetworkElementResponse, error) {
client, err := nbi.NetworkElementClient(addr, dialOptions...)
if err != nil {
return nil, err
}
// Note: Consider changing what to update. Some values are quite iffy to change.
req := &mnepb.UpdateNetworkElementRequest{
Timestamp: time.Now().UnixNano(),
NetworkElement: &mnepb.ManagedNetworkElement{
Id: mneid,
Name: updatedName,
TransportAddress: updatedTransportAddress,
TransportOption: &tpb.TransportOption{
Address: updatedTransportAddress,
},
Metadata: resourceVersion,
AssociatedPnd: updatedPid,
},
}
return client.Update(ctx, req)
}
Loading