Fix for ONOS-251 - Can't create bandwidth constrained intents
The simple link resource store was not setting a default value for the bandwidth on a link, so all requests for bandwidth constrained paths were failing due to no available bandwidth. Change-Id: Ibdeeae8ad22cfab443d694588d74fc2e910d72bf
Showing
1 changed file
with
5 additions
and
4 deletions
... | @@ -49,6 +49,7 @@ import org.slf4j.Logger; | ... | @@ -49,6 +49,7 @@ import org.slf4j.Logger; |
49 | @Component(immediate = true) | 49 | @Component(immediate = true) |
50 | @Service | 50 | @Service |
51 | public class SimpleLinkResourceStore implements LinkResourceStore { | 51 | public class SimpleLinkResourceStore implements LinkResourceStore { |
52 | + private static final int DEFAULT_BANDWIDTH = 1_000; | ||
52 | private final Logger log = getLogger(getClass()); | 53 | private final Logger log = getLogger(getClass()); |
53 | private Map<IntentId, LinkResourceAllocations> linkResourceAllocationsMap; | 54 | private Map<IntentId, LinkResourceAllocations> linkResourceAllocationsMap; |
54 | private Map<Link, Set<LinkResourceAllocations>> allocatedResources; | 55 | private Map<Link, Set<LinkResourceAllocations>> allocatedResources; |
... | @@ -88,14 +89,14 @@ public class SimpleLinkResourceStore implements LinkResourceStore { | ... | @@ -88,14 +89,14 @@ public class SimpleLinkResourceStore implements LinkResourceStore { |
88 | log.debug("No optical.wave annotation on link %s", link); | 89 | log.debug("No optical.wave annotation on link %s", link); |
89 | } | 90 | } |
90 | 91 | ||
92 | + int bandwidth = DEFAULT_BANDWIDTH; | ||
91 | try { | 93 | try { |
92 | - int bandwidth = Integer.parseInt(annotations.value(AnnotationKeys.BANDWIDTH)); | 94 | + bandwidth = Integer.parseInt(annotations.value(AnnotationKeys.BANDWIDTH)); |
93 | - allocations.add( | ||
94 | - new BandwidthResourceAllocation(Bandwidth.valueOf(bandwidth))); | ||
95 | } catch (NumberFormatException e) { | 95 | } catch (NumberFormatException e) { |
96 | log.debug("No bandwidth annotation on link %s", link); | 96 | log.debug("No bandwidth annotation on link %s", link); |
97 | } | 97 | } |
98 | - | 98 | + allocations.add( |
99 | + new BandwidthResourceAllocation(Bandwidth.valueOf(bandwidth))); | ||
99 | return allocations; | 100 | return allocations; |
100 | } | 101 | } |
101 | 102 | ... | ... |
-
Please register or login to post a comment