Search in sources :

Example 1 with VmwareDistributedVirtualSwitchVlanIdSpec

use of com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec in project cloudstack by apache.

the class HypervisorHostHelperTest method testIsSpecMatchConfigSpecWithAutoExpandUpdate.

@Test
public void testIsSpecMatchConfigSpecWithAutoExpandUpdate() throws Exception {
    int currentNumPorts = 512;
    int currentvlanId = 100;
    boolean currentAutoExpand = false;
    DVSTrafficShapingPolicy currentTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy currentIsEnabled = new BoolPolicy();
    currentIsEnabled.setValue(true);
    LongPolicy currentAvgBw = new LongPolicy();
    currentAvgBw.setValue(200L);
    LongPolicy currentBurstSize = new LongPolicy();
    currentBurstSize.setValue(400L);
    LongPolicy currentPeakBw = new LongPolicy();
    currentPeakBw.setValue(2000L);
    VMwareDVSPortSetting currentVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec currentVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    currentVlanIdSpec.setVlanId(currentvlanId);
    currentVmwareDvsPortSetting.setVlan(currentVlanIdSpec);
    currentTrafficShapingPolicy.setAverageBandwidth(currentAvgBw);
    currentTrafficShapingPolicy.setBurstSize(currentBurstSize);
    currentTrafficShapingPolicy.setPeakBandwidth(currentPeakBw);
    currentTrafficShapingPolicy.setEnabled(currentIsEnabled);
    currentVmwareDvsPortSetting.setInShapingPolicy(currentTrafficShapingPolicy);
    when(currentDvPortgroupInfo.getNumPorts()).thenReturn(currentNumPorts);
    when(currentDvPortgroupInfo.isAutoExpand()).thenReturn(currentAutoExpand);
    when(currentDvPortgroupInfo.getDefaultPortConfig()).thenReturn(currentVmwareDvsPortSetting);
    int newNumPorts = 256;
    int newvlanId = 100;
    boolean newAutoExpand = true;
    DVSTrafficShapingPolicy newTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy newIsEnabled = new BoolPolicy();
    newIsEnabled.setValue(true);
    LongPolicy newAvgBw = new LongPolicy();
    newAvgBw.setValue(200L);
    LongPolicy newBurstSize = new LongPolicy();
    newBurstSize.setValue(400L);
    LongPolicy newPeakBw = new LongPolicy();
    newPeakBw.setValue(2000L);
    VMwareDVSPortSetting newVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec newVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    newVlanIdSpec.setVlanId(newvlanId);
    newVmwareDvsPortSetting.setVlan(newVlanIdSpec);
    newTrafficShapingPolicy.setAverageBandwidth(newAvgBw);
    newTrafficShapingPolicy.setBurstSize(newBurstSize);
    newTrafficShapingPolicy.setPeakBandwidth(newPeakBw);
    newTrafficShapingPolicy.setEnabled(newIsEnabled);
    newVmwareDvsPortSetting.setInShapingPolicy(newTrafficShapingPolicy);
    when(dvPortgroupConfigSpec.getNumPorts()).thenReturn(newNumPorts);
    when(dvPortgroupConfigSpec.isAutoExpand()).thenReturn(newAutoExpand);
    when(dvPortgroupConfigSpec.getDefaultPortConfig()).thenReturn(newVmwareDvsPortSetting);
    boolean specCompareResult = HypervisorHostHelper.isSpecMatch(currentDvPortgroupInfo, dvPortgroupConfigSpec);
    assertFalse(specCompareResult);
}
Also used : LongPolicy(com.vmware.vim25.LongPolicy) VMwareDVSPortSetting(com.vmware.vim25.VMwareDVSPortSetting) DVSTrafficShapingPolicy(com.vmware.vim25.DVSTrafficShapingPolicy) BoolPolicy(com.vmware.vim25.BoolPolicy) VmwareDistributedVirtualSwitchVlanIdSpec(com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec) Test(org.junit.Test)

Example 2 with VmwareDistributedVirtualSwitchVlanIdSpec

use of com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec in project cloudstack by apache.

