public SwitchRepresentation(@Nonnull IOFSwitch sw, @Nonnull OFSwitchHandshakeHandler handshakeHandler) { Preconditions.checkNotNull(sw, "switch must not be null"); Preconditions.checkNotNull(handshakeHandler, "handshakeHandler must not be null"); // IOFSwitch this.buffers = sw.getBuffers(); this.capabilities = sw.getCapabilities(); this.tables = sw.getNumTables(); this.inetAddress = sw.getInetAddress(); this.sortedPorts = sw.getSortedPorts(); this.isConnected = sw.isConnected(); this.connectedSince = sw.getConnectedSince(); this.dpid = sw.getId(); this.attributes = sw.getAttributes(); this.isActive = sw.isActive(); // OFSwitchHandshakeHandler this.connections = handshakeHandler.getConnections(); this.handshakeState = handshakeHandler.getState(); this.quarantineReason = handshakeHandler.getQuarantineReason(); }
public SwitchRepresentation(@Nonnull IOFSwitch sw, @Nonnull OFSwitchHandshakeHandler handshakeHandler) { Preconditions.checkNotNull(sw, "switch must not be null"); Preconditions.checkNotNull(handshakeHandler, "handshakeHandler must not be null"); // IOFSwitch this.buffers = sw.getBuffers(); this.capabilities = sw.getCapabilities(); this.tables = sw.getTables(); this.inetAddress = sw.getInetAddress(); this.sortedPorts = sw.getSortedPorts(); this.isConnected = sw.isConnected(); this.connectedSince = sw.getConnectedSince(); this.dpid = sw.getId(); this.attributes = sw.getAttributes(); this.isActive = sw.isActive(); // OFSwitchHandshakeHandler this.connections = handshakeHandler.getConnections(); this.handshakeState = handshakeHandler.getState(); this.quarantineReason = handshakeHandler.getQuarantineReason(); }
@Override public SwitchRepresentation getSwitchRepresentation(DatapathId dpid) { IOFSwitch sw = this.switches.get(dpid); OFSwitchHandshakeHandler handler = this.switchHandlers.get(dpid); if(sw != null && handler != null) { return new SwitchRepresentation(sw, handler); } return null; }
public MockSwitchManager(){ switchHandlers = new ConcurrentHashMap<DatapathId, OFSwitchHandshakeHandler>(); switches = new ConcurrentHashMap<DatapathId, IOFSwitch>(); counters = new SwitchManagerCounters(new DebugCounterServiceImpl()); //switchListeners = new CopyOnWriteArrayList<IOFSwitchListener>(); }
public void setSwitchHandshakeHandlers(Map<DatapathId, OFSwitchHandshakeHandler> handlers) { this.switchHandlers = handlers; }
@Override public ImmutableList<OFSwitchHandshakeHandler> getSwitchHandshakeHandlers() { return ImmutableList.copyOf(this.switchHandlers.values()); }