congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
IpAddressTO.setNicDevId
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: apache/cloudstack

protected void setNicDevIdIfCorrectVifIsNotNull(final Connection conn, final IpAddressTO ip, final VIF correctVif)
    throws InternalErrorException, BadServerResponse, XenAPIException, XmlRpcException {
  if (correctVif == null) {
    if (ip.isAdd()) {
      throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
    } else {
      s_logger.debug("VIF to deassociate IP with does not exist, return success");
    }
  } else {
    ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
  }
}
origin: apache/cloudstack

protected ExecutionResult prepareNetworkElementCommand(final SetSourceNatCommand cmd) {
  final Connection conn = getConnection();
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  final IpAddressTO pubIp = cmd.getIpAddress();
  try {
    final VM router = getVM(conn, routerName);
    final VIF correctVif = getCorrectVif(conn, router, pubIp);
    pubIp.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
  } catch (final Exception e) {
    final String msg = "Ip SNAT failure due to " + e.toString();
    s_logger.error(msg, e);
    return new ExecutionResult(false, msg);
  }
  return new ExecutionResult(true, null);
}
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

protected ExecutionResult prepareNetworkElementCommand(final IpAssocVpcCommand cmd) {
  Connect conn;
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  try {
    conn = getLibvirtUtilitiesHelper().getConnectionByVmName(routerName);
    final IpAddressTO[] ips = cmd.getIpAddresses();
    Integer devNum = 0;
    final List<InterfaceDef> pluggedNics = getInterfaces(conn, routerName);
    final Map<String, Integer> macAddressToNicNum = new HashMap<>(pluggedNics.size());
    for (final InterfaceDef pluggedNic : pluggedNics) {
      final String pluggedVlan = pluggedNic.getBrName();
      macAddressToNicNum.put(pluggedNic.getMacAddress(), devNum);
      devNum++;
    }
    for (final IpAddressTO ip : ips) {
      ip.setNicDevId(macAddressToNicNum.get(ip.getVifMacAddress()));
    }
    return new ExecutionResult(true, null);
  } catch (final LibvirtException e) {
    s_logger.error("Ip Assoc failure on applying one ip due to exception:  ", e);
    return new ExecutionResult(false, e.getMessage());
  }
}
origin: apache/cloudstack

  private ExecutionResult prepNetBoth(String routerName, IpAddressTO[] ips, String type) {
    Xen xen = new Xen(c);
    try {
      Xen.Vm vm = xen.getVmConfig(routerName);
      for (IpAddressTO ip : ips) {
        Integer devId = vm.getVifIdByMac(ip.getVifMacAddress());
        if (devId < 0 && "IpAssocVpcCommand".equals(type)) {
          String msg = "No valid Nic devId found for " + vm.getVmName()
              + " with " + ip.getVifMacAddress();
          logger.error(msg);
          return new ExecutionResult(false, msg);
        } else if (devId < 0 && "IpAssocCommand".equals(type)) {
          // vm.get
          String msg = "No valid Nic devId found for " + vm.getVmName()
              + " with " + ip.getVifMacAddress() + " "
              + " Ignoring for now (routervm)";
          logger.debug(msg);
          devId=2;
        }
        ip.setNicDevId(devId);
      }
    } catch (Exception e) {
      String msg = type + " failure on applying one ip due to exception:  " + e;
      logger.error(msg);
      return new ExecutionResult(false, msg);
    }
    return new ExecutionResult(true, null);
  }
}
origin: apache/cloudstack

pubIP.setNicDevId(devNum);
origin: apache/cloudstack

networkUsage(routerIp, "addVif", "eth" + nicNum);
ip.setNicDevId(nicNum);
ip.setNewNic(newNic);
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

    throw new InternalErrorException(msg);
  ip.setNicDevId(publicNicInfo);
  ip.setNewNic(addVif);
} else {
  ip.setNicDevId(publicNicInfo);
origin: apache/cloudstack

ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
ip.setNewNic(addVif);
com.cloud.agent.api.toIpAddressTOsetNicDevId

Popular methods of IpAddressTO

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • requestLocationUpdates (LocationManager)
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JLabel (javax.swing)
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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