the class HypervisorHostHelperTest method testIsSpecMatchConfigSpecWithMoreDvPortsAndAutoExpandDisabled.

@Test
public void testIsSpecMatchConfigSpecWithMoreDvPortsAndAutoExpandDisabled() throws Exception {
    int currentNumPorts = 512;
    int currentvlanId = 100;
    boolean currentAutoExpand = false;
    DVSTrafficShapingPolicy currentTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy currentIsEnabled = new BoolPolicy();
    currentIsEnabled.setValue(true);
    LongPolicy currentAvgBw = new LongPolicy();
    currentAvgBw.setValue(200L);
    LongPolicy currentBurstSize = new LongPolicy();
    currentBurstSize.setValue(400L);
    LongPolicy currentPeakBw = new LongPolicy();
    currentPeakBw.setValue(2000L);
    VMwareDVSPortSetting currentVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec currentVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    currentVlanIdSpec.setVlanId(currentvlanId);
    currentVmwareDvsPortSetting.setVlan(currentVlanIdSpec);
    currentTrafficShapingPolicy.setAverageBandwidth(currentAvgBw);
    currentTrafficShapingPolicy.setBurstSize(currentBurstSize);
    currentTrafficShapingPolicy.setPeakBandwidth(currentPeakBw);
    currentTrafficShapingPolicy.setEnabled(currentIsEnabled);
    currentVmwareDvsPortSetting.setInShapingPolicy(currentTrafficShapingPolicy);
    when(currentDvPortgroupInfo.getNumPorts()).thenReturn(currentNumPorts);
    when(currentDvPortgroupInfo.isAutoExpand()).thenReturn(currentAutoExpand);
    when(currentDvPortgroupInfo.getDefaultPortConfig()).thenReturn(currentVmwareDvsPortSetting);
    int newNumPorts = 256;
    int newvlanId = 100;
    boolean newAutoExpand = false;
    DVSTrafficShapingPolicy newTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy newIsEnabled = new BoolPolicy();
    newIsEnabled.setValue(true);
    LongPolicy newAvgBw = new LongPolicy();
    newAvgBw.setValue(200L);
    LongPolicy newBurstSize = new LongPolicy();
    newBurstSize.setValue(400L);
    LongPolicy newPeakBw = new LongPolicy();
    newPeakBw.setValue(2000L);
    VMwareDVSPortSetting newVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec newVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    newVlanIdSpec.setVlanId(newvlanId);
    newVmwareDvsPortSetting.setVlan(newVlanIdSpec);
    newTrafficShapingPolicy.setAverageBandwidth(newAvgBw);
    newTrafficShapingPolicy.setBurstSize(newBurstSize);
    newTrafficShapingPolicy.setPeakBandwidth(newPeakBw);
    newTrafficShapingPolicy.setEnabled(newIsEnabled);
    newVmwareDvsPortSetting.setInShapingPolicy(newTrafficShapingPolicy);
    when(dvPortgroupConfigSpec.getNumPorts()).thenReturn(newNumPorts);
    when(dvPortgroupConfigSpec.isAutoExpand()).thenReturn(newAutoExpand);
    when(dvPortgroupConfigSpec.getDefaultPortConfig()).thenReturn(newVmwareDvsPortSetting);
    boolean specCompareResult = HypervisorHostHelper.isSpecMatch(currentDvPortgroupInfo, dvPortgroupConfigSpec);
    assertFalse(specCompareResult);
}
Also used : LongPolicy(com.vmware.vim25.LongPolicy) VMwareDVSPortSetting(com.vmware.vim25.VMwareDVSPortSetting) DVSTrafficShapingPolicy(com.vmware.vim25.DVSTrafficShapingPolicy) BoolPolicy(com.vmware.vim25.BoolPolicy) VmwareDistributedVirtualSwitchVlanIdSpec(com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec) Test(org.junit.Test)

Example 3 with VmwareDistributedVirtualSwitchVlanIdSpec

use of com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec in project cloudstack by apache.

the class HypervisorHostHelperTest method testIsSpecMatchConfigSpecWithCurrentShapingPolicyAndNewShapingPolicyDisabled.

