Search in sources :

Example 1 with InitiationMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage in project bgpcep by opendaylight.

the class InitiationHandler method serializeMessageBody.

@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.");
    final InitiationMessage initiation = (InitiationMessage) message;
    serializeTlvs(initiation.getTlvs(), buffer);
}
Also used : InitiationMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage)

Example 2 with InitiationMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage 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();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.TlvsBuilder) DescriptionTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.description.tlv.DescriptionTlvBuilder) InitiationMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessageBuilder) NameTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.name.tlv.NameTlvBuilder)

Example 3 with InitiationMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage 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();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.TlvsBuilder) DescriptionTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.description.tlv.DescriptionTlvBuilder) InitiationMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessageBuilder) NameTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.name.tlv.NameTlvBuilder)

Example 4 with InitiationMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage in project bgpcep by opendaylight.

the class BmpMockUtilTest method testCreateInitiation.

@Test
public void testCreateInitiation() {
    final InitiationMessage initiation = BmpMockUtil.createInitiation();
    final Tlvs tlvs = initiation.getTlvs();
    assertEquals("OpenDaylight", tlvs.getDescriptionTlv().getDescription());
    assertEquals("BMP mock", tlvs.getNameTlv().getName());
    assertNull(tlvs.getStringInformation());
}
Also used : InitiationMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.Tlvs) Test(org.junit.Test)

Example 5 with InitiationMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage in project bgpcep by opendaylight.

the class InitiationHandlerTest method testParseInitiationMessage.

@Test
public void testParseInitiationMessage() throws BmpDeserializationException {
    final InitiationMessage parsedInitMsg = (InitiationMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(INIT_MSG));
    assertEquals(createInitMsg(SYS_DESCR, SYS_NAME, STR_INFO), parsedInitMsg);
}
Also used : InitiationMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage) Test(org.junit.Test)

Aggregations

InitiationMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessage)3 Test (org.junit.Test)2 InitiationMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessageBuilder)2 DescriptionTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.description.tlv.DescriptionTlvBuilder)2 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.TlvsBuilder)2 NameTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.name.tlv.NameTlvBuilder)2 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.Tlvs)1