Search in sources :

Example 1 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class BuildEsrsDevice method build.

/**
 * Build the Device object using the ViPR Controller license information.
 *
 * @return
 * @throws LocalRepositoryException
 * @throws Exception
 */
public Device build() throws Exception {
    Device device = new Device();
    LicenseInfoExt licenseInfo = _licenseManager.getLicenseInfoFromCoordinator(LicenseType.CONTROLLER);
    buildDevice(licenseInfo, device);
    return device;
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Device(com.emc.vipr.model.sys.eventhandler.Device)

Example 2 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeServiceImpl method sendHeartbeatEvent.

@Override
public Response sendHeartbeatEvent() {
    // if not configured for callhome, do not continue.
    _callHomeEventManager.validateSendEvent();
    LicenseInfoListExt licenseList = null;
    try {
        licenseList = _licenseManager.getLicenseInfoListFromCoordinator();
    } catch (Exception e) {
        throw APIException.internalServerErrors.licenseInfoNotFoundForType("all license types");
    }
    if (licenseList != null) {
        // send heart beat events for each registered license type
        for (LicenseInfoExt licenseInfo : licenseList.getLicenseList()) {
            if (licenseInfo.isTrialLicense()) {
                _log.warn("Cannot send heartbeat event to SYR for trial license {} ", licenseInfo.getLicenseType().toString());
                throw APIException.forbidden.permissionDeniedForTrialLicense(licenseInfo.getLicenseType().toString());
            }
            _callHomeEventsFacade.sendHeartBeatEvent(licenseInfo, getMediaType());
        }
    }
    auditCallhome(OperationTypeEnum.SEND_HEARTBEAT, AuditLogManager.AUDITLOG_SUCCESS, null);
    return Response.ok().build();
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) LicenseInfoListExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) ForbiddenException(com.emc.storageos.svcs.errorhandling.resources.ForbiddenException)

Example 3 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testLicensExpirationEventNoCallInfoObject.

/**
 * test that a license expiration event is sent if no CallInfo object returned from zookeeper.
 */
@Test
public void testLicensExpirationEventNoCallInfoObject() throws Exception {
    MockCallHomeEventManager manager = new MockCallHomeEventManager();
    LicenseInfoExt licenseInfo = null;
    Assert.assertTrue(manager.doSendLicenseExpiration(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Test(org.junit.Test)

Example 4 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testHeartbeatEventNoCallInfoObject.

/**
 * test that a heartbeat event is sent if no CallInfo object returned from zookeeper.
 */
@Test
public void testHeartbeatEventNoCallInfoObject() throws Exception {
    MockCallHomeEventManager manager = new MockCallHomeEventManager();
    LicenseInfoExt licenseInfo = null;
    Assert.assertTrue(manager.doSendHeartBeat(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Test(org.junit.Test)

Example 5 with LicenseInfoExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt in project coprhd-controller by CoprHD.

the class CallHomeEventManagerTest method testHeartbeatEventFalse.

/**
 * Test case which recognizes that a heartbeat event should not be sent.
 */
@Test
public void testHeartbeatEventFalse() throws Exception {
    MockCallHomeEventManager manager = new MockCallHomeEventManager();
    LicenseInfoExt licenseInfo = new LicenseInfoExt();
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DAY_OF_MONTH, (CallHomeConstants.HEARTBEART_EVENT_THRESHOLD * -1) + 1);
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    String stringDate = sdf.format(cal.getTime());
    licenseInfo.setLastHeartbeatEventDate(stringDate);
    manager.setLicenseInfo(licenseInfo);
    Assert.assertFalse(manager.doSendHeartBeat(licenseInfo));
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Aggregations

LicenseInfoExt (com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt)15 Test (org.junit.Test)11 SimpleDateFormat (java.text.SimpleDateFormat)5 Calendar (java.util.Calendar)4 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)3 ForbiddenException (com.emc.storageos.svcs.errorhandling.resources.ForbiddenException)3 LicenseInfoListExt (com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt)2 LicenseType (com.emc.storageos.coordinator.client.service.CoordinatorClient.LicenseType)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 Operation (com.emc.storageos.db.client.model.Operation)1 SysEvent (com.emc.storageos.db.client.model.SysEvent)1 SendAlertEvent (com.emc.storageos.systemservices.impl.eventhandler.connectemc.SendAlertEvent)1 Device (com.emc.vipr.model.sys.eventhandler.Device)1 URI (java.net.URI)1