Search in sources :

Example 6 with VmNicFilterParameter

use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.

the class BackendVmNicFilterParametersResource method list.

@Override
public NetworkFilterParameters list() {
    NetworkFilterParameters parameters = new NetworkFilterParameters();
    List<VmNicFilterParameter> entities = getBackendCollection(QueryType.GetVmInterfaceFilterParametersByVmInterfaceId, new IdQueryParameters(nicId));
    for (VmNicFilterParameter entity : entities) {
        NetworkFilterParameter parameter = populate(map(entity), entity);
        parameters.getNetworkFilterParameters().add(addLinks(parameter));
    }
    return parameters;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) NetworkFilterParameters(org.ovirt.engine.api.model.NetworkFilterParameters) NetworkFilterParameter(org.ovirt.engine.api.model.NetworkFilterParameter) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)

Example 7 with VmNicFilterParameter

use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.

the class VmInfoBuildUtils method addNetworkFiltersToNic.

public void addNetworkFiltersToNic(Map<String, Object> struct, VmNic vmNic) {
    final NetworkFilter networkFilter = fetchVnicProfileNetworkFilter(vmNic);
    if (networkFilter != null) {
        final String networkFilterName = networkFilter.getName();
        struct.put(VdsProperties.NW_FILTER, networkFilterName);
        final List<VmNicFilterParameter> vmNicFilterParameters = getAllNetworkFiltersForVmNic(vmNic.getId());
        struct.put(VdsProperties.NETWORK_FILTER_PARAMETERS, mapVmNicFilterParameter(vmNicFilterParameters));
    }
}
Also used : NetworkFilter(org.ovirt.engine.core.common.businessentities.network.NetworkFilter) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)

Example 8 with VmNicFilterParameter

use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.

the class VmNicFilterParameterValidatorTest method setUp.

@Before
public void setUp() {
    validator = new VmNicFilterParameterValidator(vmNicFilterParameterDao, vmNicDao);
    VmNetworkInterface vmNetworkInterface = new VmNetworkInterface();
    vmNetworkInterface.setVmId(usedId);
    when(vmNicDao.get(usedId)).thenReturn(vmNetworkInterface);
    when(vmNicFilterParameterDao.get(usedId)).thenReturn(new VmNicFilterParameter());
    when(vmDao.get(usedId)).thenReturn(new VM());
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VM(org.ovirt.engine.core.common.businessentities.VM) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter) Before(org.junit.Before)

Example 9 with VmNicFilterParameter

use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.

the class VmInfoBuildUtilsTest method createVmNicFilterParameters.

List<VmNicFilterParameter> createVmNicFilterParameters() {
    List<VmNicFilterParameter> vmNicFilterParameters = new ArrayList();
    vmNicFilterParameters.add(new VmNicFilterParameter(NETWORK_FILTER_PARAMETER_0_ID, VM_NIC_ID, NETWORK_FILTER_PARAMETER_0_NAME, NETWORK_FILTER_PARAMETER_0_VALUE));
    vmNicFilterParameters.add(new VmNicFilterParameter(NETWORK_FILTER_PARAMETER_1_ID, VM_NIC_ID, NETWORK_FILTER_PARAMETER_1_NAME, NETWORK_FILTER_PARAMETER_1_VALUE));
    return vmNicFilterParameters;
}
Also used : ArrayList(java.util.ArrayList) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)

Example 10 with VmNicFilterParameter

use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.

the class BaseEditVmInterfaceModel method initNetworkFilterParameters.

protected void initNetworkFilterParameters(AsyncQuery<List<NetworkFilterParameterModel>> aQuery) {
    aQuery.converterCallback = returnValue -> {
        List<NetworkFilterParameterModel> parameters = new ArrayList<>();
        if (returnValue == null) {
            return parameters;
        }
        for (VmNicFilterParameter parameter : (List<VmNicFilterParameter>) returnValue) {
            parameters.add(new NetworkFilterParameterModel(parameter));
        }
        return parameters;
    };
    AsyncDataProvider.getInstance().getVnicInteraceNetworkFilterParameters(aQuery, getNic().getId());
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) 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