Search in sources :

Example 11 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecoveryServiceTest method testFindRecommendFailoverSite.

@Test
public void testFindRecommendFailoverSite() {
    // only one synced site
    standbySite1.setState(SiteState.STANDBY_SYNCED);
    List<SiteRestRep> responseSiteFromRemote = new ArrayList<SiteRestRep>();
    SiteRestRep recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
    assertEquals(recommendSite.getUuid(), standbySite1.getUuid());
    // only one paused site
    standbySite1.setState(SiteState.STANDBY_PAUSED);
    responseSiteFromRemote = new ArrayList<SiteRestRep>();
    recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
    assertEquals(recommendSite.getUuid(), standbySite1.getUuid());
    // one paused, two synced
    responseSiteFromRemote = new ArrayList<SiteRestRep>();
    SiteRestRep site1 = new SiteRestRep();
    site1.setUuid("standby1");
    site1.setState(SiteState.STANDBY_SYNCED.toString());
    responseSiteFromRemote.add(site1);
    SiteRestRep site2 = new SiteRestRep();
    site2.setUuid("standby2");
    site2.setState(SiteState.STANDBY_SYNCED.toString());
    responseSiteFromRemote.add(site2);
    recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
    assertEquals(recommendSite.getUuid(), site1.getUuid());
    // 3 paused
    responseSiteFromRemote = new ArrayList<SiteRestRep>();
    site1.setState(SiteState.STANDBY_PAUSED.toString());
    responseSiteFromRemote.add(site1);
    site2.setState(SiteState.STANDBY_PAUSED.toString());
    responseSiteFromRemote.add(site2);
    standbySite1.setLastStateUpdateTime((new Date()).getTime() + 1000);
    recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
    assertEquals(recommendSite.getUuid(), standbySite1.getUuid());
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) ArrayList(java.util.ArrayList) Date(java.util.Date) Test(org.junit.Test)

Example 12 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecoveryServiceTest method testGetStandby.

@Test
public void testGetStandby() throws Exception {
    doReturn(standbySite1).when(drUtil).getSiteFromLocalVdc(standbySite1.getUuid());
    SiteRestRep response = drService.getSite("site-uuid-1");
    compareSiteResponse(response, standbySite1);
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) Test(org.junit.Test)

Example 13 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecoveryServiceTest method testGetStandby_NotBelongLocalVDC.

@Test
public void testGetStandby_NotBelongLocalVDC() throws Exception {
    doReturn(null).when(coordinator).queryConfiguration(String.format("%s/vdc1", Site.CONFIG_KIND), "site-uuid-not-exist");
    SiteRestRep response = drService.getSite("site-uuid-not-exist");
    assertNull(response);
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) Test(org.junit.Test)

Example 14 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class AdminDashboard method disasterRecovery.

@Restrictions({ @Restrict("SYSTEM_MONITOR"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void disasterRecovery() {
    Date disasterRecoveryLastUpdated = AdminDashboardUtils.getNodeHealthListLastUpdated();
    List<SiteRestRep> drsites = DisasterRecoveryUtils.getSites();
    render(disasterRecoveryLastUpdated, drsites);
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) Date(java.util.Date) Restrictions(controllers.deadbolt.Restrictions)

Example 15 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecovery method switchover.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void switchover(String id) {
    String standby_name = null;
    String standby_vip = null;
    String active_name = null;
    Boolean isSwitchover = false;
    // Get active site details
    SiteRestRep activesite = DisasterRecoveryUtils.getActiveSite();
    active_name = activesite == null ? "N/A" : activesite.getName();
    SiteRestRep result = DisasterRecoveryUtils.getSite(id);
    if (result != null) {
        // Check Switchover or Failover
        SiteActive currentSite = DisasterRecoveryUtils.checkActiveSite();
        if (currentSite.getIsActive() == true) {
            DisasterRecoveryUtils.doSwitchover(id);
            isSwitchover = true;
        } else {
            DisasterRecoveryUtils.doFailover(id);
            isSwitchover = false;
        }
        standby_name = result.getName();
        standby_vip = result.getVipEndpoint();
    }
    String site_uuid = id;
    maintenance(active_name, standby_name, standby_vip, site_uuid, isSwitchover);
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) SiteActive(com.emc.storageos.model.dr.SiteActive) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Aggregations

SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)21 Restrictions (controllers.deadbolt.Restrictions)7 Test (org.junit.Test)5 FlashException (controllers.util.FlashException)4 ArrayList (java.util.ArrayList)3 Site (com.emc.storageos.coordinator.client.model.Site)2 SiteState (com.emc.storageos.coordinator.client.model.SiteState)2 Configuration (com.emc.storageos.coordinator.common.Configuration)2 SiteAddParam (com.emc.storageos.model.dr.SiteAddParam)2 SiteDetailRestRep (com.emc.storageos.model.dr.SiteDetailRestRep)2 DownloadProgress (com.emc.vipr.model.sys.DownloadProgress)2 Date (java.util.Date)2 Map (java.util.Map)2 Matchers.anyString (org.mockito.Matchers.anyString)2 InternalSiteServiceClient (com.emc.storageos.api.service.impl.resource.utils.InternalSiteServiceClient)1 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)1 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)1 SiteMonitorResult (com.emc.storageos.coordinator.client.model.SiteMonitorResult)1 NetworkHealth (com.emc.storageos.coordinator.client.model.SiteNetworkState.NetworkHealth)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1