Search in sources :

Example 6 with Aggregator

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Aggregator in project bgpcep by opendaylight.

the class Ipv6PrefixSidParser method serializeSubTlv.

@Override
public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
    checkArgument(bindingSubTlv instanceof Ipv6PrefixSidCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
    final Ipv6PrefixSid prefix = ((Ipv6PrefixSidCase) bindingSubTlv).getIpv6PrefixSid();
    final ByteBuf buffer = Unpooled.buffer();
    Ipv6SrPrefixAttributesParser.serializePrefixAttributes(prefix.getAlgorithm(), buffer);
    TlvUtil.writeTLV(getType(), buffer, aggregator);
}
Also used : Ipv6PrefixSidCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.Ipv6PrefixSidCase) Ipv6PrefixSid(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.ipv6.prefix.sid._case.Ipv6PrefixSid) ByteBuf(io.netty.buffer.ByteBuf)

Example 7 with Aggregator

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Aggregator in project bgpcep by opendaylight.

the class AbstractBmpPerPeerMessageParserTest method testPerPeerHeaderIpv6.

@Test
public void testPerPeerHeaderIpv6() {
    final PeerHeader perHeader = AbstractBmpPerPeerMessageParser.parsePerPeerHeader(Unpooled.wrappedBuffer(this.ipv6MsgWithDistinguishergBytes));
    final PeerHeaderBuilder phBuilder = new PeerHeaderBuilder().setType(PeerType.L3vpn).setPeerDistinguisher(new PeerDistinguisher(new RouteDistinguisher(new RdTwoOctetAs("0:" + RD)))).setAdjRibInType(AdjRibInType.forValue(1)).setIpv4(false).setAddress(new IpAddressNoZone(new Ipv6AddressNoZone("2001::1"))).setAs(new AsNumber(Uint32.valueOf(168))).setBgpId(new Ipv4AddressNoZone("1.1.1.2")).setTimestampSec(new Timestamp(Uint32.ZERO)).setTimestampMicro(new Timestamp(Uint32.ZERO));
    assertEquals(phBuilder.build(), perHeader);
    final ByteBuf aggregator = Unpooled.buffer();
    phBuilder.setTimestampSec(null);
    phBuilder.setTimestampMicro(null);
    this.parser.serializePerPeerHeader(phBuilder.build(), aggregator);
    assertArrayEquals(this.ipv6MsgWithDistinguishergBytes, ByteArray.getAllBytes(aggregator));
}
Also used : RdTwoOctetAs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RdTwoOctetAs) PeerHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.header.PeerHeader) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) RouteDistinguisher(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher) IpAddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone) PeerHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.header.PeerHeaderBuilder) ByteBuf(io.netty.buffer.ByteBuf) PeerDistinguisher(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Peer.PeerDistinguisher) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) Timestamp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp) Ipv6AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone) Test(org.junit.Test)

Example 8 with Aggregator

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Aggregator in project bgpcep by opendaylight.

the class SimpleBmpTlvRegistryTest method testParseTlv.

@Test
public void testParseTlv() throws BmpDeserializationException {
    final Tlv output = this.bmpTlvRegistry.parseTlv(DESCRIPTION_TLV_TYPE, this.input);
    assertNotNull(output);
    assertTrue(output instanceof MockDescriptionTlv);
    final ByteBuf aggregator = Unpooled.EMPTY_BUFFER;
    this.bmpTlvRegistry.serializeTlv(output, aggregator);
    Mockito.verify(this.descriptionTlvSerializer).serializeTlv(output, aggregator);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Tlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv) Test(org.junit.Test)

Example 9 with Aggregator

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Aggregator in project bgpcep by opendaylight.

the class AggregatorAttributeParser method parseAttribute.

/**
 * Parse {@link Aggregator} from bytes
 *
 * @param buffer byte buffer to be parsed
 * @param builder AttributesBuilder into which parsed {@link Aggregator} will be set
 */
@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) {
    final AsNumber asNumber = this.refCache.getSharedReference(new AsNumber(buffer.readUnsignedInt()));
    final Ipv4Address address = Ipv4Util.addressForByteBuf(buffer);
    builder.setAggregator(new AggregatorBuilder().setAsNumber(asNumber).setNetworkAddress(address).build());
}
Also used : AggregatorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AggregatorBuilder) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) ShortAsNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ShortAsNumber) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 10 with Aggregator

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Aggregator in project bgpcep by opendaylight.

the class EroMetricParser method serializeSubTlv.

@Override
public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
    checkArgument(bindingSubTlv instanceof EroMetricCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
    final ByteBuf buffer = Unpooled.buffer(4);
    writeUint32(buffer, ((EroMetricCase) bindingSubTlv).getEroMetric().getValue());
    TlvUtil.writeTLV(getType(), buffer, aggregator);
}
Also used : EroMetricCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.EroMetricCase) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)12 Test (org.junit.Test)7 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)4 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)3 PeerHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.header.PeerHeader)3 IpAddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone)2 Timestamp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp)2 ArrayList (java.util.ArrayList)1 BindingSubTlvsSerializer (org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsSerializer)1 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)1 Ipv6AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)1 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)1 Aggregator (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.Aggregator)1 AggregatorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AggregatorBuilder)1 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)1 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.UpdateBuilder)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