use of com.vmware.vim25.HostPortGroupSpec 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;
}
use of com.vmware.vim25.HostPortGroupSpec in project cloudstack by apache.
the class HostMO method createPortGroup.
public void createPortGroup(HostVirtualSwitch vSwitch, String portGroupName, Integer vlanId, HostNetworkSecurityPolicy secPolicy, HostNetworkTrafficShapingPolicy shapingPolicy) throws Exception {
assert (portGroupName != null);
HostNetworkSystemMO hostNetMo = getHostNetworkSystemMO();
assert (hostNetMo != null);
HostPortGroupSpec spec = new HostPortGroupSpec();
spec.setName(portGroupName);
if (vlanId != null)
spec.setVlanId(vlanId.intValue());
HostNetworkPolicy policy = new HostNetworkPolicy();
if (secPolicy != null)
policy.setSecurity(secPolicy);
policy.setShapingPolicy(shapingPolicy);
spec.setPolicy(policy);
spec.setVswitchName(vSwitch.getName());
hostNetMo.addPortGroup(spec);
}
use of com.vmware.vim25.HostPortGroupSpec in project cloudstack by apache.
the class HostMO method getPortGroupVirtualSwitchName.
public String getPortGroupVirtualSwitchName(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.getVswitchName();
}
}
return null;
}
Aggregations