use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.TerminationMessageBuilder in project bgpcep by opendaylight.
the class TestUtil method createTerminationMsg.
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();
tlvsBuilder.setReasonTlv(new ReasonTlvBuilder().setReason(Reason.AdministrativelyClosed).build());
tlvsBuilder.setStringInformation(Lists.newArrayList(createStringInfo("error1"), createStringInfo("error1")));
return terminatMsgBuilder.setTlvs(tlvsBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.TerminationMessageBuilder in project bgpcep by opendaylight.
the class TerminationHandler method parseMessageBody.
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
final TerminationMessageBuilder terminationMessage = new TerminationMessageBuilder();
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
tlvsBuilder.setStringInformation(ImmutableList.of());
parseTlvs(tlvsBuilder, bytes);
if (tlvsBuilder.getReasonTlv() == null || tlvsBuilder.getReasonTlv().getReason() == null) {
throw new BmpDeserializationException("Inclusion of Reason TLV is mandatory.");
}
return terminationMessage.setTlvs(tlvsBuilder.build()).build();
}
Aggregations