Search in sources :

Example 1 with ObjectiveTrackerService

use of org.onosproject.net.intent.ObjectiveTrackerService in project onos by opennetworkinglab.

the class IntentsDiagnosisCommand method buildServiceRefs.

private ServiceRefs buildServiceRefs() {
    IntentService intentsService = get(IntentService.class);
    if (intentsService == null) {
        return null;
    }
    DeviceService deviceService = get(DeviceService.class);
    if (deviceService == null) {
        return null;
    }
    FlowStatisticService flowStatsService = get(FlowStatisticService.class);
    if (flowStatsService == null) {
        return null;
    }
    FlowRuleService flowService = get(FlowRuleService.class);
    if (flowService == null) {
        return null;
    }
    WorkPartitionService workPartitionService = get(WorkPartitionService.class);
    if (workPartitionService == null) {
        return null;
    }
    ObjectiveTrackerService objectiveTrackerService = get(ObjectiveTrackerService.class);
    if (objectiveTrackerService == null) {
        return null;
    }
    return new ServiceRefs(intentsService, deviceService, flowService, workPartitionService, objectiveTrackerService);
}
Also used : IntentService(org.onosproject.net.intent.IntentService) WorkPartitionService(org.onosproject.net.intent.WorkPartitionService) DeviceService(org.onosproject.net.device.DeviceService) FlowStatisticService(org.onosproject.net.statistic.FlowStatisticService) FlowRuleService(org.onosproject.net.flow.FlowRuleService) ObjectiveTrackerService(org.onosproject.net.intent.ObjectiveTrackerService)

Example 2 with ObjectiveTrackerService

use of org.onosproject.net.intent.ObjectiveTrackerService in project onos by opennetworkinglab.

the class IntentsDiagnosisCommand method getIntentsByLinkSet.

private Set<Map.Entry<LinkKey, Key>> getIntentsByLinkSet(ServiceRefs svcRefs) {
    try {
        ObjectiveTrackerService objTracker = svcRefs.getObjectiveTrackerService();
        // Utilizing reflection instead of adding new interface for getting intentsByLink
        Field f = objTracker.getClass().getDeclaredField(FIELD_INTENTS_BY_LINK);
        f.setAccessible(true);
        SetMultimap<LinkKey, Key> intentsByLink = (SetMultimap<LinkKey, Key>) f.get(objTracker);
        return ImmutableSet.copyOf(intentsByLink.entries());
    } catch (NoSuchFieldException | IllegalAccessException ex) {
        error("error: " + ex);
        return ImmutableSet.of();
    }
}
Also used : Field(java.lang.reflect.Field) SetMultimap(com.google.common.collect.SetMultimap) LinkKey(org.onosproject.net.LinkKey) ObjectiveTrackerService(org.onosproject.net.intent.ObjectiveTrackerService) LinkKey(org.onosproject.net.LinkKey) Key(org.onosproject.net.intent.Key)

Aggregations

ObjectiveTrackerService (org.onosproject.net.intent.ObjectiveTrackerService)2 SetMultimap (com.google.common.collect.SetMultimap)1 Field (java.lang.reflect.Field)1 LinkKey (org.onosproject.net.LinkKey)1 DeviceService (org.onosproject.net.device.DeviceService)1 FlowRuleService (org.onosproject.net.flow.FlowRuleService)1 IntentService (org.onosproject.net.intent.IntentService)1 Key (org.onosproject.net.intent.Key)1 WorkPartitionService (org.onosproject.net.intent.WorkPartitionService)1 FlowStatisticService (org.onosproject.net.statistic.FlowStatisticService)1