Brian O'Connor

adding and removing tracked resources

Change-Id: I5030e1c21a61e54f251dbc5760783f1ac2e4d2d7
......@@ -47,6 +47,8 @@ class InstallCoordinating implements IntentUpdate {
@Override
public Optional<IntentUpdate> execute() {
try {
//FIXME we orphan flow rules that are currently on the data plane
// ... should either reuse them or remove them
FlowRuleOperations flowRules = intentManager.coordinate(pending);
return Optional.of(new Installing(intentManager, pending, flowRules));
} catch (IntentException e) {
......
......@@ -16,6 +16,7 @@
package org.onosproject.net.intent.impl;
import org.onosproject.net.flow.FlowRuleOperations;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentData;
import org.onosproject.net.intent.IntentException;
import org.slf4j.Logger;
......@@ -48,6 +49,9 @@ class Installing implements IntentUpdate {
public Optional<IntentUpdate> execute() {
try {
intentManager.flowRuleService.apply(flowRules); // FIXME we need to provide a context
for (Intent installable: pending.installables()) {
intentManager.trackerService.addTrackedResources(pending.key(), installable.resources());
}
return Optional.of(new Installed(pending));
// What kinds of exceptions are thrown by FlowRuleService.apply()?
// Is IntentException a correct exception abstraction?
......
......@@ -16,6 +16,7 @@
package org.onosproject.net.intent.impl;
import org.onosproject.net.flow.FlowRuleOperations;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentData;
import java.util.Optional;
......@@ -42,6 +43,9 @@ class Withdrawing implements IntentUpdate {
@Override
public Optional<IntentUpdate> execute() {
intentManager.flowRuleService.apply(flowRules);
for (Intent installable: pending.installables()) {
intentManager.trackerService.removeTrackedResources(pending.key(), installable.resources());
}
return Optional.of(new Withdrawn(pending));
}
}
......