Search in sources :

Example 1 with ReportedConfiguration

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

the class NetworkInSyncWithVdsNetworkInterfaceTest method testReportConfigurationsOnHostWhenDefaultRouteDiffers.

@Test
public void testReportConfigurationsOnHostWhenDefaultRouteDiffers() {
    // cannot use initIpv4ConfigurationBootProtocol because of 'randomized tests' technique.
    iface.setIpv4BootProtocol(Ipv4BootProtocol.DHCP);
    IPv4Address address = new IPv4Address();
    address.setBootProtocol(Ipv4BootProtocol.DHCP);
    testedNetworkAttachment.getIpConfiguration().setIPv4Addresses(Collections.singletonList(address));
    // network has default route role
    NetworkInSyncWithVdsNetworkInterface testedInstance = createTestedInstanceWithSameNonQosValues(true);
    ReportedConfigurations reportedConfigurations = testedInstance.reportConfigurationsOnHost();
    assertThat(reportedConfigurations.isNetworkInSync(), is(false));
    List<ReportedConfiguration> reportedConfigurationList = reportedConfigurations.getReportedConfigurationList();
    List<ReportedConfiguration> expectedReportedConfigurations = addReportedConfigurations(combineReportedConfigurations(createBasicReportedConfigurations(), reportQos(true)), new ReportedConfiguration(ReportedConfigurationType.IPV4_BOOT_PROTOCOL, iface.getIpv4BootProtocol().name(), /*ipv4Address*/
    address.getBootProtocol().name(), true), new ReportedConfiguration(ReportedConfigurationType.DNS_CONFIGURATION, addressesAsString(sampleDnsResolverConfiguration.getNameServers()), "192.168.1.1,2001:0db8:85a3:0000:0000:8a2e:0370:7334", true), new ReportedConfiguration(ReportedConfigurationType.DEFAULT_ROUTE, false, true, false));
    assertThat(reportedConfigurationList.containsAll(expectedReportedConfigurations), is(true));
    assertThat(reportedConfigurationList.size(), is(expectedReportedConfigurations.size()));
}
Also used : ReportedConfigurations(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations) ReportedConfiguration(org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address) Test(org.junit.Test)

Example 2 with ReportedConfiguration

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

the class ItemInfoPopup method addSyncDiff.

/**
 * @param networkModel must be managed
 */
private void addSyncDiff(LogicalNetworkModel networkModel) {
    addRow(templates.imageTextSetupNetwork(notInSyncImage, templates.coloredText(constants.hostOutOfSync(), SafeStylesUtils.forTrustedColor(TEXT_COLOR))));
    SafeHtml safeHtml = SafeHtmlUtils.fromTrustedString(generatePreviewSentence());
    addRow(safeHtml);
    List<ReportedConfiguration> panelParameters = filterSyncProperties(networkModel);
    Widget networkOutOfSyncPanel = new NetworkOutOfSyncPanel(panelParameters).outOfSyncTableAsWidget();
    contents.insertRow(contents.getRowCount());
    contents.setWidget(contents.getRowCount(), 0, networkOutOfSyncPanel);
}
Also used : ReportedConfiguration(org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Widget(com.google.gwt.user.client.ui.Widget)

Example 3 with ReportedConfiguration

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

the class NetworkOutOfSyncPanel method outOfSyncTableAsWidget.

public Widget outOfSyncTableAsWidget() {
    addTableFirstRow();
    for (ReportedConfiguration reportedConfiguration : reportedConfigurationList) {
        List<Label> values = reportedConfigurationAsList(reportedConfiguration);
        TextAlign textAlign = resolveAlignment(reportedConfiguration.getType());
        addOutOfSyncRow(values, textAlign);
    }
    return flowPanel.asWidget();
}
Also used : ReportedConfiguration(org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration) TextAlign(com.google.gwt.dom.client.Style.TextAlign) Label(org.gwtbootstrap3.client.ui.Label)

Example 4 with ReportedConfiguration

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

the class NetworkInSyncWithVdsNetworkInterfaceTest method testReportConfigurationsOnHostWhenSwitchTypeIsOutOfSync.

@Test
public void testReportConfigurationsOnHostWhenSwitchTypeIsOutOfSync() throws Exception {
    cluster.setRequiredSwitchTypeForCluster(SwitchType.OVS);
    ReportedConfigurations reportedConfigurations = createTestedInstance().reportConfigurationsOnHost();
    assertThat(reportedConfigurations.isNetworkInSync(), is(false));
    List<ReportedConfiguration> reportedConfigurationList = reportedConfigurations.getReportedConfigurationList();
    ReportedConfiguration expectedReportedConfiguration = new ReportedConfiguration(ReportedConfigurationType.SWITCH_TYPE, SwitchType.LEGACY, SwitchType.OVS, false);
    assertThat(reportedConfigurationList.contains(expectedReportedConfiguration), is(true));
}
Also used : ReportedConfigurations(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations) ReportedConfiguration(org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration) Test(org.junit.Test)

Example 5 with ReportedConfiguration

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

the class NetworkInSyncWithVdsNetworkInterfaceTest method testReportConfigurationsOnHostWhenDnsConfigurationResolverOutOfSync.

@Test
public void testReportConfigurationsOnHostWhenDnsConfigurationResolverOutOfSync() {
    iface.setIpv4DefaultRoute(true);
    // cannot use initIpv4ConfigurationBootProtocol because of 'randomized tests' technique.
    iface.setIpv4BootProtocol(Ipv4BootProtocol.DHCP);
    IPv4Address address = new IPv4Address();
    address.setBootProtocol(Ipv4BootProtocol.DHCP);
    testedNetworkAttachment.getIpConfiguration().setIPv4Addresses(Collections.singletonList(address));
    network.setDnsResolverConfiguration(sampleDnsResolverConfiguration2);
    ReportedConfigurations reportedConfigurations = createTestedInstanceWithSameNonQosValues(true).reportConfigurationsOnHost();
    assertThat(reportedConfigurations.isNetworkInSync(), is(false));
    List<ReportedConfiguration> reportedConfigurationList = reportedConfigurations.getReportedConfigurationList();
    List<ReportedConfiguration> expectedReportedConfigurations = addReportedConfigurations(combineReportedConfigurations(createBasicReportedConfigurations(), reportQos(true)), new ReportedConfiguration(ReportedConfigurationType.IPV4_BOOT_PROTOCOL, iface.getIpv4BootProtocol().name(), /*ipv4Address*/
    address.getBootProtocol().name(), true), new ReportedConfiguration(ReportedConfigurationType.DNS_CONFIGURATION, addressesAsString(sampleDnsResolverConfiguration.getNameServers()), addressesAsString(network.getDnsResolverConfiguration().getNameServers()), false), new ReportedConfiguration(ReportedConfigurationType.DEFAULT_ROUTE, true, true, true));
    assertThat(reportedConfigurationList.containsAll(expectedReportedConfigurations), is(true));
    assertThat(reportedConfigurationList.size(), is(expectedReportedConfigurations.size()));
}
Also used : ReportedConfigurations(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations) ReportedConfiguration(org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address) Test(org.junit.Test)

Aggregations

ReportedConfiguration (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration)10 Test (org.junit.Test)6 ReportedConfigurations (org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations)6 IPv4Address (org.ovirt.engine.core.common.businessentities.network.IPv4Address)4 TextAlign (com.google.gwt.dom.client.Style.TextAlign)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 Widget (com.google.gwt.user.client.ui.Widget)1 Label (org.gwtbootstrap3.client.ui.Label)1