Thomas Vachuska

Added protection against no resources to PathIntentInstaller.

...@@ -79,11 +79,14 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> { ...@@ -79,11 +79,14 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> {
79 79
80 @Override 80 @Override
81 public List<FlowRuleBatchOperation> install(PathIntent intent) { 81 public List<FlowRuleBatchOperation> install(PathIntent intent) {
82 - LinkResourceAllocations allocations = allocateBandwidth(intent); 82 + if (intent.resourceRequests().length > 0) {
83 - if (allocations == null) { 83 + LinkResourceAllocations allocations = allocateBandwidth(intent);
84 - log.debug("Insufficient bandwidth available to install path intent {}", intent); 84 + if (allocations == null) {
85 - return null; 85 + log.debug("Insufficient bandwidth available to install path intent {}", intent);
86 + return null;
87 + }
86 } 88 }
89 +
87 TrafficSelector.Builder builder = 90 TrafficSelector.Builder builder =
88 DefaultTrafficSelector.builder(intent.selector()); 91 DefaultTrafficSelector.builder(intent.selector());
89 Iterator<Link> links = intent.path().links().iterator(); 92 Iterator<Link> links = intent.path().links().iterator();
......