private void removeNetworks() {
    final List<Network> networks = getNetworkDao().getAllForDataCenter(getStoragePoolId());
    for (Network network : networks) {
      if (network.isExternal()) {
        for (VmNic nic : getVmNicDao().getAllForNetwork(network.getId())) {
          new ExternalNetworkManager(nic, network).deallocateIfExternal();
        }
      }
    }

    TransactionSupport.executeInNewTransaction(
        new TransactionMethod<Void>() {

          @Override
          public Void runInTransaction() {
            for (final Network net : networks) {
              List<VnicProfile> profiles =
                  getDbFacade().getVnicProfileDao().getAllForNetwork(net.getId());
              for (VnicProfile vnicProfile : profiles) {
                getCompensationContext().snapshotEntity(vnicProfile);
                getDbFacade().getVnicProfileDao().remove(vnicProfile.getId());
              }
              getCompensationContext().snapshotEntity(net);
              getNetworkDao().remove(net.getId());
            }
            getCompensationContext().stateChanged();
            return null;
          }
        });
  }
  /**
   * Checks that the destination cluster has all the networks that the given NICs require.<br>
   * No network on a NIC is allowed (it's checked when running VM).
   *
   * @param interfaces The NICs to check networks on.
   * @return Whether the destination cluster has all networks configured or not.
   */
  private boolean validateDestinationClusterContainsNetworks(List<VmNic> interfaces) {
    List<Network> networks =
        DbFacade.getInstance().getNetworkDao().getAllForCluster(targetClusterId);
    StringBuilder missingNets = new StringBuilder();
    for (VmNic iface : interfaces) {
      Network network = NetworkHelper.getNetworkByVnicProfileId(iface.getVnicProfileId());
      if (network != null) {
        boolean exists = false;
        for (Network net : networks) {
          if (net.getName().equals(network.getName())) {
            exists = true;
            break;
          }
        }
        if (!exists) {
          if (missingNets.length() > 0) {
            missingNets.append(", ");
          }
          missingNets.append(network.getName());
        }
      }
    }
    if (missingNets.length() > 0) {
      parentCommand.addCanDoActionMessage(EngineMessage.MOVE_VM_CLUSTER_MISSING_NETWORK);
      parentCommand.addCanDoActionMessageVariable("networks", missingNets.toString());
      return false;
    }

    return true;
  }
  @Test
  public void testLabeledNetworkAttachedToThisInterfaceWhenNetworkIsAssignedToWrongInterface()
      throws Exception {
    String networkName = "networkA";
    Network network = new Network();
    network.setName(networkName);

    VdsNetworkInterface nicToWhichLabeledNetworkShouldBeAttached =
        createVdsNetworkInterfaceWithName("nicA");
    VdsNetworkInterface nicImproperlyAssignedToNetwork = createVdsNetworkInterfaceWithName("nicB");
    nicImproperlyAssignedToNetwork.setNetworkName(networkName);

    List<VdsNetworkInterface> hostInterfaces =
        Arrays.asList(nicToWhichLabeledNetworkShouldBeAttached, nicImproperlyAssignedToNetwork);

    HostInterfaceValidator validator =
        new HostInterfaceValidator(nicToWhichLabeledNetworkShouldBeAttached);
    assertThat(
        validator.networksAreAttachedToThisInterface(
            hostInterfaces, Collections.singletonList(network)),
        failsWith(
            EngineMessage.LABELED_NETWORK_ATTACHED_TO_WRONG_INTERFACE,
            ReplacementUtils.replaceWith(
                HostInterfaceValidator.VAR_ASSIGNED_NETWORKS,
                Collections.singletonList(networkName))));
  }
  private String getMigrationNetworkIp() {

    if (!FeatureSupported.migrationNetwork(getVm().getVdsGroupCompatibilityVersion())) {
      return null;
    }

    Network migrationNetwork = null;

    // Find migrationNetworkCluster
    List<Network> allNetworksInCluster = getNetworkDao().getAllForCluster(getVm().getVdsGroupId());

    for (Network tempNetwork : allNetworksInCluster) {
      if (tempNetwork.getCluster().isMigration()) {
        migrationNetwork = tempNetwork;
        break;
      }
    }

    if (migrationNetwork != null) {

      // assure migration network is active on source host
      if (getMigrationNetworkAddress(getVds().getId(), migrationNetwork.getName()) == null) {
        return null;
      }

      // find migration IP address on destination host
      return getMigrationNetworkAddress(getDestinationVds().getId(), migrationNetwork.getName());
    }

    return null;
  }
 protected void buildVmNetworkCluster() {
   // set Display network
   List<NetworkCluster> all =
       DbFacade.getInstance().getNetworkClusterDao().getAllForCluster(vm.getVdsGroupId());
   NetworkCluster networkCluster = null;
   for (NetworkCluster tempNetworkCluster : all) {
     if (tempNetworkCluster.isDisplay()) {
       networkCluster = tempNetworkCluster;
       break;
     }
   }
   if (networkCluster != null) {
     Network net = null;
     List<Network> allNetworks = DbFacade.getInstance().getNetworkDao().getAll();
     for (Network tempNetwork : allNetworks) {
       if (tempNetwork.getId().equals(networkCluster.getNetworkId())) {
         net = tempNetwork;
         break;
       }
     }
     if (net != null) {
       createInfo.put(VdsProperties.DISPLAY_NETWORK, net.getName());
     }
   }
 }
  private void logChangedDisplayNetwork(
      VDS host,
      Collection<Network> engineHostNetworks,
      Collection<VdsNetworkInterface> engineInterfaces) {

    if (isVmRunningOnHost(host.getId())) {
      final Network engineDisplayNetwork =
          findDisplayNetwork(host.getVdsGroupId(), engineHostNetworks);

      if (engineDisplayNetwork == null) {
        return;
      }

      final IsNetworkOnInterfacePredicate isNetworkOnInterfacePredicate =
          new IsNetworkOnInterfacePredicate(engineDisplayNetwork.getName());
      final VdsNetworkInterface vdsmDisplayInterface =
          LinqUtils.firstOrNull(host.getInterfaces(), isNetworkOnInterfacePredicate);
      final VdsNetworkInterface engineDisplayInterface =
          LinqUtils.firstOrNull(engineInterfaces, isNetworkOnInterfacePredicate);
      final DisplayInterfaceEqualityPredicate displayIneterfaceEqualityPredicate =
          new DisplayInterfaceEqualityPredicate(engineDisplayInterface);
      if (vdsmDisplayInterface == null // the display interface is't on host anymore
          || !displayIneterfaceEqualityPredicate.eval(vdsmDisplayInterface)) {
        final AuditLogableBase loggable = new AuditLogableBase(host.getId());
        auditLogDirector.log(loggable, AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_HOST_WITH_ACTIVE_VM);
      }
    }
  }
