use of org.openkilda.integration.model.FlowV2Endpoint in project open-kilda by telstra.
the class FlowConverter method toFlowWithSwitchNames.
/**
* To flow with switch names.
*
* @param flow the flow
* @return the flow
*/
public FlowV2 toFlowWithSwitchNames(final FlowV2 flow) {
final Map<String, String> csNames = switchIntegrationService.getSwitchNames();
FlowV2Endpoint source = flow.getSource();
if (source != null) {
String switchName = switchIntegrationService.customSwitchName(csNames, source.getSwitchId());
source.setSwitchName(switchName);
}
FlowV2Endpoint destination = flow.getDestination();
if (destination != null) {
String switchName = switchIntegrationService.customSwitchName(csNames, destination.getSwitchId());
destination.setSwitchName(switchName);
}
return flow;
}
use of org.openkilda.integration.model.FlowV2Endpoint in project open-kilda by telstra.
the class FlowConverter method toFlowV2Info.
/**
* To flow V2 info.
*
* @param flow V2 the flow
* @param csNames the cs names
* @return the flow info
*/
public FlowInfo toFlowV2Info(final FlowV2 flow, Map<String, String> csNames) {
FlowInfo flowInfo = new FlowInfo();
flowInfo.setFlowid(flow.getId());
flowInfo.setMaximumBandwidth(flow.getMaximumBandwidth());
flowInfo.setAllocateProtectedPath(flow.isAllocateProtectedPath());
flowInfo.setDescription(flow.getDescription());
flowInfo.setStatus(flow.getStatus().toUpperCase());
flowInfo.setDiverseFlowid(flow.getDiverseFlowId());
flowInfo.setIgnoreBandwidth(flow.isIgnoreBandwidth());
flowInfo.setLastUpdated(flow.getLastUpdated());
flowInfo.setCreated(flow.getCreated());
flowInfo.setEncapsulationType(flow.getEncapsulationType());
flowInfo.setPathComputationStrategy(flow.getPathComputationStrategy());
flowInfo.setPinned(flow.isPinned());
flowInfo.setPeriodicPings(flow.isPeriodicPings());
flowInfo.setMaxLatency(flow.getMaxLatency());
flowInfo.setMaxLatencyTier2(flow.getMaxLatencyTier2());
flowInfo.setPriority(flow.getPriority());
flowInfo.setTargetPathComputationStrategy(flow.getTargetPathComputationStrategy());
flowInfo.setStatusInfo(flow.getStatusInfo());
if (flow.getStatusDetails() != null) {
flowInfo.setStatusDetails(flow.getStatusDetails());
}
if (flow.getDiverseWith() != null) {
flowInfo.setDiverseWith(flow.getDiverseWith());
}
flowInfo.setControllerFlow(true);
FlowV2Endpoint source = flow.getSource();
if (source != null) {
String switchName = switchIntegrationService.customSwitchName(csNames, source.getSwitchId());
flowInfo.setSourceSwitchName(switchName);
flowInfo.setSourceSwitch(source.getSwitchId());
flowInfo.setSrcPort(source.getPortId());
flowInfo.setSrcVlan(source.getVlanId());
flowInfo.setSrcInnerVlan(source.getInnerVlanId());
flowInfo.setSrcLldp(source.getDetectedDevice().isLldp());
flowInfo.setSrcArp(source.getDetectedDevice().isArp());
}
FlowV2Endpoint destination = flow.getDestination();
if (destination != null) {
String switchName = switchIntegrationService.customSwitchName(csNames, destination.getSwitchId());
flowInfo.setTargetSwitchName(switchName);
flowInfo.setTargetSwitch(destination.getSwitchId());
flowInfo.setDstPort(destination.getPortId());
flowInfo.setDstVlan(destination.getVlanId());
flowInfo.setDstInnerVlan(destination.getInnerVlanId());
flowInfo.setDstLldp(destination.getDetectedDevice().isLldp());
flowInfo.setDstArp(destination.getDetectedDevice().isArp());
}
return flowInfo;
}
Aggregations