Class AbstractTopologySessionListener<S,L>
- java.lang.Object
-
- org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener<S,L>
-
- Type Parameters:
S
- identifier type of requestsL
- identifier type for LSPs
- All Implemented Interfaces:
AutoCloseable
,EventListener
,TopologySessionStats
,PCEPSessionListener
public abstract class AbstractTopologySessionListener<S,L> extends Object implements TopologySessionStats
Base class for PCEP topology providers. It handles the common tasks involved in managing a PCEP server (PCE) endpoint, and exposing a network topology based on it. It needs to be subclassed to form a fully functional block, where the subclass provides handling of incoming messages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult>
addLsp(AddLspArgs input)
void
close()
@NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult>
ensureLspOperational(EnsureLspOperationalInput input)
int
getDelegatedLspsCount()
return the number of delegated LSPs (tunnels) from PCC.boolean
isSessionSynchronized()
Returns true if session is synchronized.protected boolean
isSynchronized()
protected abstract void
loadLspData(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node, Map<String,ReportedLsp> lspData, Map<L,String> lsps, boolean incrementalSynchro)
protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ReportedLsp>
lspIdentifier(String name)
protected abstract boolean
onMessage(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, Message message)
Perform revision-specific message processing when a message arrives.void
onMessage(PCEPSession psession, Message message)
Fired when a normal protocol message is received.void
onSessionDown(PCEPSession psession, Exception exception)
Fired when the session went down because of an IO error.void
onSessionTerminated(PCEPSession psession, PCEPTerminationReason reason)
Fired when the session is terminated locally.void
onSessionUp(PCEPSession psession)
Fired when the session was established successfully.protected abstract void
onSessionUp(PCEPSession session, PathComputationClientBuilder pccBuilder)
protected void
removeLsp(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, L id)
Remove LSP from the database.@NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult>
removeLsp(RemoveLspArgs input)
protected void
stateSynchronizationAchieved(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx)
Indicate that the peer has completed state synchronization.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<Void>>
tearDownSession(TearDownSessionInput input)
@NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult>
triggerSync(TriggerSyncArgs input)
protected void
updateLsp(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, L id, String lspName, ReportedLspBuilder rlb, boolean solicited, boolean remove)
Update an LSP in the data store.@NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult>
updateLsp(UpdateLspArgs input)
protected void
updatePccNode(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, PathComputationClient pcc)
protected abstract Object
validateReportedLsp(Optional<ReportedLsp> rep, LspId input)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opendaylight.bgpcep.pcep.topology.provider.session.stats.TopologySessionStats
isInitiationCapability, isLspUpdateCapability, isStatefulCapability
-
-
-
-
Method Detail
-
onSessionUp
public final void onSessionUp(PCEPSession psession)
Description copied from interface:PCEPSessionListener
Fired when the session was established successfully.- Specified by:
onSessionUp
in interfacePCEPSessionListener
- Parameters:
psession
- Peer address families which we accepted
-
onSessionDown
public final void onSessionDown(PCEPSession psession, Exception exception)
Description copied from interface:PCEPSessionListener
Fired when the session went down because of an IO error. Implementation should take care of closing underlying session.- Specified by:
onSessionDown
in interfacePCEPSessionListener
- Parameters:
psession
- that went downexception
- Exception that was thrown as the cause of session being down
-
onSessionTerminated
public final void onSessionTerminated(PCEPSession psession, PCEPTerminationReason reason)
Description copied from interface:PCEPSessionListener
Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state. Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.- Specified by:
onSessionTerminated
in interfacePCEPSessionListener
reason
- the cause why the session went down
-
onMessage
public final void onMessage(PCEPSession psession, Message message)
Description copied from interface:PCEPSessionListener
Fired when a normal protocol message is received.- Specified by:
onMessage
in interfacePCEPSessionListener
message
- Protocol message
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
updateLsp
protected final void updateLsp(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, L id, String lspName, ReportedLspBuilder rlb, boolean solicited, boolean remove)
Update an LSP in the data store.- Parameters:
ctx
- Message contextid
- Revision-specific LSP identifierlspName
- LSP namerlb
- Reported LSP buildersolicited
- True if the update was solicitedremove
- True if this is an LSP path removal
-
stateSynchronizationAchieved
protected final void stateSynchronizationAchieved(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx)
Indicate that the peer has completed state synchronization.- Parameters:
ctx
- Message context
-
updatePccNode
protected final void updatePccNode(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, PathComputationClient pcc)
-
lspIdentifier
protected final org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ReportedLsp> lspIdentifier(String name)
-
removeLsp
protected final void removeLsp(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, L id)
Remove LSP from the database.- Parameters:
ctx
- Message Contextid
- Revision-specific LSP identifier
-
onSessionUp
protected abstract void onSessionUp(PCEPSession session, PathComputationClientBuilder pccBuilder)
-
onMessage
protected abstract boolean onMessage(org.opendaylight.bgpcep.pcep.topology.provider.AbstractTopologySessionListener.MessageContext ctx, Message message)
Perform revision-specific message processing when a message arrives.- Parameters:
ctx
- Message processing contextmessage
- Protocol message- Returns:
- True if the message type is not handle.
-
validateReportedLsp
protected abstract Object validateReportedLsp(Optional<ReportedLsp> rep, LspId input)
-
loadLspData
protected abstract void loadLspData(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node node, Map<String,ReportedLsp> lspData, Map<L,String> lsps, boolean incrementalSynchro)
-
isSynchronized
protected final boolean isSynchronized()
-
getDelegatedLspsCount
public int getDelegatedLspsCount()
Description copied from interface:TopologySessionStats
return the number of delegated LSPs (tunnels) from PCC.- Specified by:
getDelegatedLspsCount
in interfaceTopologySessionStats
- Returns:
- status
-
isSessionSynchronized
public boolean isSessionSynchronized()
Description copied from interface:TopologySessionStats
Returns true if session is synchronized.- Specified by:
isSessionSynchronized
in interfaceTopologySessionStats
- Returns:
- status
-
tearDownSession
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<Void>> tearDownSession(TearDownSessionInput input)
-
addLsp
public abstract @NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult> addLsp(AddLspArgs input)
-
removeLsp
public abstract @NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult> removeLsp(RemoveLspArgs input)
-
updateLsp
public abstract @NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult> updateLsp(UpdateLspArgs input)
-
ensureLspOperational
public abstract @NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult> ensureLspOperational(EnsureLspOperationalInput input)
-
triggerSync
public abstract @NonNull com.google.common.util.concurrent.ListenableFuture<OperationResult> triggerSync(TriggerSyncArgs input)
-
-