Inherit resources from a high level intent when creating a FlowRuleIntent
Make constructor without resources argument deprecated
Change-Id: I400cedfb2ec5f8ec3217e4729d95b075ceb0b025
diff --git a/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java b/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
index 986b33d..b2c6cb8 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
@@ -41,6 +41,7 @@
* @param appId application id
* @param flowRules flow rules to be set.
*/
+ @Deprecated
public FlowRuleIntent(ApplicationId appId, List<FlowRule> flowRules) {
this(appId, null, flowRules, Collections.emptyList());
}
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
index 72077f9..e4f144d 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
@@ -104,7 +104,7 @@
for (DeviceId deviceId: outputPorts.keys()) {
rules.addAll(createRules(intent, deviceId, inputPorts.get(deviceId), outputPorts.get(deviceId)));
}
- return Arrays.asList(new FlowRuleIntent(appId, rules));
+ return Arrays.asList(new FlowRuleIntent(appId, rules, intent.resources()));
}
private List<FlowRule> createRules(LinkCollectionIntent intent, DeviceId deviceId,
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
index b3bd864..4558ce0 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
@@ -86,7 +86,7 @@
LinkResourceAllocations allocations = assignMplsLabel(intent);
List<FlowRule> rules = generateRules(intent, allocations);
- return Arrays.asList(new FlowRuleIntent(appId, rules));
+ return Arrays.asList(new FlowRuleIntent(appId, rules, intent.resources()));
}
@Activate