use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method testFailoverTestAndFailoverAndFailback.
// @Test
public void testFailoverTestAndFailoverAndFailback() {
logger.info("Testing RecoverPoint Failover Cancel For Volume");
RecoverPointVolumeProtectionInfo protectionInfo = null;
RecoverPointVolumeProtectionInfo failbackProtectionInfo = null;
boolean foundError = false;
try {
recreateCGAndBookmark();
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
failbackProtectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestCRRLUN1WWN);
}
if (failbackProtectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestProdLUN1WWN);
}
if (!foundError) {
// Verify this is a target
if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_TARGET) {
logger.info("Protected target volume " + BourneRPTestCRRLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
} else {
foundError = true;
fail("Volume " + BourneRPTestCRRLUN1WWN + " did not map to a protected source target");
}
}
RPCopyRequestParams failoverTestRequest = new RPCopyRequestParams();
RPCopyRequestParams failbackRequest = new RPCopyRequestParams();
failoverTestRequest.setCopyVolumeInfo(protectionInfo);
failbackRequest.setCopyVolumeInfo(failbackProtectionInfo);
try {
try {
logger.info("Delete the CDP copy");
RecoverPointVolumeProtectionInfo deleteCopyInfo = null;
deleteCopyInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCDPLUN1WWN);
rpClient.deleteCopy(deleteCopyInfo);
} catch (Exception e) {
logger.info("Ignore error deleting CDP copy");
}
logger.info("Failover test start");
rpClient.failoverCopyTest(failoverTestRequest);
logger.info("Sleep 15 seconds before complete of failover");
Thread.sleep(15000);
rpClient.failoverCopy(failoverTestRequest);
logger.info("Sleep 15 seconds before failback");
Thread.sleep(15000);
rpClient.failoverCopy(failbackRequest);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
} catch (InterruptedException e) {
foundError = true;
fail(e.getMessage());
}
if (!foundError) {
logger.info("TestFailoverTestAndFailoverAndFailback PASSED");
}
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method setupClient.
public static void setupClient(String ip, String username, String password) {
URI endpoint = null;
try {
endpoint = new URI(preURI + RPSiteToUse + postURI);
List<URI> endpoints = new ArrayList<URI>();
endpoints.add(endpoint);
rpClient = RecoverPointClientFactory.getClient(URI.create("http://anykey.com/"), endpoints, username, password);
} catch (URISyntaxException e) {
logger.error(e.getMessage(), e);
} catch (RecoverPointException e) {
logger.error(e.getMessage(), e);
}
logger.error("Hello error");
logger.debug("Hello debug");
logger.info("Hello info");
if (logger.isInfoEnabled()) {
logger.info("Info enabled");
} else {
logger.error("Info not enabled. ");
}
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method testStopStartPauseResume.
// @Test
public void testStopStartPauseResume() {
logger.info("Testing RecoverPoint Stop, Start, Pause, Resume");
RecoverPointVolumeProtectionInfo protectionInfo = null;
RecoverPointVolumeProtectionInfo crrCopyProtectionInfo = null;
RecoverPointVolumeProtectionInfo cdpCopyProtectionInfo = null;
boolean foundError = false;
try {
recreateCG();
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
crrCopyProtectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
cdpCopyProtectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCDPLUN1WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestProdLUN1WWN);
}
if (!foundError) {
logger.info("Testing RecoverPoint Disable/Enable using source");
try {
logger.info("Disable CG: " + protectionInfo.getRpProtectionName());
rpClient.disableProtection(protectionInfo);
rpClient.getCGState(protectionInfo);
logger.info("Enable CG: " + protectionInfo.getRpProtectionName());
rpClient.enableProtection(protectionInfo);
rpClient.getCGState(protectionInfo);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
}
if (!foundError) {
logger.info("Testing RecoverPoint Pause/Resume using source");
try {
logger.info("Pause CG: " + protectionInfo.getRpProtectionName());
rpClient.pauseTransfer(protectionInfo);
rpClient.getCGState(protectionInfo);
logger.info("Resume CG: " + protectionInfo.getRpProtectionName());
rpClient.resumeTransfer(protectionInfo);
rpClient.getCGState(protectionInfo);
;
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
}
if (!foundError) {
logger.info("Testing RecoverPoint Disable/Enable using CRR");
try {
logger.info("Disable CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
rpClient.disableProtection(crrCopyProtectionInfo);
rpClient.getCGState(crrCopyProtectionInfo);
logger.info("Enable CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
rpClient.enableProtection(crrCopyProtectionInfo);
rpClient.getCGState(crrCopyProtectionInfo);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
}
if (!foundError) {
logger.info("Testing RecoverPoint Pause/Resume using CRR");
try {
logger.info("Pause CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
rpClient.pauseTransfer(crrCopyProtectionInfo);
rpClient.getCGState(crrCopyProtectionInfo);
logger.info("Resume CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
rpClient.resumeTransfer(crrCopyProtectionInfo);
rpClient.getCGState(crrCopyProtectionInfo);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
}
if (!foundError) {
logger.info("Testing RecoverPoint Disable/Enable using CDP");
try {
logger.info("Disable CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
rpClient.disableProtection(cdpCopyProtectionInfo);
rpClient.getCGState(cdpCopyProtectionInfo);
logger.info("Enable CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
rpClient.enableProtection(cdpCopyProtectionInfo);
rpClient.getCGState(cdpCopyProtectionInfo);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
}
if (!foundError) {
logger.info("Testing RecoverPoint Pause/Resume using CDP");
try {
logger.info("Pause CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
rpClient.pauseTransfer(cdpCopyProtectionInfo);
rpClient.getCGState(cdpCopyProtectionInfo);
logger.info("Resume CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
rpClient.resumeTransfer(cdpCopyProtectionInfo);
rpClient.getCGState(cdpCopyProtectionInfo);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
}
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method testGetProtectionInfoForVolume.
// @Test
public void testGetProtectionInfoForVolume() {
logger.info("Testing RecoverPoint Get Protection Info For Volume");
RecoverPointVolumeProtectionInfo protectionInfo = null;
boolean foundError = false;
try {
recreateCG();
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestProdLUN1WWN);
}
if (!foundError) {
// Verify this is a source
if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_SOURCE) {
logger.info("RecoverPoint Get Protection Info For Volume PASSED");
logger.info("Protected source volume " + BourneRPTestProdLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
} else {
foundError = true;
fail("Volume " + BourneRPTestProdLUN1WWN + " did not map to a protected source volume");
}
}
protectionInfo = null;
try {
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestCRRLUN1WWN);
}
if (!foundError) {
// Verify this is a source
if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_TARGET) {
logger.info("RecoverPoint Get Protection Info For Volume PASSED");
logger.info("Protected target volume " + BourneRPTestCRRLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
} else {
foundError = true;
fail("Volume " + BourneRPTestCRRLUN1WWN + " did not map to a protected source target");
}
}
try {
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestJrnlLUN1WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestJrnlLUN1WWN);
}
if (!foundError) {
// Verify this is a source
if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.SOURCE_JOURNAL) {
logger.info("RecoverPoint Get Protection Info For Volume PASSED");
logger.info("Source journal volume " + BourneRPTestJrnlLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
} else {
foundError = true;
fail("Volume " + BourneRPTestJrnlLUN1WWN + " did not map to a source journal volume");
}
}
protectionInfo = null;
try {
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestJrnlLUN5WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestJrnlLUN5WWN);
}
if (!foundError) {
// Verify this is a source
if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.TARGET_JOURNAL) {
logger.info("RecoverPoint Get Protection Info For Volume PASSED");
logger.info("Target journal volume " + BourneRPTestJrnlLUN5WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
} else {
foundError = true;
fail("Volume " + BourneRPTestJrnlLUN5WWN + " did not map to a protected source target");
}
}
logger.info("TestGetProtectionInfoForVolumeAndEnableAndDisable PASSED");
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method testFailoverTestAndTestCancel.
// @Test
public void testFailoverTestAndTestCancel() {
logger.info("Testing RecoverPoint Failover Cancel For Volume");
RecoverPointVolumeProtectionInfo protectionInfo = null;
boolean foundError = false;
try {
recreateCGAndBookmark();
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestCRRLUN1WWN);
}
if (!foundError) {
// Verify this is a source
if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_TARGET) {
logger.info("Protected target volume " + BourneRPTestCRRLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
} else {
foundError = true;
fail("Volume " + BourneRPTestCRRLUN1WWN + " did not map to a protected source target");
}
}
RPCopyRequestParams failoverTestRequest = new RPCopyRequestParams();
failoverTestRequest.setCopyVolumeInfo(protectionInfo);
try {
try {
logger.info("Delete the CDP copy");
RecoverPointVolumeProtectionInfo deleteCopyInfo = null;
deleteCopyInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCDPLUN1WWN);
rpClient.deleteCopy(deleteCopyInfo);
} catch (Exception e) {
logger.info("Ignore error deleting CDP copy");
}
logger.info("Failover test start");
rpClient.failoverCopyTest(failoverTestRequest);
logger.info("Sleep 15 seconds before cancel of failover test");
Thread.sleep(15000);
logger.info("Failover test cancel start");
rpClient.failoverCopyTestCancel(failoverTestRequest);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
} catch (InterruptedException e) {
foundError = true;
fail(e.getMessage());
}
if (!foundError) {
logger.info("TestFailoverTestAndTestCancel PASSED");
}
}
Aggregations