Search in sources :

Example 1 with SdxClient

use of com.sequenceiq.it.cloudbreak.SdxClient in project cloudbreak by hortonworks.

the class TestContext method as.

public TestContext as(CloudbreakUser cloudbreakUser) {
    checkShutdown();
    LOGGER.info(" Acting user as: \ndisplay name: {} \naccess key: {} \nsecret key: {} \ncrn: {} \nadmin: {} ", cloudbreakUser.getDisplayName(), cloudbreakUser.getAccessKey(), cloudbreakUser.getSecretKey(), cloudbreakUser.getCrn(), cloudbreakUser.getAdmin());
    Log.as(LOGGER, cloudbreakUser.toString());
    setActingUser(cloudbreakUser);
    if (clients.get(cloudbreakUser.getAccessKey()) == null) {
        CloudbreakClient cloudbreakClient = CloudbreakClient.createProxyCloudbreakClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
        FreeIpaClient freeIpaClient = FreeIpaClient.createProxyFreeIpaClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
        EnvironmentClient environmentClient = EnvironmentClient.createProxyEnvironmentClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
        SdxClient sdxClient = SdxClient.createProxySdxClient(testParameter, cloudbreakUser);
        UmsClient umsClient = UmsClient.createProxyUmsClient(tracer, umsHost);
        SdxSaasItClient sdxSaasItClient = SdxSaasItClient.createProxySdxSaasClient(tracer, umsHost, regionAwareInternalCrnGeneratorFactory);
        RedbeamsClient redbeamsClient = RedbeamsClient.createProxyRedbeamsClient(testParameter, cloudbreakUser);
        Map<Class<? extends MicroserviceClient>, MicroserviceClient> clientMap = Map.of(CloudbreakClient.class, cloudbreakClient, FreeIpaClient.class, freeIpaClient, EnvironmentClient.class, environmentClient, SdxClient.class, sdxClient, RedbeamsClient.class, redbeamsClient, UmsClient.class, umsClient, SdxSaasItClient.class, sdxSaasItClient);
        clients.put(cloudbreakUser.getAccessKey(), clientMap);
        cloudbreakClient.setWorkspaceId(0L);
    }
    return this;
}
Also used : MicroserviceClient(com.sequenceiq.it.cloudbreak.MicroserviceClient) CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) RedbeamsClient(com.sequenceiq.it.cloudbreak.RedbeamsClient) EnvironmentClient(com.sequenceiq.it.cloudbreak.EnvironmentClient) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) UmsClient(com.sequenceiq.it.cloudbreak.UmsClient) SdxSaasItClient(com.sequenceiq.it.cloudbreak.SdxSaasItClient)

Example 2 with SdxClient

use of com.sequenceiq.it.cloudbreak.SdxClient in project cloudbreak by hortonworks.

the class TestContext method initMicroserviceClientsForUMSAccountAdmin.

private void initMicroserviceClientsForUMSAccountAdmin(CloudbreakUser accountAdmin) {
    if (clients.get(accountAdmin.getAccessKey()) == null) {
        CloudbreakClient cloudbreakClient = CloudbreakClient.createProxyCloudbreakClient(testParameter, accountAdmin, regionAwareInternalCrnGeneratorFactory.iam());
        FreeIpaClient freeIpaClient = FreeIpaClient.createProxyFreeIpaClient(testParameter, accountAdmin, regionAwareInternalCrnGeneratorFactory.iam());
        EnvironmentClient environmentClient = EnvironmentClient.createProxyEnvironmentClient(testParameter, accountAdmin, regionAwareInternalCrnGeneratorFactory.iam());
        SdxClient sdxClient = SdxClient.createProxySdxClient(testParameter, accountAdmin);
        UmsClient umsClient = UmsClient.createProxyUmsClient(tracer, umsHost);
        SdxSaasItClient sdxSaasItClient = SdxSaasItClient.createProxySdxSaasClient(tracer, umsHost, regionAwareInternalCrnGeneratorFactory);
        RedbeamsClient redbeamsClient = RedbeamsClient.createProxyRedbeamsClient(testParameter, accountAdmin);
        Map<Class<? extends MicroserviceClient>, MicroserviceClient> clientMap = Map.of(CloudbreakClient.class, cloudbreakClient, FreeIpaClient.class, freeIpaClient, EnvironmentClient.class, environmentClient, SdxClient.class, sdxClient, RedbeamsClient.class, redbeamsClient, UmsClient.class, umsClient, SdxSaasItClient.class, sdxSaasItClient);
        clients.put(accountAdmin.getAccessKey(), clientMap);
    }
    LOGGER.info(" Microservice clients have been initialized successfully for UMS account admin:: \nDisplay name: {} \nAccess key: {} \nSecret key: {} " + "\nCrn: {} ", accountAdmin.getDisplayName(), accountAdmin.getAccessKey(), accountAdmin.getSecretKey(), accountAdmin.getCrn());
}
Also used : MicroserviceClient(com.sequenceiq.it.cloudbreak.MicroserviceClient) CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) RedbeamsClient(com.sequenceiq.it.cloudbreak.RedbeamsClient) EnvironmentClient(com.sequenceiq.it.cloudbreak.EnvironmentClient) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) UmsClient(com.sequenceiq.it.cloudbreak.UmsClient) SdxSaasItClient(com.sequenceiq.it.cloudbreak.SdxSaasItClient)

Example 3 with SdxClient

use of com.sequenceiq.it.cloudbreak.SdxClient in project cloudbreak by hortonworks.

the class FreeIpaUpgradeTests method dnsLookups.

private void dnsLookups(SdxTestDto sdxTestDto, SdxClient sdxClient) {
    InstanceMetaDataV4Response instanceGroupMetadata = getInstanceGroups(sdxTestDto, sdxClient).stream().flatMap(instanceGroup -> instanceGroup.getMetadata().stream()).filter(metadata -> metadata.getInstanceGroup().equals("idbroker")).filter(metadata -> StringUtils.isNoneBlank(metadata.getDiscoveryFQDN(), metadata.getPrivateIp())).findFirst().orElseThrow(() -> new TestFailException("FreeIPA upgrade DNS lookups test failed, idbroker instance group was not found."));
    try {
        String cmd = String.format(CHECK_DNS_LOOKUPS_CMD, instanceGroupMetadata.getDiscoveryFQDN(), instanceGroupMetadata.getPrivateIp());
        Map<String, Pair<Integer, String>> results = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(sdxTestDto, sdxClient), List.of(HostGroupType.MASTER.getName()), cmd, false);
        results.values().forEach(result -> Assertions.assertEquals(0, result.getLeft()));
    } catch (Exception e) {
        logger.error("FreeIPA upgrade DNS lookups test failed with unexpected error", e);
        throw new TestFailException("FreeIPA upgrade DNS lookups test failed with unexpected error: " + e.getMessage(), e);
    }
}
Also used : SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) AddDnsZoneForSubnetsRequest(com.sequenceiq.freeipa.api.v1.dns.model.AddDnsZoneForSubnetsRequest) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) StringUtils(org.apache.commons.lang3.StringUtils) Description(com.sequenceiq.it.cloudbreak.context.Description) InstanceMetaDataV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response) OperationStatus(com.sequenceiq.freeipa.api.v1.operation.model.OperationStatus) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) WorkloadCredentialsUpdateType(com.sequenceiq.freeipa.api.v1.freeipa.user.model.WorkloadCredentialsUpdateType) RUNNING(com.sequenceiq.freeipa.api.v1.operation.model.OperationState.RUNNING) Status(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) SdxTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto) Set(java.util.Set) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) SynchronizeAllUsersRequest(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizeAllUsersRequest) List(java.util.List) Response(javax.ws.rs.core.Response) WebApplicationException(javax.ws.rs.WebApplicationException) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) ServiceKeytabRequest(com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest) SshJClientActions(com.sequenceiq.it.cloudbreak.util.ssh.action.SshJClientActions) AbsolutTimeBasedTimeoutChecker(com.sequenceiq.cloudbreak.polling.AbsolutTimeBasedTimeoutChecker) AbstractE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest) BindUserCreateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest) TelemetryTestDto(com.sequenceiq.it.cloudbreak.dto.telemetry.TelemetryTestDto) HostKeytabRequest(com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.HostKeytabRequest) FreeIpaOperationStatusTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaOperationStatusTestDto) RunningParameter.waitForFlow(com.sequenceiq.it.cloudbreak.context.RunningParameter.waitForFlow) AddDnsARecordRequest(com.sequenceiq.freeipa.api.v1.dns.model.AddDnsARecordRequest) Inject(javax.inject.Inject) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SyncOperationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus) SynchronizationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus) COMPLETED(com.sequenceiq.freeipa.api.v1.operation.model.OperationState.COMPLETED) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) CleanupRequest(com.sequenceiq.freeipa.api.v1.freeipa.cleanup.CleanupRequest) AddDnsCnameRecordRequest(com.sequenceiq.freeipa.api.v1.dns.model.AddDnsCnameRecordRequest) Assertions(org.junit.jupiter.api.Assertions) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) Collections(java.util.Collections) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) InstanceMetaDataV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) WebApplicationException(javax.ws.rs.WebApplicationException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) Pair(org.apache.commons.lang3.tuple.Pair)

Aggregations

FreeIpaClient (com.sequenceiq.it.cloudbreak.FreeIpaClient)3 SdxClient (com.sequenceiq.it.cloudbreak.SdxClient)3 CloudbreakClient (com.sequenceiq.it.cloudbreak.CloudbreakClient)2 EnvironmentClient (com.sequenceiq.it.cloudbreak.EnvironmentClient)2 MicroserviceClient (com.sequenceiq.it.cloudbreak.MicroserviceClient)2 RedbeamsClient (com.sequenceiq.it.cloudbreak.RedbeamsClient)2 SdxSaasItClient (com.sequenceiq.it.cloudbreak.SdxSaasItClient)2 UmsClient (com.sequenceiq.it.cloudbreak.UmsClient)2 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)1 InstanceMetaDataV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response)1 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)1 AbsolutTimeBasedTimeoutChecker (com.sequenceiq.cloudbreak.polling.AbsolutTimeBasedTimeoutChecker)1 AddDnsARecordRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsARecordRequest)1 AddDnsCnameRecordRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsCnameRecordRequest)1 AddDnsZoneForSubnetsRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsZoneForSubnetsRequest)1 CleanupRequest (com.sequenceiq.freeipa.api.v1.freeipa.cleanup.CleanupRequest)1 BindUserCreateRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.binduser.BindUserCreateRequest)1 Status (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status)1 SyncOperationStatus (com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus)1 SynchronizationStatus (com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus)1