import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
public void onDeviceContextLevelUp(final DeviceContext deviceContext) {
+ LOG.debug("Node:{}, deviceContext.getDeviceState().getRole():{}", deviceContext.getDeviceState().getNodeId(),
+ deviceContext.getDeviceState().getRole());
+ if (deviceContext.getDeviceState().getRole() == OfpRole.BECOMESLAVE) {
+ // if slave, we dont poll for statistics and jump to rpc initialization
+ LOG.info("Skipping Statistics for slave role for node:{}", deviceContext.getDeviceState().getNodeId());
+ deviceInitPhaseHandler.onDeviceContextLevelUp(deviceContext);
+ return;
+ }
if (null == hashedWheelTimer) {
LOG.trace("This is first device that delivered timer. Starting statistics polling immediately.");
hashedWheelTimer = deviceContext.getTimer();
}
+ LOG.info("Starting Statistics for master role for node:{}", deviceContext.getDeviceState().getNodeId());
+
final StatisticsContext statisticsContext = new StatisticsContextImpl(deviceContext);
deviceContext.addDeviceContextClosedHandler(this);
final ListenableFuture<Boolean> weHaveDynamicData = statisticsContext.gatherDynamicData();