use of com.vmware.vim25.HostNetworkInfo in project CloudStack-archive by CloudStack-extras.
the class HostMO method getPortGroupNameByNicType.
public String getPortGroupNameByNicType(HostVirtualNicType nicType) throws Exception {
assert (nicType != null);
VirtualNicManagerNetConfig[] netConfigs = (VirtualNicManagerNetConfig[]) _context.getServiceUtil().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
if (netConfigs != null) {
for (VirtualNicManagerNetConfig netConfig : netConfigs) {
if (netConfig.getNicType().equals(nicType.toString())) {
HostVirtualNic[] nics = netConfig.getCandidateVnic();
if (nics != null) {
for (HostVirtualNic nic : nics) {
return nic.getPortgroup();
}
}
}
}
}
if (nicType == HostVirtualNicType.management) {
// ESX management network is configured in service console
HostNetworkInfo netInfo = getHostNetworkInfo();
assert (netInfo != null);
HostVirtualNic[] nics = netInfo.getConsoleVnic();
if (nics != null) {
for (HostVirtualNic nic : nics) {
return nic.getPortgroup();
}
}
}
return null;
}
use of com.vmware.vim25.HostNetworkInfo in project CloudStack-archive by CloudStack-extras.
the class HostMO method getPortGroupSpec.
public HostPortGroupSpec getPortGroupSpec(String portGroupName) throws Exception {
HostNetworkInfo hostNetInfo = getHostNetworkInfo();
HostPortGroup[] portGroups = hostNetInfo.getPortgroup();
if (portGroups != null) {
for (HostPortGroup portGroup : portGroups) {
HostPortGroupSpec spec = portGroup.getSpec();
if (spec.getName().equals(portGroupName))
return spec;
}
}
return null;
}
use of com.vmware.vim25.HostNetworkInfo in project opennms by OpenNMS.
the class VmwareViJavaAccess method getHostSystemIpAddresses.
/**
* Searches for all ip addresses of a host system
*
* @param hostSystem the host system to query
* @return the ip addresses of the host system, the first one is the primary
* @throws RemoteException
*/
public TreeSet<String> getHostSystemIpAddresses(HostSystem hostSystem) throws RemoteException {
TreeSet<String> ipAddresses = new TreeSet<String>();
HostNetworkSystem hostNetworkSystem = hostSystem.getHostNetworkSystem();
if (hostNetworkSystem != null) {
HostNetworkInfo hostNetworkInfo = hostNetworkSystem.getNetworkInfo();
if (hostNetworkInfo != null) {
HostVirtualNic[] hostVirtualNics = hostNetworkInfo.getConsoleVnic();
if (hostVirtualNics != null) {
for (HostVirtualNic hostVirtualNic : hostVirtualNics) {
ipAddresses.add(hostVirtualNic.getSpec().getIp().getIpAddress());
}
}
hostVirtualNics = hostNetworkInfo.getVnic();
if (hostVirtualNics != null) {
for (HostVirtualNic hostVirtualNic : hostVirtualNics) {
ipAddresses.add(hostVirtualNic.getSpec().getIp().getIpAddress());
}
}
}
}
return ipAddresses;
}
use of com.vmware.vim25.HostNetworkInfo in project cloudstack by apache.
the class HostMO method getPortGroupNameByNicType.
public String getPortGroupNameByNicType(HostVirtualNicType nicType) throws Exception {
assert (nicType != null);
List<VirtualNicManagerNetConfig> netConfigs = _context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
if (netConfigs != null) {
for (VirtualNicManagerNetConfig netConfig : netConfigs) {
if (netConfig.getNicType().equals(nicType.toString())) {
List<HostVirtualNic> nics = netConfig.getCandidateVnic();
if (nics != null) {
for (HostVirtualNic nic : nics) {
return nic.getPortgroup();
}
}
}
}
}
if (nicType == HostVirtualNicType.management) {
// ESX management network is configured in service console
HostNetworkInfo netInfo = getHostNetworkInfo();
assert (netInfo != null);
List<HostVirtualNic> nics = netInfo.getConsoleVnic();
if (nics != null) {
for (HostVirtualNic nic : nics) {
return nic.getPortgroup();
}
}
}
return null;
}
use of com.vmware.vim25.HostNetworkInfo in project cloudstack by apache.
the class HostMO method getPortGroupSpec.
public HostPortGroupSpec getPortGroupSpec(String portGroupName) throws Exception {
HostNetworkInfo hostNetInfo = getHostNetworkInfo();
List<HostPortGroup> portGroups = hostNetInfo.getPortgroup();
if (portGroups != null) {
for (HostPortGroup portGroup : portGroups) {
HostPortGroupSpec spec = portGroup.getSpec();
if (spec.getName().equals(portGroupName))
return spec;
}
}
return null;
}
Aggregations