Exemple #7
0
 /**
  * filter networks which are not VM networks from the newtorkNames list
  *
  * @param networks logical networks
  * @param networkNames target names to match non-VM networks upon
  * @return
  */
 public static List<String> filterNonVmNetworkNames(
     List<Network> networks, Set<String> networkNames) {
   List<String> list = new ArrayList<>();
   for (Network net : networks) {
     if (!net.isVmNetwork() && networkNames.contains(net.getName())) {
       list.add(net.getName());
     }
   }
   return list;
 }
    /**
     * @return An error iff the network represents an external network that already exists in the
     *     data center that the network should be on.
     */
    public ValidationResult externalNetworkNewInDataCenter() {
      for (Network otherNetwork : getNetworks()) {
        if (network.getProvidedBy().equals(otherNetwork.getProvidedBy())) {
          return new ValidationResult(
              VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_NETWORK_ALREADY_EXISTS);
        }
      }

      return ValidationResult.VALID;
    }
Exemple #9
0
 public static Map<String, Network> networksByName(List<Network> networks) {
   if (!networks.isEmpty()) {
     Map<String, Network> byName = new HashMap<>();
     for (Network net : networks) {
       byName.put(net.getName(), net);
     }
     return byName;
   } else {
     return Collections.emptyMap();
   }
 }
  private String getMissingOperationalClusterNetworks(VDS host, List<Network> clusterNetworks) {
    List<String> networkNames = new ArrayList<>();

    for (Network net : clusterNetworks) {
      if (net.getCluster().getStatus() == OPERATIONAL
          && net.getCluster().isRequired()
          && !host.getNetworkNames().contains(net.getName())) {
        networkNames.add(net.getName());
      }
    }
    return StringUtils.join(networkNames, ",");
  }
