Search in sources :

Example 61 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 MetricObjectParser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final MetricObjectBuilder builder = new MetricObjectBuilder();
    byteBuf.skipBytes(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
    final BitArray flags = BitArray.valueOf(byteBuf.readByte());
    builder.setBound(flags.get(BOUND));
    builder.setComputed(flags.get(COMPUTED));
    builder.setMetricType(byteBuf.readUnsignedByte());
    builder.setValue(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
    return builder.build();
}
Also used : Float32(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32) ByteBufWriteUtil.writeFloat32(org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32) MetricObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.metric.object.MetricObjectBuilder) BitArray(org.opendaylight.protocol.util.BitArray)

Example 62 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 MetricObjectParser method localSerializeObject.

@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof MetricObject, "BandwidthObject is mandatory.");
    final MetricObject metric = (MetricObject) teLspObject;
    serializeAttributeHeader(BODY_SIZE, CLASS_NUM, CTYPE, output);
    output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
    final BitArray reflect = new BitArray(FLAGS_SIZE);
    reflect.set(BOUND, metric.isBound());
    reflect.set(COMPUTED, metric.isComputed());
    reflect.toByteBuf(output);
    output.writeByte(metric.getMetricType());
    writeFloat32(metric.getValue(), output);
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray) MetricObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.metric.object.MetricObject)

Example 63 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 AbstractAssociationParser method localParseObject.

@Override
protected final RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final AssociationObjectBuilder asso = new AssociationObjectBuilder();
    asso.setAssociationType(AssociationType.forValue(byteBuf.readUnsignedShort()));
    asso.setAssociationId(byteBuf.readUnsignedShort());
    asso.setIpAddress(parseAssociationIpAddress(byteBuf));
    return asso.build();
}
Also used : AssociationObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.association.object.AssociationObjectBuilder)

Example 64 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 AdminStatusObjectParser method localSerializeObject.

@Override
protected void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof AdminStatusObject, "AssociationObject is mandatory.");
    final AdminStatusObject addObject = (AdminStatusObject) teLspObject;
    serializeAttributeHeader(BODY_SIZE, CLASS_NUM, CTYPE, output);
    final BitArray reflect = new BitArray(FLAGS_SIZE);
    reflect.set(REFLECT, addObject.isReflect());
    reflect.toByteBuf(output);
    output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
    final BitArray flags = new BitArray(FLAGS_SIZE);
    flags.set(TESTING, addObject.isTesting());
    flags.set(DOWN, addObject.isAdministrativelyDown());
    flags.set(DELETION, addObject.isDeletionInProgress());
    flags.toByteBuf(output);
}
Also used : AdminStatusObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.admin.status.object.AdminStatusObject) BitArray(org.opendaylight.protocol.util.BitArray)

Example 65 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 AttributesObjectParser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final LspAttributesObjectBuilder builder = new LspAttributesObjectBuilder();
    final List<SubobjectContainer> subObjectList = new ArrayList<>();
    while (byteBuf.isReadable()) {
        final int type = byteBuf.readUnsignedShort();
        final int length = byteBuf.readUnsignedShort();
        final ByteBuf value = byteBuf.readSlice(length);
        final SubobjectContainerBuilder subObj = new SubobjectContainerBuilder();
        if (type == FLAG_TLV_TYPE) {
            subObj.setLspSubobject(new FlagsTlvBuilder().setFlagContainer(parseFlag(value)).build());
        } else {
            LOG.warn("Lsp Attributes Subobject type {} not supported", type);
        }
        subObjectList.add(subObj.build());
    }
    return builder.setSubobjectContainer(subObjectList).build();
}
Also used : SubobjectContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainer) SubobjectContainerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainerBuilder) ArrayList(java.util.ArrayList) LspAttributesObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObjectBuilder) ByteBuf(io.netty.buffer.ByteBuf) FlagsTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.att.subobject.lsp.subobject.FlagsTlvBuilder)

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