mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-05 02:31:21 +01:00
[ONOS-3113] flow-classifier manager modification
Change-Id: I9e7c8f8f397edb36be0a6a4cc53ee2b2174679c5
This commit is contained in:
parent
905ea22db6
commit
ecf971de20
@ -15,13 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.onosproject.vtnrsc.flowclassifier;
|
package org.onosproject.vtnrsc.flowclassifier;
|
||||||
|
|
||||||
|
import org.onosproject.event.ListenerService;
|
||||||
import org.onosproject.vtnrsc.FlowClassifier;
|
import org.onosproject.vtnrsc.FlowClassifier;
|
||||||
import org.onosproject.vtnrsc.FlowClassifierId;
|
import org.onosproject.vtnrsc.FlowClassifierId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides Services for Flow Classifier.
|
* Provides Services for Flow Classifier.
|
||||||
*/
|
*/
|
||||||
public interface FlowClassifierService {
|
public interface FlowClassifierService extends ListenerService<FlowClassifierEvent, FlowClassifierListener> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether Flow Classifier is present based on given Flow Classifier
|
* Check whether Flow Classifier is present based on given Flow Classifier
|
||||||
@ -79,18 +80,4 @@ public interface FlowClassifierService {
|
|||||||
* false
|
* false
|
||||||
*/
|
*/
|
||||||
boolean removeFlowClassifier(FlowClassifierId id);
|
boolean removeFlowClassifier(FlowClassifierId id);
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the specified listener to Flow-Classifier manager.
|
|
||||||
*
|
|
||||||
* @param listener Flow-Classifier listener
|
|
||||||
*/
|
|
||||||
void addListener(FlowClassifierListener listener);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the specified listener to Flow-Classifier manager.
|
|
||||||
*
|
|
||||||
* @param listener Flow-Classifier listener
|
|
||||||
*/
|
|
||||||
void removeListener(FlowClassifierListener listener);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import org.apache.felix.scr.annotations.Reference;
|
|||||||
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
||||||
import org.apache.felix.scr.annotations.Service;
|
import org.apache.felix.scr.annotations.Service;
|
||||||
import org.onlab.util.KryoNamespace;
|
import org.onlab.util.KryoNamespace;
|
||||||
|
import org.onosproject.event.AbstractListenerManager;
|
||||||
import org.onosproject.store.serializers.KryoNamespaces;
|
import org.onosproject.store.serializers.KryoNamespaces;
|
||||||
import org.onosproject.store.service.EventuallyConsistentMap;
|
import org.onosproject.store.service.EventuallyConsistentMap;
|
||||||
import org.onosproject.store.service.MultiValuedTimestamp;
|
import org.onosproject.store.service.MultiValuedTimestamp;
|
||||||
@ -32,28 +33,27 @@ import org.onosproject.store.service.StorageService;
|
|||||||
import org.onosproject.store.service.WallClockTimestamp;
|
import org.onosproject.store.service.WallClockTimestamp;
|
||||||
import org.onosproject.vtnrsc.FlowClassifierId;
|
import org.onosproject.vtnrsc.FlowClassifierId;
|
||||||
import org.onosproject.vtnrsc.FlowClassifier;
|
import org.onosproject.vtnrsc.FlowClassifier;
|
||||||
|
import org.onosproject.vtnrsc.flowclassifier.FlowClassifierEvent;
|
||||||
import org.onosproject.vtnrsc.flowclassifier.FlowClassifierListener;
|
import org.onosproject.vtnrsc.flowclassifier.FlowClassifierListener;
|
||||||
import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
|
import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides implementation of the Flow Classifier Service.
|
* Provides implementation of the Flow Classifier Service.
|
||||||
*/
|
*/
|
||||||
@Component(immediate = true)
|
@Component(immediate = true)
|
||||||
@Service
|
@Service
|
||||||
public class FlowClassifierManager implements FlowClassifierService {
|
public class FlowClassifierManager extends AbstractListenerManager<FlowClassifierEvent, FlowClassifierListener>
|
||||||
|
implements FlowClassifierService {
|
||||||
|
|
||||||
private static final String FLOW_CLASSIFIER_NOT_NULL = "Flow Classifier cannot be null";
|
private static final String FLOW_CLASSIFIER_NOT_NULL = "Flow Classifier cannot be null";
|
||||||
private static final String FLOW_CLASSIFIER_ID_NOT_NULL = "Flow Classifier Id cannot be null";
|
private static final String FLOW_CLASSIFIER_ID_NOT_NULL = "Flow Classifier Id cannot be null";
|
||||||
private static final String LISTENER_NOT_NULL = "Listener cannot be null";
|
private static final String LISTENER_NOT_NULL = "Listener cannot be null";
|
||||||
|
|
||||||
private final Logger log = getLogger(FlowClassifierManager.class);
|
private final Logger log = getLogger(FlowClassifierManager.class);
|
||||||
private final Set<FlowClassifierListener> listeners = Sets.newCopyOnWriteArraySet();
|
|
||||||
private EventuallyConsistentMap<FlowClassifierId, FlowClassifier> flowClassifierStore;
|
private EventuallyConsistentMap<FlowClassifierId, FlowClassifier> flowClassifierStore;
|
||||||
|
|
||||||
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
|
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
|
||||||
@ -75,7 +75,6 @@ public class FlowClassifierManager implements FlowClassifierService {
|
|||||||
@Deactivate
|
@Deactivate
|
||||||
protected void deactivate() {
|
protected void deactivate() {
|
||||||
flowClassifierStore.destroy();
|
flowClassifierStore.destroy();
|
||||||
listeners.clear();
|
|
||||||
log.info("Flow Classifier service deactivated");
|
log.info("Flow Classifier service deactivated");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,16 +144,4 @@ public class FlowClassifierManager implements FlowClassifierService {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addListener(FlowClassifierListener listener) {
|
|
||||||
checkNotNull(listener, LISTENER_NOT_NULL);
|
|
||||||
listeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeListener(FlowClassifierListener listener) {
|
|
||||||
checkNotNull(listener, LISTENER_NOT_NULL);
|
|
||||||
listeners.remove(listener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user