use of org.openkilda.floodlight.error.InvalidConnectionDataException in project open-kilda by telstra.
the class SwitchTrackingService method switchDiscoveryAction.
private void switchDiscoveryAction(DatapathId dpId, SwitchChangeType event) {
logger.info("Send switch discovery ({} - {})", dpId, event);
SwitchInfoData payload = null;
if (SwitchChangeType.DEACTIVATED != event && SwitchChangeType.REMOVED != event) {
try {
IOFSwitch sw = switchManager.lookupSwitch(dpId);
SpeakerSwitchView switchView = buildSwitch(sw);
payload = buildSwitchMessage(sw, switchView, event);
} catch (SwitchNotFoundException | InvalidConnectionDataException e) {
logger.error("Switch {} is not in management state now({}), switch ISL discovery details will be degraded.", dpId, e.getMessage());
}
}
if (payload == null) {
payload = buildSwitchMessage(dpId, event);
}
emitDiscoveryEvent(dpId, payload);
}
use of org.openkilda.floodlight.error.InvalidConnectionDataException in project open-kilda by telstra.
the class SwitchTrackingService method buildSwitch.
private SpeakerSwitchView buildSwitch(IOFSwitch sw) throws InvalidConnectionDataException {
SpeakerSwitchView.SpeakerSwitchViewBuilder builder = SpeakerSwitchView.builder().datapath(new SwitchId(sw.getId().getLong())).hostname(readHostname(sw.getInetAddress())).ofVersion(sw.getOFFactory().getVersion().toString()).features(featureDetector.detectSwitch(sw));
SwitchDescription ofDescription = sw.getSwitchDescription();
builder.description(SpeakerSwitchDescription.builder().manufacturer(ofDescription.getManufacturerDescription()).hardware(ofDescription.getHardwareDescription()).software(ofDescription.getSoftwareDescription()).serialNumber(ofDescription.getSerialNumber()).datapath(ofDescription.getDatapathDescription()).build());
switchManager.getPhysicalPorts(sw).stream().map(port -> new SpeakerSwitchPortView(port.getPortNo().getPortNumber(), port.isEnabled() ? SpeakerSwitchPortView.State.UP : SpeakerSwitchPortView.State.DOWN)).forEach(builder::port);
buildSwitchAddress(builder, sw);
buildSwitchSpeakerAddress(builder, sw);
return builder.build();
}
Aggregations