Search in sources :

Example 1 with BgpPrefixSidTlvRegistry

use of org.opendaylight.protocol.bgp.parser.spi.BgpPrefixSidTlvRegistry in project bgpcep by opendaylight.

the class SimpleRegistryTest method testSimpleBgpPrefixSidTlvRegistry.

@Test
public void testSimpleBgpPrefixSidTlvRegistry() {
    final BgpPrefixSidTlvRegistry sidTlvReg = this.ctx.getBgpPrefixSidTlvRegistry();
    final byte[] tlvBytes = { 0x00, 0x03, 0x00, 0x00, 0x00 };
    final BgpPrefixSidTlv tlv = mock(BgpPrefixSidTlv.class);
    doReturn(BgpPrefixSidTlv.class).when(tlv).getImplementedInterface();
    final ByteBuf buffer = Unpooled.buffer(tlvBytes.length);
    sidTlvReg.serializeBgpPrefixSidTlv(tlv, buffer);
    verify(this.activator.sidTlvSerializer, times(1)).serializeBgpPrefixSidTlv(Mockito.any(BgpPrefixSidTlv.class), Mockito.any(ByteBuf.class));
    sidTlvReg.parseBgpPrefixSidTlv(BgpTestActivator.TYPE, Unpooled.wrappedBuffer(tlvBytes));
    verify(this.activator.sidTlvParser, times(1)).parseBgpPrefixSidTlv(Mockito.any(ByteBuf.class));
}
Also used : BgpPrefixSidTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.BgpPrefixSidTlv) BgpPrefixSidTlvRegistry(org.opendaylight.protocol.bgp.parser.spi.BgpPrefixSidTlvRegistry) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 BgpPrefixSidTlvRegistry (org.opendaylight.protocol.bgp.parser.spi.BgpPrefixSidTlvRegistry)1 BgpPrefixSidTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.BgpPrefixSidTlv)1