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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations