Search in sources :

Example 26 with GatewayResourceProfile

use of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile in project airavata by apache.

the class RegisterUS3Application method registerGatewayResourceProfile.

public static void registerGatewayResourceProfile() {
    try {
        System.out.println("#### Registering Gateway proflie #### \n");
        ComputeResourcePreference stampedeResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(stampedeResourceId, "TG-MCB070039N", false, null, null, null, "/scratch/01623/us3/jobs/");
        ComputeResourcePreference trestlesResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(trestlesResourceId, "uot111", false, null, null, null, "/oasis/projects/nsf/uot111/us3/airavata-workdirs/");
        ComputeResourcePreference lonestarResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(lonestarResourceId, "ULTRASCAN", false, null, null, null, "/scratch/01623/us3/airavata/");
        ComputeResourcePreference alamoResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(alamoResourceId, null, false, null, null, null, "/mnt/glusterfs/work/");
        GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
        gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
        gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences);
        gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences);
        gatewayResourceProfile.addToComputeResourcePreferences(lonestarResourcePreferences);
        gatewayResourceProfile.addToComputeResourcePreferences(alamoResourcePreferences);
        String gatewayProfile = airavataClient.registerGatewayResourceProfile(new AuthzToken(""), gatewayResourceProfile);
        System.out.println("Gateway Profile is registered with Id " + gatewayProfile);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 27 with GatewayResourceProfile

use of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile in project airavata by apache.

the class AiravataIT method testCreateGateway.

@org.testng.annotations.Test(priority = 1)
public void testCreateGateway() {
    try {
        logger.info("testCreateGateway() -> Creating test gateway......");
        setup.getGatewayRegister().createGateway();
        GatewayResourceProfile gatewayResourceProfile = setup.getGatewayRegister().getGatewayResourceProfile();
        Assert.assertNotNull(gatewayResourceProfile);
        Gateway testGateway = setup.getGatewayRegister().getGateway(properties.getGname());
        Assert.assertNotNull(testGateway);
        Assert.assertEquals(testGateway.getGatewayName(), properties.getGname());
        Assert.assertEquals(testGateway.getDomain(), properties.getGname() + properties.getGdomain());
        Assert.assertEquals(testGateway.getGatewayApprovalStatus(), GatewayApprovalStatus.APPROVED);
        String createdToken = setup.getGatewayRegister().writeToken();
        Assert.assertEquals(new String(Files.readAllBytes(Paths.get(properties.getTokenFileLoc() + File.separator + TestFrameworkConstants.CredentialStoreConstants.TOKEN_FILE_NAME))), createdToken);
        /*
            TODO: Not required for local setup
            FIXME: for scp transfer
            Currently credential store does not support jpa its plane sql and need
             */
        // setup.getGatewayRegister().registerSSHKeys();
        logger.info("testCreateGateway() -> Created test gateway. Gateway Id : " + properties.getGname());
    } catch (Exception e) {
        logger.error("Error occured while testCreateGateways", e);
        Assert.fail();
    }
}
Also used : GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) Gateway(org.apache.airavata.model.workspace.Gateway)

Example 28 with GatewayResourceProfile

use of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile in project airavata by apache.

the class ComputeResourceRegister method registerGatewayResourceProfile.

public void registerGatewayResourceProfile(String computeResourceId) throws Exception {
    try {
        ComputeResourcePreference localResourcePreference = null;
        loginNamesWithResourceIds = getLoginNamesWithResourceIDs();
        List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayResourceProfiles(authzToken);
        for (GatewayResourceProfile gatewayResourceProfile : allGatewayComputeResources) {
            for (String resourceId : loginNamesWithResourceIds.keySet()) {
                String loginUserName = loginNamesWithResourceIds.get(resourceId);
                if (resourceId.equals(computeResourceId) && loginUserName.equals(LOGIN_USER)) {
                    localResourcePreference = createComputeResourcePreference(resourceId, ALLOCATION_PROJECT_NUMBER, true, BATCH_QUEUE, JobSubmissionProtocol.LOCAL, DataMovementProtocol.LOCAL, TestFrameworkConstants.SCRATCH_LOCATION, loginUserName);
                    airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, localResourcePreference);
                }
            }
        }
    } catch (TException e) {
        logger.error("Error occured while updating gateway resource profiles", e);
        throw new Exception("Error occured while updating gateway resource profiles", e);
    }
}
Also used : TException(org.apache.thrift.TException) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) TException(org.apache.thrift.TException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException)

Example 29 with GatewayResourceProfile

use of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile in project airavata by apache.

the class StorageResourceRegister method registerGatewayStorageProfile.

public void registerGatewayStorageProfile(String storageResourceId) throws Exception {
    StoragePreference localResourcePreference = null;
    try {
        loginNamesWithResourceIds = getLoginNamesWithResourceIDs();
        List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayResourceProfiles(authzToken);
        for (GatewayResourceProfile gatewayResourceProfile : allGatewayComputeResources) {
            for (String resourceId : loginNamesWithResourceIds.keySet()) {
                String loginUserName = loginNamesWithResourceIds.get(resourceId);
                if (resourceId.equals(storageResourceId) && loginUserName.equals(LOGIN_USER)) {
                    localResourcePreference = createStoragePreferenceResource(resourceId, loginUserName, TestFrameworkConstants.STORAGE_LOCATION);
                    airavata.addGatewayStoragePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, localResourcePreference);
                }
            }
        }
    } catch (TException e) {
        logger.error("Error occured while registering gateway storage profiles", e);
        throw new Exception("Error occured while registering gateway storage profiles", e);
    }
}
Also used : TException(org.apache.thrift.TException) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) StoragePreference(org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference) TException(org.apache.thrift.TException)

Aggregations

GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)29 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)11 TException (org.apache.thrift.TException)11 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)10 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)6 CredentialStoreService (org.apache.airavata.credential.store.cpi.CredentialStoreService)5 AiravataException (org.apache.airavata.common.exception.AiravataException)3 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)3 StoragePreference (org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference)3 PasswordCredential (org.apache.airavata.model.credential.store.PasswordCredential)3 AuthzToken (org.apache.airavata.model.security.AuthzToken)3 Gateway (org.apache.airavata.model.workspace.Gateway)3 AiravataSecurityException (org.apache.airavata.security.AiravataSecurityException)3 ArrayList (java.util.ArrayList)2 CredentialStoreException (org.apache.airavata.credential.store.exception.CredentialStoreException)2 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)2 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)2 TrustStoreManager (org.apache.airavata.security.util.TrustStoreManager)2 AxisFault (org.apache.axis2.AxisFault)2 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)2