use of org.opendaylight.protocol.util.BitArray 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);
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class TrafficActionEcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
buffer.skipBytes(RESERVED);
final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
final boolean sample = flags.get(SAMPLE_BIT);
final boolean terminal = flags.get(TERMINAL_BIT);
return new TrafficActionExtendedCommunityCaseBuilder().setTrafficActionExtendedCommunity(new TrafficActionExtendedCommunityBuilder().setSample(sample).setTerminalAction(terminal).build()).build();
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class Ipv6BgpPrefixSidParser method serializeBgpPrefixSidTlv.
@Override
public void serializeBgpPrefixSidTlv(final BgpPrefixSidTlv tlv, final ByteBuf bytes) {
Preconditions.checkArgument(tlv instanceof Ipv6SidTlv, "Incoming TLV is not Ipv6SidTlv");
final Ipv6SidTlv ipv6Tlv = (Ipv6SidTlv) tlv;
bytes.writeZero(RESERVED);
final BitArray flags = new BitArray(FLAGS_SIZE);
flags.set(PROCESS_IPV6_HEADER_FLAG, ipv6Tlv.isProcessIpv6HeadAbility());
flags.toByteBuf(bytes);
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class AbstractNumericOperandParser method serialize.
@Override
public final void serialize(final NumericOperand operand, final int length, final boolean endOfList, final ByteBuf buffer) {
final BitArray operandValues = new BitArray(OPERAND_LENGTH);
operandValues.set(END_OF_LIST, endOfList);
operandValues.set(AND_BIT, operand.isAndBit());
operandValues.set(LESS_THAN, operand.isLessThan());
operandValues.set(GREATER_THAN, operand.isGreaterThan());
operandValues.set(EQUAL, operand.isEquals());
final byte byteLength = (byte) (Integer.numberOfTrailingZeros(length) << LENGTH_SHIFT);
buffer.writeByte(operandValues.toByte() | byteLength);
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class SyncOptimizationsCapabilityTlvParser method parseFlags.
@Override
protected void parseFlags(final StatefulBuilder sb, final ByteBuf buffer) {
final BitArray flags = BitArray.valueOf(buffer, FLAGS_F_LENGTH);
sb.setLspUpdateCapability(flags.get(U_FLAG_OFFSET));
if (flags.get(I_FLAG_OFFSET)) {
sb.addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(Boolean.TRUE).build());
}
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1Builder syncOptBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1Builder();
if (flags.get(S_FLAG_OFFSET)) {
syncOptBuilder.setIncludeDbVersion(Boolean.TRUE);
}
if (flags.get(T_FLAG_OFFSET)) {
syncOptBuilder.setTriggeredResync(Boolean.TRUE);
}
if (flags.get(D_FLAG_OFFSET)) {
syncOptBuilder.setDeltaLspSyncCapability(Boolean.TRUE);
}
if (flags.get(F_FLAG_OFFSET)) {
syncOptBuilder.setTriggeredInitialSync(Boolean.TRUE);
}
sb.addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1.class, syncOptBuilder.build());
}
Aggregations