Tabnine Logo
VlanDao
Code IndexAdd Tabnine to your IDE (free)

How to use
VlanDao
in
com.cloud.dc.dao

Best Java code snippets using com.cloud.dc.dao.VlanDao (Showing top 20 results out of 315)

origin: apache/cloudstack

public static VlanVO findVlanById(long vlanDbId) {
  return s_vlanDao.findById(vlanDbId);
}
origin: apache/cloudstack

public static List<? extends Vlan> listVlanByNetworkId(long networkId) {
  return s_vlanDao.listVlansByNetworkId(networkId);
}
origin: apache/cloudstack

  AssignIpAddressSearch.and("forSystemVms", AssignIpAddressSearch.entity().isForSystemVms(), Op.EQ);
SearchBuilder<VlanVO> vlanSearch = _vlanDao.createSearchBuilder();
vlanSearch.and("type", vlanSearch.entity().getVlanType(), Op.EQ);
vlanSearch.and("networkId", vlanSearch.entity().getNetworkId(), Op.EQ);
AssignIpAddressFromPodVlanSearch.and("vlanId", AssignIpAddressFromPodVlanSearch.entity().getVlanId(), Op.IN);
SearchBuilder<VlanVO> podVlanSearch = _vlanDao.createSearchBuilder();
podVlanSearch.and("type", podVlanSearch.entity().getVlanType(), Op.EQ);
podVlanSearch.and("networkId", podVlanSearch.entity().getNetworkId(), Op.EQ);
origin: apache/cloudstack

  @Override
  public Boolean doInTransaction(final TransactionStatus status) {
    // delete vlans for this zone
    final List<VlanVO> vlans = _vlanDao.listByZone(zoneId);
    for (final VlanVO vlan : vlans) {
      _vlanDao.remove(vlan.getId());
    }
    final boolean success = _zoneDao.remove(zoneId);
    if (success) {
      // delete all capacity records for the zone
      _capacityDao.removeBy(null, zoneId, null, null, null);
      // remove from dedicated resources
      final DedicatedResourceVO dr = _dedicatedDao.findByZoneId(zoneId);
      if (dr != null) {
        _dedicatedDao.remove(dr.getId());
        // find the group associated and check if there are any more
        // resources under that group
        final List<DedicatedResourceVO> resourcesInGroup = _dedicatedDao.listByAffinityGroupId(dr.getAffinityGroupId());
        if (resourcesInGroup.isEmpty()) {
          // delete the group
          _affinityGroupService.deleteAffinityGroup(dr.getAffinityGroupId(), null, null, null, null);
        }
      }
    }
    return success;
  }
});
origin: apache/cloudstack

  @Override
  public Boolean doInTransaction(TransactionStatus status) {
    portableIpLock.lock(5);
    IPAddressVO ip = _ipAddressDao.findById(addrId);
    // unassign portable IP
    PortableIpVO portableIp = _portableIpDao.findByIpAddress(ip.getAddress().addr());
    _portableIpDao.unassignIpAddress(portableIp.getId());
    // removed the provisioned vlan
    VlanVO vlan = _vlanDao.findById(ip.getVlanId());
    _vlanDao.remove(vlan.getId());
    // remove the provisioned public ip address
    _ipAddressDao.remove(ip.getId());
    return true;
  }
});
origin: apache/cloudstack

