use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 in project bgpcep by opendaylight.
the class SyncOptimizationsCapabilityTlvParser method serializeFlags.
@Override
protected BitArray serializeFlags(final Stateful sct) {
final BitArray flags = new BitArray(FLAGS_F_LENGTH);
final Stateful1 sfi = sct.getAugmentation(Stateful1.class);
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 sf2 = sct.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1.class);
if (sf2 != null) {
flags.set(F_FLAG_OFFSET, sf2.isTriggeredInitialSync());
flags.set(D_FLAG_OFFSET, sf2.isDeltaLspSyncCapability());
flags.set(T_FLAG_OFFSET, sf2.isTriggeredResync());
flags.set(S_FLAG_OFFSET, sf2.isIncludeDbVersion());
}
if (sfi != null) {
flags.set(I_FLAG_OFFSET, sfi.isInitiation());
}
flags.set(U_FLAG_OFFSET, sct.isLspUpdateCapability());
return flags;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testStatefulTlvSyncOptimizationExtension.
@Test
public void testStatefulTlvSyncOptimizationExtension() throws PCEPDeserializerException {
final SyncOptimizationsCapabilityTlvParser parser = new SyncOptimizationsCapabilityTlvParser();
final Stateful tlv = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE).addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1Builder().setTriggeredInitialSync(Boolean.TRUE).setDeltaLspSyncCapability(Boolean.TRUE).setIncludeDbVersion(Boolean.TRUE).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(STATEFUL_SYNC_OPT_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(STATEFUL_SYNC_OPT_BYTES, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 in project bgpcep by opendaylight.
the class CInitiated00StatefulCapabilityTlvParser method serializeFlags.
@Override
protected BitArray serializeFlags(final Stateful sct) {
final BitArray flags = new BitArray(FLAGS_F_LENGTH);
final Stateful1 sfi = sct.getAugmentation(Stateful1.class);
if (sfi != null) {
flags.set(I_FLAG_OFFSET, sfi.isInitiation());
}
flags.set(U_FLAG_OFFSET, sct.isLspUpdateCapability());
return flags;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method setStatefulCapabilities.
private synchronized void setStatefulCapabilities(final Stateful stateful) {
this.statefulCapability.set(true);
if (stateful.isLspUpdateCapability() != null) {
this.lspUpdateCapability.set(stateful.isLspUpdateCapability());
}
final Stateful1 stateful1 = stateful.getAugmentation(Stateful1.class);
if (stateful1 != null && stateful1.isInitiation() != null) {
this.initiationCapability.set(stateful1.isInitiation());
}
}
Aggregations