Search in sources :

Example 11 with HostPortGroupSpec

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;
}
Also used : HostNetworkInfo(com.vmware.vim25.HostNetworkInfo) HostPortGroup(com.vmware.vim25.HostPortGroup) HostPortGroupSpec(com.vmware.vim25.HostPortGroupSpec)

Example 12 with HostPortGroupSpec

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);
}
Also used : HostNetworkPolicy(com.vmware.vim25.HostNetworkPolicy) HostPortGroupSpec(com.vmware.vim25.HostPortGroupSpec)

Example 13 with HostPortGroupSpec

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;
}
Also used : HostNetworkInfo(com.vmware.vim25.HostNetworkInfo) HostPortGroup(com.vmware.vim25.HostPortGroup) HostPortGroupSpec(com.vmware.vim25.HostPortGroupSpec)

Aggregations

HostPortGroupSpec (com.vmware.vim25.HostPortGroupSpec)13 HostPortGroup (com.vmware.vim25.HostPortGroup)7 HostNetworkInfo (com.vmware.vim25.HostNetworkInfo)6 HostNetworkPolicy (com.vmware.vim25.HostNetworkPolicy)4 Pair (com.cloud.utils.Pair)2 GlobalLock (com.cloud.utils.db.GlobalLock)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 HostNetworkSecurityPolicy (com.vmware.vim25.HostNetworkSecurityPolicy)2 HostNetworkTrafficShapingPolicy (com.vmware.vim25.HostNetworkTrafficShapingPolicy)2 HostVirtualSwitch (com.vmware.vim25.HostVirtualSwitch)2 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)2 URISyntaxException (java.net.URISyntaxException)2 InvalidParameterException (java.security.InvalidParameterException)2 CloudException (com.cloud.exception.CloudException)1 BroadcastDomainType (com.cloud.network.Networks.BroadcastDomainType)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 TransformerException (javax.xml.transform.TransformerException)1 SAXException (org.xml.sax.SAXException)1