use of org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext in project ovirt-engine by oVirt.
the class MatchUserMappingToOvfVnicTest method testFindMappingEntry.
@Test
public void testFindMappingEntry() {
VmNetworkInterface vnic = new VmNetworkInterface();
vnic.setNetworkName(NETWORK_NAME);
vnic.setVnicProfileName(VNIC_PROFILE1_NAME);
MapVnicsContext ctx = new MapVnicsContext();
ctx.setUserMappings(externalVnicProfileMappings);
ctx.setOvfVnics(singletonList(vnic));
underTest.handle(ctx);
assertThat(ctx.getMatched().get(vnic), sameInstance(externalVnicProfileMapping1));
}
use of org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext in project ovirt-engine by oVirt.
the class MatchUserMappingToOvfVnicTest method testFindMappingEntryEmptyExternal.
@Test
public void testFindMappingEntryEmptyExternal() {
VmNetworkInterface vnic = new VmNetworkInterface();
vnic.setNetworkName(NETWORK_NAME);
vnic.setVnicProfileName(VNIC_PROFILE1_NAME);
MapVnicsContext ctx = new MapVnicsContext();
ctx.setUserMappings(singletonList(emptySourceMapping));
ctx.setOvfVnics(singletonList(vnic));
underTest.handle(ctx);
assertEquals(null, ctx.getMatched().get(vnic));
}
use of org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext in project ovirt-engine by oVirt.
the class MatchUserMappingToOvfVnicTest method testFindMappingEntryEmptyInput.
@Test
public void testFindMappingEntryEmptyInput() {
VmNetworkInterface vnic = new VmNetworkInterface();
MapVnicsContext ctx = new MapVnicsContext();
ctx.setUserMappings(emptyList());
ctx.setOvfVnics(singletonList(vnic));
underTest.handle(ctx);
assertEquals(1, ctx.getMatched().size());
assertEquals(null, ctx.getMatched().get(vnic));
}
use of org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext in project ovirt-engine by oVirt.
the class DrMappingHelper method updateVnicsFromMappings.
public List<String> updateVnicsFromMappings(Guid clusterId, String vmName, List<VmNetworkInterface> vnics, Collection<ExternalVnicProfileMapping> mappings) {
MapVnicsContext ctx = new MapVnicsContext("updateVnicsFromMappings").setClusterId(clusterId).setVmName(vmName).setOvfVnics(vnics).setUserMappings(mappings);
mapVnicsFlow.getHead().process(ctx);
return !CollectionUtils.isEmpty(ctx.getNonAssociableVnics()) ? ctx.getNonAssociableVnics() : Collections.emptyList();
}
use of org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext in project ovirt-engine by oVirt.
the class MatchUserMappingToOvfVnicTest method testFindMappingEntryEmptySourceVnicProfile.
@Test
public void testFindMappingEntryEmptySourceVnicProfile() {
VmNetworkInterface vnic = new VmNetworkInterface();
vnic.setNetworkName(null);
vnic.setVnicProfileName(null);
MapVnicsContext ctx = new MapVnicsContext();
ctx.setUserMappings(singletonList(emptySourceMapping));
ctx.setOvfVnics(singletonList(vnic));
underTest.handle(ctx);
assertThat(ctx.getMatched().get(vnic), sameInstance(emptySourceMapping));
}
Aggregations