use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class SessionAttributeLspRaObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final SessionAttributeObjectWithResourcesAffinitiesBuilder builder = new SessionAttributeObjectWithResourcesAffinitiesBuilder();
builder.setIncludeAny(new AttributeFilter(byteBuf.readUnsignedInt()));
builder.setExcludeAny(new AttributeFilter(byteBuf.readUnsignedInt()));
builder.setIncludeAll(new AttributeFilter(byteBuf.readUnsignedInt()));
builder.setSetupPriority(byteBuf.readUnsignedByte());
builder.setHoldPriority(byteBuf.readUnsignedByte());
final BitArray bs = BitArray.valueOf(byteBuf.readByte());
builder.setLocalProtectionDesired(bs.get(SessionAttributeLspObjectParser.LOCAL_PROTECTION));
builder.setLabelRecordingDesired(bs.get(SessionAttributeLspObjectParser.LABEL_RECORDING));
builder.setSeStyleDesired(bs.get(SessionAttributeLspObjectParser.SE_STYLE));
final short nameLenght = byteBuf.readUnsignedByte();
final ByteBuf auxBuf = byteBuf.readSlice(nameLenght);
final String name = new String(ByteArray.readAllBytes(auxBuf), StandardCharsets.US_ASCII);
builder.setSessionName(name);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class SimpleRSVPObjectRegistryTest method testParseRSVP.
@Test
public void testParseRSVP() throws RSVPParsingException {
final RsvpTeObject output = this.simpleRSVPObjectRegistry.parseRSPVTe(this.subObjectTypeOne, this.subObjectCTypeOne, this.input);
assertNotNull(output);
assertTrue(output instanceof SecondaryExplicitRouteObject);
final ByteBuf aggregator = Unpooled.EMPTY_BUFFER;
this.simpleRSVPObjectRegistry.serializeRSPVTe(output, aggregator);
Mockito.verify(this.rsvpTeObjectSerializer).serializeObject(output, aggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class DetourObjectIpv4Parser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf byteAggregator) {
Preconditions.checkArgument(teLspObject instanceof Ipv4DetourObject, "DetourObject is mandatory.");
final Ipv4DetourObject detourObject = (Ipv4DetourObject) teLspObject;
final List<Plr> list = detourObject.getPlr();
serializeAttributeHeader(list.size() * 2 * Ipv4Util.IP4_LENGTH, CLASS_NUM, CTYPE, byteAggregator);
for (final Plr plr : list) {
ByteBufWriteUtil.writeIpv4Address(plr.getPlrId(), byteAggregator);
ByteBufWriteUtil.writeIpv4Address(plr.getAvoidNode(), byteAggregator);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class DetourObjectIpv4Parser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) {
final Ipv4DetourObjectBuilder ipv4Case = new Ipv4DetourObjectBuilder();
final List<Plr> plrList = new ArrayList<>();
while (byteBuf.isReadable()) {
final PlrBuilder plr = new PlrBuilder();
plr.setPlrId(Ipv4Util.addressForByteBuf(byteBuf));
plr.setAvoidNode(Ipv4Util.addressForByteBuf(byteBuf));
plrList.add(plr.build());
}
return ipv4Case.setPlr(plrList).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class DetourObjectIpv6Parser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf byteAggregator) {
Preconditions.checkArgument(teLspObject instanceof Ipv6DetourObject, "DetourObject is mandatory.");
final Ipv6DetourObject detourObject = (Ipv6DetourObject) teLspObject;
final List<PlrId> pList = detourObject.getPlrId();
final List<AvoidNode> aList = detourObject.getAvoidNode();
serializeAttributeHeader((pList.size() * Ipv6Util.IPV6_LENGTH) + (aList.size() * Ipv6Util.IPV6_LENGTH), CLASS_NUM, CTYPE, byteAggregator);
for (final PlrId plrId : pList) {
byteAggregator.writeBytes(Ipv6Util.byteBufForAddress(plrId.getPlrId()));
}
for (final AvoidNode avoidNode : aList) {
byteAggregator.writeBytes(Ipv6Util.byteBufForAddress(avoidNode.getAvoidNode()));
}
}
Aggregations