Tabnine Logo
IpAddressTO.getBroadcastUri
Code IndexAdd Tabnine to your IDE (free)

How to use
getBroadcastUri
method
in
com.cloud.agent.api.to.IpAddressTO

Best Java code snippets using com.cloud.agent.api.to.IpAddressTO.getBroadcastUri (Showing top 12 results out of 315)

origin: apache/cloudstack

for (final IpAddressTO ip : ips) {
  boolean newNic = false;
  if (!broadcastUriAllocatedToVM.containsKey(ip.getBroadcastUri())) {
    VifHotPlug(conn, routerName, ip.getBroadcastUri(), ip.getVifMacAddress());
    broadcastUriAllocatedToVM.put(ip.getBroadcastUri(), nicPos++);
    newNic = true;
  nicNum = broadcastUriAllocatedToVM.get(ip.getBroadcastUri());
  networkUsage(routerIp, "addVif", "eth" + nicNum);
origin: apache/cloudstack

protected ExecutionResult prepareNetworkElementCommand(final SetSourceNatCommand cmd) {
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  final IpAddressTO pubIp = cmd.getIpAddress();
  try {
    final String broadcastUri = pubIp.getBroadcastUri();
    final String vlanId = BroadcastDomainType.getValue(broadcastUri);
    final int ethDeviceNum = getVmNics(routerName, vlanId);
    if (ethDeviceNum > 0) {
      pubIp.setNicDevId(ethDeviceNum);
    } else {
      return new ExecutionResult(false, "Prepare Ip SNAT failed due to unable to find the nic");
    }
  } catch (final Exception e) {
    final String msg = "Prepare Ip SNAT failure due to " + e.toString();
    s_logger.error(msg, e);
    return new ExecutionResult(false, e.toString());
  }
  return new ExecutionResult(true, null);
}
origin: apache/cloudstack

for (final IpAddressTO ip : ips) {
  if (!broadcastUriAllocatedToVM.containsKey(ip.getBroadcastUri())) {
    VifHotPlug(conn, routerName, ip.getBroadcastUri(), ip.getVifMacAddress());
    broadcastUriAllocatedToVM.put(ip.getBroadcastUri(), nicPos++);
  nicNum = broadcastUriAllocatedToVM.get(ip.getBroadcastUri());
origin: apache/cloudstack

private ExecutionResult prepareNetworkElementCommand(final IpAssocVpcCommand cmd) {
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  try {
    final IpAddressTO[] ips = cmd.getIpAddresses();
    for (final IpAddressTO ip : ips) {
      final URI broadcastUri = BroadcastDomainType.fromString(ip.getBroadcastUri());
      if (BroadcastDomainType.getSchemeValue(broadcastUri) != BroadcastDomainType.Vlan) {
        throw new InternalErrorException("Invalid Broadcast URI " + ip.getBroadcastUri());
      }
      final String vlanId = BroadcastDomainType.getValue(broadcastUri);
      int publicNicInfo = -1;
      publicNicInfo = getVmNics(routerName, vlanId);
      if (publicNicInfo < 0) {
        if (ip.isAdd()) {
          throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with.");
        } else {
          s_logger.debug("VIF to deassociate IP with does not exist, return success");
          continue;
        }
      }
      ip.setNicDevId(publicNicInfo);
    }
  } catch (final Exception e) {
    s_logger.error("Prepare Ip Assoc failure on applying one ip due to exception:  ", e);
    return new ExecutionResult(false, e.toString());
  }
  return new ExecutionResult(true, null);
}
origin: apache/cloudstack

conn = LibvirtConnection.getConnectionByVmName(routerName);
Integer devNum = 0;
final String pubVlan = pubIP.getBroadcastUri();
final List<InterfaceDef> pluggedNics = getInterfaces(conn, routerName);
origin: apache/cloudstack

protected Answer execute(final IpAssocCommand cmd) {
  if (s_logger.isInfoEnabled()) {
    s_logger.info("Executing resource IPAssocCommand: " + s_gson.toJson(cmd));
  }
  int i = 0;
  final String[] results = new String[cmd.getIpAddresses().length];
  try {
    final IpAddressTO[] ips = cmd.getIpAddresses();
    final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
    final String controlIp = getRouterSshControlIp(cmd);
    for (final IpAddressTO ip : ips) {
      assignPublicIpAddress(routerName, controlIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getBroadcastUri(), ip.getVlanGateway(),
          ip.getVlanNetmask(), ip.getVifMacAddress());
      results[i++] = ip.getPublicIp() + " - success";
    }
    for (; i < cmd.getIpAddresses().length; i++) {
      results[i++] = IpAssocAnswer.errorResult;
    }
  } catch (final Throwable e) {
    s_logger.error("Unexpected exception: " + e.toString() + " will shortcut rest of IPAssoc commands", e);
    for (; i < cmd.getIpAddresses().length; i++) {
      results[i++] = IpAssocAnswer.errorResult;
    }
  }
  return new IpAssocAnswer(cmd, results);
}
origin: apache/cloudstack

protected VIF getCorrectVif(final Connection conn, final VM router, final IpAddressTO ip) throws XmlRpcException, XenAPIException {
  final NicTO nic = new NicTO();
  nic.setType(ip.getTrafficType());
  nic.setName(ip.getNetworkName());
  if (ip.getBroadcastUri() == null) {
    nic.setBroadcastType(BroadcastDomainType.Native);
  } else {
    final URI uri = BroadcastDomainType.fromString(ip.getBroadcastUri());
    nic.setBroadcastType(BroadcastDomainType.getSchemeValue(uri));
    nic.setBroadcastUri(uri);
  }
  final Network network = getNetwork(conn, nic);
  // Determine the correct VIF on DomR to associate/disassociate the
  // IP address with
  final Set<VIF> routerVIFs = router.getVIFs(conn);
  for (final VIF vif : routerVIFs) {
    final Network vifNetwork = vif.getNetwork(conn);
    if (vifNetwork.getUuid(conn).equals(network.getUuid(conn))) {
      return vif;
    }
  }
  return null;
}
origin: apache/cloudstack

final URI broadcastUri = BroadcastDomainType.fromString(ip.getBroadcastUri());
if (BroadcastDomainType.getSchemeValue(broadcastUri) != BroadcastDomainType.Vlan) {
  throw new InternalErrorException("Unable to assign a public IP to a VIF on network " + ip.getBroadcastUri());
origin: apache/cloudstack

final IpAddressTO[] ips = cmd.getIpAddresses();
for (final IpAddressTO ip : ips) {
  final long guestVlanTag = Long.parseLong(ip.getBroadcastUri());
  final String vlanSelfIp = ip.getVlanGateway();
  final String vlanNetmask = ip.getVlanNetmask();
origin: apache/cloudstack

if (ip.getBroadcastUri() != null) {
  String parsedVlanTag = parsePublicVlanTag(ip.getBroadcastUri());
  if (!parsedVlanTag.equals("untagged")) {
    try {
origin: apache/cloudstack

nic.setMac(ip.getVifMacAddress());
nic.setType(ip.getTrafficType());
if (ip.getBroadcastUri() == null) {
  nic.setBroadcastType(BroadcastDomainType.Native);
} else {
  final URI uri = BroadcastDomainType.fromString(ip.getBroadcastUri());
  nic.setBroadcastType(BroadcastDomainType.getSchemeValue(uri));
  nic.setBroadcastUri(uri);
origin: apache/cloudstack

nic.setMac(ip.getVifMacAddress());
nic.setType(ip.getTrafficType());
if (ip.getBroadcastUri() == null) {
  nic.setBroadcastType(BroadcastDomainType.Native);
} else {
  final URI uri = BroadcastDomainType.fromString(ip.getBroadcastUri());
  nic.setBroadcastType(BroadcastDomainType.getSchemeValue(uri));
  nic.setBroadcastUri(uri);
com.cloud.agent.api.toIpAddressTOgetBroadcastUri

Popular methods of IpAddressTO

  • isAdd
  • getVifMacAddress
  • getPublicIp
  • setNicDevId
  • getVlanGateway
  • getVlanNetmask
  • isSourceNat
  • setNewNic
  • getTrafficType
  • isFirstIP
  • <init>
  • getNetworkName
  • <init>,
  • getNetworkName,
  • getNetworkRate,
  • getNicDevId,
  • isNewNic,
  • isOneToOneNat,
  • setNetworkName,
  • setTrafficType

Popular in Java

  • Updating database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • String (java.lang)
  • Path (java.nio.file)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • 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