Search in sources :

Example 1 with LuLabelIndexTlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.bgp.prefix.sid.tlv.LuLabelIndexTlv in project bgpcep by opendaylight.

the class BgpPrefixSidTlvsTest method testLabelIndexParser.

@Test
public void testLabelIndexParser() {
    final LabelIndexTlvParser parser = new LabelIndexTlvParser();
    final LuLabelIndexTlv tlv = new LuLabelIndexTlvBuilder().setLabelIndexTlv(333L).build();
    final ByteBuf serialized = Unpooled.buffer(7);
    final byte[] expected = new byte[] { 0, 0, 0, 0, 0, 1, (byte) 0x4d };
    parser.serializeBgpPrefixSidTlv(tlv, serialized);
    assertArrayEquals(expected, serialized.array());
    assertEquals(tlv.getLabelIndexTlv(), parser.parseBgpPrefixSidTlv(serialized).getLabelIndexTlv());
    assertEquals(1, parser.getType());
}
Also used : LuLabelIndexTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.bgp.prefix.sid.tlv.LuLabelIndexTlvBuilder) ByteBuf(io.netty.buffer.ByteBuf) LuLabelIndexTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.bgp.prefix.sid.tlv.LuLabelIndexTlv) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 LuLabelIndexTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.bgp.prefix.sid.tlv.LuLabelIndexTlv)1 LuLabelIndexTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.bgp.prefix.sid.tlv.LuLabelIndexTlvBuilder)1