@Test public void modState() throws Exception { sw.modState(SwitchChangeType.ACTIVATED); assertTrue(sw.isActive()); sw.modState(SwitchChangeType.DEACTIVATED); assertFalse(sw.isActive()); }
@Override public void modState(SwitchChangeType state) throws SimulatorException { this.state = state; switch (state) { case ADDED: break; case ACTIVATED: activate(); break; case DEACTIVATED: case REMOVED: deactivate(); break; case CHANGED: throw new SimulatorException("Received modState of CHANGED, no idea why"); default: throw new SimulatorException(String.format("Unknown state %s", state)); } }
ISwitchImpl implements ISwitch { @Override public void modState(SwitchChangeType state) throws SimulatorException { this.state = state; switch (state) { case ADDED: break; case ACTIVATED: activate(); break; case DEACTIVATED: case REMOVED: deactivate(); break; case CHANGED: throw new SimulatorException("Received modState of CHANGED, no idea why"); default: throw new SimulatorException(String.format("Unknown state %s", state)); } } }
ISwitchImpl implements ISwitch { @Override public void modState(SwitchChangeType state) throws SimulatorException { this.state = state; switch (state) { case ADDED: break; case ACTIVATED: activate(); break; case DEACTIVATED: case REMOVED: deactivate(); break; case CHANGED: throw new SimulatorException("Received modState of CHANGED, no idea why"); default: throw new SimulatorException(String.format("Unknown state %s", state)); } } ISwitchImpl();  ISwitchImpl(SwitchId dpid);  ISwitchImpl(SwitchId dpid, int numOfPorts, PortStateType portState); }
ISwitchImpl implements ISwitch { @Override public void modState(SwitchChangeType state) throws SimulatorException { this.state = state; switch (state) { case ADDED: break; case ACTIVATED: activate(); break; case DEACTIVATED: case REMOVED: deactivate(); break; case CHANGED: throw new SimulatorException("Received modState of CHANGED, no idea why"); default: throw new SimulatorException(String.format("Unknown state %s", state)); } } ISwitchImpl();  ISwitchImpl(SwitchId dpid);  ISwitchImpl(SwitchId dpid, int numOfPorts, PortStateType portState); @Override void modState(SwitchChangeType state); @Override void activate(); @Override void deactivate(); @Override boolean isActive(); @Override int getControlPlaneLatency(); @Override void setControlPlaneLatency(int controlPlaneLatency); @Override DatapathId getDpid(); @Override String getDpidAsString(); @Override void setDpid(DatapathId dpid); @Override void setDpid(SwitchId dpid); @Override List<IPortImpl> getPorts(); @Override IPortImpl getPort(int portNum); @Override int addPort(IPortImpl port); @Override int getMaxPorts(); @Override void setMaxPorts(int maxPorts); @Override Map<Long, IFlow> getFlows(); @Override IFlow getFlow(long cookie); @Override void addFlow(IFlow flow); @Override void modFlow(IFlow flow); @Override void delFlow(long cookie); @Override List<PortStatsEntry> getPortStats(); @Override PortStatsEntry getPortStats(int portNum); }
ISwitchImpl implements ISwitch { @Override public void modState(SwitchChangeType state) throws SimulatorException { this.state = state; switch (state) { case ADDED: break; case ACTIVATED: activate(); break; case DEACTIVATED: case REMOVED: deactivate(); break; case CHANGED: throw new SimulatorException("Received modState of CHANGED, no idea why"); default: throw new SimulatorException(String.format("Unknown state %s", state)); } } ISwitchImpl();  ISwitchImpl(SwitchId dpid);  ISwitchImpl(SwitchId dpid, int numOfPorts, PortStateType portState); @Override void modState(SwitchChangeType state); @Override void activate(); @Override void deactivate(); @Override boolean isActive(); @Override int getControlPlaneLatency(); @Override void setControlPlaneLatency(int controlPlaneLatency); @Override DatapathId getDpid(); @Override String getDpidAsString(); @Override void setDpid(DatapathId dpid); @Override void setDpid(SwitchId dpid); @Override List<IPortImpl> getPorts(); @Override IPortImpl getPort(int portNum); @Override int addPort(IPortImpl port); @Override int getMaxPorts(); @Override void setMaxPorts(int maxPorts); @Override Map<Long, IFlow> getFlows(); @Override IFlow getFlow(long cookie); @Override void addFlow(IFlow flow); @Override void modFlow(IFlow flow); @Override void delFlow(long cookie); @Override List<PortStatsEntry> getPortStats(); @Override PortStatsEntry getPortStats(int portNum);  }