Search in sources :

Example 11 with ServiceDescriptor

use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project genius by opendaylight.

the class DatastoreServiceStatusProvider method getServiceDescriptor.

@Override
public ServiceDescriptor getServiceDescriptor() {
    ServiceState dataStoreServiceState = ServiceState.ERROR;
    String statusDesc;
    Boolean operSyncStatusValue = (Boolean) MBeanUtils.readMBeanAttribute("org.opendaylight.controller:type=" + "DistributedOperationalDatastore,Category=ShardManager,name=shard-manager-operational", "SyncStatus");
    Boolean configSyncStatusValue = (Boolean) MBeanUtils.readMBeanAttribute("org.opendaylight.controller:type=" + "DistributedConfigDatastore,Category=ShardManager,name=shard-manager-config", "SyncStatus");
    if (operSyncStatusValue != null && configSyncStatusValue != null) {
        if (operSyncStatusValue && configSyncStatusValue) {
            dataStoreServiceState = ServiceState.OPERATIONAL;
            statusDesc = dataStoreServiceState.name();
        } else {
            statusDesc = "datastore out of sync";
        }
    } else {
        statusDesc = "Unable to obtain the datastore status";
    }
    return new ServiceDescriptor(DATASTORE_SERVICE_NAME, dataStoreServiceState, statusDesc);
}
Also used : ServiceState(org.opendaylight.infrautils.diagstatus.ServiceState) ServiceDescriptor(org.opendaylight.infrautils.diagstatus.ServiceDescriptor)

Example 12 with ServiceDescriptor

use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project infrautils by opendaylight.

the class DiagStatusServiceImpl method register.

@Override
public ServiceRegistration register(String serviceIdentifier) {
    ServiceDescriptor serviceDescriptor = new ServiceDescriptor(serviceIdentifier, STARTING, "INITIALIZING");
    statusMap.put(serviceIdentifier, serviceDescriptor);
    return () -> {
        if (statusMap.remove(serviceIdentifier) == null) {
            throw new IllegalStateException("Service already unregistered");
        }
    };
}
Also used : ServiceDescriptor(org.opendaylight.infrautils.diagstatus.ServiceDescriptor)

Example 13 with ServiceDescriptor

use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project infrautils by opendaylight.

the class DiagStatusServiceImpl method updateServiceStatusMap.

private void updateServiceStatusMap() {
    for (ServiceStatusProvider serviceReference : serviceStatusProviders) {
        ServiceDescriptor serviceDescriptor = serviceReference.getServiceDescriptor();
        statusMap.put(serviceDescriptor.getModuleServiceName(), serviceDescriptor);
    }
}
Also used : ServiceStatusProvider(org.opendaylight.infrautils.diagstatus.ServiceStatusProvider) ServiceDescriptor(org.opendaylight.infrautils.diagstatus.ServiceDescriptor)

Example 14 with ServiceDescriptor

use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project infrautils by opendaylight.

the class DiagStatusServiceMBeanImpl method acquireServiceStatusDetailed.

@Override
public String acquireServiceStatusDetailed() {
    StringBuilder statusSummary = new StringBuilder();
    statusSummary.append("System ready state: ").append(systemReadyMonitor.getSystemState()).append('\n');
    for (ServiceDescriptor status : diagStatusService.getAllServiceDescriptors()) {
        statusSummary.append("  ").append(String.format("%-20s%-20s", status.getModuleServiceName(), ": " + status.getServiceState())).append("\n");
    }
    return statusSummary.toString();
}
Also used : ServiceDescriptor(org.opendaylight.infrautils.diagstatus.ServiceDescriptor)

Aggregations

ServiceDescriptor (org.opendaylight.infrautils.diagstatus.ServiceDescriptor)14 PreDestroy (javax.annotation.PreDestroy)4 Test (org.junit.Test)2 ServiceState (org.opendaylight.infrautils.diagstatus.ServiceState)2 JsonWriter (com.google.gson.stream.JsonWriter)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Date (java.util.Date)1 ServiceStatusProvider (org.opendaylight.infrautils.diagstatus.ServiceStatusProvider)1 AbstractIntegrationTest (org.opendaylight.infrautils.itestutils.AbstractIntegrationTest)1