<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <failOnError>true</failOnError>
+ </configuration>
+ </plugin>
<!-- test jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
final StatisticsReportHandler statisticsReportHandler = new StatisticsReportHandler(this.messageRegistry,
context.getBmpStatisticsTlvRegistry());
- regs.add(context.registerBmpMessageParser(statisticsReportHandler.getBmpMessageType(), statisticsReportHandler));
+ regs.add(context.registerBmpMessageParser(statisticsReportHandler.getBmpMessageType(),
+ statisticsReportHandler));
regs.add(context.registerBmpMessageSerializer(StatsReportsMessage.class, statisticsReportHandler));
- final RouteMonitoringMessageHandler routeMonitoringMessageHandler = new RouteMonitoringMessageHandler(this.messageRegistry);
- regs.add(context.registerBmpMessageParser(routeMonitoringMessageHandler.getBmpMessageType(), routeMonitoringMessageHandler));
+ final RouteMonitoringMessageHandler routeMonitoringMessageHandler =
+ new RouteMonitoringMessageHandler(this.messageRegistry);
+ regs.add(context.registerBmpMessageParser(routeMonitoringMessageHandler.getBmpMessageType(),
+ routeMonitoringMessageHandler));
regs.add(context.registerBmpMessageSerializer(RouteMonitoringMessage.class, routeMonitoringMessageHandler));
- final RouteMirroringMessageHandler routeMirroringMessageHandler = new RouteMirroringMessageHandler(this.messageRegistry, context.getBmpRouteMirroringTlvRegistry());
- regs.add(context.registerBmpMessageParser(routeMirroringMessageHandler.getBmpMessageType(), routeMirroringMessageHandler));
+ final RouteMirroringMessageHandler routeMirroringMessageHandler =
+ new RouteMirroringMessageHandler(this.messageRegistry, context.getBmpRouteMirroringTlvRegistry());
+ regs.add(context.registerBmpMessageParser(routeMirroringMessageHandler.getBmpMessageType(),
+ routeMirroringMessageHandler));
regs.add(context.registerBmpMessageSerializer(RouteMirroringMessage.class, routeMirroringMessageHandler));
}
- private static void registerBmpTlvHandlers(final List<AutoCloseable> regs, final BmpExtensionProviderContext context) {
+ private static void registerBmpTlvHandlers(final List<AutoCloseable> regs,
+ final BmpExtensionProviderContext context) {
final DescriptionTlvHandler descriptionTlvHandler = new DescriptionTlvHandler();
regs.add(context.registerBmpInitiationTlvParser(DescriptionTlvHandler.TYPE, descriptionTlvHandler));
regs.add(context.registerBmpInitiationTlvSerializer(DescriptionTlv.class, descriptionTlvHandler));
regs.add(context.registerBmpRouteMirroringTlvSerializer(MirrorInformationTlv.class, informationTlvHandler));
}
- private void registerBmpStatTlvHandlers(final List<AutoCloseable> regs, final BmpExtensionProviderContext context) {
+ private void registerBmpStatTlvHandlers(final List<AutoCloseable> regs,
+ final BmpExtensionProviderContext context) {
final StatType000TlvHandler statType000TlvHandler = new StatType000TlvHandler();
regs.add(context.registerBmpStatisticsTlvParser(StatType000TlvHandler.TYPE, statType000TlvHandler));
regs.add(context.registerBmpStatisticsTlvSerializer(RejectedPrefixesTlv.class, statType000TlvHandler));
final StatType001TlvHandler statType001TlvHandler = new StatType001TlvHandler();
regs.add(context.registerBmpStatisticsTlvParser(StatType001TlvHandler.TYPE, statType001TlvHandler));
- regs.add(context.registerBmpStatisticsTlvSerializer(DuplicatePrefixAdvertisementsTlv.class, statType001TlvHandler));
+ regs.add(context.registerBmpStatisticsTlvSerializer(DuplicatePrefixAdvertisementsTlv.class,
+ statType001TlvHandler));
final StatType002TlvHandler statType002TlvHandler = new StatType002TlvHandler();
regs.add(context.registerBmpStatisticsTlvParser(StatType002TlvHandler.TYPE, statType002TlvHandler));
final StatType003TlvHandler statType003TlvHandler = new StatType003TlvHandler();
regs.add(context.registerBmpStatisticsTlvParser(StatType003TlvHandler.TYPE, statType003TlvHandler));
- regs.add(context.registerBmpStatisticsTlvSerializer(InvalidatedClusterListLoopTlv.class, statType003TlvHandler));
+ regs.add(context.registerBmpStatisticsTlvSerializer(InvalidatedClusterListLoopTlv.class,
+ statType003TlvHandler));
final StatType004TlvHandler statType004TlvHandler = new StatType004TlvHandler();
regs.add(context.registerBmpStatisticsTlvParser(StatType004TlvHandler.TYPE, statType004TlvHandler));
regs.add(context.registerBmpStatisticsTlvParser(StatType008TlvHandler.TYPE, statType008TlvHandler));
regs.add(context.registerBmpStatisticsTlvSerializer(LocRibRoutesTlv.class, statType008TlvHandler));
- final StatType009TlvHandler statType009TlvHandler = new StatType009TlvHandler(this.afiRegistry, this.safiRegistry);
+ final StatType009TlvHandler statType009TlvHandler =
+ new StatType009TlvHandler(this.afiRegistry, this.safiRegistry);
regs.add(context.registerBmpStatisticsTlvParser(StatType009TlvHandler.TYPE, statType009TlvHandler));
regs.add(context.registerBmpStatisticsTlvSerializer(PerAfiSafiAdjRibInTlv.class, statType009TlvHandler));
- final StatType010TlvHandler statType010TlvHandler = new StatType010TlvHandler(this.afiRegistry, this.safiRegistry);
+ final StatType010TlvHandler statType010TlvHandler =
+ new StatType010TlvHandler(this.afiRegistry, this.safiRegistry);
regs.add(context.registerBmpStatisticsTlvParser(StatType010TlvHandler.TYPE, statType010TlvHandler));
regs.add(context.registerBmpStatisticsTlvSerializer(PerAfiSafiLocRibTlv.class, statType010TlvHandler));
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
- Preconditions.checkArgument(message instanceof InitiationMessage, "Incorrect instance of BGP message. The Initiation Message is expected.");
+ Preconditions.checkArgument(message instanceof InitiationMessage,
+ "Incorrect instance of BGP message. The Initiation Message is expected.");
final InitiationMessage initiation = (InitiationMessage) message;
serializeTlvs(initiation.getTlvs(), buffer);
}
} else if (tlv instanceof StringTlv) {
builder.setStringInformation(ImmutableList.<StringInformation>builder()
.addAll(builder.getStringInformation())
- .add(new StringInformationBuilder().setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
+ .add(new StringInformationBuilder()
+ .setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
}
}
}
import static org.opendaylight.protocol.bmp.parser.message.PeerDownHandler.Reason.REASON_ONE;
import static org.opendaylight.protocol.bmp.parser.message.PeerDownHandler.Reason.REASON_THREE;
import static org.opendaylight.protocol.bmp.parser.message.PeerDownHandler.Reason.REASON_TWO;
+
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import io.netty.buffer.ByteBuf;
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
- Preconditions.checkArgument(message instanceof PeerDownNotification, "An instance of PeerDownNotification is required");
+ Preconditions.checkArgument(message instanceof PeerDownNotification,
+ "An instance of PeerDownNotification is required");
final PeerDownNotification peerDown = (PeerDownNotification) message;
if (peerDown.isLocalSystemClosed()) {
if (peerDown.getData() instanceof FsmEventCode) {
ByteBufWriteUtil.writeUnsignedByte(REASON_TWO.getValue(), buffer);
ByteBufWriteUtil.writeUnsignedShort(((FsmEventCode) peerDown.getData()).getFsmEventCode(), buffer);
- } else if (peerDown.getData() instanceof
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) {
+ } else if (peerDown.getData()
+ instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207
+ .peer.down.data.Notification) {
ByteBufWriteUtil.writeUnsignedByte(REASON_ONE.getValue(), buffer);
serializePDU(peerDown.getData(), buffer);
}
} else {
- if (peerDown.getData() instanceof
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) {
+ if (peerDown.getData()
+ instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207
+ .peer.down.data.Notification) {
ByteBufWriteUtil.writeUnsignedByte(REASON_THREE.getValue(), buffer);
serializePDU(peerDown.getData(), buffer);
} else {
}
private void serializePDU(final Data data, final ByteBuf buffer) {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification notification
- = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) data;
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+ .Notification notification = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp
+ .message.rev171207.peer.down.data.Notification) data;
this.msgRegistry.serializeMessage(new NotifyBuilder(notification.getNotification()).build(), buffer);
}
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
- final PeerDownNotificationBuilder peerDown = new PeerDownNotificationBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+ final PeerDownNotificationBuilder peerDown = new PeerDownNotificationBuilder()
+ .setPeerHeader(parsePerPeerHeader(bytes));
final Reason reason = Reason.forValue(bytes.readUnsignedByte());
if (reason != null) {
switch (reason) {
- case REASON_ONE:
- peerDown.setLocalSystemClosed(true);
- peerDown.setData(parseBgpNotificationMessage(bytes));
- break;
- case REASON_TWO:
- peerDown.setLocalSystemClosed(true);
- peerDown.setData(new FsmEventCodeBuilder().setFsmEventCode(bytes.readUnsignedShort()).build());
- break;
- case REASON_THREE:
- case REASON_FOUR:
- peerDown.setLocalSystemClosed(false);
- peerDown.setData(parseBgpNotificationMessage(bytes));
- break;
- case REASON_FIVE:
- peerDown.setLocalSystemClosed(false);
- break;
- default:
- break;
+ case REASON_ONE:
+ peerDown.setLocalSystemClosed(true);
+ peerDown.setData(parseBgpNotificationMessage(bytes));
+ break;
+ case REASON_TWO:
+ peerDown.setLocalSystemClosed(true);
+ peerDown.setData(new FsmEventCodeBuilder().setFsmEventCode(bytes.readUnsignedShort()).build());
+ break;
+ case REASON_THREE:
+ case REASON_FOUR:
+ peerDown.setLocalSystemClosed(false);
+ peerDown.setData(parseBgpNotificationMessage(bytes));
+ break;
+ case REASON_FIVE:
+ peerDown.setLocalSystemClosed(false);
+ break;
+ default:
+ break;
}
}
return peerDown.build();
}
- private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification parseBgpNotificationMessage(final ByteBuf bytes) throws BmpDeserializationException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.NotificationBuilder notificationCBuilder
- = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.NotificationBuilder();
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+ .Notification parseBgpNotificationMessage(final ByteBuf bytes) throws BmpDeserializationException {
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+ .NotificationBuilder notificationCBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params
+ .xml.ns.yang.bmp.message.rev171207.peer.down.data.NotificationBuilder();
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification.NotificationBuilder notificationBuilder
- = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification.NotificationBuilder();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+ .notification.NotificationBuilder notificationBuilder = new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification
+ .NotificationBuilder();
try {
final Notification not = this.msgRegistry.parseMessage(bytes, null);
requireNonNull(not, "Notify message may not be null.");
- Preconditions.checkArgument(not instanceof NotifyMessage, "An instance of NotifyMessage is required");
+ Preconditions.checkArgument(not instanceof NotifyMessage,
+ "An instance of NotifyMessage is required");
notificationBuilder.fieldsFrom((NotifyMessage) not);
notificationCBuilder.setNotification(notificationBuilder.build());
} catch (final BGPDocumentedException | BGPParsingException e) {
}
public enum Reason {
-
- REASON_ONE((short) 1), REASON_TWO((short) 2), REASON_THREE((short) 3), REASON_FOUR((short) 4), REASON_FIVE((short) 5);
+ REASON_ONE((short) 1),
+ REASON_TWO((short) 2),
+ REASON_THREE((short) 3),
+ REASON_FOUR((short) 4),
+ REASON_FIVE((short) 5);
private static final Map<Short, Reason> VALUE_MAP;
package org.opendaylight.protocol.bmp.parser.message;
-
import static java.util.Objects.requireNonNull;
import com.google.common.base.Preconditions;
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
final PeerUpNotificationBuilder peerUpNot = new PeerUpNotificationBuilder()
- .setPeerHeader(parsePerPeerHeader(bytes));
+ .setPeerHeader(parsePerPeerHeader(bytes));
if (peerUpNot.getPeerHeader().isIpv4()) {
bytes.skipBytes(Ipv6Util.IPV6_LENGTH - Ipv4Util.IP4_LENGTH);
peerUpNot.setRemotePort(new PortNumber(bytes.readUnsignedShort()));
try {
final Notification opSent = this.msgRegistry
- .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
+ .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
requireNonNull(opSent,
- "Error on parse Sent OPEN Message, Sent OPEN Message is null");
+ "Error on parse Sent OPEN Message, Sent OPEN Message is null");
Preconditions.checkArgument(opSent instanceof OpenMessage,
- "An instance of OpenMessage notification is required");
+ "An instance of OpenMessage notification is required");
final OpenMessage sent = (OpenMessage) opSent;
final Notification opRec = this.msgRegistry
- .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
+ .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
requireNonNull(opRec,
- "Error on parse Received OPEN Message, Received OPEN Message is null");
+ "Error on parse Received OPEN Message, Received OPEN Message is null");
Preconditions.checkArgument(opRec instanceof OpenMessage,
- "An instance of OpenMessage notification is required");
+ "An instance of OpenMessage notification is required");
final OpenMessage received = (OpenMessage) opRec;
peerUpNot.setSentOpen(new SentOpenBuilder(sent).build());
peerUpNot.setReceivedOpen(new ReceivedOpenBuilder(received).build());
final InformationBuilder infos = new InformationBuilder();
- if ( bytes.isReadable() ) {
+ if (bytes.isReadable()) {
parseTlvs(infos, bytes);
peerUpNot.setInformation(infos.build());
}
protected void addTlv(final InformationBuilder builder, final Tlv tlv) {
if (tlv instanceof StringTlv) {
final ImmutableList.Builder<StringInformation> stringInfoListBuilder = ImmutableList.builder();
- if ( builder.getStringInformation() != null ) {
+ if (builder.getStringInformation() != null) {
stringInfoListBuilder.addAll(builder.getStringInformation());
}
builder.setStringInformation(stringInfoListBuilder.add(new StringInformationBuilder().setStringTlv(
- new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
+ new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
}
}
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
- Preconditions.checkArgument(message instanceof RouteMirroringMessage, "An instance of RouteMirroringMessage is required");
+ Preconditions.checkArgument(message instanceof RouteMirroringMessage,
+ "An instance of RouteMirroringMessage is required");
final RouteMirroringMessage routeMirror = (RouteMirroringMessage) message;
serializeTlvs(routeMirror.getTlvs(), buffer);
}
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
- final RouteMirroringMessageBuilder routeMirror = new RouteMirroringMessageBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+ final RouteMirroringMessageBuilder routeMirror = new RouteMirroringMessageBuilder()
+ .setPeerHeader(parsePerPeerHeader(bytes));
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes);
return routeMirror.setTlvs(tlvsBuilder.build()).build();
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
- Preconditions.checkArgument(message instanceof RouteMonitoringMessage, "An instance of RouteMonitoringMessage is required");
+ Preconditions.checkArgument(message instanceof RouteMonitoringMessage,
+ "An instance of RouteMonitoringMessage is required");
final RouteMonitoringMessage routeMonitor = (RouteMonitoringMessage) message;
this.msgRegistry.serializeMessage(new UpdateBuilder(routeMonitor.getUpdate()).build(), buffer);
}
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
- final RouteMonitoringMessageBuilder routeMonitor = new RouteMonitoringMessageBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+ final RouteMonitoringMessageBuilder routeMonitor = new RouteMonitoringMessageBuilder()
+ .setPeerHeader(parsePerPeerHeader(bytes));
try {
final Notification message = this.msgRegistry.parseMessage(bytes, null);
requireNonNull(message, "UpdateMessage may not be null");
- Preconditions.checkArgument(message instanceof UpdateMessage, "An instance of UpdateMessage is required");
+ Preconditions.checkArgument(message instanceof UpdateMessage,
+ "An instance of UpdateMessage is required");
final UpdateMessage updateMessage = (UpdateMessage) message;
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route.monitoring
- .message.Update update = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message
- .rev171207.route.monitoring.message.UpdateBuilder(updateMessage).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route
+ .monitoring.message.Update update = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+ .ns.yang.bmp.message.rev171207.route.monitoring.message.UpdateBuilder(updateMessage).build();
routeMonitor.setUpdate(update);
} catch (final BGPDocumentedException | BGPParsingException e) {
throw new BmpDeserializationException("Error while parsing Update Message.", e);
import static org.opendaylight.protocol.util.ByteBufWriteUtil.INT_BYTES_LENGTH;
import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedInt;
+
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.tlvs.UpdatesTreatedAsWithdrawTlv;
import org.opendaylight.yangtools.yang.binding.Notification;
-/**
- * Created by cgasparini on 13.5.2015.
- */
public class StatisticsReportHandler extends AbstractBmpPerPeerMessageParser<TlvsBuilder> {
private static final int MESSAGE_TYPE = 1;
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
- Preconditions.checkArgument(message instanceof StatsReportsMessage, "An instance of Statistics Reports message is required");
+ Preconditions.checkArgument(message instanceof StatsReportsMessage,
+ "An instance of Statistics Reports message is required");
final StatsReportsMessage statsReport = (StatsReportsMessage) message;
serializeTlvs(statsReport.getTlvs(), buffer);
}
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
- final StatsReportsMessageBuilder statReport = new StatsReportsMessageBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+ final StatsReportsMessageBuilder statReport = new StatsReportsMessageBuilder()
+ .setPeerHeader(parsePerPeerHeader(bytes));
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
bytes.skipBytes(INT_BYTES_LENGTH);
parseTlvs(tlvsBuilder, bytes);
return MESSAGE_TYPE;
}
- protected void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
+ private void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
final AtomicInteger counter = new AtomicInteger(0);
final ByteBuf tlvsBuffer = Unpooled.buffer();
serializeStatTlv(tlvs.getRejectedPrefixesTlv(), tlvsBuffer, counter);
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder;
import org.opendaylight.yangtools.yang.binding.Notification;
-/**
- * Created by cgasparini on 13.5.2015.
- */
public class TerminationHandler extends AbstractBmpMessageWithTlvParser<TlvsBuilder> {
public TerminationHandler(final BmpTlvRegistry tlvRegistry) {
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
- Preconditions.checkArgument(message instanceof TerminationMessage, "An instance of Termination message is required");
+ Preconditions.checkArgument(message instanceof TerminationMessage,
+ "An instance of Termination message is required");
final TerminationMessage terminationMsg = (TerminationMessage) message;
serializeTlvs(terminationMsg.getTlvs(), buffer);
}
} else if (tlv instanceof StringTlv) {
builder.setStringInformation(ImmutableList.<StringInformation>builder()
.addAll(builder.getStringInformation())
- .add(new StringInformationBuilder().setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
+ .add(new StringInformationBuilder()
+ .setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
}
}
}
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof MirrorInformationTlv, "MirrorInformationTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof MirrorInformationTlv,
+ "MirrorInformationTlv is mandatory.");
TlvUtil.formatTlvShort16(TYPE, ((MirrorInformationTlv) tlv).getCode().getIntValue(), output);
}
if (buffer == null) {
return null;
}
- return new MirrorInformationTlvBuilder().setCode(MirrorInformationCode.forValue(buffer.readUnsignedShort())).build();
+ return new MirrorInformationTlvBuilder()
+ .setCode(MirrorInformationCode.forValue(buffer.readUnsignedShort())).build();
}
}
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof DuplicatePrefixAdvertisementsTlv, "DuplicatePrefixAdvertisementsTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof DuplicatePrefixAdvertisementsTlv,
+ "DuplicatePrefixAdvertisementsTlv is mandatory.");
TlvUtil.formatTlvCounter32(TYPE, ((DuplicatePrefixAdvertisementsTlv) tlv).getCount(), output);
}
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof InvalidatedClusterListLoopTlv, "InvalidatedClusterListLoopTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof InvalidatedClusterListLoopTlv,
+ "InvalidatedClusterListLoopTlv is mandatory.");
TlvUtil.formatTlvCounter32(TYPE, ((InvalidatedClusterListLoopTlv) tlv).getCount(), output);
}
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof InvalidatedOriginatorIdTlv, "InvalidatedOriginatorIdTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof InvalidatedOriginatorIdTlv,
+ "InvalidatedOriginatorIdTlv is mandatory.");
TlvUtil.formatTlvCounter32(TYPE, ((InvalidatedOriginatorIdTlv) tlv).getCount(), output);
}
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof InvalidatedAsConfedLoopTlv, "InvalidatedAsConfedLoopTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof InvalidatedAsConfedLoopTlv,
+ "InvalidatedAsConfedLoopTlv is mandatory.");
TlvUtil.formatTlvCounter32(TYPE, ((InvalidatedAsConfedLoopTlv) tlv).getCount(), output);
}
if (buffer == null) {
return null;
}
- return new AdjRibsInRoutesTlvBuilder().setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+ return new AdjRibsInRoutesTlvBuilder()
+ .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
}
}
if (buffer == null) {
return null;
}
- return new LocRibRoutesTlvBuilder().setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+ return new LocRibRoutesTlvBuilder()
+ .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
}
}
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
Preconditions.checkArgument(tlv instanceof PerAfiSafiAdjRibInTlv, "PerAfiSafiAdjRibInTlv is mandatory.");
final ByteBuf buffer = Unpooled.buffer();
- ByteBufWriteUtil.writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv).getAfi()), buffer);
- ByteBufWriteUtil.writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv).getSafi()).shortValue(), buffer);
+ ByteBufWriteUtil.writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv)
+ .getAfi()), buffer);
+ ByteBufWriteUtil.writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv)
+ .getSafi()).shortValue(), buffer);
ByteBufWriteUtil.writeUnsignedLong(((PerAfiSafiAdjRibInTlv) tlv).getCount().getValue(), buffer);
TlvUtil.formatTlv(TYPE, buffer, output);
}
return null;
}
return new PerAfiSafiAdjRibInTlvBuilder()
- .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
- .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
- .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+ .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
+ .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
+ .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
}
}
package org.opendaylight.protocol.bmp.parser.tlv;
import static java.util.Objects.requireNonNull;
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedByte;
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedLong;
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort;
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.bmp.spi.parser.BmpTlvSerializer;
import org.opendaylight.protocol.bmp.spi.parser.TlvUtil;
import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Gauge64;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.tlvs.PerAfiSafiLocRibTlv;
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
Preconditions.checkArgument(tlv instanceof PerAfiSafiLocRibTlv, "PerAfiSafiLocRibInTlv is mandatory.");
final ByteBuf buffer = Unpooled.buffer();
- ByteBufWriteUtil.writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getAfi()), buffer);
- ByteBufWriteUtil.writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getSafi()).shortValue(), buffer);
- ByteBufWriteUtil.writeUnsignedLong(((PerAfiSafiLocRibTlv) tlv).getCount().getValue(), buffer);
+ writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getAfi()), buffer);
+ writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getSafi()).shortValue(), buffer);
+ writeUnsignedLong(((PerAfiSafiLocRibTlv) tlv).getCount().getValue(), buffer);
TlvUtil.formatTlv(TYPE, buffer, output);
}
return null;
}
return new PerAfiSafiLocRibTlvBuilder()
- .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
- .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
- .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+ .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
+ .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
+ .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
}
}
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof UpdatesTreatedAsWithdrawTlv, "UpdatesTreatedAsWithdrawTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof UpdatesTreatedAsWithdrawTlv,
+ "UpdatesTreatedAsWithdrawTlv is mandatory.");
TlvUtil.formatTlvCounter32(TYPE, ((UpdatesTreatedAsWithdrawTlv) tlv).getCount(), output);
}
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof PrefixesTreatedAsWithdrawTlv, "PrefixesTreatedAsWithdrawTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof PrefixesTreatedAsWithdrawTlv,
+ "PrefixesTreatedAsWithdrawTlv is mandatory.");
TlvUtil.formatTlvCounter32(TYPE, ((PrefixesTreatedAsWithdrawTlv) tlv).getCount(), output);
}
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createInitMsg;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
* 00 1C <- the length of STRING
* 54 68 65 20 69 6E 66 6F 72 6D 61 74 69 6F 6E 20 66 69 65 6C 64 20 74 79 70 65 20 30 <- value of STRING
*/
- (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x4B, (byte) 0x04, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x0E,
- (byte) 0x53, (byte) 0x79, (byte) 0x73, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x20, (byte) 0x74, (byte) 0x79,
- (byte) 0x70, (byte) 0x65, (byte) 0x20, (byte) 0x32, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x0F, (byte) 0x53, (byte) 0x79,
- (byte) 0x73, (byte) 0x44, (byte) 0x65, (byte) 0x73, (byte) 0x63, (byte) 0x72, (byte) 0x20, (byte) 0x74, (byte) 0x79, (byte) 0x70,
- (byte) 0x65, (byte) 0x20, (byte) 0x31, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1C, (byte) 0x54, (byte) 0x68, (byte) 0x65,
- (byte) 0x20, (byte) 0x69, (byte) 0x6E, (byte) 0x66, (byte) 0x6F, (byte) 0x72, (byte) 0x6D, (byte) 0x61, (byte) 0x74, (byte) 0x69,
- (byte) 0x6F, (byte) 0x6E, (byte) 0x20, (byte) 0x66, (byte) 0x69, (byte) 0x65, (byte) 0x6C, (byte) 0x64, (byte) 0x20, (byte) 0x74,
+ (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x4B, (byte) 0x04, (byte) 0x00, (byte) 0x02,
+ (byte) 0x00, (byte) 0x0E,
+ (byte) 0x53, (byte) 0x79, (byte) 0x73, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x20,
+ (byte) 0x74, (byte) 0x79,
+ (byte) 0x70, (byte) 0x65, (byte) 0x20, (byte) 0x32, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x0F,
+ (byte) 0x53, (byte) 0x79,
+ (byte) 0x73, (byte) 0x44, (byte) 0x65, (byte) 0x73, (byte) 0x63, (byte) 0x72, (byte) 0x20, (byte) 0x74,
+ (byte) 0x79, (byte) 0x70,
+ (byte) 0x65, (byte) 0x20, (byte) 0x31, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1C, (byte) 0x54,
+ (byte) 0x68, (byte) 0x65,
+ (byte) 0x20, (byte) 0x69, (byte) 0x6E, (byte) 0x66, (byte) 0x6F, (byte) 0x72, (byte) 0x6D, (byte) 0x61,
+ (byte) 0x74, (byte) 0x69,
+ (byte) 0x6F, (byte) 0x6E, (byte) 0x20, (byte) 0x66, (byte) 0x69, (byte) 0x65, (byte) 0x6C, (byte) 0x64,
+ (byte) 0x20, (byte) 0x74,
(byte) 0x79, (byte) 0x70, (byte) 0x65, (byte) 0x20, (byte) 0x30
};
@Test
public void testParseInitiationMessage() throws BmpDeserializationException {
- final InitiationMessage parsedInitMsg = (InitiationMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(INIT_MSG));
+ final InitiationMessage parsedInitMsg = (InitiationMessage) getBmpMessageRegistry()
+ .parseMessage(Unpooled.copiedBuffer(INIT_MSG));
assertEquals(createInitMsg(SYS_DESCR, SYS_NAME, STR_INFO), parsedInitMsg);
}
}
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createPeerDownFSM;
import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createPeerDownNotification;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
* 00 00 00 0A - time stamp micro - 4 bytes
*
* 02 <- Reason why the session was terminated (2 - the local system closed the session)
- * 00 18 <- the code of FSM event (24 - NotifMsgVerErr - An event is generated when a Notification message with "version error" is received.)
+ * 00 18 <- the code of FSM event (24 - NotifMsgVerErr - An event is generated when a
+ * Notification message with "version error" is received.)
*/
(byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x33, (byte) 0x02,
(byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x01,
- (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0x00, (byte) 0x15,
(byte) 0x03,
(byte) 0x01,
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createPeerUpNotification;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
(byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x05,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0xDC,
(byte) 0x13, (byte) 0x88,
- (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0x00, (byte) 0x2B,
(byte) 0x01,
(byte) 0x04,
(byte) 0x03, (byte) 0xE8,
(byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14,
(byte) 0x0E,
- (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
+ (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46,
+ (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
- (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0x00, (byte) 0x2B,
(byte) 0x01,
(byte) 0x04,
(byte) 0x03, (byte) 0xE8,
(byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14,
(byte) 0x0E,
- (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
+ (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46,
+ (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04,
(byte) 0x61, (byte) 0x61, (byte) 0x61, (byte) 0x61
};
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createRouteMonitMsg;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
(byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x05,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A,
- (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0x00, (byte) 0x84,
(byte) 0x02,
- (byte) 0x00, (byte) 0x0C, (byte) 0x18, (byte) 0x0A, (byte) 0x0A, (byte) 0x14, (byte) 0x18, (byte) 0x14, (byte) 0x14,
+ (byte) 0x00, (byte) 0x0C, (byte) 0x18, (byte) 0x0A, (byte) 0x0A, (byte) 0x14, (byte) 0x18, (byte) 0x14,
+ (byte) 0x14,
(byte) 0x0A, (byte) 0x18, (byte) 0x1E, (byte) 0x0A, (byte) 0x0A, (byte) 0x00, (byte) 0x55, (byte) 0x40,
(byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x80, (byte) 0x1A, (byte) 0x0B, (byte) 0x01, (byte) 0x00,
(byte) 0x0B, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
@Test
public void testParseRouteMonitMessage() throws BmpDeserializationException {
- final RouteMonitoringMessage parsedInitMsg = (RouteMonitoringMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(ROUTE_MONIT_MSG));
+ final RouteMonitoringMessage parsedInitMsg = (RouteMonitoringMessage) getBmpMessageRegistry()
+ .parseMessage(Unpooled.copiedBuffer(ROUTE_MONIT_MSG));
assertEquals(createRouteMonitMsg(true), parsedInitMsg);
}
}
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createStatsReportMsg;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
(byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // < - element 28
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // < - element 28
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
(byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0E, // <- tlv counts
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10,
- (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B, (byte) 0x00, (byte) 0x03, (byte) 0x00,
- (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x35, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x42, (byte) 0x00, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46, (byte) 0x00,
- (byte) 0x06, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x37, (byte) 0x00, (byte) 0x07, (byte) 0x00, (byte) 0x08,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A, (byte) 0x00, (byte) 0x08, (byte) 0x00,
- (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64,
+ (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x10,
+ (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B,
+ (byte) 0x00, (byte) 0x03, (byte) 0x00,
+ (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x35, (byte) 0x00, (byte) 0x04, (byte) 0x00,
+ (byte) 0x04, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x42, (byte) 0x00, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x46, (byte) 0x00,
+ (byte) 0x06, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x37, (byte) 0x00,
+ (byte) 0x07, (byte) 0x00, (byte) 0x08,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A,
+ (byte) 0x00, (byte) 0x08, (byte) 0x00,
+ (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x64,
(byte) 0x00, (byte) 0x09, // <- per afi safi adj rib routes type
(byte) 0x00, (byte) 0x0B, // <- length
(byte) 0x00, (byte) 0x01, // <- afi
(byte) 0x01, // <- safi
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x09, // <- value
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x09, // <- value
(byte) 0x00, (byte) 0x0A, // <- per afi safi local rib routes type
(byte) 0x00, (byte) 0x0B, // <- length
(byte) 0x00, (byte) 0x01, // <- afi
(byte) 0x01, // <- safi
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A, // <- value
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0A, // <- value
(byte) 0x00, (byte) 0x0B, // <- updates treated as withdraw
(byte) 0x00, (byte) 0x04, // <- length
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B, // <- value
@Test
public void testParseStatsReportMessage() throws BmpDeserializationException {
- final StatsReportsMessage parsedStatsReportsMsg = (StatsReportsMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(STATS_REPORT));
+ final StatsReportsMessage parsedStatsReportsMsg = (StatsReportsMessage) getBmpMessageRegistry()
+ .parseMessage(Unpooled.copiedBuffer(STATS_REPORT));
assertEquals(createStatsReportMsg(), parsedStatsReportsMsg);
}
}
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createTerminationMsg;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
@Test
public void testParseTerminationMessage() throws BmpDeserializationException {
- final TerminationMessage parsedInitMsg = (TerminationMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(TERMINATION_MESSAGE));
+ final TerminationMessage parsedInitMsg = (TerminationMessage) getBmpMessageRegistry()
+ .parseMessage(Unpooled.copiedBuffer(TERMINATION_MESSAGE));
assertEquals(createTerminationMsg(), parsedInitMsg);
}
}
}
public static final Ipv4Address IPV4_ADDRESS_10 = new Ipv4Address("10.10.10.10");
- public static final Ipv4Address IPV4_ADDRESS_20 = new Ipv4Address("20.20.20.20");
- public static final Ipv4Address IPV4_ADDRESS_30 = new Ipv4Address("30.30.30.30");
- public static final Ipv4Address IPV4_ADDRESS_40 = new Ipv4Address("40.40.40.40");
- public static final Ipv4Address IPV4_ADDRESS_12 = new Ipv4Address("12.12.12.12");
- public static final Ipv4Address IPV4_ADDRESS_100 = new Ipv4Address("100.100.100.100");
+ private static final Ipv4Address IPV4_ADDRESS_20 = new Ipv4Address("20.20.20.20");
+ private static final Ipv4Address IPV4_ADDRESS_30 = new Ipv4Address("30.30.30.30");
+ private static final Ipv4Address IPV4_ADDRESS_40 = new Ipv4Address("40.40.40.40");
+ private static final Ipv4Address IPV4_ADDRESS_12 = new Ipv4Address("12.12.12.12");
+ private static final Ipv4Address IPV4_ADDRESS_100 = new Ipv4Address("100.100.100.100");
public static final AsNumber PEER_AS = new AsNumber(72L);
public static final PortNumber PEER_LOCAL_PORT = new PortNumber(220);
public static final PortNumber PEER_REMOTE_PORT = new PortNumber(5000);
return initMsgBuilder.setTlvs(tlvsBuilder.build()).build();
}
- public static StringInformation createStringInfo(final String string) {
- return new StringInformationBuilder().setStringTlv(new StringTlvBuilder().setStringInfo(string).build()).build();
+ private static StringInformation createStringInfo(final String string) {
+ return new StringInformationBuilder()
+ .setStringTlv(new StringTlvBuilder().setStringInfo(string).build()).build();
}
public static TerminationMessage createTerminationMsg() {
final TerminationMessageBuilder terminatMsgBuilder = new TerminationMessageBuilder();
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder tlvsBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination
+ .TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bmp.message.rev171207.termination.TlvsBuilder();
tlvsBuilder.setReasonTlv(new ReasonTlvBuilder().setReason(Reason.AdministrativelyClosed).build());
tlvsBuilder.setStringInformation(Lists.newArrayList(createStringInfo("error1"), createStringInfo("error1")));
return terminatMsgBuilder.setTlvs(tlvsBuilder.build()).build();
}
- public static PeerHeader createPeerHeader(final Ipv4Address bgpId, final AdjRibInType ribType) {
+ private static PeerHeader createPeerHeader(final Ipv4Address bgpId, final AdjRibInType ribType) {
final PeerHeaderBuilder peerHeaderBuilder = new PeerHeaderBuilder()
.setAddress(new IpAddress(IPV4_ADDRESS_10))
.setAs(PEER_AS)
return peerHeaderBuilder.build();
}
- public static PeerHeader createPeerHeader(final Ipv4Address bgpId) {
+ private static PeerHeader createPeerHeader(final Ipv4Address bgpId) {
return createPeerHeader(bgpId, AdjRibInType.PrePolicy);
}
- public static PeerHeader createPeerHeader() {
+ private static PeerHeader createPeerHeader() {
return createPeerHeader(IPV4_ADDRESS_10);
}
return peerUpNotifBuilder.build();
}
- public static PeerUpNotification createPeerUpNotification() {
+ static PeerUpNotification createPeerUpNotification() {
return createPeerUpNotification(IPV4_ADDRESS_10, false);
}
public static PeerDownNotification createPeerDownNotification(final Ipv4Address bgpId) {
final NotificationBuilder notifBuilder = new NotificationBuilder()
- .setNotification(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification.NotificationBuilder()
+ .setNotification(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message
+ .rev171207.peer.down.data.notification.NotificationBuilder()
.setErrorCode((short) 1)
.setErrorSubcode((short) 1).build());
final PeerDownNotificationBuilder peerDownNotifBuilder = new PeerDownNotificationBuilder()
return peerDownNotifBuilder.build();
}
- public static PeerDownNotification createPeerDownNotification() {
+ static PeerDownNotification createPeerDownNotification() {
return createPeerDownNotification(IPV4_ADDRESS_10);
}
private static List<OptionalCapabilities> createOptionalCapabilities(final boolean multiprotocol) {
final OptionalCapabilitiesBuilder optCapabilitiesBuilder = new OptionalCapabilitiesBuilder()
- .setCParameters(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(70L)).build()).build());
+ .setCParameters(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder()
+ .setAsNumber(new AsNumber(70L)).build()).build());
final CParametersBuilder paramsBuilder = new CParametersBuilder();
if (multiprotocol) {
final CParameters1Builder params1Builder = new CParameters1Builder();
}
final OptionalCapabilitiesBuilder optCapabilitiesBuilder2 = new OptionalCapabilitiesBuilder()
.setCParameters(paramsBuilder
- .setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(80L)).build()).build());
+ .setAs4BytesCapability(new As4BytesCapabilityBuilder()
+ .setAsNumber(new AsNumber(80L)).build()).build());
final List<OptionalCapabilities> optCapabilities = Lists.newArrayList();
optCapabilities.add(optCapabilitiesBuilder.build());
optCapabilities.add(optCapabilitiesBuilder2.build());
return createRouteMonitMsg(withNormalizedIpv4Prefixes, IPV4_ADDRESS_10, AdjRibInType.PrePolicy);
}
- public static RouteMonitoringMessage createRouteMonitMsg(final boolean withNormalizedIpv4Prefixes, final Ipv4Address bgpId, final AdjRibInType ribType) {
+ public static RouteMonitoringMessage createRouteMonitMsg(final boolean withNormalizedIpv4Prefixes,
+ final Ipv4Address bgpId, final AdjRibInType ribType) {
final RouteMonitoringMessageBuilder routeMonitMsgBuilder = new RouteMonitoringMessageBuilder()
.setPeerHeader(createPeerHeader(bgpId, ribType))
.setUpdate(createUpdate(withNormalizedIpv4Prefixes));
public static RouteMirroringMessage createRouteMirrorMsg(final Ipv4Address bgpId) {
final RouteMirroringMessageBuilder routeMirrorMsgBuilder = new RouteMirroringMessageBuilder()
.setPeerHeader(createPeerHeader(bgpId));
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.mirror.TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.mirror.TlvsBuilder();
- tlvsBuilder.setMirrorInformationTlv(new MirrorInformationTlvBuilder().setCode(MirrorInformationCode.forValue(1)).build());
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.mirror
+ .TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bmp.message.rev171207.mirror.TlvsBuilder();
+ tlvsBuilder.setMirrorInformationTlv(new MirrorInformationTlvBuilder()
+ .setCode(MirrorInformationCode.forValue(1)).build());
routeMirrorMsgBuilder.setTlvs(tlvsBuilder.build());
return routeMirrorMsgBuilder.build();
}
}
private static Attributes createAttributes() {
- final List<AsNumber> asSequences = Lists.newArrayList(new AsNumber(72L), new AsNumber(82L), new AsNumber(92L));
+ final List<AsNumber> asSequences = Lists.newArrayList(new AsNumber(72L), new AsNumber(82L),
+ new AsNumber(92L));
final List<Segments> segments = Lists.newArrayList();
final SegmentsBuilder segmentsBuild = new SegmentsBuilder();
segmentsBuild.setAsSequence(asSequences).build();
final AttributesBuilder attribBuilder = new AttributesBuilder()
- .setAggregator(new AggregatorBuilder().setAsNumber(new AsNumber(72L)).setNetworkAddress(new Ipv4Address(IPV4_ADDRESS_20)).build())
- .setAigp(new AigpBuilder().setAigpTlv(new AigpTlvBuilder().setMetric(new AccumulatedIgpMetric(BigInteger.ONE)).build()).build())
+ .setAggregator(new AggregatorBuilder().setAsNumber(new AsNumber(72L))
+ .setNetworkAddress(new Ipv4Address(IPV4_ADDRESS_20)).build())
+ .setAigp(new AigpBuilder().setAigpTlv(new AigpTlvBuilder()
+ .setMetric(new AccumulatedIgpMetric(BigInteger.ONE)).build()).build())
.setAsPath(new AsPathBuilder().setSegments(segments).build())
.setAtomicAggregate(new AtomicAggregateBuilder().build())
.setClusterId(new ClusterIdBuilder().setCluster(Lists.newArrayList(new ClusterIdentifier(IPV4_ADDRESS_30),
}
private static List<WithdrawnRoutes> createWithdrawnRoutes() {
- final WithdrawnRoutes w1 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("10.10.20.0/24")).build();
- final WithdrawnRoutes w2 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("20.20.10.0/24")).build();
- final WithdrawnRoutes w3 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("30.10.10.0/24")).build();
+ final WithdrawnRoutes w1 = new WithdrawnRoutesBuilder()
+ .setPrefix(new Ipv4Prefix("10.10.20.0/24")).build();
+ final WithdrawnRoutes w2 = new WithdrawnRoutesBuilder()
+ .setPrefix(new Ipv4Prefix("20.20.10.0/24")).build();
+ final WithdrawnRoutes w3 = new WithdrawnRoutesBuilder()
+ .setPrefix(new Ipv4Prefix("30.10.10.0/24")).build();
return Lists.newArrayList(w1, w2, w3);
}
public static StatsReportsMessage createStatsReportMsg(final Ipv4Address bgpId) {
final StatsReportsMessageBuilder statsReportMsgBuilder = new StatsReportsMessageBuilder();
statsReportMsgBuilder.setPeerHeader(TestUtil.createPeerHeader(bgpId));
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.TlvsBuilder tlvsBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.TlvsBuilder();
- tlvsBuilder.setAdjRibsInRoutesTlv(new AdjRibsInRoutesTlvBuilder().setCount(new Gauge64(BigInteger.valueOf(10L))).build());
- tlvsBuilder.setDuplicatePrefixAdvertisementsTlv(new DuplicatePrefixAdvertisementsTlvBuilder().setCount(new Counter32(16L)).build());
- tlvsBuilder.setDuplicateWithdrawsTlv(new DuplicateWithdrawsTlvBuilder().setCount(new Counter32(11L)).build());
- tlvsBuilder.setInvalidatedAsConfedLoopTlv(new InvalidatedAsConfedLoopTlvBuilder().setCount(new Counter32(55L)).build());
- tlvsBuilder.setInvalidatedAsPathLoopTlv(new InvalidatedAsPathLoopTlvBuilder().setCount(new Counter32(66L)).build());
- tlvsBuilder.setInvalidatedClusterListLoopTlv(new InvalidatedClusterListLoopTlvBuilder().setCount(new Counter32(53L)).build());
- tlvsBuilder.setInvalidatedOriginatorIdTlv(new InvalidatedOriginatorIdTlvBuilder().setCount(new Counter32(70L)).build());
- tlvsBuilder.setLocRibRoutesTlv(new LocRibRoutesTlvBuilder().setCount(new Gauge64(BigInteger.valueOf(100L))).build());
- tlvsBuilder.setRejectedPrefixesTlv(new RejectedPrefixesTlvBuilder().setCount(new Counter32(8L)).build());
- tlvsBuilder.setPerAfiSafiAdjRibInTlv(new PerAfiSafiAdjRibInTlvBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setCount(new Gauge64(BigInteger.valueOf(9L))).build());
- tlvsBuilder.setPerAfiSafiLocRibTlv(new PerAfiSafiLocRibTlvBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setCount(new Gauge64(BigInteger.valueOf(10L))).build());
- tlvsBuilder.setUpdatesTreatedAsWithdrawTlv(new UpdatesTreatedAsWithdrawTlvBuilder().setCount(new Counter32(11L)).build());
- tlvsBuilder.setPrefixesTreatedAsWithdrawTlv(new PrefixesTreatedAsWithdrawTlvBuilder().setCount(new Counter32(12L)).build());
- tlvsBuilder.setDuplicateUpdatesTlv(new DuplicateUpdatesTlvBuilder().setCount(new Counter32(13L)).build());
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat
+ .TlvsBuilder tlvsBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat
+ .TlvsBuilder();
+ tlvsBuilder.setAdjRibsInRoutesTlv(new AdjRibsInRoutesTlvBuilder()
+ .setCount(new Gauge64(BigInteger.valueOf(10L))).build());
+ tlvsBuilder.setDuplicatePrefixAdvertisementsTlv(new DuplicatePrefixAdvertisementsTlvBuilder()
+ .setCount(new Counter32(16L)).build());
+ tlvsBuilder.setDuplicateWithdrawsTlv(new DuplicateWithdrawsTlvBuilder()
+ .setCount(new Counter32(11L)).build());
+ tlvsBuilder.setInvalidatedAsConfedLoopTlv(new InvalidatedAsConfedLoopTlvBuilder()
+ .setCount(new Counter32(55L)).build());
+ tlvsBuilder.setInvalidatedAsPathLoopTlv(new InvalidatedAsPathLoopTlvBuilder()
+ .setCount(new Counter32(66L)).build());
+ tlvsBuilder.setInvalidatedClusterListLoopTlv(new InvalidatedClusterListLoopTlvBuilder()
+ .setCount(new Counter32(53L)).build());
+ tlvsBuilder.setInvalidatedOriginatorIdTlv(new InvalidatedOriginatorIdTlvBuilder()
+ .setCount(new Counter32(70L)).build());
+ tlvsBuilder.setLocRibRoutesTlv(new LocRibRoutesTlvBuilder()
+ .setCount(new Gauge64(BigInteger.valueOf(100L))).build());
+ tlvsBuilder.setRejectedPrefixesTlv(new RejectedPrefixesTlvBuilder()
+ .setCount(new Counter32(8L)).build());
+ tlvsBuilder.setPerAfiSafiAdjRibInTlv(new PerAfiSafiAdjRibInTlvBuilder()
+ .setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
+ .setCount(new Gauge64(BigInteger.valueOf(9L))).build());
+ tlvsBuilder.setPerAfiSafiLocRibTlv(new PerAfiSafiLocRibTlvBuilder()
+ .setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
+ .setCount(new Gauge64(BigInteger.valueOf(10L))).build());
+ tlvsBuilder.setUpdatesTreatedAsWithdrawTlv(new UpdatesTreatedAsWithdrawTlvBuilder()
+ .setCount(new Counter32(11L)).build());
+ tlvsBuilder.setPrefixesTreatedAsWithdrawTlv(new PrefixesTreatedAsWithdrawTlvBuilder()
+ .setCount(new Counter32(12L)).build());
+ tlvsBuilder.setDuplicateUpdatesTlv(new DuplicateUpdatesTlvBuilder()
+ .setCount(new Counter32(13L)).build());
return statsReportMsgBuilder.setTlvs(tlvsBuilder.build()).build();
}
- public static StatsReportsMessage createStatsReportMsg() {
+ static StatsReportsMessage createStatsReportMsg() {
return createStatsReportMsg(IPV4_ADDRESS_10);
}
- public static RouteMonitoringMessage createRouteMonMsgWithEndOfRibMarker(final Ipv4Address bgpId, final AdjRibInType ribType) {
- return new RouteMonitoringMessageBuilder().setPeerHeader(createPeerHeader(bgpId, ribType)).setUpdate(createEndOfRibMarker()).build();
+ public static RouteMonitoringMessage createRouteMonMsgWithEndOfRibMarker(final Ipv4Address bgpId,
+ final AdjRibInType ribType) {
+ return new RouteMonitoringMessageBuilder().setPeerHeader(createPeerHeader(bgpId, ribType))
+ .setUpdate(createEndOfRibMarker()).build();
}
private static Update createEndOfRibMarker() {