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

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

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

origin: apache/cloudstack

public static List<? extends Vlan> listVlanByNetworkId(long networkId) {
  return s_vlanDao.listVlansByNetworkId(networkId);
}
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

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

@Override
public String getStartIpv6Address(long networkId) {
  List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
  if (vlans == null) {
    return null;
  }
  String startIpv6 = null;
  // Get the start ip of first create vlan(not the lowest, because if you add a lower vlan, lowest vlan would change)
  for (Vlan vlan : vlans) {
    if (vlan.getIp6Range() != null) {
      startIpv6 = vlan.getIp6Range().split("-")[0];
      break;
    }
  }
  return startIpv6;
}
origin: apache/cloudstack

@Override
public String getStartIpAddress(long networkId) {
  List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
  if (vlans.isEmpty()) {
    return null;
  }
  String startIP = vlans.get(0).getIpRange().split("-")[0];
  for (VlanVO vlan : vlans) {
    String startIP1 = vlan.getIpRange().split("-")[0];
    long startIPLong = NetUtils.ip2Long(startIP);
    long startIPLong1 = NetUtils.ip2Long(startIP1);
    if (startIPLong1 < startIPLong) {
      startIP = startIP1;
    }
  }
  return startIP;
}
origin: apache/cloudstack

@Override
public NetworkVO getNetworkWithSGWithFreeIPs(Long zoneId) {
  List<NetworkVO> networks = _networksDao.listByZoneSecurityGroup(zoneId);
  if (networks == null || networks.isEmpty()) {
    return null;
  }
  NetworkVO ret_network = null;
  for (NetworkVO nw : networks) {
    List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(nw.getId());
    for (VlanVO vlan : vlans) {
      if (_ipAddressDao.countFreeIpsInVlan(vlan.getId()) > 0) {
        ret_network = nw;
        break;
      }
    }
    if (ret_network != null) {
      break;
    }
  }
  if (ret_network == null) {
    s_logger.debug("Can not find network with security group enabled with free IPs");
  }
  return ret_network;
}
origin: apache/cloudstack

protected boolean deleteVlansInNetwork(final long networkId, final long userId, final Account callerAccount) {
  //cleanup Public vlans
  final List<VlanVO> publicVlans = _vlanDao.listVlansByNetworkId(networkId);
  boolean result = true;
  for (final VlanVO vlan : publicVlans) {
    if (!_configMgr.deleteVlanAndPublicIpRange(userId, vlan.getId(), callerAccount)) {
      s_logger.warn("Failed to delete vlan " + vlan.getId() + ");");
      result = false;
    }
  }
  //cleanup private vlans
  final int privateIpAllocCount = _privateIpDao.countAllocatedByNetworkId(networkId);
  if (privateIpAllocCount > 0) {
    s_logger.warn("Can't delete Private ip range for network " + networkId + " as it has allocated ip addresses");
    result = false;
  } else {
    _privateIpDao.deleteByNetworkId(networkId);
    s_logger.debug("Deleted ip range for private network id=" + networkId);
  }
  return result;
}
origin: apache/cloudstack

@Override
public boolean areThereIPv6AddressAvailableInNetwork(long networkId) {
  Network network = _networksDao.findById(networkId);
  if (network == null) {
    return false;
  }
  if (network.getIp6Gateway() == null) {
    return false;
  }
  List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
  for (Vlan vlan : vlans) {
    if (isIP6AddressAvailableInVlan(vlan.getId())) {
      return true;
    }
  }
  return false;
}
origin: apache/cloudstack

public VspNetwork updateVspNetworkByPublicIp(VspNetwork vspNetwork, Network network, String publicIp) {
  List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(network.getId());
  final long ip = NetUtils.ip2Long(publicIp);
  VlanVO matchingVlan = vlans.stream()
                .filter(vlan -> isVlanContainingIp(vlan, ip))
                .findFirst()
                .get();
  boolean underlayEnabled = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, matchingVlan);
  return new VspNetwork.Builder().fromObject(vspNetwork)
      .gateway(matchingVlan.getVlanGateway())
      .cidr(NetUtils.getCidrFromGatewayAndNetmask(matchingVlan.getVlanGateway(), matchingVlan.getVlanNetmask()))
      .vlanUnderlay(underlayEnabled)
      .build();
}
origin: apache/cloudstack

