private static final byte[] NO_EXPORT_SUBCONFED = new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x03 };
+ private static final byte[] LLGR_STALE = new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x06 };
+
+ private static final byte[] NO_LLGR = new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x07 };
+
private final ReferenceCache refCache;
public CommunitiesAttributeParser(final ReferenceCache refCache) {
return CommunityUtil.NO_ADVERTISE;
} else if (Arrays.equals(body, NO_EXPORT_SUBCONFED)) {
return CommunityUtil.NO_EXPORT_SUBCONFED;
+ } else if (Arrays.equals(body, LLGR_STALE)) {
+ return CommunityUtil.LLGR_STALE;
+ } else if (Arrays.equals(body, NO_LLGR)) {
+ return CommunityUtil.NO_LLGR;
}
return CommunityUtil.create(refCache, buffer.readUnsignedShort(), buffer.readUnsignedShort());
}
public static final Community NO_EXPORT_SUBCONFED
= CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF03);
+ /**
+ * LLGR_STALE community can be used to mark stale routes retained for a longer period of time.
+ * Such long-lived stale routes are to be handled according to the procedures specified in
+ * https://tools.ietf.org/html/draft-uttaro-idr-bgp-persistence-04#section-4.
+ */
+ public static final Community LLGR_STALE
+ = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0x0006);
+
+ /**
+ * NO_LLGR community can be used to mark routes which a BGP speaker does not want treated according
+ * to procedures, as detailed in https://tools.ietf.org/html/draft-uttaro-idr-bgp-persistence-04#section-4.
+ */
+ public static final Community NO_LLGR
+ = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0x0007);
+
private final ReferenceCache refCache;
public CommunityUtil(final ReferenceCache refCache) {
public class CommunitiesAttributeParserTest {
- private static final byte[] CommunitiesBytes = {(byte) 0xC0, (byte) 0x08, (byte) 0x10,
+ private static final byte[] CommunitiesBytes = {(byte) 0xC0, (byte) 0x08, (byte) 0x18,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x1,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x2,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x3,
- (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x10};
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x10,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x06,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x07};
@Test
public void testCommunitiesAttributeParser() throws Exception {
comms.add((Communities) CommunityUtil.NO_ADVERTISE);
comms.add((Communities) CommunityUtil.NO_EXPORT_SUBCONFED);
comms.add((Communities) CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF10));
+ comms.add((Communities) CommunityUtil.LLGR_STALE);
+ comms.add((Communities) CommunityUtil.NO_LLGR);
final AttributesBuilder paBuilder = new AttributesBuilder();
paBuilder.setCommunities(comms);