Search in sources :

Example 56 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 DynamicProtectionObjectParser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final DynamicControlProtectionObjectBuilder builder = new DynamicControlProtectionObjectBuilder();
    final ProtectionSubobject pSub = ProtectionCommonParser.parseCommonProtectionBodyType2(byteBuf);
    return builder.setProtectionSubobject(pSub).build();
}
Also used : ProtectionSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject) DynamicControlProtectionObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.DynamicControlProtectionObjectBuilder)

Example 57 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 DynamicProtectionObjectParser method localSerializeObject.

@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof DynamicControlProtectionObject, "ProtectionObject is mandatory.");
    final DynamicControlProtectionObject protectionObject = (DynamicControlProtectionObject) teLspObject;
    serializeAttributeHeader(PROTECTION_TYPE2_BODY_SIZE, CLASS_NUM, CTYPE, output);
    ProtectionCommonParser.serializeBodyType2(protectionObject.getProtectionSubobject(), output);
}
Also used : DynamicControlProtectionObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.DynamicControlProtectionObject)

Example 58 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 ExcludeRouteObjectParser method localSerializeObject.

@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof ExcludeRouteObject, "DetourObject is mandatory.");
    final ExcludeRouteObject excludeObject = (ExcludeRouteObject) teLspObject;
    final ByteBuf bufferAux = Unpooled.buffer();
    serializeList(excludeObject.getSubobjectContainer(), bufferAux);
    serializeAttributeHeader(bufferAux.readableBytes(), CLASS_NUM, CTYPE, output);
    output.writeBytes(bufferAux);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) ExcludeRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.ExcludeRouteObject)

Example 59 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 ExplicitRouteObjectParser method localSerializeObject.

@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof ExplicitRouteObject, "ExplicitRouteObject is mandatory.");
    final ExplicitRouteObject explicitObject = (ExplicitRouteObject) teLspObject;
    final ByteBuf bufferAux = Unpooled.buffer();
    serializeList(explicitObject.getSubobjectContainer(), bufferAux);
    serializeAttributeHeader(bufferAux.readableBytes(), CLASS_NUM, CTYPE, output);
    output.writeBytes(bufferAux);
}
Also used : ExplicitRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.object.ExplicitRouteObject) ByteBuf(io.netty.buffer.ByteBuf)

Example 60 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 FlowSpecObjectParser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final FlowSpecObjectBuilder builder = new FlowSpecObjectBuilder();
    // skip version number, reserved, overall length
    byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
    builder.setServiceHeader(ServiceNumber.forValue(byteBuf.readUnsignedByte()));
    // skip reserved
    byteBuf.skipBytes(ByteBufWriteUtil.ONE_BYTE_LENGTH);
    // skip Length of controlled-load data
    byteBuf.skipBytes(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
    // skip parameter ID 127 and 127 flags
    byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
    final TspecObjectBuilder tBuilder = new TspecObjectBuilder();
    tBuilder.setTokenBucketRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
    tBuilder.setTokenBucketSize(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
    tBuilder.setPeakDataRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
    tBuilder.setMinimumPolicedUnit(byteBuf.readUnsignedInt());
    tBuilder.setMaximumPacketSize(byteBuf.readUnsignedInt());
    builder.setTspecObject(tBuilder.build());
    if (builder.getServiceHeader().getIntValue() == 2) {
        // skip parameter ID 130, flags, lenght
        byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
        builder.setRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
        builder.setSlackTerm(byteBuf.readUnsignedInt());
    }
    return builder.build();
}
Also used : ByteBufWriteUtil.writeFloat32(org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32) Float32(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32) TspecObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObjectBuilder) FlowSpecObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.flow.spec.object.FlowSpecObjectBuilder)

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