Java Code Examples for com.vmware.vim25.VirtualEthernetCard#setAddressType()

The following examples show how to use com.vmware.vim25.VirtualEthernetCard#setAddressType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VmwareHelper.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
public static VirtualDevice prepareNicOpaque(VirtualMachineMO vmMo, VirtualEthernetCardType deviceType, String portGroupName,
        String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {

    assert(vmMo.getRunningHost().hasOpaqueNSXNetwork());

    VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);

    VirtualEthernetCardOpaqueNetworkBackingInfo nicBacking = new VirtualEthernetCardOpaqueNetworkBackingInfo();
    nicBacking.setOpaqueNetworkId("br-int");
    nicBacking.setOpaqueNetworkType("nsx.network");

    nic.setBacking(nicBacking);

    nic.setAddressType("Manual");
    nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
    nic.setMacAddress(macAddress);
    nic.setKey(-contextNumber);
    return nic;
}
 
Example 2
Source File: VmwareHelper.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String portGroupName,
        String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {

    VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);

    VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
    nicBacking.setDeviceName(portGroupName);
    nicBacking.setNetwork(morNetwork);
    nic.setBacking(nicBacking);

    nic.setAddressType("Manual");
    nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
    nic.setMacAddress(macAddress);
    nic.setKey(-contextNumber);
    return nic;
}
 
Example 3
Source File: VmwareHelper.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
public static VirtualDevice prepareDvNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String dvPortGroupName,
        String dvSwitchUuid, String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {

    VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);

    final VirtualEthernetCardDistributedVirtualPortBackingInfo dvPortBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo();
    final DistributedVirtualSwitchPortConnection dvPortConnection = new DistributedVirtualSwitchPortConnection();

    dvPortConnection.setSwitchUuid(dvSwitchUuid);
    dvPortConnection.setPortgroupKey(morNetwork.getValue());
    dvPortBacking.setPort(dvPortConnection);
    nic.setBacking(dvPortBacking);

    nic.setAddressType("Manual");
    nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
    nic.setMacAddress(macAddress);
    nic.setKey(-contextNumber);
    return nic;
}
 
Example 4
Source File: VmUtils.java    From cs-actions with Apache License 2.0 5 votes vote down vote up
private VirtualEthernetCard getEth(String fileName, String addressType, Integer key) {
    VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
    nicBacking.setDeviceName(fileName);

    VirtualEthernetCard nic = new VirtualPCNet32();
    nic.setBacking(nicBacking);
    nic.setAddressType(addressType);
    nic.setKey(key);

    return nic;
}