Search in sources :

Example 1 with TerminationMessageBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.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();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.termination.TlvsBuilder) TerminationMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.TerminationMessageBuilder) BmpDeserializationException(org.opendaylight.protocol.bmp.spi.parser.BmpDeserializationException)

Example 2 with TerminationMessageBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.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.rev200120.termination.TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.termination.TlvsBuilder();
    tlvsBuilder.setReasonTlv(new ReasonTlvBuilder().setReason(Reason.AdministrativelyClosed).build());
    tlvsBuilder.setStringInformation(Lists.newArrayList(createStringInfo("error1"), createStringInfo("error1")));
    return terminatMsgBuilder.setTlvs(tlvsBuilder.build()).build();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.initiation.TlvsBuilder) ReasonTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.reason.tlv.ReasonTlvBuilder) TerminationMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.TerminationMessageBuilder)

Aggregations

TerminationMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.TerminationMessageBuilder)2 BmpDeserializationException (org.opendaylight.protocol.bmp.spi.parser.BmpDeserializationException)1 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.initiation.TlvsBuilder)1 ReasonTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.reason.tlv.ReasonTlvBuilder)1 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.termination.TlvsBuilder)1