本文整理匯總了Java中org.onosproject.net.flowobjective.ObjectiveEvent類的典型用法代碼示例。如果您正苦於以下問題:Java ObjectiveEvent類的具體用法?Java ObjectiveEvent怎麽用?Java ObjectiveEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ObjectiveEvent類屬於org.onosproject.net.flowobjective包,在下文中一共展示了ObjectiveEvent類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: notify
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Override
public void notify(ObjectiveEvent event) {
log.debug("Received notification of obj event {}", event);
Set<PendingNext> pending = pendingForwards.remove(event.subject());
if (pending == null) {
log.debug("Nothing pending for this obj event");
return;
}
log.debug("Processing pending forwarding objectives {}", pending.size());
pending.forEach(p -> getDevicePipeliner(p.deviceId())
.forward(p.forwardingObjective()));
}
示例2: notify
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Override
public void notify(ObjectiveEvent event) {
if (event.type() == Type.ADD) {
log.debug("Received notification of obj event {}", event);
Set<PendingNext> pending;
synchronized (pendingForwards) {
// needs to be synchronized for queueObjective lookup
pending = pendingForwards.remove(event.subject());
}
if (pending == null) {
log.debug("Nothing pending for this obj event {}", event);
return;
}
log.debug("Processing {} pending forwarding objectives for nextId {}",
pending.size(), event.subject());
pending.forEach(p -> getDevicePipeliner(p.deviceId())
.forward(p.forwardingObjective()));
}
}
示例3: activate
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Activate
public void activate() {
tpool = Executors.newFixedThreadPool(4, groupedThreads("onos/flobj-notifier", "%d", log));
eventQ = new LinkedBlockingQueue<ObjectiveEvent>();
tpool.execute(new FlowObjectiveNotifier());
nextGroups = storageService.<Integer, byte[]>consistentMapBuilder()
.withName("flowobjective-groups")
.withSerializer(Serializer.using(
new KryoNamespace.Builder()
.register(byte[].class)
.register(Versioned.class)
.build("DistributedFlowObjectiveStore")))
.build();
nextGroups.addListener(mapListener);
nextIds = storageService.getAtomicCounter("next-objective-counter");
log.info("Started");
}
示例4: activate
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Activate
public void activate() {
tpool = Executors.newFixedThreadPool(4, groupedThreads("onos/flobj-notifier", "%d", log));
eventQ = new LinkedBlockingQueue<ObjectiveEvent>();
tpool.execute(new FlowObjectiveNotifier());
nextGroups = storageService.<Integer, byte[]>consistentMapBuilder()
.withName("onos-flowobjective-groups")
.withSerializer(Serializer.using(
new KryoNamespace.Builder()
.register(byte[].class)
.register(Versioned.class)
.build("DistributedFlowObjectiveStore")))
.build();
nextGroups.addListener(mapListener);
nextIds = storageService.getAtomicIdGenerator("next-objective-id-generator");
log.info("Started");
}
示例5: notify
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Override
public void notify(ObjectiveEvent event) {
if (event.type() == ObjectiveEvent.Type.ADD) {
log.debug("Received notification of obj event {}", event);
Set<PendingFlowObjective> pending;
// first send all pending flows
synchronized (pendingForwards) {
// needs to be synchronized for queueObjective lookup
pending = pendingForwards.remove(event.subject());
}
if (pending == null) {
log.debug("No forwarding objectives pending for this "
+ "obj event {}", event);
} else {
log.debug("Processing {} pending forwarding objectives for nextId {}",
pending.size(), event.subject());
pending.forEach(p -> getDevicePipeliner(p.deviceId())
.forward((ForwardingObjective) p.flowObjective()));
}
// now check for pending next-objectives
synchronized (pendingNexts) {
// needs to be synchronized for queueObjective lookup
pending = pendingNexts.remove(event.subject());
}
if (pending == null) {
log.debug("No next objectives pending for this "
+ "obj event {}", event);
} else {
log.debug("Processing {} pending next objectives for nextId {}",
pending.size(), event.subject());
pending.forEach(p -> getDevicePipeliner(p.deviceId())
.next((NextObjective) p.flowObjective()));
}
}
}
示例6: putNextGroup
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Override
public void putNextGroup(NetworkId networkId, Integer nextId, NextGroup group) {
ConcurrentMap<Integer, byte[]> nextGroups = getNextGroups(networkId);
nextGroups.put(nextId, group.data());
updateNextGroupsMap(networkId, nextGroups);
eventQ.add(new VirtualObjectiveEvent(networkId, ObjectiveEvent.Type.ADD, nextId));
}
示例7: removeNextGroup
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Override
public NextGroup removeNextGroup(NetworkId networkId, Integer nextId) {
ConcurrentMap<Integer, byte[]> nextGroups = getNextGroups(networkId);
byte[] nextGroup = nextGroups.remove(nextId);
updateNextGroupsMap(networkId, nextGroups);
eventQ.add(new VirtualObjectiveEvent(networkId, ObjectiveEvent.Type.REMOVE, nextId));
return new DefaultNextGroup(nextGroup);
}
示例8: notify
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
@Override
public void notify(ObjectiveEvent event) {
if (event.type() == Type.ADD) {
log.debug("Received notification of obj event {}", event);
Set<PendingFlowObjective> pending;
// first send all pending flows
synchronized (pendingForwards) {
// needs to be synchronized for queueObjective lookup
pending = pendingForwards.remove(event.subject());
}
if (pending == null) {
log.debug("No forwarding objectives pending for this "
+ "obj event {}", event);
} else {
log.debug("Processing {} pending forwarding objectives for nextId {}",
pending.size(), event.subject());
pending.forEach(p -> getDevicePipeliner(p.deviceId())
.forward((ForwardingObjective) p.flowObjective()));
}
// now check for pending next-objectives
List<PendingFlowObjective> pendNexts;
synchronized (pendingNexts) {
// needs to be synchronized for queueObjective lookup
pendNexts = pendingNexts.remove(event.subject());
}
if (pendNexts == null) {
log.debug("No next objectives pending for this "
+ "obj event {}", event);
} else {
log.debug("Processing {} pending next objectives for nextId {}",
pendNexts.size(), event.subject());
pendNexts.forEach(p -> getDevicePipeliner(p.deviceId())
.next((NextObjective) p.flowObjective()));
}
}
}
示例9: pendingForwardingObjective
import org.onosproject.net.flowobjective.ObjectiveEvent; //導入依賴的package包/類
/**
* Tests adding a pending forwarding objective.
*
* @throws TestUtilsException if lookup of a field fails
*/
@Test
public void pendingForwardingObjective() throws TestUtilsException {
TrafficSelector selector = DefaultTrafficSelector.emptySelector();
TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
ForwardingObjective forward4 =
DefaultForwardingObjective.builder()
.fromApp(NetTestTools.APP_ID)
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.withSelector(selector)
.withTreatment(treatment)
.makePermanent()
.nextStep(4)
.add();
ForwardingObjective forward5 =
DefaultForwardingObjective.builder()
.fromApp(NetTestTools.APP_ID)
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.withSelector(selector)
.withTreatment(treatment)
.makePermanent()
.nextStep(5)
.add();
// multiple pending forwards should be combined
manager.forward(id1, forward4);
manager.forward(id1, forward4);
manager.forward(id1, forward5);
// 1 should be complete, 1 pending
TestTools.assertAfter(RETRY_MS, () ->
assertThat(forwardingObjectives, hasSize(1)));
assertThat(forwardingObjectives, hasItem("of:d1"));
assertThat(filteringObjectives, hasSize(0));
assertThat(nextObjectives, hasSize(0));
// Now send events to trigger the objective still in the queue
ObjectiveEvent event1 = new ObjectiveEvent(ObjectiveEvent.Type.ADD, 4);
FlowObjectiveStoreDelegate delegate = TestUtils.getField(manager, "delegate");
delegate.notify(event1);
// all should be processed now
TestTools.assertAfter(RETRY_MS, () ->
assertThat(forwardingObjectives, hasSize(2)));
assertThat(forwardingObjectives, hasItem("of:d1"));
assertThat(filteringObjectives, hasSize(0));
assertThat(nextObjectives, hasSize(0));
}