Search in sources :

Example 1 with VmNicFilterParameter

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);
}
Also used : VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)

Example 2 with VmNicFilterParameter

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());
    }
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter) Test(org.junit.Test)

Example 3 with VmNicFilterParameter

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;
}
Also used : VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)

Example 4 with VmNicFilterParameter

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());
    }
}
Also used : VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter) Test(org.junit.Test)

Example 5 with VmNicFilterParameter

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()));
}
Also used : VmNicFilterParameterParameters(org.ovirt.engine.core.common.action.VmNicFilterParameterParameters) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)

Aggregations

VmNicFilterParameter (org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)14 ArrayList (java.util.ArrayList)3 VmNicFilterParameterParameters (org.ovirt.engine.core.common.action.VmNicFilterParameterParameters)3 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)3 List (java.util.List)2 Test (org.junit.Test)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)2 Scheduler (com.google.gwt.core.client.Scheduler)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Objects (java.util.Objects)1 ConstraintViolation (javax.validation.ConstraintViolation)1 Before (org.junit.Before)1 NetworkFilterParameter (org.ovirt.engine.api.model.NetworkFilterParameter)1 NetworkFilterParameters (org.ovirt.engine.api.model.NetworkFilterParameters)1 ActionUtils (org.ovirt.engine.core.common.ActionUtils)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 RemoveVmNicFilterParameterParameters (org.ovirt.engine.core.common.action.RemoveVmNicFilterParameterParameters)1