Search in sources :

Example 51 with RsvpTeObject

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();
}
Also used : SessionAttributeObjectWithResourcesAffinitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.SessionAttributeObjectWithResourcesAffinitiesBuilder) AttributeFilter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AttributeFilter) BitArray(org.opendaylight.protocol.util.BitArray) ByteBuf(io.netty.buffer.ByteBuf)

Example 52 with RsvpTeObject

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);
}
Also used : RsvpTeObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject) SecondaryExplicitRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.SecondaryExplicitRouteObject) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 53 with RsvpTeObject

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);
    }
}
Also used : Plr(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv4.detour.object.Plr) Ipv4DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv4DetourObject)

Example 54 with RsvpTeObject

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();
}
Also used : PlrBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv4.detour.object.PlrBuilder) Plr(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv4.detour.object.Plr) ArrayList(java.util.ArrayList) Ipv4DetourObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv4DetourObjectBuilder)

Example 55 with RsvpTeObject

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()));
    }
}
Also used : AvoidNode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode) Ipv6DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObject) PlrId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrId)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)44 Test (org.junit.Test)25 RsvpTeObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject)25 BitArray (org.opendaylight.protocol.util.BitArray)8 Bandwidth (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth)6 ArrayList (java.util.ArrayList)4 SubobjectContainer (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainer)4 ByteBufWriteUtil.writeFloat32 (org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32)3 Float32 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32)3 AttributeFilter (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AttributeFilter)3 FlagContainer (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.attribute.flags.FlagContainer)2 Plr (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv4.detour.object.Plr)2 AvoidNode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode)2 PlrId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrId)2 ExplicitRouteObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.object.ExplicitRouteObject)2 LspSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.att.subobject.LspSubobject)2 FlagsTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.att.subobject.lsp.subobject.FlagsTlv)2 FlagsTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.att.subobject.lsp.subobject.FlagsTlvBuilder)2 LspAttributesObjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObjectBuilder)2 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainerBuilder)2