Exemple #11
0
  /** Returns the cluster's display network */
  public static Network getDisplayNetwork(Collection<Network> clusterNetworks) {
    Network displayNetwork = null;

    for (Network network : clusterNetworks) {
      if (network.getCluster().isDisplay()) {
        displayNetwork = network;
        break;
      }
    }

    return displayNetwork;
  }
  private Network findDisplayNetwork(Guid clusterId, Collection<Network> networks) {
    Network managementNetwork = null;
    for (Network network : networks) {
      if (network.getCluster().isDisplay()) {
        return network;
      }
      if (managementNetworkUtil.isManagementNetwork(network.getId(), clusterId)) {
        managementNetwork = network;
      }
    }

    return managementNetwork;
  }
  private String getVmNetworksImplementedAsBridgeless(VDS host, List<Network> clusterNetworks) {
    Map<String, VdsNetworkInterface> interfacesByNetworkName =
        Entities.hostInterfacesByNetworkName(host.getInterfaces());
    List<String> networkNames = new ArrayList<>();

    for (Network net : clusterNetworks) {
      if (net.isVmNetwork()
          && interfacesByNetworkName.containsKey(net.getName())
          && !interfacesByNetworkName.get(net.getName()).isBridged()) {
        networkNames.add(net.getName());
      }
    }

    return StringUtils.join(networkNames, ",");
  }
 public EditNetworkModel(Network network, ListModel sourceListModel) {
   super(network, sourceListModel);
   originallyVmNetwork = network.isVmNetwork();
   getDataCenters().setIsChangeable(false);
   init();
   initManagement();
 }
 private boolean qosConfiguredOnInterface(VdsNetworkInterface iface, Network network) {
   if (iface.isQosOverridden()) {
     return iface.getQos() != null;
   } else {
     return network.getQosId() != null;
   }
 }
 protected void setGetNetworksQueryExpectations(int times) throws Exception {
   while (times-- > 0) {
     ArrayList<org.ovirt.engine.core.common.businessentities.network.Network> networks =
         new ArrayList<>();
     org.ovirt.engine.core.common.businessentities.network.Network network =
         new org.ovirt.engine.core.common.businessentities.network.Network();
     network.setId(GUIDS[0]);
     network.setName("orcus");
     networks.add(network);
     setUpEntityQueryExpectations(
         VdcQueryType.GetAllNetworksByClusterId,
         IdQueryParameters.class,
         new String[] {"Id"},
         new Object[] {GUIDS[0]},
         networks);
   }
 }
  private void skipManagementNetworkCheck(
      List<VdsNetworkInterface> ifaces, List<Network> clusterNetworks, Guid clusterId) {
    final Network managementNetwork = managementNetworkUtil.getManagementNetwork(clusterId);
    final String managementNetworkName = managementNetwork.getName();
    for (VdsNetworkInterface iface : ifaces) {
      if (managementNetworkName.equals(iface.getNetworkName())) {
        return;
      }
    }

    for (Iterator<Network> iterator = clusterNetworks.iterator(); iterator.hasNext(); ) {
      Network network = iterator.next();
      if (managementNetworkName.equals(network.getName())) {
        iterator.remove();
        break;
      }
    }
  }
  private void addVnicProfile(Network network, boolean publicUse) {
    VnicProfile vnicProfile = new VnicProfile();
    vnicProfile.setName(network.getName());
    vnicProfile.setNetworkId(network.getId());
    VnicProfileParameters parameters = new VnicProfileParameters(vnicProfile);
    parameters.setPublicUse(publicUse);
    Frontend.getInstance()
        .runAction(
            VdcActionType.AddVnicProfile,
            parameters,
            new IFrontendActionAsyncCallback() {

              @Override
              public void executed(FrontendActionAsyncResult result) {
                sourceListModel.getSearchCommand().execute();
              }
            });
  }
