use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.InitiationMessageBuilder in project bgpcep by opendaylight.
the class BmpMockUtil method createInitiation.
static InitiationMessage createInitiation() {
final InitiationMessageBuilder msgBuilder = new InitiationMessageBuilder();
msgBuilder.setTlvs(new TlvsBuilder().setDescriptionTlv(new DescriptionTlvBuilder().setDescription(DESCRIPTION).build()).setNameTlv(new NameTlvBuilder().setName(NAME).build()).build());
return msgBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.InitiationMessageBuilder in project bgpcep by opendaylight.
the class InitiationHandler method parseMessageBody.
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
final InitiationMessageBuilder initiationBuilder = new InitiationMessageBuilder();
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
tlvsBuilder.setStringInformation(ImmutableList.of());
parseTlvs(tlvsBuilder, bytes);
if (tlvsBuilder.getDescriptionTlv() == null || tlvsBuilder.getDescriptionTlv().getDescription() == null) {
throw new BmpDeserializationException("Inclusion of sysDescr TLV is mandatory.");
}
if (tlvsBuilder.getNameTlv() == null || tlvsBuilder.getNameTlv().getName() == null) {
throw new BmpDeserializationException("Inclusion of sysName TLV is mandatory.");
}
return initiationBuilder.setTlvs(tlvsBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.InitiationMessageBuilder in project bgpcep by opendaylight.
the class TestUtil method createInitMsg.
public static InitiationMessage createInitMsg(final String sysDescr, final String sysName, final String info) {
final InitiationMessageBuilder initMsgBuilder = new InitiationMessageBuilder();
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
tlvsBuilder.setDescriptionTlv(new DescriptionTlvBuilder().setDescription(sysDescr).build());
tlvsBuilder.setNameTlv(new NameTlvBuilder().setName(sysName).build());
tlvsBuilder.setStringInformation(Lists.newArrayList(createStringInfo(info)));
return initMsgBuilder.setTlvs(tlvsBuilder.build()).build();
}
Aggregations