use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate in project controller by opendaylight.
the class AbstractShardTest method mockShardDataTreeCohort.
protected ShardDataTreeCohort mockShardDataTreeCohort() {
ShardDataTreeCohort cohort = mock(ShardDataTreeCohort.class);
DataTreeCandidate candidate = mockCandidate("candidate");
successfulCanCommit(cohort);
successfulPreCommit(cohort, candidate);
successfulCommit(cohort);
doReturn(candidate).when(cohort).getCandidate();
return cohort;
}
use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate in project controller by opendaylight.
the class AbstractShardTest method commitTransaction.
static DataTreeCandidate commitTransaction(final DataTree store, final DataTreeModification modification) throws DataValidationFailedException {
modification.ready();
store.validate(modification);
final DataTreeCandidate candidate = store.prepare(modification);
store.commit(candidate);
return candidate;
}
use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate in project controller by opendaylight.
the class AbstractShardTest method payloadForModification.
static CommitTransactionPayload payloadForModification(final DataTree source, final DataTreeModification mod, final TransactionIdentifier transactionId) throws DataValidationFailedException, IOException {
source.validate(mod);
final DataTreeCandidate candidate = source.prepare(mod);
source.commit(candidate);
return CommitTransactionPayload.create(transactionId, candidate);
}
use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate in project bgpcep by opendaylight.
the class AbstractRIBTestSetup method ipv4Input.
public Collection<DataTreeCandidate> ipv4Input(final YangInstanceIdentifier target, final ModificationType type, final Ipv4Prefix... prefix) {
final Collection<DataTreeCandidate> col = new HashSet<>();
final DataTreeCandidate candidate = mock(DataTreeCandidate.class);
final DataTreeCandidateNode rootNode = mock(DataTreeCandidateNode.class);
doReturn(rootNode).when(candidate).getRootNode();
doReturn(type).when(rootNode).getModificationType();
doCallRealMethod().when(rootNode).toString();
doReturn(target).when(candidate).getRootPath();
doCallRealMethod().when(candidate).toString();
final Collection<DataTreeCandidateNode> children = new HashSet<>();
for (final Ipv4Prefix p : prefix) {
final NodeIdentifierWithPredicates routekey = new NodeIdentifierWithPredicates(Ipv4Route.QNAME, PREFIX_QNAME, p);
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> b = ImmutableNodes.mapEntryBuilder();
b.withNodeIdentifier(routekey);
b.addChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(PREFIX_QNAME)).withValue(p).build());
final DataTreeCandidateNode child = mock(DataTreeCandidateNode.class);
doReturn(createIdentifier(p)).when(child).getIdentifier();
doReturn(java.util.Optional.of(b.build())).when(child).getDataAfter();
doReturn(type).when(child).getModificationType();
children.add(child);
}
doReturn(children).when(rootNode).getChildNodes();
col.add(candidate);
return col;
}
use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate in project bgpcep by opendaylight.
the class AdjRibOutListener method onDataTreeChanged.
@Override
public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
LOG.debug("Data change received for AdjRibOut {}", changes);
for (final DataTreeCandidate tc : changes) {
LOG.trace("Change {} type {}", tc.getRootNode(), tc.getRootNode().getModificationType());
for (final DataTreeCandidateNode child : tc.getRootNode().getChildNodes()) {
processSupportedFamilyRoutes(child);
}
}
this.session.flush();
}
Aggregations