use of org.ovirt.engine.core.common.businessentities.MacRange in project ovirt-engine by oVirt.
the class MacPoolModel method init.
protected void init() {
if (getEntity() == null) {
return;
}
allowDuplicates.setEntity(getEntity().isAllowDuplicateMacAddresses());
List<MacRangeModel> rangeModels = new ArrayList<>();
for (MacRange range : getEntity().getRanges()) {
rangeModels.add(new MacRangeModel(range));
}
Collections.sort(rangeModels, Comparator.comparing((MacRangeModel m) -> m.getLeftBound().getEntity()).thenComparing(m -> m.getRightBound().getEntity()));
macRanges.setItems(rangeModels);
}
use of org.ovirt.engine.core.common.businessentities.MacRange in project ovirt-engine by oVirt.
the class MacPoolDaoTest method generateNewEntity.
@Override
protected MacPool generateNewEntity() {
final MacPool macPool = new MacPool();
macPool.setId(Guid.newGuid());
macPool.setName("someName");
macPool.setAllowDuplicateMacAddresses(true);
macPool.setDescription("someDesc");
macPool.setDefaultPool(false);
final MacRange macRange = new MacRange();
macRange.setMacPoolId(macPool.getId());
macRange.setMacFrom("01:c0:81:21:71:17");
macRange.setMacTo("01:c1:81:21:71:17");
macPool.getRanges().add(macRange);
return macPool;
}
use of org.ovirt.engine.core.common.businessentities.MacRange in project ovirt-engine by oVirt.
the class MacPoolDaoImpl method update.
@Override
public void update(MacPool entity) {
super.update(entity);
// If ranges definition is also sent, update them as well.
if (entity.getRanges() != null && !entity.getRanges().isEmpty()) {
deleteAllRangesForMacPool(entity.getId());
for (MacRange macRange : entity.getRanges()) {
macRange.setMacPoolId(entity.getId());
saveRange(macRange);
}
}
}
use of org.ovirt.engine.core.common.businessentities.MacRange in project ovirt-engine by oVirt.
the class MacPoolMapper method mapRange.
private static MacRange mapRange(org.ovirt.engine.api.model.Range range) {
final MacRange result = new MacRange();
result.setMacFrom(range.getFrom());
result.setMacTo(range.getTo());
return result;
}
Aggregations