use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class BaseNetworkImplementationDetailsUtilsTest method initMocksForNetworkImplementationDetailsUtils.
private NetworkImplementationDetailsUtils initMocksForNetworkImplementationDetailsUtils(Network network, HostNetworkQos qos, VdsNetworkInterface testIface) {
final VdsNetworkInterface baseIface = this.calculateBaseNic.getBaseNic(testIface);
Guid baseIfaceId = baseIface.getId();
Guid networkId = network == null ? null : network.getId();
if (baseIfaceId != null && networkId != null) {
when(networkAttachmentDaoMock.getNetworkAttachmentByNicIdAndNetworkId(eq(baseIfaceId), eq(networkId))).thenReturn(createNetworkAttachment(qos, baseIface));
}
return this.networkImplementationDetailsUtils;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class BaseNetworkImplementationDetailsUtilsTest method createBaseInterface.
protected VdsNetworkInterface createBaseInterface(HostNetworkQos qos, String networkName) {
VdsNetworkInterface baseInterface = new VdsNetworkInterface();
baseInterface.setId(Guid.newGuid());
baseInterface.setNetworkName(networkName);
baseInterface.setName("eth");
baseInterface.setQos(qos);
baseInterface.setVdsId(VDS_ID);
return baseInterface;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class CalculateBaseNicTest method testGetBaseNicUsingCacheNotHavingRequiredRecord.
@Test
public void testGetBaseNicUsingCacheNotHavingRequiredRecord() throws Exception {
when(interfaceDao.get(baseNic.getVdsId(), baseNic.getName())).thenReturn(baseNic);
Map<String, VdsNetworkInterface> cachedExistingInterfaces = Collections.singletonMap("unrelatedNicName", new VdsNetworkInterface());
assertThat(calculateBaseNic.getBaseNic(vlanNic, cachedExistingInterfaces), is(baseNic));
verify(interfaceDao).get(eq(baseNic.getVdsId()), eq(baseNic.getName()));
verifyNoMoreInteractions(interfaceDao);
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class CalculateBaseNicTest method createVlanNic.
private VdsNetworkInterface createVlanNic(VdsNetworkInterface baseNic) {
VdsNetworkInterface vlanNic = createNic("vlanNic");
vlanNic.setBaseInterface(baseNic.getName());
vlanNic.setVlanId(100);
vlanNic.setVdsId(baseNic.getVdsId());
return vlanNic;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method getBondNameToSlaves.
private Map<String, List<VdsNetworkInterface>> getBondNameToSlaves() {
final Map<String, VdsNetworkInterface> nicMap = Entities.entitiesByName(allExistingNics);
Map<String, List<VdsNetworkInterface>> bondToSlaves = new HashMap<>();
for (CreateOrUpdateBond createOrUpdateBond : hostSetupNetworksParametersData.getBonds()) {
String bondName = createOrUpdateBond.getName();
// $NON-NLS-1$
assert !bondToSlaves.containsKey(bondName) : "the same bond shouldn't exist twice in the parameters";
bondToSlaves.put(bondName, new ArrayList<VdsNetworkInterface>());
Set<String> slavesNames = createOrUpdateBond.getSlaves();
for (String slaveName : slavesNames) {
bondToSlaves.get(bondName).add(nicMap.get(slaveName));
}
}
return bondToSlaves;
}
Aggregations