use of org.ovirt.engine.core.common.errors.EngineMessage in project ovirt-engine by oVirt.
the class HostInterfaceValidator method nicIsNotLabeledWithSpecifiedLabel.
public ValidationResult nicIsNotLabeledWithSpecifiedLabel(String label) {
boolean shouldFail = !NetworkUtils.isLabeled(iface) || !iface.getLabels().contains(label);
EngineMessage engineMessage = EngineMessage.INTERFACE_NOT_LABELED;
String nicNameReplacement = ReplacementUtils.getVariableAssignmentString(engineMessage, iface.getName());
String labelReplacement = ReplacementUtils.createSetVariableString(VAR_NIC_LABEL, label);
return ValidationResult.failWith(engineMessage, nicNameReplacement, labelReplacement).when(shouldFail);
}
use of org.ovirt.engine.core.common.errors.EngineMessage in project ovirt-engine by oVirt.
the class HostInterfaceValidator method interfaceIsBondOrNull.
public ValidationResult interfaceIsBondOrNull() {
String ifaceName = iface == null ? "null" : iface.getName();
final EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_IS_NOT_BOND;
return ValidationResult.failWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, ifaceName)).when(iface != null && !iface.isBond());
}
use of org.ovirt.engine.core.common.errors.EngineMessage in project ovirt-engine by oVirt.
the class MacAddressValidator method isMacAssignableValidator.
public ValidationResult isMacAssignableValidator() {
boolean allowDupMacs = macPool.isDuplicateMacAddressesAllowed();
boolean illegalDuplicateMacUsage = !allowDupMacs && macPool.isMacInUse(macAddress);
EngineMessage failMessage = EngineMessage.NETWORK_MAC_ADDRESS_IN_USE;
return ValidationResult.failWith(failMessage, ReplacementUtils.getVariableAssignmentString(failMessage, macAddress)).when(illegalDuplicateMacUsage);
}
use of org.ovirt.engine.core.common.errors.EngineMessage in project ovirt-engine by oVirt.
the class ProviderValidatorTest method testValidateReadOnlyActions.
@Test
public void testValidateReadOnlyActions() {
String providerName = "providerName";
OpenstackNetworkProviderProperties additionalProperties = new OpenstackNetworkProviderProperties();
additionalProperties.setReadOnly(true);
Provider<AdditionalProperties> provider = new Provider<>();
provider.setAdditionalProperties(additionalProperties);
provider.setType(ProviderType.EXTERNAL_NETWORK);
provider.setName(providerName);
ProviderValidator validator = new ProviderValidator(provider);
EngineMessage engineMessage = EngineMessage.ACTION_TYPE_FAILED_EXTERNAL_PROVIDER_IS_READ_ONLY;
assertThat(validator.validateReadOnlyActions(), failsWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, providerName)));
additionalProperties.setReadOnly(false);
assertThat(validator.validateReadOnlyActions(), isValid());
provider.setType(ProviderType.OPENSTACK_NETWORK);
assertThat(validator.validateReadOnlyActions(), isValid());
}
Aggregations