@Test
public void testIsSpecMatchConfigSpecWithCurrentShapingPolicyAndNewShapingPolicyDisabled() throws Exception {
    int currentNumPorts = 512;
    int currentvlanId = 100;
    boolean currentAutoExpand = true;
    DVSTrafficShapingPolicy currentTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy currentIsEnabled = new BoolPolicy();
    currentIsEnabled.setValue(false);
    VMwareDVSPortSetting currentVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec currentVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    currentVlanIdSpec.setVlanId(currentvlanId);
    currentVmwareDvsPortSetting.setVlan(currentVlanIdSpec);
    currentTrafficShapingPolicy.setEnabled(currentIsEnabled);
    currentVmwareDvsPortSetting.setInShapingPolicy(currentTrafficShapingPolicy);
    when(currentDvPortgroupInfo.getNumPorts()).thenReturn(currentNumPorts);
    when(currentDvPortgroupInfo.isAutoExpand()).thenReturn(currentAutoExpand);
    when(currentDvPortgroupInfo.getDefaultPortConfig()).thenReturn(currentVmwareDvsPortSetting);
    int newNumPorts = 256;
    int newvlanId = 100;
    boolean newAutoExpand = true;
    DVSTrafficShapingPolicy newTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy newIsEnabled = new BoolPolicy();
    newIsEnabled.setValue(false);
    VMwareDVSPortSetting newVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec newVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    newVlanIdSpec.setVlanId(newvlanId);
    newVmwareDvsPortSetting.setVlan(newVlanIdSpec);
    newTrafficShapingPolicy.setEnabled(newIsEnabled);
    newVmwareDvsPortSetting.setInShapingPolicy(newTrafficShapingPolicy);
    when(dvPortgroupConfigSpec.getNumPorts()).thenReturn(newNumPorts);
    when(dvPortgroupConfigSpec.isAutoExpand()).thenReturn(newAutoExpand);
    when(dvPortgroupConfigSpec.getDefaultPortConfig()).thenReturn(newVmwareDvsPortSetting);
    boolean specCompareResult = HypervisorHostHelper.isSpecMatch(currentDvPortgroupInfo, dvPortgroupConfigSpec);
    assertTrue(specCompareResult);
}
Also used : VMwareDVSPortSetting(com.vmware.vim25.VMwareDVSPortSetting) DVSTrafficShapingPolicy(com.vmware.vim25.DVSTrafficShapingPolicy) BoolPolicy(com.vmware.vim25.BoolPolicy) VmwareDistributedVirtualSwitchVlanIdSpec(com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec) Test(org.junit.Test)

Example 4 with VmwareDistributedVirtualSwitchVlanIdSpec

use of com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec in project cloudstack by apache.

the class HypervisorHostHelperTest method testIsSpecMatchConfigSpecWithHighBandwidthShapingPolicy.