@DB
public boolean releasePublicIpRange(final long vlanDbId, final long userId, final Account caller) {
  VlanVO vlan = _vlanDao.findById(vlanDbId);
  if(vlan == null) {
    s_logger.warn("VLAN information for Account '" + caller + "', User '" + userId + "' VLAN '" + vlanDbId + "' is null. This is NPE situation.");
  if (allocIpCount > 0) {
    try {
      vlan = _vlanDao.acquireInLockTable(vlanDbId, 30);
      if (vlan == null) {
        throw new CloudRuntimeException("Unable to acquire vlan configuration: " + vlanDbId);
      _vlanDao.releaseFromLockTable(vlanDbId);
origin: apache/cloudstack

  @Override
  public void doInTransactionWithoutResult(TransactionStatus status) {
    long physicalNetworkId = _networkModel.getDefaultPhysicalNetworkByZoneAndTrafficType(dstNetwork.getDataCenterId(), TrafficType.Public).getId();
    long publicNetworkId = _networkModel.getSystemNetworkByZoneAndTrafficType(dstNetwork.getDataCenterId(), TrafficType.Public).getId();
    ip.setDataCenterId(dstNetwork.getDataCenterId());
    ip.setPhysicalNetworkId(physicalNetworkId);
    ip.setSourceNetworkId(publicNetworkId);
    _ipAddressDao.update(ipAddrId, ip);
    VlanVO vlan = _vlanDao.findById(ip.getVlanId());
    vlan.setPhysicalNetworkId(physicalNetworkId);
    vlan.setNetworkId(publicNetworkId);
    vlan.setDataCenterId(dstNetwork.getDataCenterId());
    _vlanDao.update(ip.getVlanId(), vlan);
  }
});
origin: apache/cloudstack

final Object keyword = cmd.getKeyword();
final SearchBuilder<VlanVO> sb = _vlanDao.createSearchBuilder();
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
sb.and("vlan", sb.entity().getVlanTag(), SearchCriteria.Op.EQ);
  final SearchCriteria<VlanVO> ssc = _vlanDao.createSearchCriteria();
  ssc.addOr("vlanTag", SearchCriteria.Op.LIKE, "%" + keyword + "%");
  ssc.addOr("ipRange", SearchCriteria.Op.LIKE, "%" + keyword + "%");
final Pair<List<VlanVO>, Integer> result = _vlanDao.searchAndCount(sc, searchFilter);
return new Pair<List<? extends Vlan>, Integer>(result.first(), result.second());
origin: apache/cloudstack

private void checkVlanUnderlayCompatibility(VlanVO newVlan) throws ResourceUnavailableException {
  List<VlanVO> vlans = _vlanDao.listByZone(newVlan.getDataCenterId());
  if (CollectionUtils.isNotEmpty(vlans)) {
    boolean newVlanUnderlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, newVlan);
    final String newCidr = NetUtils.getCidrFromGatewayAndNetmask(newVlan.getVlanGateway(), newVlan.getVlanNetmask());
    for (VlanVO vlan : vlans) {
      if (vlan.getId() == newVlan.getId()) continue;
      final String existingCidr = NetUtils.getCidrFromGatewayAndNetmask(vlan.getVlanGateway(), vlan.getVlanNetmask());
      NetUtils.SupersetOrSubset supersetOrSubset = NetUtils.isNetowrkASubsetOrSupersetOfNetworkB(newCidr, existingCidr);
      if (supersetOrSubset == NetUtils.SupersetOrSubset.sameSubnet) {
        boolean vlanUnderlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, vlan);
        if (newVlanUnderlay != vlanUnderlay) {
          throw new ResourceUnavailableException("Mixed values for the underlay flag for IP ranges in the same subnet is not supported", Vlan.class, newVlan.getId());
        }
        break;
      }
    }
  }
}
origin: apache/cloudstack

SearchCriteria<VlanVO> sc = _vlanDao.createSearchCriteria();
sc.setParameters("network_id", pubNet.getId());
VlanVO vlanVO = _vlanDao.findOneBy(sc);
origin: apache/cloudstack

@Override
@DB
public boolean deleteVlanAndPublicIpRange(final long userId, final long vlanDbId, final Account caller) {
  VlanVO vlanRange = _vlanDao.findById(vlanDbId);
  if (vlanRange == null) {
    throw new InvalidParameterValueException("Please specify a valid IP range id.");
    int resourceCountToBeDecrement = 0;
    try {
      vlanRange = _vlanDao.acquireInLockTable(vlanDbId, 30);
      if (vlanRange == null) {
        throw new CloudRuntimeException("Unable to acquire vlan configuration: " + vlanDbId);
      _vlanDao.releaseFromLockTable(vlanDbId);
      if (resourceCountToBeDecrement > 0) {  //Making sure to decrement the count of only success operations above. For any reaason if disassociation fails then this number will vary from original range length.
        _resourceLimitMgr.decrementResourceCount(acctVln.get(0).getAccountId(), ResourceType.public_ip, new Long(resourceCountToBeDecrement));
origin: apache/cloudstack

final List<VlanVO> vlans = _vlanDao.listByZone(dataCenterId);
List<String> pvlan = new ArrayList<String>();
for (final VlanVO vlan : vlans) {
origin: apache/cloudstack

SearchCriteria<VlanVO> sc = _vlanDao.createSearchCriteria();
sc.setParameters("network_id", pubNet.getId());
VlanVO pubVlanVO = _vlanDao.findOneBy(sc);
String pubVlanStr = pubVlanVO.getVlanTag();
origin: apache/cloudstack

public static Long getVlanNetworkId(long vlanId) {
  VlanVO vlan = s_vlanDao.findById(vlanId);
  if (vlan != null) {
    return vlan.getNetworkId();
  } else {
    return null;
  }
}
origin: apache/cloudstack

private List<Pair<String, String>> getSharedIpAddressRanges(long networkId) {
  List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
  List<Pair<String, String>> ipAddressRanges = Lists.newArrayList();
  for (VlanVO vlan : vlans) {
    Pair<String, String> ipAddressRange = NuageVspUtil.getIpAddressRange(vlan);
    if (ipAddressRange != null) {
      ipAddressRanges.add(ipAddressRange);
    }
  }
  return ipAddressRanges;
}
origin: apache/cloudstack

AssignIpAddressSearch.and("allocated", AssignIpAddressSearch.entity().getAllocatedTime(), Op.NULL);
AssignIpAddressSearch.and("vlanId", AssignIpAddressSearch.entity().getVlanId(), Op.IN);
final SearchBuilder<VlanVO> vlanSearch = _vlanDao.createSearchBuilder();
vlanSearch.and("type", vlanSearch.entity().getVlanType(), Op.EQ);
vlanSearch.and("networkId", vlanSearch.entity().getNetworkId(), Op.EQ);
AssignIpAddressFromPodVlanSearch.and("vlanId", AssignIpAddressFromPodVlanSearch.entity().getVlanId(), Op.IN);
final SearchBuilder<VlanVO> podVlanSearch = _vlanDao.createSearchBuilder();
podVlanSearch.and("type", podVlanSearch.entity().getVlanType(), Op.EQ);
podVlanSearch.and("networkId", podVlanSearch.entity().getNetworkId(), Op.EQ);
origin: apache/cloudstack

final List<VlanVO> vlans = _vlanDao.listByZone(zone.getId());
for (final VlanVO vlan : vlans) {
  final String otherVlanGateway = vlan.getVlanGateway();
final List<VlanVO> vlans = _vlanDao.listByZone(zone.getId());
for (final VlanVO vlan : vlans) {
  if (vlan.getIp6Gateway() == null) {
origin: apache/cloudstack

@Override
public boolean isIP6AddressAvailableInVlan(long vlanId) {
  VlanVO vlan = _vlanDao.findById(vlanId);
  if (vlan.getIp6Range() == null) {
    return false;
  }
  long existedCount = _ipv6Dao.countExistedIpsInVlan(vlanId);
  BigInteger existedInt = BigInteger.valueOf(existedCount);
  BigInteger rangeInt = NetUtils.countIp6InRange(vlan.getIp6Range());
  return (existedInt.compareTo(rangeInt) < 0);
}
origin: apache/cloudstack

private void checkMultipleSubnetsCombinedWithUseData(Network network) {
  if (isServiceProvidedByVR(network, Network.Service.UserData)) {
    List<VlanVO> vlanVOs = _vlanDao.listVlansByNetworkId(network.getId());
    if (vlanVOs.stream()
          .map(VlanVO::getVlanGateway)
          .distinct()
          .count() > 1) {
          s_logger.error("NuageVsp provider does not support multiple subnets in combination with user data. Network: " + network + ", vlans: " + vlanVOs);
          throw new UnsupportedServiceException("NuageVsp provider does not support multiple subnets in combination with user data.");
    }
  }
}
origin: apache/cloudstack

IpAddressSearch.and("vpcId", IpAddressSearch.entity().getVpcId(), Op.EQ);
IpAddressSearch.and("associatedWithNetworkId", IpAddressSearch.entity().getAssociatedWithNetworkId(), Op.EQ);
SearchBuilder<VlanVO> virtualNetworkVlanSB = _vlanDao.createSearchBuilder();
virtualNetworkVlanSB.and("vlanType", virtualNetworkVlanSB.entity().getVlanType(), Op.EQ);
IpAddressSearch.join("virtualNetworkVlanSB", virtualNetworkVlanSB, IpAddressSearch.entity().getVlanId(), virtualNetworkVlanSB.entity().getId(),
com.cloud.dc.daoVlanDao

Most used methods

  • findById
  • listVlansByNetworkId
  • createSearchBuilder
  • listByZone
  • createSearchCriteria
  • acquireInLockTable
  • findByNetworkIdAndIpv4
  • findByZoneAndVlanId
  • findOneBy
  • listAll
  • listDedicatedVlans
  • listVlansByNetworkIdAndGateway
  • listDedicatedVlans,
  • listVlansByNetworkIdAndGateway,
  • listVlansByNetworkIdIncludingRemoved,
  • listVlansByPhysicalNetworkId,
  • listVlansForPod,
  • listVlansForPodByType,
  • listZoneWideNonDedicatedVlans,
  • persist,
  • releaseFromLockTable,
  • remove

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now