Search in sources :

Example 6 with RootRelationship

use of org.opentosca.toscana.model.relation.RootRelationship in project TOSCAna by StuPro-TOSCAna.

the class CloudFormationVisitorExtension method getHostsOfConnectedTo.

protected Set<Compute> getHostsOfConnectedTo(RootNode node) {
    Set<Compute> connected = new HashSet<>();
    Set<RootRelationship> incomingEdges = topology.incomingEdgesOf(node);
    for (RootRelationship incomingEdge : incomingEdges) {
        RootNode source = topology.getEdgeSource(incomingEdge);
        if (source instanceof WebApplication) {
            WebApplication webApplication = (WebApplication) source;
            Compute compute = getCompute(webApplication);
            connected.add(compute);
        }
    }
    return connected;
}
Also used : RootNode(org.opentosca.toscana.model.node.RootNode) Compute(org.opentosca.toscana.model.node.Compute) WebApplication(org.opentosca.toscana.model.node.WebApplication) HashSet(java.util.HashSet) RootRelationship(org.opentosca.toscana.model.relation.RootRelationship)

Example 7 with RootRelationship

use of org.opentosca.toscana.model.relation.RootRelationship in project TOSCAna by StuPro-TOSCAna.

the class EffectiveModel method initEdges.

private void initEdges() {
    logger.info("Populating edges");
    for (RootNode node : topology.vertexSet()) {
        for (Requirement<?, ?, ?> requirement : node.getRequirements()) {
            Set<? extends RootNode> fulfillers = requirement.getFulfillers();
            for (RootNode fulfiller : fulfillers) {
                RootRelationship relationship = requirement.get(requirement.RELATIONSHIP);
                logger.info(LogFormat.pointAt(1, 25, node.getEntityName(), relationship.getClass().getSimpleName(), fulfiller.getEntityName()));
                topology.addEdge(node, fulfiller, relationship);
            }
        }
    }
    initialized = true;
}
Also used : RootNode(org.opentosca.toscana.model.node.RootNode) RootRelationship(org.opentosca.toscana.model.relation.RootRelationship)

Aggregations

RootNode (org.opentosca.toscana.model.node.RootNode)7 RootRelationship (org.opentosca.toscana.model.relation.RootRelationship)7 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 WebApplication (org.opentosca.toscana.model.node.WebApplication)2 HostedOn (org.opentosca.toscana.model.relation.HostedOn)2 Test (org.junit.Test)1 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)1 EffectiveModel (org.opentosca.toscana.model.EffectiveModel)1 EffectiveModelFactory (org.opentosca.toscana.model.EffectiveModelFactory)1 Capability (org.opentosca.toscana.model.capability.Capability)1 EndpointCapability (org.opentosca.toscana.model.capability.EndpointCapability)1 Compute (org.opentosca.toscana.model.node.Compute)1 UnsupportedTypeException (org.opentosca.toscana.model.visitor.UnsupportedTypeException)1 CheckModelNodeVisitor (org.opentosca.toscana.plugins.cloudformation.visitor.CheckModelNodeVisitor)1 CheckModelRelationshipVisitor (org.opentosca.toscana.plugins.cloudformation.visitor.CheckModelRelationshipVisitor)1 PrepareModelNodeVisitor (org.opentosca.toscana.plugins.cloudformation.visitor.PrepareModelNodeVisitor)1 PrepareModelRelationshipVisitor (org.opentosca.toscana.plugins.cloudformation.visitor.PrepareModelRelationshipVisitor)1