import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.openflowplugin.api.openflow.OFPContext;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
when(deviceInfo.getDatapathId()).thenReturn(BigInteger.TEN);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
- when(rpcManager.gainContext(Mockito.any())).thenReturn(rpcContext);
}
@Test
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceContext.getDeviceFlowRegistry()).thenReturn(new DeviceFlowRegistryImpl(dataBroker, nodeInstanceIdentifier));
when(deviceManager.gainContext(deviceInfo)).thenReturn(deviceContext);
- when(deviceManager.onClusterRoleChange(deviceInfo, OfpRole.BECOMEMASTER)).thenReturn(listenableFuture);
lifecycleConductor.roleChangeOnDevice(deviceInfo,OfpRole.BECOMEMASTER);
verify(statisticsManager).startScheduling(Mockito.<DeviceInfo>any());
}
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceContext.getDeviceFlowRegistry()).thenReturn(new DeviceFlowRegistryImpl(dataBroker, nodeInstanceIdentifier));
when(deviceManager.gainContext(deviceInfo)).thenReturn(deviceContext);
- when(deviceManager.onClusterRoleChange(deviceInfo, OfpRole.BECOMESLAVE)).thenReturn(listenableFuture);
lifecycleConductor.roleChangeOnDevice(deviceInfo,OfpRole.BECOMESLAVE);
verify(statisticsManager).stopScheduling(Mockito.<DeviceInfo>any());