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

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

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

origin: apache/cloudstack

private synchronized Answer execute(IpAssocCommand cmd,  int numRetries) {
  String[] results = new String[cmd.getIpAddresses().length];
  int i = 0;
  IpAddressTO[] ips = cmd.getIpAddresses();
  for (IpAddressTO ip : ips) {
    results[i++] = ip.getPublicIp() + " - success";
  }
  return new IpAssocAnswer(cmd, results);
}
origin: apache/cloudstack

protected SetSourceNatAnswer execute(final SetSourceNatCommand cmd) {
  if (s_logger.isInfoEnabled()) {
    s_logger.info("Executing resource SetSourceNatCommand " + s_gson.toJson(cmd));
  }
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  final String routerIp = getRouterSshControlIp(cmd);
  final IpAddressTO pubIp = cmd.getIpAddress();
  try {
    final int ethDeviceNum = findRouterEthDeviceIndex(routerName, routerIp, pubIp.getVifMacAddress());
    String args = "";
    args += " -A ";
    args += " -l ";
    args += pubIp.getPublicIp();
    args += " -c ";
    args += "eth" + ethDeviceNum;
    final String command = String.format("%s%s %s", "/opt/cloud/bin/", VRScripts.VPC_SOURCE_NAT, args);
    final Pair<Boolean, String> result = SshHelper.sshExecute(routerIp, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, command);
    if (!result.first()) {
      final String msg = "SetupGuestNetworkCommand on domain router " + routerIp + " failed. message: " + result.second();
      s_logger.error(msg);
      return new SetSourceNatAnswer(cmd, false, msg);
    }
    return new SetSourceNatAnswer(cmd, true, "success");
  } catch (final Exception e) {
    final String msg = "Ip SNAT failure due to " + e.toString();
    s_logger.error(msg, e);
    return new SetSourceNatAnswer(cmd, false, msg);
  }
}
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

@Override
public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
  final IpAssocCommand command = (IpAssocCommand) cmd;
  final List<IpAddress> ips = new LinkedList<IpAddress>();
  for (final IpAddressTO ip : command.getIpAddresses()) {
    final IpAddress ipAddress = new IpAddress(ip.getPublicIp(), ip.isSourceNat(), ip.isAdd(), ip.isOneToOneNat(), ip.isFirstIP(), ip.getVlanGateway(), ip.getVlanNetmask(),
        ip.getVifMacAddress(), ip.getNicDevId(), ip.isNewNic(), ip.getTrafficType().toString());
    ips.add(ipAddress);
  }
  final IpAssociation ipAssociation = new IpAssociation(ips.toArray(new IpAddress[ips.size()]));
  return generateConfigItems(ipAssociation);
}
origin: apache/cloudstack

    type = GuestNetworkType.SOURCE_NAT;
    if (ip.getPublicIp() == null) {
      throw new ExecutionException("Source NAT IP address must not be null.");
    } else {
      sourceNatIpAddress = ip.getPublicIp();
  results[i++] = ip.getPublicIp() + " - success";
} catch (ExecutionException e) {
  s_logger.error(e);
origin: apache/cloudstack

results[i++] = ip.getPublicIp() + " - success";
final String action = ip.isAdd() ? "associate" : "remove";
if (s_logger.isDebugEnabled()) {
origin: apache/cloudstack

if (ip.isAdd() && publicNicInfo == -1) {
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("Plug new NIC to associate" + controlIp + " to " + ip.getPublicIp());
com.cloud.agent.api.toIpAddressTOgetPublicIp

Popular methods of IpAddressTO

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • JComboBox (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for Android Studio
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