import org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainMastershipWatcher;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainState;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainStateListener;
+import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SetRoleOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
case RPC_REGISTRATION:
LOG.debug("Device {}, RPC registration OK.", deviceInfo);
this.rpcRegistration.set(true);
+ break;
case INITIAL_FLOW_REGISTRY_FILL:
// Flow registry fill is not mandatory to work as a master
LOG.debug("Device {}, initial registry filling OK.", deviceInfo);
return ContextState.TERMINATION.equals(state);
}
+ @Override
+ public boolean isPrepared() {
+ return this.initialGathering.get() &&
+ this.masterStateOnDevice.get() &&
+ this.rpcRegistration.get();
+ }
+
+ @Override
+ public boolean continueInitializationAfterReconciliation() {
+ return isMastered(ContextChainMastershipState.INITIAL_SUBMIT) && contexts.stream()
+ .filter(StatisticsContext.class::isInstance)
+ .map(StatisticsContext.class::cast)
+ .findAny()
+ .map(StatisticsContext::initialSubmitAfterReconciliation)
+ .orElse(false);
+ }
+
@Override
public boolean addAuxiliaryConnection(@Nonnull ConnectionContext connectionContext) {
return (connectionContext.getFeatures().getAuxiliaryId() != 0)