HIGUCHI Yuta
Committed by Gerrit Code Review

Change default available MPLS label range

- Follow IANA assignments, and
  align with old resource service behavior

Change-Id: I1b7c96707842cf8e6f0f13cff99fa0eda8230263
...@@ -63,7 +63,11 @@ final class ResourceDeviceListener implements DeviceListener { ...@@ -63,7 +63,11 @@ final class ResourceDeviceListener implements DeviceListener {
63 private static final int MAX_VLAN_ID = VlanId.MAX_VLAN; 63 private static final int MAX_VLAN_ID = VlanId.MAX_VLAN;
64 private static final List<VlanId> ENTIRE_VLAN_IDS = getEntireVlans(); 64 private static final List<VlanId> ENTIRE_VLAN_IDS = getEntireVlans();
65 65
66 - private static final int MAX_MPLS_LABEL = 1048576; 66 + // Ref: http://www.iana.org/assignments/mpls-label-values/mpls-label-values.xhtml
67 + // Smallest non-reserved MPLS label
68 + private static final int MIN_UNRESERVED_LABEL = 0x10;
69 + // Max non-reserved MPLS label = 239
70 + private static final int MAX_UNRESERVED_LABEL = 0xEF;
67 private static final List<MplsLabel> ENTIRE_MPLS_LABELS = getEntireMplsLabels(); 71 private static final List<MplsLabel> ENTIRE_MPLS_LABELS = getEntireMplsLabels();
68 72
69 private static final int TOTAL_ODU2_TRIBUTARY_SLOTS = 8; 73 private static final int TOTAL_ODU2_TRIBUTARY_SLOTS = 8;
...@@ -264,8 +268,7 @@ final class ResourceDeviceListener implements DeviceListener { ...@@ -264,8 +268,7 @@ final class ResourceDeviceListener implements DeviceListener {
264 } 268 }
265 269
266 private static List<MplsLabel> getEntireMplsLabels() { 270 private static List<MplsLabel> getEntireMplsLabels() {
267 - // potentially many objects are created 271 + return IntStream.range(MIN_UNRESERVED_LABEL, MAX_UNRESERVED_LABEL + 1)
268 - return IntStream.range(0, MAX_MPLS_LABEL)
269 .mapToObj(MplsLabel::mplsLabel) 272 .mapToObj(MplsLabel::mplsLabel)
270 .collect(Collectors.toList()); 273 .collect(Collectors.toList());
271 } 274 }
......