use of org.openkilda.messaging.nbtopology.response.SwitchConnectionsResponse in project open-kilda by telstra.
the class SwitchOperationsService method getSwitchConnections.
/**
* Find and return the set of connections to the speakers for specific switch.
*/
public SwitchConnectionsResponse getSwitchConnections(SwitchId switchId) throws SwitchNotFoundException {
Switch sw = switchRepository.findById(switchId).orElseThrow(() -> new SwitchNotFoundException(switchId));
SwitchAvailabilityData.SwitchAvailabilityDataBuilder payload = SwitchAvailabilityData.builder();
for (SwitchConnect entry : switchConnectRepository.findBySwitchId(switchId)) {
payload.connection(SwitchMapper.INSTANCE.map(entry));
}
return new SwitchConnectionsResponse(sw.getSwitchId(), sw.getStatus(), payload.build());
}
Aggregations