Search in sources :

Example 1 with AttributeRegistry

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

the class SimpleRegistryTest method testSimpleAttribute.

@Test
public void testSimpleAttribute() throws BGPDocumentedException, BGPParsingException, BGPTreatAsWithdrawException {
    final AttributeRegistry attrReg = this.ctx.getAttributeRegistry();
    final byte[] attributeBytes = { 0x00, 0x00, 0x00 };
    final ByteBuf byteAggregator = Unpooled.buffer(attributeBytes.length);
    attrReg.serializeAttribute(mock(Attributes.class), byteAggregator);
    attrReg.parseAttributes(Unpooled.wrappedBuffer(attributeBytes), CONSTRAINT);
    verify(this.activator.attrParser, times(1)).parseAttribute(any(ByteBuf.class), any(AttributesBuilder.class), any(RevisedErrorHandling.class), any(PeerSpecificParserConstraint.class));
    verify(this.activator.attrSerializer, times(1)).serializeAttribute(any(Attributes.class), any(ByteBuf.class));
}
Also used : RevisedErrorHandling(org.opendaylight.protocol.bgp.parser.spi.RevisedErrorHandling) AttributeRegistry(org.opendaylight.protocol.bgp.parser.spi.AttributeRegistry) PeerSpecificParserConstraint(org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes) ByteBuf(io.netty.buffer.ByteBuf) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 AttributeRegistry (org.opendaylight.protocol.bgp.parser.spi.AttributeRegistry)1 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)1 RevisedErrorHandling (org.opendaylight.protocol.bgp.parser.spi.RevisedErrorHandling)1 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)1 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)1