+ final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction();
+ LOG.debug("Received data change to ApplicationRib {}", changes);
+ for (final DataTreeCandidate tc : changes) {
+ LOG.debug("Modification Type {}", tc.getRootNode().getModificationType());
+ final YangInstanceIdentifier path = tc.getRootPath();
+ final PathArgument lastArg = path.getLastPathArgument();
+ Verify.verify(lastArg instanceof NodeIdentifierWithPredicates, "Unexpected type %s in path %s", lastArg.getClass(), path);
+ final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) lastArg;
+ if (!this.supportedTables.contains(tableKey)) {
+ LOG.trace("Skipping received data change for non supported family {}.", tableKey);
+ continue;
+ }
+ for (final DataTreeCandidateNode child : tc.getRootNode().getChildNodes()) {
+ final PathArgument childIdentifier = child.getIdentifier();
+ final YangInstanceIdentifier tableId = this.adjRibsInId.node(tableKey).node(childIdentifier);
+ switch (child.getModificationType()) {
+ case DELETE:
+ LOG.trace("App peer -> AdjRibsIn path delete: {}", childIdentifier);
+ tx.delete(LogicalDatastoreType.OPERATIONAL, tableId);
+ break;
+ case UNMODIFIED:
+ // No-op
+ break;
+ case SUBTREE_MODIFIED:
+ if (EffectiveRibInWriter.TABLE_ROUTES.equals(childIdentifier)) {
+ processRoutesTable(child, tableId, tx, tableId);
+ break;
+ }
+ case WRITE:
+ if (child.getDataAfter().isPresent()) {
+ final NormalizedNode<?,?> dataAfter = child.getDataAfter().get();
+ LOG.trace("App peer -> AdjRibsIn path : {}", tableId);
+ LOG.trace("App peer -> AdjRibsIn data : {}", dataAfter);
+ tx.put(LogicalDatastoreType.OPERATIONAL, tableId, dataAfter);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ tx.submit();