use of org.opentosca.toscana.plugins.cloudfoundry.visitor.PrepareVisitor in project TOSCAna by StuPro-TOSCAna.
the class CloudFoundryLifecycle method prepare.
@Override
public void prepare() {
logger.info("Begin preparation for transformation to Cloud Foundry");
PrepareVisitor prepareVisitor = new PrepareVisitor(logger);
for (RootNode node : context.getModel().getNodes()) {
node.accept(prepareVisitor);
}
logger.debug("Collecting Compute Nodes in topology");
ComputeNodeFindingVisitor computeFinder = new ComputeNodeFindingVisitor();
model.getNodes().forEach(e -> {
e.accept(computeFinder);
KubernetesNodeContainer container = new KubernetesNodeContainer(e);
nodes.put(e.getEntityName(), container);
});
computeFinder.getComputeNodes().forEach(e -> computeNodes.add(nodes.get(e.getEntityName())));
logger.debug("Finding top Level Nodes");
graph = model.getTopology();
Set<RootNode> topLevelNodes = determineTopLevelNodes(context.getModel(), computeFinder.getComputeNodes().stream().map(Compute.class::cast).collect(Collectors.toList()), e -> nodes.get(e.getEntityName()).activateParentComputeNode());
logger.debug("Building complete Topology stacks");
this.stacks.addAll(buildTopologyStacks(model, topLevelNodes, nodes));
// TODO: check how many different applications there are and fill list with them
// probably there must be a combination of application and set of nodes
applications = new ArrayList<>();
int i = 1;
for (NodeStack stack : stacks) {
Application myApp = new Application(i, context);
i++;
myApp.setProvider(provider);
myApp.setConnection(connection);
myApp.setName(stack.getStackName());
myApp.addStack(stack);
applications.add(myApp);
}
}
Aggregations