Search in sources :

Example 1 with PMSITunnelAttributeHandler

use of org.opendaylight.protocol.bgp.evpn.impl.attributes.PMSITunnelAttributeHandler in project bgpcep by opendaylight.

the class PMSITunnelAttributeHandlerTest method testPMSITunnelAttributeParser.

@Test
public void testPMSITunnelAttributeParser() {
    final PMSITunnelAttributeHandler pmsiHandler = new PMSITunnelAttributeHandler(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAddressFamilyRegistry());
    assertEquals(22, pmsiHandler.getType());
    final AttributesBuilder builder = new AttributesBuilder();
    final ByteBuf emptyBuffer = Unpooled.buffer();
    pmsiHandler.parseAttribute(emptyBuffer, builder);
    final Attributes emptyAttributes = new AttributesBuilder().build();
    assertEquals(emptyAttributes, builder.build());
    pmsiHandler.serializeAttribute(emptyAttributes, emptyBuffer);
    assertEquals(Unpooled.buffer(), emptyBuffer);
}
Also used : PMSITunnelAttributeHandler(org.opendaylight.protocol.bgp.evpn.impl.attributes.PMSITunnelAttributeHandler) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) ByteBuf(io.netty.buffer.ByteBuf) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder) Test(org.junit.Test)

Example 2 with PMSITunnelAttributeHandler

use of org.opendaylight.protocol.bgp.evpn.impl.attributes.PMSITunnelAttributeHandler in project bgpcep by opendaylight.

the class BGPActivator method registerAttributesHandler.

private static void registerAttributesHandler(final BGPExtensionProviderContext context, final List<AutoCloseable> regs) {
    final PMSITunnelAttributeHandler pmsiParser = new PMSITunnelAttributeHandler(context.getAddressFamilyRegistry());
    regs.add(context.registerAttributeParser(pmsiParser.getType(), pmsiParser));
    regs.add(context.registerAttributeSerializer(pmsiParser.getClazz(), pmsiParser));
}
Also used : PMSITunnelAttributeHandler(org.opendaylight.protocol.bgp.evpn.impl.attributes.PMSITunnelAttributeHandler)

Aggregations

PMSITunnelAttributeHandler (org.opendaylight.protocol.bgp.evpn.impl.attributes.PMSITunnelAttributeHandler)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)1 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)1