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

How to use
IpAssocCommand
in
com.cloud.agent.api.routing

Best Java code snippets using com.cloud.agent.api.routing.IpAssocCommand (Showing top 15 results out of 315)

origin: apache/cloudstack

private ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) {
  return prepNetBoth(cmd
      .getAccessDetail(NetworkElementCommand.ROUTER_NAME),
      cmd.getIpAddresses(), "IpAssocCommand");
}
origin: apache/cloudstack

public IpAssocAnswer(IpAssocCommand cmd, String[] results) {
  boolean finalResult = true;
  for (String result : results) {
    if (result.equals(errorResult)) {
      finalResult = false;
      break;
    }
  }
  this.result = finalResult;
  this.details = null;
  assert (cmd.getIpAddresses().length == results.length) : "Shouldn't the results match the commands?";
  this.results = results;
}
origin: apache/cloudstack

final IpAssocCommand cmd = new IpAssocCommand(ipsToSend);
cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(associatedWithNetworkId, router.getId()));
cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());
  cmd.setAccessDetail(NetworkElementCommand.NETWORK_PUB_LAST_IP, "true");
} else {
  cmd.setAccessDetail(NetworkElementCommand.NETWORK_PUB_LAST_IP, "false");
origin: apache/cloudstack

IpAddressTO[] ips = new IpAddressTO[1];
ips[0] = ip;
IpAssocCommand cmd = new IpAssocCommand(ips);
Answer answer = _agentMgr.easySend(externalLoadBalancer.getId(), cmd);
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

IpAddressTO[] ips = new IpAddressTO[1];
ips[0] = ip;
IpAssocCommand cmd = new IpAssocCommand(ips);
cmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY, guestVlanGateway);
cmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR, guestVlanCidr);
cmd.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG, String.valueOf(guestVlanTag));
Answer answer = _agentMgr.easySend(externalFirewall.getId(), cmd);
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

private Answer execute(IpAssocCommand cmd, int numRetries) {
  String[] results = new String[cmd.getIpAddresses().length];
  int i = 0;
  try {
    IpAddressTO ip;
    if (cmd.getIpAddresses().length != 1) {
      throw new ExecutionException("Received an invalid number of guest IPs to associate.");
    } else {
      ip = cmd.getIpAddresses()[0];
    long guestVlanTag = Long.parseLong(cmd.getAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG));
    String guestVlanGateway = cmd.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
    String cidr = cmd.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR);
    long cidrSize = NetUtils.cidrToLong(cidr)[1];
    String guestVlanSubnet = NetUtils.getCidrSubNet(guestVlanGateway, cidrSize);
origin: apache/cloudstack

final String[] results = new String[cmd.getIpAddresses().length];
int i = 0;
try {
  final IpAddressTO[] ips = cmd.getIpAddresses();
  for (final IpAddressTO ip : ips) {
    final long guestVlanTag = Long.parseLong(ip.getBroadcastUri());
origin: apache/cloudstack

protected ExecutionResult cleanupNetworkElementCommand(final IpAssocCommand cmd) {
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  final String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
  final String lastIp = cmd.getAccessDetail(NetworkElementCommand.NETWORK_PUB_LAST_IP);
  Connect conn;
    final IpAddressTO[] ips = cmd.getIpAddresses();
    int nicNum = 0;
    for (final IpAddressTO ip : ips) {
origin: apache/cloudstack

public ExecutionResult prepareNetworkElementCommand(final IpAssocCommand cmd) {
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  final String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
  Connect conn;
  try {
    final IpAddressTO[] ips = cmd.getIpAddresses();
    int nicNum = 0;
    for (final IpAddressTO ip : ips) {
origin: apache/cloudstack

private ExecutionResult prepareNetworkElementCommand(final IpAssocCommand cmd) {
  try {
    final IpAddressTO[] ips = cmd.getIpAddresses();
    final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
    final String controlIp = getRouterSshControlIp(cmd);
origin: apache/cloudstack

protected ExecutionResult cleanupNetworkElementCommand(final IpAssocCommand cmd) {
  final Connection conn = getConnection();
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  final String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
  final String lastIp = cmd.getAccessDetail(NetworkElementCommand.NETWORK_PUB_LAST_IP);
    final IpAddressTO[] ips = cmd.getIpAddresses();
    for (final IpAddressTO ip : ips) {
origin: apache/cloudstack

protected ExecutionResult prepareNetworkElementCommand(final IpAssocCommand cmd) {
  final Connection conn = getConnection();
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  final String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
    final IpAddressTO[] ips = cmd.getIpAddresses();
    for (final IpAddressTO ip : ips) {
com.cloud.agent.api.routingIpAssocCommand

Most used methods

  • getIpAddresses
  • getAccessDetail
  • <init>
  • setAccessDetail

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text 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