Exemple #19
0
 /**
  * Check whether the network attachment has any QoS configured on it, whether via its network or
  * overridden.
  *
  * @param networkAttachment The network interface.
  * @param network The network attached to the interface.
  * @return true iff any QoS is applied to the interface.
  */
 public static boolean qosConfiguredOnInterface(
     NetworkAttachment networkAttachment, Network network) {
   if (networkAttachment != null && networkAttachment.isQosOverridden()) {
     return networkAttachment.getHostNetworkQos() != null
         && !networkAttachment
             .getHostNetworkQos()
             .isEmpty(); // TODO MM: I think that is empty is wrong, since qos can be overridden
                         // back to unlimited.
   } else {
     return network != null && network.getQosId() != null;
   }
 }
  @Test
  public void testLabeledNetworkAttachedToThisInterface() throws Exception {
    String networkName = "networkA";
    Network network = new Network();
    network.setName(networkName);

    VdsNetworkInterface nicToWhichLabeledNetworkShouldBeAttached =
        createVdsNetworkInterfaceWithName("nicA");
    nicToWhichLabeledNetworkShouldBeAttached.setNetworkName(networkName);

    List<VdsNetworkInterface> hostInterfaces =
        Arrays.asList(
            nicToWhichLabeledNetworkShouldBeAttached, createVdsNetworkInterfaceWithName("nicB"));

    HostInterfaceValidator validator =
        new HostInterfaceValidator(nicToWhichLabeledNetworkShouldBeAttached);
    List<Network> clusterNetworksWithLabel = Collections.singletonList(network);
    assertThat(
        validator.networksAreAttachedToThisInterface(hostInterfaces, clusterNetworksWithLabel),
        isValid());
  }
  public void onImport() {
    if (!validate()) {
      return;
    }

    List<VdcActionParametersBase> multipleActionParameters =
        new LinkedList<VdcActionParametersBase>();
    List<IFrontendActionAsyncCallback> callbacks = new LinkedList<IFrontendActionAsyncCallback>();
    dcClusters = new HashMap<Guid, Collection<VDSGroup>>();

    for (final ExternalNetwork externalNetwork :
        (Iterable<ExternalNetwork>) importedNetworks.getItems()) {
      final Network network = externalNetwork.getNetwork();
      final Guid dcId = ((StoragePool) externalNetwork.getDataCenters().getSelectedItem()).getId();
      network.setName(externalNetwork.getDisplayName());
      network.setDataCenterId(dcId);
      AddNetworkStoragePoolParameters params = new AddNetworkStoragePoolParameters(dcId, network);
      params.setVnicProfileRequired(false);
      multipleActionParameters.add(params);
      callbacks.add(
          new IFrontendActionAsyncCallback() {

            @Override
            public void executed(FrontendActionAsyncResult result) {
              VdcReturnValueBase returnValue = result.getReturnValue();
              if (returnValue != null && returnValue.getSucceeded()) {
                network.setId((Guid) returnValue.getActionReturnValue());

                // Perform sequentially: first fetch clusters, then attach network, then create VNIC
                // profile
                fetchDcClusters(dcId, network, externalNetwork.isPublicUse());
              }
            }
          });
    }

    Frontend.getInstance()
        .runMultipleActions(VdcActionType.AddNetwork, multipleActionParameters, callbacks);
    cancel();
  }
 private void addDefaultNetworks() {
   Network net = new Network();
   net.setId(Guid.newGuid());
   net.setName(managementNetworkUtil.getDefaultManagementNetworkName());
   net.setDescription(AddClusterCommand.DefaultNetworkDescription);
   net.setDataCenterId(getStoragePool().getId());
   net.setVmNetwork(true);
   getNetworkDao().save(net);
   NetworkHelper.addPermissionsOnNetwork(getCurrentUser().getId(), net.getId());
   VnicProfile profile = NetworkHelper.createVnicProfile(net);
   getVnicProfileDao().save(profile);
   NetworkHelper.addPermissionsOnVnicProfile(getCurrentUser().getId(), profile.getId(), true);
 }
  private void attachNetworkToClusters(
      final Network network, Collection<VDSGroup> clusters, final boolean publicUse) {
    NetworkCluster networkCluster = new NetworkCluster();
    networkCluster.setRequired(false);
    network.setCluster(networkCluster);
    List<VdcActionParametersBase> parameters = new LinkedList<VdcActionParametersBase>();
    for (VDSGroup cluster : clusters) {
      parameters.add(new AttachNetworkToVdsGroupParameter(cluster, network));
    }

    Frontend.getInstance()
        .runMultipleActions(
            VdcActionType.AttachNetworkToVdsGroup,
            parameters,
            new IFrontendActionAsyncCallback() {

              @Override
              public void executed(FrontendActionAsyncResult result) {
                addVnicProfile(network, publicUse);
              }
            });
  }
  @Override
  protected void executeCommand() {
    updateVdsData();
    if (NeedToUpdateVdsBroker()) {
      initializeVds();
    }

    if (getParameters().isInstallHost()) {
      InstallVdsParameters tempVar =
          new InstallVdsParameters(getVdsId(), getParameters().getPassword());
      tempVar.setIsReinstallOrUpgrade(getParameters().isReinstallOrUpgrade());
      tempVar.setoVirtIsoFile(getParameters().getoVirtIsoFile());
      if (getVdsDao().get(getVdsId()).getStatus() == VDSStatus.InstallingOS) {
        // TODO: remove hack when reinstall api will provider override-firewall parameter.
        // https://bugzilla.redhat.com/show_bug.cgi?id=1177126 - for now we override firewall
        // configurations on each deploy for provisioned host to avoid wrong deployment.
        tempVar.setOverrideFirewall(true);
      } else {
        tempVar.setOverrideFirewall(getParameters().getOverrideFirewall());
      }
      tempVar.setOverrideFirewall(getParameters().getOverrideFirewall());
      tempVar.setActivateHost(getParameters().getActivateHost());
      tempVar.setNetworkProviderId(getParameters().getNetworkProviderId());
      tempVar.setNetworkMappings(getParameters().getNetworkMappings());
      tempVar.setAuthMethod(getParameters().getAuthMethod());
      ArrayList<VdcReturnValueBase> resultList =
          runInternalMultipleActions(
              actionType, new ArrayList<VdcActionParametersBase>(Arrays.asList(tempVar)));

      // Since Host status is set to "Installing", failure of InstallVdsCommand will hang the Host
      // to in that
      // status, therefore needed to fail the command to revert the status.
      if (!resultList.isEmpty()) {
        VdcReturnValueBase vdcReturnValueBase = resultList.get(0);
        if (vdcReturnValueBase != null && !vdcReturnValueBase.getCanDoAction()) {
          ArrayList<String> canDoActionMessages = vdcReturnValueBase.getCanDoActionMessages();
          if (!canDoActionMessages.isEmpty()) {
            // add can do action messages to return value so error messages
            // are returned back to the client
            getReturnValue().getCanDoActionMessages().addAll(canDoActionMessages);
            log.error(
                "Installation/upgrade of Host '{}', '{}' failed: {}",
                getVdsId(),
                getVdsName(),
                StringUtils.join(
                    Backend.getInstance()
                        .getErrorsTranslator()
                        .TranslateErrorText(canDoActionMessages),
                    ","));
          }
          // set can do action to false so can do action messages are
          // returned back to client
          getReturnValue().setCanDoAction(false);
          setSucceeded(false);
          // add old vds dynamic data to compensation context. This
          // way the status will revert back to what it was before
          // starting installation process
          getCompensationContext().snapshotEntityStatus(oldHost.getDynamicData());
          getCompensationContext().stateChanged();
          return;
        }
      }
    }

    if (oldHost.getProtocol() != getParameters().getVdsStaticData().getProtocol()) {
      ResourceManager.getInstance().reestablishConnection(oldHost.getId());
    }

    // set clusters network to be operational (if needed)
    if (oldHost.getStatus() == VDSStatus.Up) {
      List<NetworkCluster> networkClusters =
          DbFacade.getInstance().getNetworkClusterDao().getAllForCluster(oldHost.getVdsGroupId());
      List<Network> networks =
          DbFacade.getInstance().getNetworkDao().getAllForCluster(oldHost.getVdsGroupId());
      for (NetworkCluster item : networkClusters) {
        for (Network net : networks) {
          if (net.getId().equals(item.getNetworkId())) {
            NetworkClusterHelper.setStatus(oldHost.getVdsGroupId(), net);
          }
        }
      }
    }
    alertIfPowerManagementNotConfigured(getParameters().getVdsStaticData());
    testVdsPowerManagementStatus(getParameters().getVdsStaticData());
    checkKdumpIntegrationStatus();
    setSucceeded(true);
  }
  private Map<String, Object> generateNetworks() {
    Map<String, Object> networks = new HashMap<String, Object>();
    NetworkQoSDao qosDao = getDbFacade().getQosDao();
    for (Network network : getParameters().getNetworks()) {
      Map<String, Object> opts = new HashMap<String, Object>();
      VdsNetworkInterface iface =
          findNetworkInterface(
              network.getName(), getParameters().getInterfaces(), getParameters().getBonds());
      String ifaceNameWithoutVlan = NetworkUtils.stripVlan(iface);
      Boolean bonded = findInterfaceByName(ifaceNameWithoutVlan).getBonded();
      String type = (bonded != null && bonded) ? "bonding" : "nic";
      opts.put(type, ifaceNameWithoutVlan);
      if (NetworkUtils.isVlan(network)) {
        opts.put("vlan", network.getVlanId().toString());
      }

      if (iface.getBootProtocol() != null) {
        addBootProtocol(opts, iface);
      }

      if (network.getMtu() == 0) {
        opts.put("mtu", NetworkUtils.getDefaultMtu().toString());
      } else {
        opts.put("mtu", String.valueOf(network.getMtu()));
      }

      opts.put("bridged", Boolean.toString(network.isVmNetwork()));
      if (network.isVmNetwork()) {
        opts.put(VdsProperties.STP, network.getStp() ? "yes" : "no");
      }

      VDS host = getDbFacade().getVdsDao().get(getParameters().getVdsId());
      Version version = host.getVdsGroupCompatibilityVersion();
      if (qosConfiguredOnInterface(iface, network) && FeatureSupported.hostNetworkQos(version)) {
        NetworkQosMapper qosMapper =
            new NetworkQosMapper(
                opts, VdsProperties.HOST_QOS_INBOUND, VdsProperties.HOST_QOS_OUTBOUND);
        qosMapper.serialize(
            iface.isQosOverridden() ? iface.getQos() : qosDao.get(network.getQosId()));
      }

      Set<Version> supportedClusterVersionsSet = host.getSupportedClusterVersionsSet();
      if (supportedClusterVersionsSet == null || supportedClusterVersionsSet.isEmpty()) {
        log.warnFormat(
            "Host {0} ({1}) doesn't contain Supported Cluster Versions, therefore 'defaultRoute'"
                + " will not be sent via the SetupNetworks",
            host.getName(), host.getId());
      } else if (FeatureSupported.defaultRoute(Collections.max(supportedClusterVersionsSet))
          && NetworkUtils.isManagementNetwork(network)
          && (iface.getBootProtocol() == NetworkBootProtocol.DHCP
              || (iface.getBootProtocol() == NetworkBootProtocol.STATIC_IP
                  && StringUtils.isNotEmpty(iface.getGateway())))) {
        opts.put(DEFAULT_ROUTE, Boolean.TRUE);
      }

      if (iface.hasCustomProperties()) {
        opts.put(VdsProperties.NETWORK_CUSTOM_PROPERTIES, iface.getCustomProperties());
      }

      networks.put(network.getName(), opts);
    }

    for (String net : getParameters().getRemovedNetworks()) {
      networks.put(net, REMOVE_OBJ);
    }

    return networks;
  }
