Search in sources :

Example 1 with AgentConfiguration

use of org.ovirt.engine.api.model.AgentConfiguration in project ovirt-engine by oVirt.

the class OpenStackNetworkProviderMapper method map.

@Mapping(from = OpenstackNetworkProviderProperties.AgentConfiguration.class, to = AgentConfiguration.class)
public static AgentConfiguration map(OpenstackNetworkProviderProperties.AgentConfiguration entity, AgentConfiguration template) {
    AgentConfiguration model = template != null ? template : new AgentConfiguration();
    if (entity.getNetworkMappings() != null) {
        model.setNetworkMappings(entity.getNetworkMappings());
    }
    OpenstackNetworkProviderProperties.MessagingConfiguration messagingConfiguration = entity.getMessagingConfiguration();
    if (messagingConfiguration != null) {
        if (messagingConfiguration.getBrokerType() != null) {
            model.setBrokerType(map(messagingConfiguration.getBrokerType()));
        }
        if (messagingConfiguration.getAddress() != null) {
            model.setAddress(messagingConfiguration.getAddress());
        }
        if (messagingConfiguration.getPort() != null) {
            model.setPort(messagingConfiguration.getPort());
        }
        if (messagingConfiguration.getUsername() != null) {
            model.setUsername(messagingConfiguration.getUsername());
        }
    // The password isn't mapped for security reasons.
    // if (messagingConfiguration.getPassword() != null) {
    // model.setPassword(messagingConfiguration.getPassword());
    // }
    }
    return model;
}
Also used : AgentConfiguration(org.ovirt.engine.api.model.AgentConfiguration) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Mapping(org.ovirt.engine.api.restapi.types.Mapping)

Example 2 with AgentConfiguration

use of org.ovirt.engine.api.model.AgentConfiguration in project ovirt-engine by oVirt.

the class OpenStackNetworkProviderMapperTest method postPopulate.

@Override
protected OpenStackNetworkProvider postPopulate(OpenStackNetworkProvider model) {
    model.setType(OpenStackNetworkProviderType.NEUTRON);
    model.setPluginType(MappingTestHelper.shuffle(NetworkPluginType.class));
    AgentConfiguration agentConfiguration = model.getAgentConfiguration();
    agentConfiguration.setBrokerType(MappingTestHelper.shuffle(MessageBrokerType.class));
    model.setAutoSync(true);
    model.setReadOnly(false);
    model.setUnmanaged(true);
    return model;
}
Also used : MessageBrokerType(org.ovirt.engine.api.model.MessageBrokerType) AgentConfiguration(org.ovirt.engine.api.model.AgentConfiguration) NetworkPluginType(org.ovirt.engine.api.model.NetworkPluginType)

Aggregations

AgentConfiguration (org.ovirt.engine.api.model.AgentConfiguration)2 MessageBrokerType (org.ovirt.engine.api.model.MessageBrokerType)1 NetworkPluginType (org.ovirt.engine.api.model.NetworkPluginType)1 Mapping (org.ovirt.engine.api.restapi.types.Mapping)1 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)1