Search in sources :

Example 1 with VirtualDataCenters

use of com.emc.vipr.client.core.VirtualDataCenters in project coprhd-controller by CoprHD.

the class GeoMode method setupGeoTenantModeBase.

@BeforeClass
public static void setupGeoTenantModeBase() throws Exception {
    VirtualDataCenters vdcs = superUserClient.vdcs();
    List<NamedRelatedResourceRep> list = vdcs.list();
    for (NamedRelatedResourceRep vdc : list) {
        VirtualDataCenterRestRep restRep = superUserClient.vdcs().get(vdc.getId());
        vdcList.add(restRep);
    }
    if (vdcList.size() < 2) {
        String errorMsg = "env check fail, only one VDC, Geo test need at least 2 vdcs";
        logger.error(errorMsg);
        throw new Exception(errorMsg);
    }
    logger.info("grant " + superUser + " security admin in both VDCs");
    ViPRCoreClient vdc1RootClient = new ViPRCoreClient(getVdcEndpointByIndex(0), true).withLogin("root", rootPassword);
    ViPRClientHelper vdc1Helper = new ViPRClientHelper(vdc1RootClient);
    vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SecurityAdmin.toString());
    vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemAdmin.toString());
    vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemMonitor.toString());
    vdc1RootClient.auth().logout();
    ViPRCoreClient vdc2RootClient = new ViPRCoreClient(getVdcEndpointByIndex(1), true).withLogin("root", rootPassword);
    ViPRClientHelper vdc2Helper = new ViPRClientHelper(vdc2RootClient);
    vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SecurityAdmin.toString());
    vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemAdmin.toString());
    vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemMonitor.toString());
    vdc2RootClient.auth().logout();
}
Also used : VirtualDataCenters(com.emc.vipr.client.core.VirtualDataCenters) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) ViPRClientHelper(com.emc.storageos.usermanagement.util.ViPRClientHelper) BeforeClass(org.junit.BeforeClass)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 VirtualDataCenterRestRep (com.emc.storageos.model.vdc.VirtualDataCenterRestRep)1 ViPRClientHelper (com.emc.storageos.usermanagement.util.ViPRClientHelper)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 VirtualDataCenters (com.emc.vipr.client.core.VirtualDataCenters)1 BeforeClass (org.junit.BeforeClass)1