Package com.vmware.vim25

Examples of com.vmware.vim25.HostPortGroupSpec


  public void updatePortGroup(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.updatePortGroup(portGroupName, spec);
  }
View Full Code Here


        } else {
            if (!hostMo.hasPortGroup(vSwitch, networkName)) {
                hostMo.createPortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
                bWaitPortGroupReady = true;
            } else {
                HostPortGroupSpec spec = hostMo.getPortGroupSpec(networkName);
                if(!isSpecMatch(spec, vid, shapingPolicy)) {
                    hostMo.updatePortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
                    bWaitPortGroupReady = true;
                }
            }
View Full Code Here

        String vSwitchName = vSwitch.getName();

        // Find all vlanids that we have in use
        List<Integer> usedVlans = new ArrayList<Integer>();
        for (HostPortGroup pg : hostMo.getHostNetworkInfo().getPortgroup()) {
            HostPortGroupSpec hpgs = pg.getSpec();
            if (vSwitchName.equals(hpgs.getVswitchName()))
                usedVlans.add(hpgs.getVlanId());
        }

        // Find the first free vlanid
        int nvpVlanId = 0;
        for (nvpVlanId = 1; nvpVlanId < 4095; nvpVlanId++) {
View Full Code Here

        assert (vmMo != null);
        assert (hostMo != null);

        String[] networks = vmMo.getNetworks();
        for (String networkName : networks) {
            HostPortGroupSpec portGroupSpec = hostMo.getHostPortGroupSpec(networkName);
            HostNetworkTrafficShapingPolicy shapingPolicy = null;
            if (portGroupSpec != null) {
                shapingPolicy = portGroupSpec.getPolicy().getShapingPolicy();
            }

            if (networkName.startsWith("cloud.private")) {
                String[] tokens = networkName.split("\\.");
                if (tokens.length == 3) {
View Full Code Here

        boolean bWaitPortGroupReady = false;
        if (!hostMo.hasPortGroup(vSwitch, networkName)) {
            hostMo.createPortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
            bWaitPortGroupReady = true;
        } else {
            HostPortGroupSpec spec = hostMo.getPortGroupSpec(networkName);
            if(!isSpecMatch(spec, vid, shapingPolicy)) {
                hostMo.updatePortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
                bWaitPortGroupReady = true;
            }
        }
View Full Code Here

        assert (vmMo != null);
        assert (hostMo != null);

        String[] networks = vmMo.getNetworks();
        for (String networkName : networks) {
            HostPortGroupSpec portGroupSpec = hostMo.getHostPortGroupSpec(networkName);
            HostNetworkTrafficShapingPolicy shapingPolicy = null;
            if (portGroupSpec != null) {
                shapingPolicy = portGroupSpec.getPolicy().getShapingPolicy();
            }

            if (networkName.startsWith("cloud.private")) {
                String[] tokens = networkName.split("\\.");
                if (tokens.length == 3) {
View Full Code Here

    HostVirtualSwitchSpec spec = new HostVirtualSwitchSpec();
    spec.setNumPorts(8);
    hns.addVirtualSwitch(switchName, spec);
   
    // add a port group
    HostPortGroupSpec hpgs = new HostPortGroupSpec();
    hpgs.setName(portGroupName);
    hpgs.setVlanId(0); // not associated with a VLAN
    hpgs.setVswitchName(switchName);
    hpgs.setPolicy(new HostNetworkPolicy());
    hns.addPortGroup(hpgs);
   
    // add a virtual NIC to VMKernel
    HostVirtualNicSpec hvns = new HostVirtualNicSpec();
    hvns.setMac("00:50:56:7d:5e:0b");
View Full Code Here

    HostVirtualSwitchSpec spec = new HostVirtualSwitchSpec();
    spec.setNumPorts(8);
    hns.addVirtualSwitch(switchName, spec);
   
    // add a port group
    HostPortGroupSpec hpgs = new HostPortGroupSpec();
    hpgs.setName(portGroupName);
    hpgs.setVlanId(0); // not associated with a VLAN
    hpgs.setVswitchName(switchName);
    hpgs.setPolicy(new HostNetworkPolicy());
    hns.addPortGroup(hpgs);
   
    // add a virtual NIC to VMKernel
    HostVirtualNicSpec hvns = new HostVirtualNicSpec();
    hvns.setMac("00:50:56:7d:5e:0b");
View Full Code Here

        boolean bWaitPortGroupReady = false;
        if (!hostMo.hasPortGroup(vSwitch, networkName)) {
            hostMo.createPortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
            bWaitPortGroupReady = true;
        } else {
            HostPortGroupSpec spec = hostMo.getPortGroupSpec(networkName);
            if(!isSpecMatch(spec, vid, shapingPolicy)) {
                hostMo.updatePortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
                bWaitPortGroupReady = true;
            }
        }
View Full Code Here

                return node.getSnapshot();
            } else {
                VirtualMachineSnapshotTree[] childTree =
                    node.getChildSnapshotList();
                if (childTree != null) {
                    ManagedObjectReference mor =
                        findSnapshotInTree(childTree, snapName);
                    if (mor != null) { return mor; }
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.vmware.vim25.HostPortGroupSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.