Open Kilda Java Documentation
FlowPathConverter.java
Go to the documentation of this file.
1 package org.openkilda.integration.converter;
2 
3 import java.util.List;
4 import java.util.Map;
5 
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Component;
11 
12 @Component
13 public class FlowPathConverter {
14 
15  @Autowired
16  SwitchIntegrationService switchIntegrationService;
17 
25  public FlowPayload getFlowPath(final String flowId, final FlowPayload flowPayload) {
26  Map<String, String> csNames = switchIntegrationService.getCustomSwitchNameFromFile();
27  setSwitchName(flowPayload.getForward(), csNames);
28  setSwitchName(flowPayload.getReverse(), csNames);
29  return flowPayload;
30  }
31 
38  private void setSwitchName(List<FlowPathNode> pathNodes, Map<String, String> csNames) {
39  pathNodes.parallelStream().forEach((pathNode) -> {
40  pathNode.setSwitchName(
41  switchIntegrationService.customSwitchName(csNames, pathNode.getSwitchId()));
42  });
43  }
44 
45 }
FlowPayload getFlowPath(final String flowId, final FlowPayload flowPayload)