Class AbstractTopologyBuilder<T extends Route>
- java.lang.Object
-
- org.opendaylight.bgpcep.bgp.topology.provider.AbstractTopologyBuilder<T>
-
- All Implemented Interfaces:
EventListener
,TopologyReference
,org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener<T>
,org.opendaylight.mdsal.binding.api.DataTreeChangeListener<T>
,org.opendaylight.mdsal.binding.api.TransactionChainListener
,InstanceReference<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology>
- Direct Known Subclasses:
Ipv4ReachabilityTopologyBuilder
,Ipv6ReachabilityTopologyBuilder
,LinkstateGraphBuilder
,LinkstateTopologyBuilder
public abstract class AbstractTopologyBuilder<T extends Route> extends Object implements org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener<T>, TopologyReference, org.opendaylight.mdsal.binding.api.TransactionChainListener
-
-
Field Summary
Fields Modifier and Type Field Description protected @org.checkerframework.checker.lock.qual.GuardedBy({"this"}) int
listenerScheduledRestartEnforceCounter
protected @org.checkerframework.checker.lock.qual.GuardedBy({"this"}) long
listenerScheduledRestartTime
protected boolean
networkTopologyTransaction
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTopologyBuilder(org.opendaylight.mdsal.binding.api.DataBroker dataProvider, RibReference locRibReference, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId topologyId, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes types, Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi)
protected
AbstractTopologyBuilder(org.opendaylight.mdsal.binding.api.DataBroker dataProvider, RibReference locRibReference, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId topologyId, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes types, Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi, long listenerResetLimitInMillsec, int listenerResetEnforceCounter)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
clearTopology()
com.google.common.util.concurrent.FluentFuture<? extends org.opendaylight.mdsal.common.api.CommitInfo>
close()
protected abstract void
createObject(org.opendaylight.mdsal.binding.api.ReadWriteTransaction trans, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> id, T value)
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology>
getInstanceIdentifier()
Returns the InstanceIdentifier of the object.protected abstract org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>
getRouteWildcard(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<Tables> tablesId)
void
onDataTreeChanged(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<T>> changes)
void
onTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)
void
onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain)
protected abstract void
removeObject(org.opendaylight.mdsal.binding.api.ReadWriteTransaction trans, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> id, T value)
protected void
resetListener()
Reset the data change listener to its initial status.protected void
resetTransactionChain()
Reset the transaction chain only so that the PingPong transaction chain will become usable again.protected boolean
restartTransactionChainOnDemand()
There are a few reasons we want to schedule a listener restart in a delayed manner: 1.protected void
routeChanged(org.opendaylight.mdsal.binding.api.DataTreeModification<T> change, org.opendaylight.mdsal.binding.api.ReadWriteTransaction trans)
protected void
scheduleListenerRestart()
void
start()
-
-
-
Field Detail
-
listenerScheduledRestartTime
protected @org.checkerframework.checker.lock.qual.GuardedBy({"this"}) long listenerScheduledRestartTime
-
listenerScheduledRestartEnforceCounter
protected @org.checkerframework.checker.lock.qual.GuardedBy({"this"}) int listenerScheduledRestartEnforceCounter
-
networkTopologyTransaction
protected boolean networkTopologyTransaction
-
-
Constructor Detail
-
AbstractTopologyBuilder
protected AbstractTopologyBuilder(org.opendaylight.mdsal.binding.api.DataBroker dataProvider, RibReference locRibReference, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId topologyId, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes types, Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi, long listenerResetLimitInMillsec, int listenerResetEnforceCounter)
-
AbstractTopologyBuilder
protected AbstractTopologyBuilder(org.opendaylight.mdsal.binding.api.DataBroker dataProvider, RibReference locRibReference, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId topologyId, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes types, Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi)
-
-
Method Detail
-
start
public final void start()
-
getRouteWildcard
protected abstract org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> getRouteWildcard(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<Tables> tablesId)
-
createObject
protected abstract void createObject(org.opendaylight.mdsal.binding.api.ReadWriteTransaction trans, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> id, T value)
-
removeObject
protected abstract void removeObject(org.opendaylight.mdsal.binding.api.ReadWriteTransaction trans, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> id, T value)
-
clearTopology
protected abstract void clearTopology()
-
getInstanceIdentifier
public final org.opendaylight.yangtools.yang.binding.InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology> getInstanceIdentifier()
Description copied from interface:InstanceReference
Returns the InstanceIdentifier of the object.- Specified by:
getInstanceIdentifier
in interfaceInstanceReference<T extends Route>
- Returns:
- instance identifier
-
close
public final com.google.common.util.concurrent.FluentFuture<? extends org.opendaylight.mdsal.common.api.CommitInfo> close()
-
onDataTreeChanged
public void onDataTreeChanged(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<T>> changes)
-
routeChanged
protected void routeChanged(org.opendaylight.mdsal.binding.api.DataTreeModification<T> change, org.opendaylight.mdsal.binding.api.ReadWriteTransaction trans)
-
resetListener
protected void resetListener()
Reset the data change listener to its initial status. By resetting the listener we will be able to recover all the data lost before
-
resetTransactionChain
protected void resetTransactionChain()
Reset the transaction chain only so that the PingPong transaction chain will become usable again. However, there will be data loss if we do not apply the previous failed transaction again
-
restartTransactionChainOnDemand
protected boolean restartTransactionChainOnDemand()
There are a few reasons we want to schedule a listener restart in a delayed manner: 1. we should avoid restarting the listener as when the topology is big, there might be huge overhead rebuilding the whole linkstate topology again and again 2. the #onTransactionChainFailed() normally get invoked after a delay. During that time gap, more data changes might still be pushed to #onDataTreeChanged(). And because #onTransactionChainFailed() is not invoked yet, listener restart/transaction chain restart is not done. Thus the new changes will still cause error and another #onTransactionChainFailed() might be invoked later. The listener will be restarted again in that case, which is unexpected. Restarting of transaction chain only introduce little overhead and it's okay to be restarted within a small time window. Note: when the listener is restarted, we can disregard all the incoming data changes before the restart is done, as after the listener unregister/reregister, the first #onDataTreeChanged() call will contain the a complete set of existing changes- Returns:
- if the listener get restarted, return true; otherwise false
-
scheduleListenerRestart
protected void scheduleListenerRestart()
-
onTransactionChainFailed
public final void onTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)
- Specified by:
onTransactionChainFailed
in interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
onTransactionChainSuccessful
public final void onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain)
- Specified by:
onTransactionChainSuccessful
in interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
-