Skip to content

Commit

Permalink
Issue-4964 Update NB API to get LACP connection status
Browse files Browse the repository at this point in the history
  • Loading branch information
durgakako committed Jan 26, 2023
1 parent bb072f4 commit 4a2c83a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ public CompletableFuture<List<LacpStatusResponse>> getLacpStatus(@PathVariable("
* @param logicalPortNumber the switch
*
*/
@ApiOperation(value = "Read all LACP status on specific switch", response = LacpStatusResponse.class)
@ApiOperation(value = "Read LACP status on specific port of the switch", response = LacpStatusResponse.class)
@GetMapping(value = "/{switch_id}/lacp/{logical_port_number}")
@ResponseStatus(HttpStatus.OK)
public CompletableFuture<List<LacpStatusResponse>> getLacpStatus(@PathVariable("switch_id") SwitchId switchId,
public CompletableFuture<LacpStatusResponse> getLacpStatus(@PathVariable("switch_id") SwitchId switchId,
@PathVariable("logical_port_number")
int logicalPortNumber) {
return switchService.getLacpStatus(switchId, logicalPortNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ CompletableFuture<PortPropertiesResponse> updatePortProperties(SwitchId switchId

CompletableFuture<List<LacpStatusResponse>> getLacpStatus(SwitchId switchId);

CompletableFuture<List<LacpStatusResponse>> getLacpStatus(SwitchId switchId, int logicalPortNumber);
CompletableFuture<LacpStatusResponse> getLacpStatus(SwitchId switchId, int logicalPortNumber);

CompletableFuture<LagPortResponse> updateLagPort(
SwitchId switchId, int logicalPortNumber, LagPortRequest payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,18 +704,16 @@ public CompletableFuture<List<LacpStatusResponse>> getLacpStatus(SwitchId switch
}

@Override
public CompletableFuture<List<LacpStatusResponse>> getLacpStatus(SwitchId switchId, int logicalPortNumber) {
log.info("API request: Getting LACP status on switch {}", switchId);
public CompletableFuture<LacpStatusResponse> getLacpStatus(SwitchId switchId, int logicalPortNumber) {
log.info("API request: Read LACP status on specific port {} of the switch {}", logicalPortNumber, switchId);

GetLacpStatusRequest data = new GetLacpStatusRequest(switchId, logicalPortNumber);
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), RequestCorrelationId.getId());

return messagingChannel.sendAndGetChunked(nbworkerTopic, request)
.thenApply(result -> result.stream()
.map(SwitchLacpStatusResponse.class::cast)
.map(SwitchLacpStatusResponse::getData)
.map(lacpStatusMapper::map)
.collect(Collectors.toList()));
return messagingChannel.sendAndGet(nbworkerTopic, request)
.thenApply(SwitchLacpStatusResponse.class::cast)
.thenApply(SwitchLacpStatusResponse::getData)
.thenApply(lacpStatusMapper::map);
}

@Override
Expand Down

0 comments on commit 4a2c83a

Please sign in to comment.