Search in sources :

Example 1 with DefaultRouteResponse

use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.DefaultRouteResponse in project cloudbreak by hortonworks.

the class SaltApiRunPostResponse method defaultRoute.

protected Object defaultRoute() throws JsonProcessingException {
    Map<String, String> iFace = new HashMap<>();
    iFace.put("flags", "UG");
    iFace.put("interface", "eth0");
    DefaultRouteResponse defaultRouteResponse = new DefaultRouteResponse(Collections.singletonList(Collections.singletonMap("hostname", Collections.singletonList(iFace))));
    return objectMapper.writeValueAsString(defaultRouteResponse);
}
Also used : DefaultRouteResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.DefaultRouteResponse) HashMap(java.util.HashMap)

Example 2 with DefaultRouteResponse

use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.DefaultRouteResponse in project cloudbreak by hortonworks.

the class SaltBootstrapTest method setUp.

@Before
public void setUp() {
    saltConnector = mock(SaltConnector.class);
    gatewayConfig = new GatewayConfig("1.1.1.1", "10.0.0.1", "172.16.252.43", "10-0-0-1.example.com", 9443, "serverCert", "clientCert", "clientKey", "saltpasswd", "saltbootpassword", "signkey", false, true, null, null);
    GenericResponse response = new GenericResponse();
    response.setStatusCode(HttpStatus.OK.value());
    GenericResponses genericResponses = new GenericResponses();
    genericResponses.setResponses(Collections.singletonList(response));
    when(saltConnector.action(Mockito.any(SaltAction.class))).thenReturn(genericResponses);
    when(saltConnector.run(Mockito.any(), Mockito.eq("network.default_route"), Mockito.any(), Mockito.any())).thenReturn(new DefaultRouteResponse(Collections.emptyList()));
    NetworkInterfaceResponse networkInterfaceResponse = new NetworkInterfaceResponse();
    List<Map<String, String>> networkResultList = new ArrayList<>();
    networkMap = new HashMap<>();
    networkMap.put("host-10-0-0-1.example.com", "10.0.0.1");
    networkMap.put("host-10-0-0-2.example.com", "10.0.0.2");
    networkMap.put("host-10-0-0-3.example.com", "10.0.0.3");
    networkResultList.add(networkMap);
    networkInterfaceResponse.setResult(networkResultList);
    when(saltConnector.run(Mockito.any(), Mockito.eq("network.interface_ip"), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(networkInterfaceResponse);
}
Also used : NetworkInterfaceResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.NetworkInterfaceResponse) DefaultRouteResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.DefaultRouteResponse) GenericResponse(com.sequenceiq.cloudbreak.orchestrator.model.GenericResponse) ArrayList(java.util.ArrayList) GenericResponses(com.sequenceiq.cloudbreak.orchestrator.model.GenericResponses) HashMap(java.util.HashMap) Map(java.util.Map) SaltConnector(com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) SaltAction(com.sequenceiq.cloudbreak.orchestrator.salt.domain.SaltAction) Before(org.junit.Before)

Aggregations

DefaultRouteResponse (com.sequenceiq.cloudbreak.orchestrator.salt.domain.DefaultRouteResponse)2 HashMap (java.util.HashMap)2 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)1 GenericResponse (com.sequenceiq.cloudbreak.orchestrator.model.GenericResponse)1 GenericResponses (com.sequenceiq.cloudbreak.orchestrator.model.GenericResponses)1 SaltConnector (com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector)1 NetworkInterfaceResponse (com.sequenceiq.cloudbreak.orchestrator.salt.domain.NetworkInterfaceResponse)1 SaltAction (com.sequenceiq.cloudbreak.orchestrator.salt.domain.SaltAction)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Before (org.junit.Before)1