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

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

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

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

protected ExecutionResult prepareNetworkElementCommand(final IpAssocVpcCommand cmd) {
  final Connection conn = getConnection();
  final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  try {
    final IpAddressTO[] ips = cmd.getIpAddresses();
    for (final IpAddressTO ip : ips) {
      final VM router = getVM(conn, routerName);
      final VIF correctVif = getVifByMac(conn, router, ip.getVifMacAddress());
      setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif);
    }
  } catch (final Exception e) {
    s_logger.error("Ip Assoc failure on applying one ip due to exception:  ", e);
    return new ExecutionResult(false, e.getMessage());
  }
  return new ExecutionResult(true, null);
}
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 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

@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

VifHotPlug(conn, routerName, ip.getBroadcastUri(), ip.getVifMacAddress());
broadcastUriAllocatedToVM.put(ip.getBroadcastUri(), nicPos++);
  vifHotUnPlug(conn, routerName, ip.getVifMacAddress());
  networkUsage(routerIp, "deleteVif", "eth" + nicNum);
origin: apache/cloudstack

if (!broadcastUriAllocatedToVM.containsKey(ip.getBroadcastUri())) {
  VifHotPlug(conn, routerName, ip.getBroadcastUri(), ip.getVifMacAddress());
  broadcastUriAllocatedToVM.put(ip.getBroadcastUri(), nicPos++);
  newNic = true;
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

nic.setMac(ip.getVifMacAddress());
nic.setType(ip.getTrafficType());
if (ip.getBroadcastUri() == null) {
origin: apache/cloudstack

nic.setMac(ip.getVifMacAddress());
nic.setType(ip.getTrafficType());
if (ip.getBroadcastUri() == null) {
com.cloud.agent.api.toIpAddressTOgetVifMacAddress

Popular methods of IpAddressTO

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

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • setContentView (Activity)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Path (java.nio.file)
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • CodeWhisperer alternatives
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