* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.linkstate.attribute.sr;
+package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr;
+
+import static org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs.SIDParser.SID_TYPE;
import com.google.common.collect.ImmutableMap;
import io.netty.buffer.ByteBuf;
throw new UnsupportedOperationException();
}
- enum Size {
+ public enum Size {
LABEL(3), SID(4), IPV6_ADD(16);
- private int size;
private static final Map<Integer, Size> VALUE_MAP;
+
static {
final ImmutableMap.Builder<java.lang.Integer, Size> b = ImmutableMap.builder();
- for (final Size enumItem : Size.values()){
- b.put(enumItem.size, enumItem);
+ for (final Size enumItem : Size.values()) {
+ b.put(enumItem.length, enumItem);
}
VALUE_MAP = b.build();
}
- Size(final int size) {
- this.size = size;
+
+ private final int length;
+
+ Size(final int length) {
+ this.length = length;
}
- static Size forValue(final int value) {
+
+ public static Size forValue(final int value) {
return VALUE_MAP.get(value);
}
}
- static final int SID_TYPE = 1161;
-
- static ByteBuf serializeSidValue(final SidLabelIndex tlv) {
+ public static ByteBuf serializeSidValue(final SidLabelIndex tlv) {
if (tlv instanceof Ipv6AddressCase) {
return Ipv6Util.byteBufForAddress(((Ipv6AddressCase) tlv).getIpv6Address());
} else if (tlv instanceof LocalLabelCase) {
return parseSidLabelIndex(Size.forValue(length), buffer);
}
- static SidLabelIndex parseSidLabelIndex(final Size length, final ByteBuf buffer) {
+ public static SidLabelIndex parseSidLabelIndex(final Size length, final ByteBuf buffer) {
switch (length) {
case LABEL:
return new LocalLabelCaseBuilder().setLocalLabel(new MplsLabel(new Long(buffer.readUnsignedMedium() & LABEL_MASK))).build();