use of org.openkilda.integration.model.FlowEndpoint in project open-kilda by telstra.
the class FlowConverter method toFlowInfo.
public static FlowInfo toFlowInfo(final Flow flow) {
FlowInfo flowInfo = new FlowInfo();
flowInfo.setFlowid(flow.getId());
flowInfo.setMaximumBandwidth(flow.getMaximumBandwidth());
flowInfo.setDescription(flow.getDescription());
FlowEndpoint source = flow.getSource();
if (source != null) {
flowInfo.setSourceSwitch(source.getSwitchId());
flowInfo.setSrcPort(source.getPortId());
flowInfo.setSrcVlan(source.getVlanId());
}
FlowEndpoint destination = flow.getDestination();
if (destination != null) {
flowInfo.setTargetSwitch(destination.getSwitchId());
flowInfo.setDstPort(destination.getPortId());
flowInfo.setDstVlan(destination.getVlanId());
}
return flowInfo;
}
use of org.openkilda.integration.model.FlowEndpoint in project open-kilda by telstra.
the class FlowConverter method toFlowInfo.
/**
* To flow info.
*
* @param flow the flow
* @param csNames the cs names
* @return the flow info
*/
public FlowInfo toFlowInfo(final Flow 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(Long.valueOf(flow.getMaxLatency()));
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);
FlowEndpoint 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());
}
FlowEndpoint 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