Example #1
0
  private void checkAmountOfNodesCreated() {

    if (SimulationBase.getInstance().getGridSimulatorModel().getEntities().size() <= 0) {
      addError(
          SimulationBase.getInstance().getGridSimulatorModel(), " \n►No contiene ningun nodo.");
    }
  }
Example #2
0
  /**
   * Verifica que no hayan partes de red aisladas. Todos los nodos deben estar conectados a una
   * misma red.
   */
  private void checkIsolatedNetworks() {

    Routing routing = SimulationBase.getInstance().getGridSimulatorModel().getRouting();
    Boolean foundIsolatedNetworks = false;

    if (routing instanceof RoutingViaJung) {
      // System.out.println("Entro a:RoutingViaJung");
      Graph networkRoutingGraph = ((RoutingViaJung) routing).getHybridNetwork();
      GridVertex pivotVertex = null;

      Iterator<GridVertex> itVertexes = networkRoutingGraph.getVertices().iterator();
      while (itVertexes.hasNext() && !foundIsolatedNetworks) {
        GridVertex vertex = itVertexes.next();

        if (pivotVertex == null) {
          pivotVertex = vertex;
          continue;
        }

        if (pivotVertex.getTheEntity().getHopCount(vertex.getTheEntity()) == -1) {
          addError(
              SimulationBase.getInstance().getGridSimulatorModel(),
              " \n►Contiene redes disconexas.");
          foundIsolatedNetworks = true;
        }
      }
    } else if (routing instanceof ShortesPathRouting) {
      // System.out.println("Entro a:ShortesPathRouting");
      NetworkProxy networkProxy = new NetworkProxy();
      networkProxy.setHyrbidNetwork(((ShortesPathRouting) routing).getHyrbidNetwork());
      NetworkRouting networkRouting = ((ShortesPathRouting) routing).getHybridNetworkRouting();

      String pivotVertexID = null;

      Iterator<String> itVertexesID = networkProxy.getNodeIDs().iterator();
      while (itVertexesID.hasNext() && !foundIsolatedNetworks) {

        String vertexID = itVertexesID.next();

        if (pivotVertexID == null) {
          pivotVertexID = vertexID;
          continue;
        }

        Iterator<Connection> itConns =
            networkRouting.findConnections(pivotVertexID, vertexID).iterator();

        while (itConns.hasNext()) {
          Connection conn = itConns.next();

          if (conn.getRoute() == null) {
            addError(
                SimulationBase.getInstance().getGridSimulatorModel(),
                " \n►Contiene redes disconexas.");
            foundIsolatedNetworks = true;
          }
        }
      }
    }
  }
Example #3
0
  private void checkSwitchesWellLinked() {

    for (SimBaseEntity oneSwitch :
        SimulationBase.getInstance().getGridSimulatorModel().getEntitiesOfType(Switch.class)) {

      if (oneSwitch.getOutPorts().size() == 1) {
        addError((Switch) oneSwitch, " \n►Solo tiene un enlace, debe tener almenos otro.");
      } else if (oneSwitch.getOutPorts().size() > 1) {

        SimBaseEntity targetNode = null;
        boolean foundDiffTargets = false;

        for (SimBaseOutPort oneOutPort : oneSwitch.getOutPorts()) {

          if (targetNode == null) {
            targetNode = oneOutPort.getTarget().getOwner();
          } else {
            if (!targetNode.equals(oneOutPort.getTarget().getOwner())) {
              foundDiffTargets = true;
            }
          }
        }

        if (!foundDiffTargets) {
          addError(
              (Switch) oneSwitch,
              " \n►Tiene varios enlaces pero todos van dirigidos al mismo nodo. Genere un enlace con otro nodo.");
        }
      }
    }
  }
Example #4
0
  private void checkNecessaryNodes() {

    if (SimulationBase.getInstance()
            .getGridSimulatorModel()
            .getEntitiesOfType(ClientNode.class)
            .size()
        == 0) {
      addError(
          SimulationBase.getInstance().getGridSimulatorModel(),
          " \n►Debe haber por lo menos un \"Nodo Cliente\".");
    }

    if (SimulationBase.getInstance()
            .getGridSimulatorModel()
            .getEntitiesOfType(ResourceNode.class)
            .size()
        == 0) {
      addError(
          SimulationBase.getInstance().getGridSimulatorModel(),
          " \n►Debe haber por lo menos un \"Nodo de Recurso\".");
    }

    if (SimulationBase.getInstance()
            .getGridSimulatorModel()
            .getEntitiesOfType(ServiceNode.class)
            .size()
        == 0) {
      addError(
          SimulationBase.getInstance().getGridSimulatorModel(),
          " \n►Debe haber por lo menos un \"Nodo de Servicio\".");
    }
    if (SimulationBase.getInstance().getGridSimulatorModel().getEntitiesOfType(Switch.class).size()
        == 0) {
      addError(
          SimulationBase.getInstance().getGridSimulatorModel(),
          " \n►Debe haber por lo menos un \"Nodo de Conmutación\".");
    }

    if (SimulationBase.getInstance().getGridSimulatorModel().getEntitiesOfType(PCE.class).size()
        == 0) {
      addError(
          SimulationBase.getInstance().getGridSimulatorModel(),
          " \n►Debe haber por lo menos un \"Nodo PCE\".");
    }
  }
Example #5
0
  private void checkCorrectNodesWithPCE() {

    for (SimBaseEntity brokerNode :
        SimulationBase.getInstance().getGridSimulatorModel().getEntitiesOfType(ServiceNode.class)) {
      if (((ServiceNode) brokerNode).getPce() == null) {
        addError(
            (ServiceNode) brokerNode,
            " \n►Al ser un Nodo de Servicio debe tener un PCE registrado.");
      }
    }
  }
Example #6
0
  private void checkLinksBetweenNodes() {

    for (SimBaseEntity simBaseEntity :
        SimulationBase.getInstance().getGridSimulatorModel().getEntities()) {
      Entity node = (Entity) simBaseEntity;

      if (node.getOutPorts().size() <= 0) {
        addError(node, " \n►No tiene enlaces.");
      }
    }
  }
Example #7
0
  private void checkCorrectNodesWithBroker() {

    for (SimBaseEntity clienNode :
        SimulationBase.getInstance().getGridSimulatorModel().getEntitiesOfType(ClientNode.class)) {
      if (((ClientNode) clienNode).getServiceNode() == null) {
        addError(
            (ClientNode) clienNode,
            " \n►Al ser un Cliente debe tener un Nodo de Servicio registrado.");
      }
    }

    for (SimBaseEntity resourceNode :
        SimulationBase.getInstance()
            .getGridSimulatorModel()
            .getEntitiesOfType(ResourceNode.class)) {
      if (((ResourceNode) resourceNode).getServiceNodes().size() <= 0) {
        addError(
            (ResourceNode) resourceNode,
            " \n►Al ser un Recurso debe tener almenos un Nodo de Servicio registrado.");
      }
    }
  }