use of org.openkilda.topology.domain.Switch in project open-kilda by telstra.
the class TopologyServiceImpl method network.
/**
* {@inheritDoc}
*/
@Override
public Topology network(String correlationId) {
logger.debug("Dumping topology: {}={}", CORRELATION_ID, correlationId);
List<Isl> isls = islRepository.getAllIsl();
logger.debug("Found isls: {}={}, {}", CORRELATION_ID, correlationId, isls);
Iterable<Switch> switches = switchRepository.findAll();
List<Node> nodes = new ArrayList<>();
for (Switch sw : switches) {
List<String> relationships = new ArrayList<>();
for (Isl isl : isls) {
if (isl.getSourceSwitch().equals(sw.getName())) {
relationships.add(isl.getDestinationSwitch());
}
}
nodes.add(new Node(sw.getName(), relationships));
}
return new Topology(nodes);
}
Aggregations