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();
}
Aggregations