use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder in project bgpcep by opendaylight.
the class PCEPStatefulPeerProposalTest method testSetPeerProposalSuccess.
@Test
public void testSetPeerProposalSuccess() throws Exception {
updateBuilder(() -> {
final var listeners = captor.getAllValues();
assertEquals(2, listeners.size());
// not entirely accurate, but works well enough
final var modPath = TOPOLOGY_IID.child(Node.class, new NodeKey(ServerSessionManager.createNodeId(ADDRESS.getAddress())));
final var dbverRoot = mock(DataObjectModification.class);
doReturn(LSP_DB_VERSION).when(dbverRoot).getDataAfter();
final var dbverMod = mock(DataTreeModification.class);
doReturn(DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, modPath)).when(dbverMod).getRootPath();
doReturn(dbverRoot).when(dbverMod).getRootNode();
for (DataTreeChangeListener<?> listener : listeners) {
if (listener instanceof LspDbVersionListener) {
listener.onDataTreeChanged(List.of(dbverMod));
}
}
// Mock lspdb
});
assertEquals(new Tlvs3Builder().setLspDbVersion(LSP_DB_VERSION).build(), tlvsBuilder.augmentation(Tlvs3.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder in project bgpcep by opendaylight.
the class PCCServerPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(final InetSocketAddress address, final TlvsBuilder openBuilder) {
requireNonNull(address);
final LspDbVersionBuilder lspDbVersionBuilder = new LspDbVersionBuilder();
if (this.isAfterReconnection) {
lspDbVersionBuilder.setLspDbVersionValue(this.dbVersion);
} else {
this.isAfterReconnection = true;
}
openBuilder.addAugmentation(new Tlvs3Builder().setLspDbVersion(lspDbVersionBuilder.build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder in project bgpcep by opendaylight.
the class SyncOptimizationsOpenObjectParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs3Builder syncOptTlvsBuilder = new Tlvs3Builder();
if (tbuilder.augmentation(Tlvs3.class) != null) {
final Tlvs3 t = tbuilder.augmentation(Tlvs3.class);
if (t.getLspDbVersion() != null) {
syncOptTlvsBuilder.setLspDbVersion(t.getLspDbVersion());
}
if (t.getSpeakerEntityId() != null) {
syncOptTlvsBuilder.setSpeakerEntityId(t.getSpeakerEntityId());
}
}
if (tlv instanceof LspDbVersion) {
syncOptTlvsBuilder.setLspDbVersion((LspDbVersion) tlv);
}
if (tlv instanceof SpeakerEntityId) {
syncOptTlvsBuilder.setSpeakerEntityId((SpeakerEntityId) tlv);
}
tbuilder.addAugmentation(syncOptTlvsBuilder.build());
}
Aggregations