List<VlanVO> vlan_list = vlanDao.listVlansByNetworkId(_id);
for (VlanVO vlan : vlan_list) {
  String cidr = NetUtils.ipAndNetMaskToCidr(vlan.getVlanGateway(), vlan.getVlanNetmask());
origin: apache/cloudstack

private boolean sharedNetworkSupportNumericalVlanId(Network network, String lSwitchUuid, String ownerName, HostVO niciraNvpHost) {
  List<VlanVO> networkVlans = vlanDao.listVlansByNetworkId(network.getId());
  if (networkVlans.size() == 1){
    for (VlanVO vlanVO : networkVlans) {
      long vlanId = Long.parseLong(vlanVO.getVlanTag());
      String l2GatewayServiceUuid = niciraNvpHost.getDetail("l2gatewayserviceuuid");
      if (l2GatewayServiceUuid == null){
        throw new CloudRuntimeException("No L2 Gateway Service Uuid found on " + niciraNvpHost.getName());
      }
      ConfigureSharedNetworkVlanIdCommand cmd =
          new ConfigureSharedNetworkVlanIdCommand(lSwitchUuid, l2GatewayServiceUuid , vlanId, ownerName, network.getId());
      ConfigureSharedNetworkVlanIdAnswer answer = (ConfigureSharedNetworkVlanIdAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
      if (answer.getResult() == false) {
        s_logger.error("Failed to configure Shared network " + network.getDisplayText());
        return false;
      }
    }
  }
  return true;
}
origin: apache/cloudstack

_vn.clearNetworkIpam();
List<VlanVO> vlan_list = vlanDao.listVlansByNetworkId(_id);
for (VlanVO vlan : vlan_list) {
  String cidr = NetUtils.ipAndNetMaskToCidr(vlan.getVlanGateway(), vlan.getVlanNetmask());
origin: apache/cloudstack

  @Override
  public Vlan doInTransaction(final TransactionStatus status) {
    String newVlanNetmask = newVlanNetmaskFinal;
    String newVlanGateway = newVlanGatewayFinal;
    if ((sameSubnet == null || !sameSubnet.first()) && network.getTrafficType() == TrafficType.Guest && network.getGuestType() == GuestType.Shared
        && _vlanDao.listVlansByNetworkId(networkId) != null) {
      final Map<Capability, String> dhcpCapabilities = _networkSvc.getNetworkOfferingServiceCapabilities(_networkOfferingDao.findById(network.getNetworkOfferingId()),
        Service.Dhcp);
      final String supportsMultipleSubnets = dhcpCapabilities.get(Capability.DhcpAccrossMultipleSubnets);
      if (supportsMultipleSubnets == null || !Boolean.valueOf(supportsMultipleSubnets)) {
        throw new  InvalidParameterValueException("The dhcp service provider for this network does not support dhcp across multiple subnets");
      }
      s_logger.info("adding a new subnet to the network " + network.getId());
    } else if (sameSubnet != null) {
      // if it is same subnet the user might not send the vlan and the
      // netmask details. so we are
      // figuring out while validation and setting them here.
      newVlanGateway = sameSubnet.second().first();
      newVlanNetmask = sameSubnet.second().second();
    }
    final Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, forSystemVms, podId, startIP, endIP, newVlanGateway, newVlanNetmask, vlanId,
        false, domain, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
    // create an entry in the nic_secondary table. This will be the new
    // gateway that will be configured on the corresponding routervm.
    return vlan;
  }
});
origin: apache/cloudstack

vn.clearNetworkIpam();
List<VlanVO> vlan_list = vlanDao.listVlansByNetworkId(_id);
for (VlanVO vlan : vlan_list) {
  String cidr = NetUtils.ipAndNetMaskToCidr(vlan.getVlanGateway(), vlan.getVlanNetmask());
origin: apache/cloudstack

sc_nic.addAnd("macAddress", SearchCriteria.Op.EQ, vmNetworkStat.getMacAddress());
NicVO nic = _nicDao.search(sc_nic, null).get(0);
List<VlanVO> vlan = _vlanDao.listVlansByNetworkId(nic.getNetworkId());
if (vlan == null || vlan.size() == 0 || vlan.get(0).getVlanType() != VlanType.DirectAttached)
  continue; // only get network statistics for DirectAttached network (shared networks in Basic zone and Advanced zone with/without SG)
origin: apache/cloudstack

nic.setIPv4Netmask(NetUtils.getCidrNetmask(network.getCidr()));
List<VlanVO> vlan = _vlanDao.listVlansByNetworkId(network.getId());
origin: apache/cloudstack

sc_nic.addAnd("macAddress", SearchCriteria.Op.EQ, vmNetworkStat.getMacAddress());
NicVO nic = _nicDao.search(sc_nic, null).get(0);
List<VlanVO> vlan = _vlanDao.listVlansByNetworkId(nic.getNetworkId());
if (vlan == null || vlan.size() == 0 || vlan.get(0).getVlanType() != VlanType.DirectAttached)
origin: apache/cloudstack

  throw new InvalidParameterValueException("The requested IP is already taken!");
List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
if (vlans == null) {
  throw new CloudRuntimeException("Cannot find related vlan attached to network " + networkId);
origin: apache/cloudstack

for (VlanVO vlan : _vlanDao.listVlansByNetworkId(networkId)) {
  boolean underlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, vlan);
  if (previousUnderlay == null || underlay == previousUnderlay) {
origin: apache/cloudstack

    final List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(network.getId());
    if (vlans != null && vlans.size() > 0) {
      final VlanVO vlan = vlans.get(0);
  throw new InvalidParameterValueException("Cannot execute createVLANIpRanges on management network");
} else if (zone.getNetworkType() == NetworkType.Basic) {
  final List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(network.getId());
  sameSubnet = validateIpRange(startIP, endIP, newVlanGateway, newVlanNetmask, vlans, ipv4, ipv6, ip6Gateway, ip6Cidr, startIPv6, endIPv6, network);
com.cloud.dc.daoVlanDaolistVlansByNetworkId

Popular methods of VlanDao

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

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • JPanel (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • From CI to AI: The AI layer in your organization
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