Inherit network resource information from a high level intent
This patch fixes ONOS-1677
Change-Id: I37d8742eb1a03b56d1e47d30d9342546ab42d23b
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 82ea0b7..986b33d 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
@@ -46,6 +46,17 @@
}
/**
+ * Creates a flow rule intent with the specified flow rules and resources.
+ *
+ * @param appId application id
+ * @param flowRules flow rules to be set
+ * @param resources network resource to be set
+ */
+ public FlowRuleIntent(ApplicationId appId, List<FlowRule> flowRules, Collection<NetworkResource> resources) {
+ this(appId, null, flowRules, resources);
+ }
+
+ /**
* Creates an flow rule intent with the specified key, flow rules to be set, and
* required network resources.
*
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
index 856499c..3e193ac 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
@@ -88,7 +88,7 @@
Set<LinkResourceAllocations> resources) {
LinkResourceAllocations allocations = assignWavelength(intent);
- return Arrays.asList(new FlowRuleIntent(appId, createRules(intent, allocations)));
+ return Arrays.asList(new FlowRuleIntent(appId, createRules(intent, allocations), intent.resources()));
}
private LinkResourceAllocations assignWavelength(OpticalPathIntent intent) {