private void parseVirtualDevices() throws ResourceNotFoundException {

    for (int i = 0; i < mappingResult.getVnodes().size(); i++) {

      int vnodeId = mappingResult.getVnodes().get(i);
      String deviceId = inpNetwork.getNodes().get(vnodeId).getPnodeID();
      Device device = NetworkModelHelper.getDeviceByName(physicalNetworkModel, deviceId);

      if (device == null)
        throw new ResourceNotFoundException(
            "Device " + deviceId + " not found in network topology.");

      VirtualDevice vDevice = new VirtualDevice();
      vDevice.setName(String.valueOf(i));
      vDevice.setImplementedBy(deviceId);

      mappingNetworkResult.getNetworkElements().add(vDevice);
    }
  }
  private void addVirtualDeviceToModel(int phyNodeId) throws ResourceNotFoundException {

    List<NetworkElement> vDevices =
        NetworkModelHelper.getNetworkElementsByClassName(
            VirtualDevice.class, mappingNetworkResult.getNetworkElements());

    int virtualId = vDevices.size();

    String phyDeviceId = inpNetwork.getNodes().get(phyNodeId).getPnodeID();

    Device device = NetworkModelHelper.getDeviceByName(physicalNetworkModel, phyDeviceId);

    if (device == null)
      throw new ResourceNotFoundException(
          "Device " + phyDeviceId + " not found in network topology.");

    VirtualDevice vDevice = new VirtualDevice();
    vDevice.setName(String.valueOf(virtualId));
    vDevice.setImplementedBy(phyDeviceId);

    mappingNetworkResult.getNetworkElements().add(vDevice);
  }