Search in sources :

Example 1 with NetworkDetails

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails in project cloudbreak by hortonworks.

the class NetworkCheckerConclusionStepTest method checkShouldFailAndReturnConclusionIfCcmIsNotAccessible.

@Test
public void checkShouldFailAndReturnConclusionIfCcmIsNotAccessible() {
    NetworkDetails networkDetails = NetworkDetails.newBuilder().setCcmEnabled(true).setCcmAccessible(HealthStatus.NOK).setClouderaComAccessible(HealthStatus.OK).setAnyNeighboursAccessible(HealthStatus.OK).build();
    when(nodeStatusService.getNetworkReport(eq(1L))).thenReturn(createNetworkReportResponse(networkDetails));
    Conclusion stepResult = underTest.check(1L);
    assertTrue(stepResult.isFailureFound());
    assertEquals("[CCM is not accessible from node host1. Please check network settings!]", stepResult.getConclusion());
    assertEquals("[CCM health status is NOK for node host1]", stepResult.getDetails());
    assertEquals(NetworkCheckerConclusionStep.class, stepResult.getConclusionStepClass());
    verify(nodeStatusService, times(1)).getNetworkReport(eq(1L));
}
Also used : NetworkDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails) Test(org.junit.jupiter.api.Test)

Example 2 with NetworkDetails

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails in project cloudbreak by hortonworks.

the class NetworkCheckerConclusionStepTest method checkShouldFailAndReturnConclusionIfClouderaComIsNotAccessible.

@Test
public void checkShouldFailAndReturnConclusionIfClouderaComIsNotAccessible() {
    NetworkDetails networkDetails = NetworkDetails.newBuilder().setCcmEnabled(true).setCcmAccessible(HealthStatus.OK).setClouderaComAccessible(HealthStatus.NOK).setAnyNeighboursAccessible(HealthStatus.OK).build();
    when(nodeStatusService.getNetworkReport(eq(1L))).thenReturn(createNetworkReportResponse(networkDetails));
    Conclusion stepResult = underTest.check(1L);
    assertTrue(stepResult.isFailureFound());
    assertEquals("[Cloudera.com is not accessible from node: host1. Please check network settings!]", stepResult.getConclusion());
    assertEquals("[Cloudera.com accessibility status is NOK for node host1]", stepResult.getDetails());
    assertEquals(NetworkCheckerConclusionStep.class, stepResult.getConclusionStepClass());
    verify(nodeStatusService, times(1)).getNetworkReport(eq(1L));
}
Also used : NetworkDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails) Test(org.junit.jupiter.api.Test)

Example 3 with NetworkDetails

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails in project cloudbreak by hortonworks.

the class NetworkCheckerConclusionStep method checkNetworkFailures.

private void checkNetworkFailures(RPCResponse<NodeStatusReport> networkReport, List<String> networkFailures, List<String> networkFailureDetails) {
    for (NodeStatus nodeStatus : networkReport.getResult().getNodesList()) {
        NetworkDetails networkDetails = nodeStatus.getNetworkDetails();
        String host = nodeStatus.getStatusDetails().getHost();
        if (networkDetails.getCcmEnabled() && HealthStatus.NOK.equals(networkDetails.getCcmAccessible())) {
            networkFailures.add("CCM is not accessible from node " + host + ". Please check network settings!");
            String details = String.format("CCM health status is %s for node %s", networkDetails.getCcmAccessible(), host);
            networkFailureDetails.add(details);
            LOGGER.warn(details);
        }
        if (HealthStatus.NOK.equals(networkDetails.getClouderaComAccessible())) {
            networkFailures.add("Cloudera.com is not accessible from node: " + host + ". Please check network settings!");
            String details = String.format("Cloudera.com accessibility status is %s for node %s", networkDetails.getClouderaComAccessible(), host);
            networkFailureDetails.add(details);
            LOGGER.warn(details);
        }
        if (networkDetails.getNeighbourScan() && HealthStatus.NOK.equals(networkDetails.getAnyNeighboursAccessible())) {
            networkFailures.add("Node " + host + " cannot reach any neighbour nodes. Please check nodes and network settings!");
            String details = String.format("Neighbours accessibility status is %s for node %s", networkDetails.getAnyNeighboursAccessible(), host);
            networkFailureDetails.add(details);
            LOGGER.warn(details);
        }
    }
}
Also used : NetworkDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails) NodeStatus(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatus)

Example 4 with NetworkDetails

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails in project cloudbreak by hortonworks.

the class NetworkCheckerConclusionStepTest method checkShouldBeSuccessfulIfNetworkIsHealthy.

@Test
public void checkShouldBeSuccessfulIfNetworkIsHealthy() {
    NetworkDetails networkDetails = NetworkDetails.newBuilder().setCcmEnabled(true).setCcmAccessible(HealthStatus.OK).setAnyNeighboursAccessible(HealthStatus.OK).setClouderaComAccessible(HealthStatus.OK).build();
    when(nodeStatusService.getNetworkReport(eq(1L))).thenReturn(createNetworkReportResponse(networkDetails));
    Conclusion stepResult = underTest.check(1L);
    assertFalse(stepResult.isFailureFound());
    assertNull(stepResult.getConclusion());
    assertNull(stepResult.getDetails());
    assertEquals(NetworkCheckerConclusionStep.class, stepResult.getConclusionStepClass());
    verify(nodeStatusService, times(1)).getNetworkReport(eq(1L));
}
Also used : NetworkDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails) Test(org.junit.jupiter.api.Test)

Example 5 with NetworkDetails

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails in project cloudbreak by hortonworks.

the class NetworkCheckerConclusionStepTest method checkShouldFailAndReturnConclusionIfNeighboursAreNotAccessible.

@Test
public void checkShouldFailAndReturnConclusionIfNeighboursAreNotAccessible() {
    NetworkDetails networkDetails = NetworkDetails.newBuilder().setCcmEnabled(true).setNeighbourScan(true).setCcmAccessible(HealthStatus.OK).setClouderaComAccessible(HealthStatus.OK).setAnyNeighboursAccessible(HealthStatus.NOK).build();
    when(nodeStatusService.getNetworkReport(eq(1L))).thenReturn(createNetworkReportResponse(networkDetails));
    Conclusion stepResult = underTest.check(1L);
    assertTrue(stepResult.isFailureFound());
    assertEquals("[Node host1 cannot reach any neighbour nodes. Please check nodes and network settings!]", stepResult.getConclusion());
    assertEquals("[Neighbours accessibility status is NOK for node host1]", stepResult.getDetails());
    assertEquals(NetworkCheckerConclusionStep.class, stepResult.getConclusionStepClass());
    verify(nodeStatusService, times(1)).getNetworkReport(eq(1L));
}
Also used : NetworkDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails) Test(org.junit.jupiter.api.Test)

Aggregations

NetworkDetails (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NetworkDetails)5 Test (org.junit.jupiter.api.Test)4 NodeStatus (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatus)1