Exemple #26
0
 /**
  * Constructs the vlan device name in the format of "{nic name}.{vlan-id}"
  *
  * @param underlyingNic the device on top the vlan device is created
  * @param network the network which holds the vlan-id
  * @return a name representing the vlan device
  */
 public static String constructVlanDeviceName(VdsNetworkInterface underlyingNic, Network network) {
   return underlyingNic.getName() + "." + network.getVlanId();
 }
Exemple #27
0
 /**
  * Determine if a given network interface should be configured on hosts
  *
  * @param network the network to check.
  * @return <code>true</code> iff the network is labeled and not an external network.
  */
 public static boolean isConfiguredByLabel(Network network) {
   return isLabeled(network) && !network.isExternal();
 }
Exemple #28
0
 /**
  * Determine if a given network is labeled
  *
  * @param network the network to check.
  * @return <code>true</code> iff the network is labeled.
  */
 public static boolean isLabeled(Network network) {
   return network.getLabel() != null;
 }
Exemple #29
0
 /**
  * Determine if a given network is configured as a vlan
  *
  * @param network the network to check.
  * @return <code>true</code> iff the network is a vlan.
  */
 public static boolean isVlan(Network network) {
   return network.getVlanId() != null;
 }
Exemple #30
0
 /**
  * Returns true if a given network is non-VM network with no Vlan tagging, else false.
  *
  * @param network The network to check
  */
 public static boolean isNonVmNonVlanNetwork(Network network) {
   return !network.isVmNetwork() && !isVlan(network);
 }