@Test
public void testIsSpecMatchConfigSpecWithHighBandwidthShapingPolicy() throws Exception {
    // Tests case of network offering upgrade in terms of bandwidth
    int currentNumPorts = 256;
    int currentvlanId = 100;
    boolean currentAutoExpand = true;
    DVSTrafficShapingPolicy currentTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy currentIsEnabled = new BoolPolicy();
    currentIsEnabled.setValue(true);
    LongPolicy currentAvgBw = new LongPolicy();
    currentAvgBw.setValue(200L);
    LongPolicy currentBurstSize = new LongPolicy();
    currentBurstSize.setValue(400L);
    LongPolicy currentPeakBw = new LongPolicy();
    currentPeakBw.setValue(2000L);
    VMwareDVSPortSetting currentVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec currentVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    currentVlanIdSpec.setVlanId(currentvlanId);
    currentVmwareDvsPortSetting.setVlan(currentVlanIdSpec);
    currentTrafficShapingPolicy.setAverageBandwidth(currentAvgBw);
    currentTrafficShapingPolicy.setBurstSize(currentBurstSize);
    currentTrafficShapingPolicy.setPeakBandwidth(currentPeakBw);
    currentTrafficShapingPolicy.setEnabled(currentIsEnabled);
    currentVmwareDvsPortSetting.setInShapingPolicy(currentTrafficShapingPolicy);
    when(currentDvPortgroupInfo.getNumPorts()).thenReturn(currentNumPorts);
    when(currentDvPortgroupInfo.isAutoExpand()).thenReturn(currentAutoExpand);
    when(currentDvPortgroupInfo.getDefaultPortConfig()).thenReturn(currentVmwareDvsPortSetting);
    int newNumPorts = 256;
    int newvlanId = 100;
    boolean newAutoExpand = true;
    DVSTrafficShapingPolicy newTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy newIsEnabled = new BoolPolicy();
    newIsEnabled.setValue(true);
    LongPolicy newAvgBw = new LongPolicy();
    newAvgBw.setValue(400L);
    LongPolicy newBurstSize = new LongPolicy();
    newBurstSize.setValue(800L);
    LongPolicy newPeakBw = new LongPolicy();
    newPeakBw.setValue(4000L);
    VMwareDVSPortSetting newVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec newVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    newVlanIdSpec.setVlanId(newvlanId);
    newVmwareDvsPortSetting.setVlan(newVlanIdSpec);
    newTrafficShapingPolicy.setAverageBandwidth(newAvgBw);
    newTrafficShapingPolicy.setBurstSize(newBurstSize);
    newTrafficShapingPolicy.setPeakBandwidth(newPeakBw);
    newTrafficShapingPolicy.setEnabled(newIsEnabled);
    newVmwareDvsPortSetting.setInShapingPolicy(newTrafficShapingPolicy);
    when(dvPortgroupConfigSpec.getNumPorts()).thenReturn(newNumPorts);
    when(dvPortgroupConfigSpec.isAutoExpand()).thenReturn(newAutoExpand);
    when(dvPortgroupConfigSpec.getDefaultPortConfig()).thenReturn(newVmwareDvsPortSetting);
    boolean specCompareResult = HypervisorHostHelper.isSpecMatch(currentDvPortgroupInfo, dvPortgroupConfigSpec);
    assertFalse(specCompareResult);
}
Also used : LongPolicy(com.vmware.vim25.LongPolicy) VMwareDVSPortSetting(com.vmware.vim25.VMwareDVSPortSetting) DVSTrafficShapingPolicy(com.vmware.vim25.DVSTrafficShapingPolicy) BoolPolicy(com.vmware.vim25.BoolPolicy) VmwareDistributedVirtualSwitchVlanIdSpec(com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec) Test(org.junit.Test)

Example 5 with VmwareDistributedVirtualSwitchVlanIdSpec

use of com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec in project cloudstack by apache.

the class HypervisorHostHelperTest method testIsSpecMatch.

