use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class AddVmNicFilterParameterCommand method executeVmCommand.
@Override
protected void executeVmCommand() {
super.executeVmCommand();
VmNicFilterParameter filterParameter = getParameters().getFilterParameter();
filterParameter.setId(Guid.newGuid());
vmNicFilterParameterDao.save(filterParameter);
getReturnValue().setActionReturnValue(filterParameter.getId());
setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class VmNicFilterParameterAnnotationTest method runTest.
@Test
public void runTest() {
VmNicFilterParameter vmNicFilterParameter = new VmNicFilterParameter();
vmNicFilterParameter.setName(name);
vmNicFilterParameter.setValue(value);
vmNicFilterParameter.setVmInterfaceId(vmInterfaceId);
Set<ConstraintViolation<VmNicFilterParameter>> violations = validator.validate(vmNicFilterParameter, VALIDATE_GROUPS);
boolean expectViolations = expectedErrorMessage != null;
assertTrue(expectViolations != violations.isEmpty());
if (expectViolations) {
assertEquals(expectedErrorMessage, violations.iterator().next().getMessage());
}
}
use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class VmNicFilterParameterDaoTest method generateNewEntity.
@Override
protected VmNicFilterParameter generateNewEntity() {
VmNicFilterParameter parameter = new VmNicFilterParameter();
parameter.setId(Guid.newGuid());
parameter.setName("IP");
parameter.setValue("192.168.122.2");
parameter.setVmInterfaceId(FixturesTool.VM_NETWORK_INTERFACE);
return parameter;
}
use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class VmNicFilterParameterDaoTest method testGetAllForVmNic.
/**
* Ensures that the returned network filter parameters are associated to the network interface.
*/
@Test
public void testGetAllForVmNic() {
List<VmNicFilterParameter> result = dao.getAllForVmNic(FixturesTool.VM_NETWORK_INTERFACE);
assertNotNull(result);
assertEquals(FixturesTool.NUMBER_OF_VM_NETWORK_FILTER_PARAMETERS_OF_VM_NETWORK_INTERFACE, result.size());
for (VmNicFilterParameter parameter : result) {
assertEquals(FixturesTool.VM_NETWORK_INTERFACE, parameter.getVmInterfaceId());
}
}
use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class BackendVmNicFilterParametersResource method add.
@Override
public Response add(NetworkFilterParameter parameter) {
validateParameters(parameter, "value");
VmNicFilterParameter vmNicFilterParameter = map(parameter);
vmNicFilterParameter.setVmInterfaceId(nicId);
return performCreate(ActionType.AddVmNicFilterParameter, new VmNicFilterParameterParameters(vmId, vmNicFilterParameter), new NicNetworkFilterParameterResolver(parameter.getName()));
}
Aggregations