Search in sources :

Example 1 with PccSyncState

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.PccSyncState in project bgpcep by opendaylight.

the class AbstractTopologySessionListener method updatePccState.

synchronized void updatePccState(final PccSyncState pccSyncState) {
    if (this.nodeState == null) {
        LOG.info("Server Session Manager is closed.");
        AbstractTopologySessionListener.this.session.close(TerminationReason.UNKNOWN);
        return;
    }
    final MessageContext ctx = new MessageContext(this.nodeState.getChain().newWriteOnlyTransaction());
    updatePccNode(ctx, new PathComputationClientBuilder().setStateSync(pccSyncState).build());
    if (pccSyncState != PccSyncState.Synchronized) {
        this.synced.set(false);
        this.triggeredResyncInProcess = true;
    }
    // All set, commit the modifications
    ctx.trans.commit().addCallback(new FutureCallback<CommitInfo>() {

        @Override
        public void onSuccess(final CommitInfo result) {
            LOG.trace("Pcc Internal state for session {} updated successfully", AbstractTopologySessionListener.this.session);
        }

        @Override
        public void onFailure(final Throwable throwable) {
            LOG.error("Failed to update Pcc internal state for session {}", AbstractTopologySessionListener.this.session, throwable);
            AbstractTopologySessionListener.this.session.close(TerminationReason.UNKNOWN);
        }
    }, MoreExecutors.directExecutor());
}
Also used : PathComputationClientBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.PathComputationClientBuilder) CommitInfo(org.opendaylight.mdsal.common.api.CommitInfo)

Aggregations

CommitInfo (org.opendaylight.mdsal.common.api.CommitInfo)1 PathComputationClientBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.PathComputationClientBuilder)1