use of com.emc.storageos.model.smis.SMISProviderCreateParam in project coprhd-controller by CoprHD.
the class ApiTest method createSMISProvider.
/**
* Create a VNXBlock SMISProvider.
*
* @return SMISProviderRestRep : provider.
* @throws InterruptedException
*/
private SMISProviderRestRep createSMISProvider() throws InterruptedException {
// vnxblock
SMISProviderCreateParam providerParam = new SMISProviderCreateParam();
providerParam.setName("VNXBlock_Provider");
providerParam.setIpAddress(EnvConfig.get("sanity", "smis.ip"));
providerParam.setPortNumber(5988);
providerParam.setUserName("admin");
providerParam.setPassword("#1Password");
providerParam.setUseSSL(false);
TaskResourceRep task = rZAdmin.path("/vdc/smis-providers").post(TaskResourceRep.class, providerParam);
String opId = task.getOpId();
Assert.assertNotNull(opId);
NamedRelatedResourceRep providerLink = task.getResource();
Assert.assertNotNull(providerLink);
// wait upto ~3 minute for SMIS provider scan
int checkCount = 18;
String status;
do {
Thread.sleep(10000);
TaskResourceRep taskResp = rZAdmin.path(String.format("/vdc/smis-providers/%s/tasks/%s", providerLink.getId(), opId)).get(TaskResourceRep.class);
status = taskResp.getState();
} while (status.equals("pending") && checkCount-- > 0);
if (!status.equals("ready")) {
Assert.assertTrue("Failed to create SMIS provider: time out", false);
}
SMISProviderRestRep provider = rZAdmin.path(String.format("/vdc/smis-providers/%s", providerLink.getId())).get(SMISProviderRestRep.class);
Assert.assertNotNull(provider);
_log.info("Scanned SMI-S Provider : " + providerLink.getId());
// Discover SMIS Provider:
TaskList tasks = rZAdmin.path("/vdc/storage-systems/discover").post(TaskList.class, providerParam);
// wait upto ~10 minute for discover
checkCount = 60;
for (TaskResourceRep taskRep : tasks.getTaskList()) {
opId = taskRep.getOpId();
Assert.assertNotNull(opId);
providerLink = taskRep.getResource();
Assert.assertNotNull(providerLink);
boolean success = monitorDiscoveredObjectTask(StorageSystemRestRep.class, taskRep);
if (!success) {
Assert.assertTrue("Failed to discover system : " + providerLink.getId().toString(), false);
}
}
_log.info(" Discover for all devices is completed");
return provider;
}
Aggregations