}
void removePeer() {
- final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction();
- tx.delete(LogicalDatastoreType.OPERATIONAL, this.peerPath);
+ if(this.peerPath != null) {
+ final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction();
+ tx.delete(LogicalDatastoreType.OPERATIONAL, this.peerPath);
- try {
- tx.submit().checkedGet();
- } catch (final TransactionCommitFailedException e) {
- LOG.debug("Failed to remove Peer {}", this.peerPath, e);
+ try {
+ tx.submit().checkedGet();
+ } catch (final TransactionCommitFailedException e) {
+ LOG.debug("Failed to remove Peer {}", this.peerPath, e);
+ }
}
}
for (final DataTreeCandidate tc : changes) {
LOG.trace("Change {} type {}", tc.getRootNode(), tc.getRootNode().getModificationType());
for (final DataTreeCandidateNode child : tc.getRootNode().getChildNodes()) {
- for (final DataTreeCandidateNode route : this.support.changedRoutes(child)) {
- final Update update;
-
- switch (route.getModificationType()) {
- case UNMODIFIED:
- LOG.debug("Skipping unmodified route {}", route.getIdentifier());
- continue;
- case DELETE:
- case DISAPPEARED:
- // FIXME: we can batch deletions into a single batch
- update = withdraw((MapEntryNode) route.getDataBefore().get());
- break;
- case APPEARED:
- case SUBTREE_MODIFIED:
- case WRITE:
- update = advertise((MapEntryNode) route.getDataAfter().get());
- break;
- default:
- LOG.warn("Ignoring unhandled modification type {}", route.getModificationType());
- continue;
- }
-
- LOG.debug("Writing update {}", update);
- this.session.write(update);
- }
+ processSupportedFamilyRoutes(child);
}
}
this.session.flush();
}
+ private void processSupportedFamilyRoutes(final DataTreeCandidateNode child) {
+ for (final DataTreeCandidateNode route : this.support.changedRoutes(child)) {
+ processRouteChange(route);
+ }
+ }
+
+ private void processRouteChange(final DataTreeCandidateNode route) {
+ final Update update;
+ switch (route.getModificationType()) {
+ case UNMODIFIED:
+ LOG.debug("Skipping unmodified route {}", route.getIdentifier());
+ return;
+ case DELETE:
+ case DISAPPEARED:
+ // FIXME: we can batch deletions into a single batch
+ update = withdraw((MapEntryNode) route.getDataBefore().get());
+ LOG.debug("Withdrawing routes {}", update);
+ break;
+ case APPEARED:
+ case SUBTREE_MODIFIED:
+ case WRITE:
+ update = advertise((MapEntryNode) route.getDataAfter().get());
+ LOG.debug("Advertising routes {}", update);
+ break;
+ default:
+ LOG.warn("Ignoring unhandled modification type {}", route.getModificationType());
+ return;
+ }
+ this.session.write(update);
+ }
+
private Attributes routeAttributes(final MapEntryNode route) {
if (LOG.isDebugEnabled()) {
LOG.debug("AdjRibOut parsing route {}", NormalizedNodes.toStringTree(route));
@Override
public synchronized void close() {
- dropConnection();
+ releaseConnection();
this.chain.close();
- // TODO should this perform cleanup ?
}
@Override
@Override
public void releaseConnection() {
- dropConnection();
cleanup();
+ dropConnection();
}
@GuardedBy("this")
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction, final Throwable cause) {
LOG.error("Transaction chain failed.", cause);
- dropConnection();
+ releaseConnection();
this.chain.close();
this.chain = this.rib.createPeerChain(this);
}
final Map<RouteUpdateKey, AbstractRouteEntry> ret, final YangInstanceIdentifier rootPath, final DOMDataWriteTransaction tx) {
final DataTreeCandidateNode ribIn = rootNode.getModifiedChild(EFFRIBIN_NID);
if (ribIn == null) {
- LOG.debug("Skipping change {}", rootNode.getIdentifier());
+ LOG.trace("Skipping change {}", rootNode.getIdentifier());
return;
}
final DataTreeCandidateNode table = ribIn.getModifiedChild(TABLES_NID).getModifiedChild(this.tableKey);
if (table == null) {
- LOG.debug("Skipping change {}", rootNode.getIdentifier());
+ LOG.trace("Skipping change {}", rootNode.getIdentifier());
return;
}
initializeTableWithExistenRoutes(table, peerId, rootPath, tx);