adding and removing tracked resources
Change-Id: I5030e1c21a61e54f251dbc5760783f1ac2e4d2d7
Showing
3 changed files
with
10 additions
and
0 deletions
... | @@ -47,6 +47,8 @@ class InstallCoordinating implements IntentUpdate { | ... | @@ -47,6 +47,8 @@ class InstallCoordinating implements IntentUpdate { |
47 | @Override | 47 | @Override |
48 | public Optional<IntentUpdate> execute() { | 48 | public Optional<IntentUpdate> execute() { |
49 | try { | 49 | try { |
50 | + //FIXME we orphan flow rules that are currently on the data plane | ||
51 | + // ... should either reuse them or remove them | ||
50 | FlowRuleOperations flowRules = intentManager.coordinate(pending); | 52 | FlowRuleOperations flowRules = intentManager.coordinate(pending); |
51 | return Optional.of(new Installing(intentManager, pending, flowRules)); | 53 | return Optional.of(new Installing(intentManager, pending, flowRules)); |
52 | } catch (IntentException e) { | 54 | } catch (IntentException e) { | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.net.intent.impl; | 16 | package org.onosproject.net.intent.impl; |
17 | 17 | ||
18 | import org.onosproject.net.flow.FlowRuleOperations; | 18 | import org.onosproject.net.flow.FlowRuleOperations; |
19 | +import org.onosproject.net.intent.Intent; | ||
19 | import org.onosproject.net.intent.IntentData; | 20 | import org.onosproject.net.intent.IntentData; |
20 | import org.onosproject.net.intent.IntentException; | 21 | import org.onosproject.net.intent.IntentException; |
21 | import org.slf4j.Logger; | 22 | import org.slf4j.Logger; |
... | @@ -48,6 +49,9 @@ class Installing implements IntentUpdate { | ... | @@ -48,6 +49,9 @@ class Installing implements IntentUpdate { |
48 | public Optional<IntentUpdate> execute() { | 49 | public Optional<IntentUpdate> execute() { |
49 | try { | 50 | try { |
50 | intentManager.flowRuleService.apply(flowRules); // FIXME we need to provide a context | 51 | intentManager.flowRuleService.apply(flowRules); // FIXME we need to provide a context |
52 | + for (Intent installable: pending.installables()) { | ||
53 | + intentManager.trackerService.addTrackedResources(pending.key(), installable.resources()); | ||
54 | + } | ||
51 | return Optional.of(new Installed(pending)); | 55 | return Optional.of(new Installed(pending)); |
52 | // What kinds of exceptions are thrown by FlowRuleService.apply()? | 56 | // What kinds of exceptions are thrown by FlowRuleService.apply()? |
53 | // Is IntentException a correct exception abstraction? | 57 | // Is IntentException a correct exception abstraction? | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.net.intent.impl; | 16 | package org.onosproject.net.intent.impl; |
17 | 17 | ||
18 | import org.onosproject.net.flow.FlowRuleOperations; | 18 | import org.onosproject.net.flow.FlowRuleOperations; |
19 | +import org.onosproject.net.intent.Intent; | ||
19 | import org.onosproject.net.intent.IntentData; | 20 | import org.onosproject.net.intent.IntentData; |
20 | 21 | ||
21 | import java.util.Optional; | 22 | import java.util.Optional; |
... | @@ -42,6 +43,9 @@ class Withdrawing implements IntentUpdate { | ... | @@ -42,6 +43,9 @@ class Withdrawing implements IntentUpdate { |
42 | @Override | 43 | @Override |
43 | public Optional<IntentUpdate> execute() { | 44 | public Optional<IntentUpdate> execute() { |
44 | intentManager.flowRuleService.apply(flowRules); | 45 | intentManager.flowRuleService.apply(flowRules); |
46 | + for (Intent installable: pending.installables()) { | ||
47 | + intentManager.trackerService.removeTrackedResources(pending.key(), installable.resources()); | ||
48 | + } | ||
45 | return Optional.of(new Withdrawn(pending)); | 49 | return Optional.of(new Withdrawn(pending)); |
46 | } | 50 | } |
47 | } | 51 | } | ... | ... |
-
Please register or login to post a comment