Search in sources :

Example 1 with MessagingConfiguration

use of org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration in project ovirt-engine by oVirt.

the class NeutronAgentModel method flush.

public void flush(Provider<OpenstackNetworkProviderProperties> provider) {
    OpenstackNetworkProviderProperties properties = provider.getAdditionalProperties();
    if (properties == null) {
        properties = new OpenstackNetworkProviderProperties();
        provider.setAdditionalProperties(properties);
    }
    properties.setPluginType(NetworkProviderPluginTranslator.getPluginNameForDisplayString(getPluginType().getSelectedItem()));
    if (!isPluginConfigurationAvailable().getEntity()) {
        properties.setAgentConfiguration(null);
    } else {
        AgentConfiguration agentConfiguration = properties.getAgentConfiguration();
        if (agentConfiguration == null) {
            agentConfiguration = new AgentConfiguration();
            properties.setAgentConfiguration(agentConfiguration);
        }
        agentConfiguration.setNetworkMappings(getInterfaceMappings().getEntity());
        MessagingConfiguration messagingConfiguration = agentConfiguration.getMessagingConfiguration();
        if (messagingConfiguration == null) {
            messagingConfiguration = new MessagingConfiguration();
            agentConfiguration.setMessagingConfiguration(messagingConfiguration);
        }
        messagingConfiguration.setAddress(getMessagingServer().getEntity());
        String port = getMessagingServerPort().getEntity();
        messagingConfiguration.setPort(port == null ? null : Integer.valueOf(port));
        messagingConfiguration.setUsername(getMessagingServerUsername().getEntity());
        messagingConfiguration.setPassword(getMessagingServerPassword().getEntity());
        messagingConfiguration.setBrokerType(getBrokerType().getSelectedItem());
    }
}
Also used : AgentConfiguration(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.AgentConfiguration) MessagingConfiguration(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)

Example 2 with MessagingConfiguration

use of org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration in project ovirt-engine by oVirt.

the class NeutronAgentModel method init.

public void init(Provider<OpenstackNetworkProviderProperties> provider, ProviderType type) {
    OpenstackNetworkProviderProperties properties = provider.getAdditionalProperties();
    NetworkProviderPluginTranslator translator = NetworkProviderPluginTranslator.getTranslatorByProviderType(type);
    String pluginName = translator.getDisplayStringForPluginName(properties == null ? translator.getDefault() : properties.getPluginType());
    List<String> displayItems = translator.getPresetDisplayStrings();
    getPluginType().setItems(displayItems);
    getPluginType().setSelectedItem(pluginName);
    pluginValidator = translator.getPluginValidator();
    if (properties != null) {
        AgentConfiguration agentConfiguration = properties.getAgentConfiguration();
        if (agentConfiguration != null) {
            getInterfaceMappings().setEntity(agentConfiguration.getNetworkMappings());
            MessagingConfiguration messagingConfiguration = agentConfiguration.getMessagingConfiguration();
            if (messagingConfiguration != null) {
                getBrokerType().setSelectedItem(messagingConfiguration.getBrokerType());
                getMessagingServer().setEntity(messagingConfiguration.getAddress());
                Integer port = messagingConfiguration.getPort();
                getMessagingServerPort().setEntity(port == null ? null : Integer.toString(port));
                getMessagingServerUsername().setEntity(messagingConfiguration.getUsername());
                getMessagingServerPassword().setEntity(messagingConfiguration.getPassword());
            }
        }
    }
}
Also used : AgentConfiguration(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.AgentConfiguration) MessagingConfiguration(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)

Example 3 with MessagingConfiguration

use of org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration in project ovirt-engine by oVirt.

the class NetworkProviderValidatorTest method mockMessagingConfiguration.

private void mockMessagingConfiguration() {
    mockProviderAdditionalProperties();
    MessagingConfiguration messagingConfiguration = mock(MessagingConfiguration.class);
    when(getProviderAgentConfiguration().getMessagingConfiguration()).thenReturn(messagingConfiguration);
}
Also used : MessagingConfiguration(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration)

Aggregations

MessagingConfiguration (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration)3 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)2 AgentConfiguration (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.AgentConfiguration)2