Search in sources :

Example 6 with Tl1Device

use of org.onosproject.tl1.Tl1Device in project onos by opennetworkinglab.

the class DefaultTl1Controller method disconnectDevice.

@Override
public void disconnectDevice(DeviceId deviceId) {
    // Ignore if unknown device
    Tl1Device device = deviceMap.get(deviceId);
    if (device == null) {
        return;
    }
    Channel channel = device.channel();
    if (channel != null) {
        channel.close();
        msgMap.remove(channel);
    }
    device.disconnect();
    tl1Listeners.forEach(l -> l.deviceDisconnected(deviceId));
}
Also used : NioSocketChannel(io.netty.channel.socket.nio.NioSocketChannel) SocketChannel(io.netty.channel.socket.SocketChannel) Channel(io.netty.channel.Channel) Tl1Device(org.onosproject.tl1.Tl1Device)

Aggregations

Tl1Device (org.onosproject.tl1.Tl1Device)6 SocketChannel (io.netty.channel.socket.SocketChannel)3 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)3 Channel (io.netty.channel.Channel)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 DeviceId (org.onosproject.net.DeviceId)2 DefaultTl1Command (org.onosproject.tl1.DefaultTl1Command)2 Tl1Command (org.onosproject.tl1.Tl1Command)2 Tl1Controller (org.onosproject.tl1.Tl1Controller)2 Bootstrap (io.netty.bootstrap.Bootstrap)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 DelimiterBasedFrameDecoder (io.netty.handler.codec.DelimiterBasedFrameDecoder)1 StringDecoder (io.netty.handler.codec.string.StringDecoder)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 Socket (java.net.Socket)1 NoSuchElementException (java.util.NoSuchElementException)1 CompletableFuture (java.util.concurrent.CompletableFuture)1