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);
}
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));
}
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);
}
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());
}
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);
}
Aggregations