import org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainState;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainStateListener;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.GuardedContext;
-import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
+import org.opendaylight.openflowplugin.api.openflow.lifecycle.ReconciliationFrameworkStep;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
+ @SuppressWarnings("checkstyle:IllegalCatch")
public void instantiateServiceInstance() {
-
try {
contexts.forEach(OFPContext::instantiateServiceInstance);
LOG.info("Started clustering services for node {}", deviceInfo);
}
@Override
+ @SuppressWarnings("checkstyle:IllegalCatch")
public void close() {
if (ContextChainState.CLOSED.equals(contextChainState.get())) {
LOG.debug("ContextChain for node {} is already in TERMINATION state.", deviceInfo);
}
@Override
- public boolean isMastered(@Nonnull ContextChainMastershipState mastershipState) {
+ public boolean isMastered(@Nonnull ContextChainMastershipState mastershipState,
+ boolean inReconciliationFrameworkStep) {
switch (mastershipState) {
case INITIAL_SUBMIT:
LOG.debug("Device {}, initial submit OK.", deviceInfo);
// Flow registry fill is not mandatory to work as a master
LOG.debug("Device {}, initial registry filling OK.", deviceInfo);
this.registryFilling.set(true);
+ break;
case CHECK:
+ // no operation
+ break;
default:
+ // no operation
+ break;
}
final boolean result = initialGathering.get() &&
masterStateOnDevice.get() &&
- initialSubmitting.get() &&
- rpcRegistration.get();
+ rpcRegistration.get() &&
+ inReconciliationFrameworkStep || initialSubmitting.get();
- if (result && mastershipState != ContextChainMastershipState.CHECK) {
+ if (!inReconciliationFrameworkStep &&
+ result &&
+ mastershipState != ContextChainMastershipState.CHECK) {
LOG.info("Device {} is able to work as master{}",
deviceInfo,
registryFilling.get() ? "." : " WITHOUT flow registry !!!");
}
@Override
- public boolean isPrepared() {
- return this.initialGathering.get() &&
- this.masterStateOnDevice.get() &&
- this.rpcRegistration.get();
- }
-
- @Override
- public boolean continueInitializationAfterReconciliation() {
- final AtomicBoolean initialSubmit = new AtomicBoolean(false);
-
+ public void continueInitializationAfterReconciliation() {
contexts.forEach(context -> {
- if (context.map(StatisticsContext.class::isInstance)) {
- initialSubmit.set(context.map(StatisticsContext.class::cast).initialSubmitAfterReconciliation());
+ if (context.map(ReconciliationFrameworkStep.class::isInstance)) {
+ context.map(ReconciliationFrameworkStep.class::cast).continueInitializationAfterReconciliation();
}
});
-
- return initialSubmit.get() && isMastered(ContextChainMastershipState.INITIAL_SUBMIT);
}
@Override