@Test public void roleChanged() { provider.roleChanged(DID1, MASTER); assertEquals("Should be MASTER", RoleState.MASTER, controller.roleMap.get(DPID1)); provider.roleChanged(DID1, STANDBY); assertEquals("Should be EQUAL", RoleState.EQUAL, controller.roleMap.get(DPID1)); provider.roleChanged(DID1, NONE); assertEquals("Should be SLAVE", RoleState.SLAVE, controller.roleMap.get(DPID1)); }
@Override public void roleChanged(DeviceId deviceId, MastershipRole newRole) { switch (newRole) { case MASTER: controller.setRole(dpid(deviceId.uri()), RoleState.MASTER); break; case STANDBY: controller.setRole(dpid(deviceId.uri()), RoleState.EQUAL); break; case NONE: controller.setRole(dpid(deviceId.uri()), RoleState.SLAVE); break; default: LOG.error("Unknown Mastership state : {}", newRole); } LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId); }
OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public void roleChanged(DeviceId deviceId, MastershipRole newRole) { switch (newRole) { case MASTER: controller.setRole(dpid(deviceId.uri()), RoleState.MASTER); break; case STANDBY: controller.setRole(dpid(deviceId.uri()), RoleState.EQUAL); break; case NONE: controller.setRole(dpid(deviceId.uri()), RoleState.SLAVE); break; default: LOG.error("Unknown Mastership state : {}", newRole); } LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId); } }
OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public void roleChanged(DeviceId deviceId, MastershipRole newRole) { switch (newRole) { case MASTER: controller.setRole(dpid(deviceId.uri()), RoleState.MASTER); break; case STANDBY: controller.setRole(dpid(deviceId.uri()), RoleState.EQUAL); break; case NONE: controller.setRole(dpid(deviceId.uri()), RoleState.SLAVE); break; default: LOG.error("Unknown Mastership state : {}", newRole); } LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId); } OpenFlowDeviceProvider(); }
OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public void roleChanged(DeviceId deviceId, MastershipRole newRole) { switch (newRole) { case MASTER: controller.setRole(dpid(deviceId.uri()), RoleState.MASTER); break; case STANDBY: controller.setRole(dpid(deviceId.uri()), RoleState.EQUAL); break; case NONE: controller.setRole(dpid(deviceId.uri()), RoleState.SLAVE); break; default: LOG.error("Unknown Mastership state : {}", newRole); } LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId); } OpenFlowDeviceProvider(); @Activate void activate(ComponentContext context); @Deactivate void deactivate(ComponentContext context); @Modified void modified(ComponentContext context); @Override boolean isReachable(DeviceId deviceId); @Override void triggerProbe(DeviceId deviceId); @Override void roleChanged(DeviceId deviceId, MastershipRole newRole); @Override void changePortState(DeviceId deviceId, PortNumber portNumber,
                                boolean enable); }
OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public void roleChanged(DeviceId deviceId, MastershipRole newRole) { switch (newRole) { case MASTER: controller.setRole(dpid(deviceId.uri()), RoleState.MASTER); break; case STANDBY: controller.setRole(dpid(deviceId.uri()), RoleState.EQUAL); break; case NONE: controller.setRole(dpid(deviceId.uri()), RoleState.SLAVE); break; default: LOG.error("Unknown Mastership state : {}", newRole); } LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId); } OpenFlowDeviceProvider(); @Activate void activate(ComponentContext context); @Deactivate void deactivate(ComponentContext context); @Modified void modified(ComponentContext context); @Override boolean isReachable(DeviceId deviceId); @Override void triggerProbe(DeviceId deviceId); @Override void roleChanged(DeviceId deviceId, MastershipRole newRole); @Override void changePortState(DeviceId deviceId, PortNumber portNumber,
                                boolean enable);  }