@Test
public void testIsSpecMatch() throws Exception {
    int currentNumPorts = 256;
    int currentvlanId = 100;
    boolean currentAutoExpand = true;
    DVSTrafficShapingPolicy currentTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy currentIsEnabled = new BoolPolicy();
    currentIsEnabled.setValue(true);
    LongPolicy currentAvgBw = new LongPolicy();
    currentAvgBw.setValue(200L);
    LongPolicy currentBurstSize = new LongPolicy();
    currentBurstSize.setValue(400L);
    LongPolicy currentPeakBw = new LongPolicy();
    currentPeakBw.setValue(2000L);
    VMwareDVSPortSetting currentVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec currentVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    currentVlanIdSpec.setVlanId(currentvlanId);
    currentVmwareDvsPortSetting.setVlan(currentVlanIdSpec);
    currentTrafficShapingPolicy.setAverageBandwidth(currentAvgBw);
    currentTrafficShapingPolicy.setBurstSize(currentBurstSize);
    currentTrafficShapingPolicy.setPeakBandwidth(currentPeakBw);
    currentTrafficShapingPolicy.setEnabled(currentIsEnabled);
    currentVmwareDvsPortSetting.setInShapingPolicy(currentTrafficShapingPolicy);
    when(currentDvPortgroupInfo.getNumPorts()).thenReturn(currentNumPorts);
    when(currentDvPortgroupInfo.isAutoExpand()).thenReturn(currentAutoExpand);
    when(currentDvPortgroupInfo.getDefaultPortConfig()).thenReturn(currentVmwareDvsPortSetting);
    int newNumPorts = 256;
    int newvlanId = 100;
    boolean newAutoExpand = true;
    DVSTrafficShapingPolicy newTrafficShapingPolicy = new DVSTrafficShapingPolicy();
    BoolPolicy newIsEnabled = new BoolPolicy();
    newIsEnabled.setValue(true);
    LongPolicy newAvgBw = new LongPolicy();
    newAvgBw.setValue(200L);
    LongPolicy newBurstSize = new LongPolicy();
    newBurstSize.setValue(400L);
    LongPolicy newPeakBw = new LongPolicy();
    newPeakBw.setValue(2000L);
    VMwareDVSPortSetting newVmwareDvsPortSetting = new VMwareDVSPortSetting();
    VmwareDistributedVirtualSwitchVlanIdSpec newVlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
    newVlanIdSpec.setVlanId(newvlanId);
    newVmwareDvsPortSetting.setVlan(newVlanIdSpec);
    newTrafficShapingPolicy.setAverageBandwidth(newAvgBw);
    newTrafficShapingPolicy.setBurstSize(newBurstSize);
    newTrafficShapingPolicy.setPeakBandwidth(newPeakBw);
    newTrafficShapingPolicy.setEnabled(newIsEnabled);
    newVmwareDvsPortSetting.setInShapingPolicy(newTrafficShapingPolicy);
    when(dvPortgroupConfigSpec.getNumPorts()).thenReturn(newNumPorts);
    when(dvPortgroupConfigSpec.isAutoExpand()).thenReturn(newAutoExpand);
    when(dvPortgroupConfigSpec.getDefaultPortConfig()).thenReturn(newVmwareDvsPortSetting);
    boolean specCompareResult = HypervisorHostHelper.isSpecMatch(currentDvPortgroupInfo, dvPortgroupConfigSpec);
    assertTrue(specCompareResult);
}
Also used : LongPolicy(com.vmware.vim25.LongPolicy) VMwareDVSPortSetting(com.vmware.vim25.VMwareDVSPortSetting) DVSTrafficShapingPolicy(com.vmware.vim25.DVSTrafficShapingPolicy) BoolPolicy(com.vmware.vim25.BoolPolicy) VmwareDistributedVirtualSwitchVlanIdSpec(com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec) Test(org.junit.Test)

Aggregations

VmwareDistributedVirtualSwitchVlanIdSpec (com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec)10 BoolPolicy (com.vmware.vim25.BoolPolicy)9 DVSTrafficShapingPolicy (com.vmware.vim25.DVSTrafficShapingPolicy)8 VMwareDVSPortSetting (com.vmware.vim25.VMwareDVSPortSetting)8 LongPolicy (com.vmware.vim25.LongPolicy)7 Test (org.junit.Test)7 NicTO (com.cloud.agent.api.to.NicTO)1 CloudException (com.cloud.exception.CloudException)1 InternalErrorException (com.cloud.exception.InternalErrorException)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 DVPortConfigInfo (com.vmware.vim25.DVPortConfigInfo)1 DVPortConfigSpec (com.vmware.vim25.DVPortConfigSpec)1 DistributedVirtualPort (com.vmware.vim25.DistributedVirtualPort)1 DistributedVirtualSwitchPortConnection (com.vmware.vim25.DistributedVirtualSwitchPortConnection)1 DistributedVirtualSwitchPortCriteria (com.vmware.vim25.DistributedVirtualSwitchPortCriteria)1 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)1 VirtualDevice (com.vmware.vim25.VirtualDevice)1 VirtualDeviceBackingInfo (com.vmware.vim25.VirtualDeviceBackingInfo)1 VirtualEthernetCardDistributedVirtualPortBackingInfo (com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo)1 VirtualEthernetCardNetworkBackingInfo (com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo)1