Search in sources :

Example 1 with ProtectionSubobjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobjectBuilder in project bgpcep by opendaylight.

the class ProtectionCommonParser method parseCommonProtectionBodyType1.

protected static ProtectionSubobject parseCommonProtectionBodyType1(final ByteBuf byteBuf) {
    final BitArray bitArray = BitArray.valueOf(byteBuf.readByte());
    final ProtectionSubobjectBuilder sub = new ProtectionSubobjectBuilder();
    sub.setSecondary(bitArray.get(SECONDARY));
    // Skip Reserved
    byteBuf.skipBytes(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
    final int linkFlags = byteBuf.readByte();
    sub.setLinkFlags(LinkFlags.forValue(linkFlags));
    return sub.build();
}
Also used : ProtectionSubobjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobjectBuilder) BitArray(org.opendaylight.protocol.util.BitArray)

Example 2 with ProtectionSubobjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobjectBuilder in project bgpcep by opendaylight.

the class ProtectionCommonParser method parseCommonProtectionBodyType2.

protected static ProtectionSubobject parseCommonProtectionBodyType2(final ByteBuf byteBuf) throws RSVPParsingException {
    if (byteBuf.readableBytes() != CONTENT_LENGTH_C2) {
        throw new RSVPParsingException("Wrong length of array of bytes. Passed: " + byteBuf.readableBytes() + "; " + "Expected: " + CONTENT_LENGTH_C2 + ".");
    }
    final ProtectionSubobjectBuilder sub = new ProtectionSubobjectBuilder();
    final BitArray protectionFlag = BitArray.valueOf(byteBuf.readByte());
    sub.setSecondary(protectionFlag.get(SECONDARY));
    sub.setProtecting(protectionFlag.get(PROTECTING));
    sub.setNotification(protectionFlag.get(NOTIFICATION));
    sub.setOperational(protectionFlag.get(OPERATIONAL));
    final int lspFlags = byteBuf.readByte();
    sub.setLspFlag(LspFlag.forValue(lspFlags)).build();
    // Skip Reserved
    byteBuf.skipBytes(ByteBufWriteUtil.ONE_BYTE_LENGTH);
    final int linkFlags = byteBuf.readByte();
    sub.setLinkFlags(LinkFlags.forValue(linkFlags));
    final BitArray bitArray2 = BitArray.valueOf(byteBuf.readByte());
    sub.setInPlace(bitArray2.get(IN_PLACE));
    sub.setRequired(bitArray2.get(REQUIRED));
    final int segFlags = byteBuf.readByte();
    sub.setSegFlag(LspFlag.forValue(segFlags));
    byteBuf.skipBytes(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
    return sub.build();
}
Also used : ProtectionSubobjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobjectBuilder) BitArray(org.opendaylight.protocol.util.BitArray) RSVPParsingException(org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException)

Aggregations

BitArray (org.opendaylight.protocol.util.BitArray)2 ProtectionSubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobjectBuilder)2 RSVPParsingException (org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException)1