@Test public void testRoleSetting() { agent.addConnectedSwitch(dpid2, switch2); assertThat(switch2.getRole(), is(RoleState.MASTER)); controller.setRole(dpid2, RoleState.EQUAL); assertThat(switch2.getRole(), is(RoleState.EQUAL)); controller.setRole(dpid3, RoleState.SLAVE); }
@Override public void setRole(Dpid dpid, RoleState role) { final OpenFlowSwitch sw = getSwitch(dpid); if (sw == null) { log.debug("Switch not connected. Ignoring setRole({}, {})", dpid, role); return; } sw.setRole(role); }
OpenFlowControllerImpl implements OpenFlowController { @Override public void setRole(Dpid dpid, RoleState role) { final OpenFlowSwitch sw = getSwitch(dpid); if (sw == null) { log.debug("Switch not connected. Ignoring setRole({}, {})", dpid, role); return; } sw.setRole(role); } }
OpenFlowControllerImpl implements OpenFlowController { @Override public void setRole(Dpid dpid, RoleState role) { final OpenFlowSwitch sw = getSwitch(dpid); if (sw == null) { log.debug("Switch not connected. Ignoring setRole({}, {})", dpid, role); return; } sw.setRole(role); }  }
OpenFlowControllerImpl implements OpenFlowController { @Override public void setRole(Dpid dpid, RoleState role) { final OpenFlowSwitch sw = getSwitch(dpid); if (sw == null) { log.debug("Switch not connected. Ignoring setRole({}, {})", dpid, role); return; } sw.setRole(role); }  @Activate void activate(ComponentContext context); @Deactivate void deactivate(); @Modified void modified(ComponentContext context); @Override Iterable<OpenFlowSwitch> getSwitches(); @Override Iterable<OpenFlowSwitch> getMasterSwitches(); @Override Iterable<OpenFlowSwitch> getEqualSwitches(); @Override OpenFlowSwitch getSwitch(Dpid dpid); @Override OpenFlowSwitch getMasterSwitch(Dpid dpid); @Override OpenFlowSwitch getEqualSwitch(Dpid dpid); @Override void addListener(OpenFlowSwitchListener listener); @Override void removeListener(OpenFlowSwitchListener listener); @Override void addMessageListener(OpenFlowMessageListener listener); @Override void removeMessageListener(OpenFlowMessageListener listener); @Override void addPacketListener(int priority, PacketListener listener); @Override void removePacketListener(PacketListener listener); @Override void addEventListener(OpenFlowEventListener listener); @Override void removeEventListener(OpenFlowEventListener listener); @Override void write(Dpid dpid, OFMessage msg); @Override void processPacket(Dpid dpid, OFMessage msg); @Override void setRole(Dpid dpid, RoleState role); }
OpenFlowControllerImpl implements OpenFlowController { @Override public void setRole(Dpid dpid, RoleState role) { final OpenFlowSwitch sw = getSwitch(dpid); if (sw == null) { log.debug("Switch not connected. Ignoring setRole({}, {})", dpid, role); return; } sw.setRole(role); }  @Activate void activate(ComponentContext context); @Deactivate void deactivate(); @Modified void modified(ComponentContext context); @Override Iterable<OpenFlowSwitch> getSwitches(); @Override Iterable<OpenFlowSwitch> getMasterSwitches(); @Override Iterable<OpenFlowSwitch> getEqualSwitches(); @Override OpenFlowSwitch getSwitch(Dpid dpid); @Override OpenFlowSwitch getMasterSwitch(Dpid dpid); @Override OpenFlowSwitch getEqualSwitch(Dpid dpid); @Override void addListener(OpenFlowSwitchListener listener); @Override void removeListener(OpenFlowSwitchListener listener); @Override void addMessageListener(OpenFlowMessageListener listener); @Override void removeMessageListener(OpenFlowMessageListener listener); @Override void addPacketListener(int priority, PacketListener listener); @Override void removePacketListener(PacketListener listener); @Override void addEventListener(OpenFlowEventListener listener); @Override void removeEventListener(OpenFlowEventListener listener); @Override void write(Dpid dpid, OFMessage msg); @Override void processPacket(Dpid dpid, OFMessage msg); @Override void setRole(Dpid dpid, RoleState role);  }