Skip to content

Commit

Permalink
Remove NioEventLoopGroup usage
Browse files Browse the repository at this point in the history
After adapting to NETCONF's new transport introduced in
NETCONF-1108 we no more need to create our won NioEventLoopGroup.

Signed-off-by: Ivan Hrasko <[email protected]>
(cherry picked from commit e1ebe49)
  • Loading branch information
ihrasko committed May 21, 2024
1 parent de963ef commit c0387a8
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import static org.testng.Assert.assertTrue;

import io.lighty.netconf.device.utils.TimeoutUtil;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand All @@ -28,7 +26,6 @@
import org.junit.jupiter.api.Test;
import org.opendaylight.netconf.api.messages.NetconfMessage;
import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.client.NetconfClientFactory;
import org.opendaylight.netconf.client.NetconfClientFactoryImpl;
import org.opendaylight.netconf.client.NetconfClientSession;
import org.opendaylight.netconf.client.NetconfClientSessionListener;
Expand Down Expand Up @@ -66,21 +63,18 @@ public class ActionDeviceTest {
public static final String RESET_TAG = "reset-finished-at";

private static Main deviceSimulator;
private static NioEventLoopGroup nettyGroup;
private static NetconfClientFactoryImpl dispatcher;

@BeforeAll
public static void setUpClass() {
deviceSimulator = new Main();
deviceSimulator.start(new String[]{DEVICE_SIMULATOR_PORT + ""}, false);
nettyGroup = new NioEventLoopGroup(1, new DefaultThreadFactory(NetconfClientFactory.class));
dispatcher = new NetconfClientFactoryImpl(new DefaultNetconfTimer());
}

@AfterAll
public static void cleanUpClass() throws InterruptedException {
deviceSimulator.shutdown();
nettyGroup.shutdownGracefully().sync();
}

private static NetconfClientConfiguration createSHHConfig(final NetconfClientSessionListener sessionListener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import static org.testng.Assert.assertTrue;

import io.lighty.netconf.device.utils.TimeoutUtil;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -74,7 +72,6 @@ public class DeviceTest {
private static final String DELETE_TOPOLOGY_CONFIG_REQUEST_XML = "delete_topology_config_request.xml";
private static final String GET_SCHEMAS_REQUEST_XML = "get_schemas_request.xml";
private static Main deviceSimulator;
private static NioEventLoopGroup nettyGroup;
private static NetconfClientFactory dispatcher;


Expand All @@ -83,14 +80,12 @@ public static void setUpClass() {
deviceSimulator = new Main();
deviceSimulator.start(new String[]{DEVICE_SIMULATOR_PORT + ""}, false, false);

nettyGroup = new NioEventLoopGroup(1, new DefaultThreadFactory(NetconfClientFactory.class));
dispatcher = new NetconfClientFactoryImpl(new DefaultNetconfTimer());
}

@AfterAll
public static void cleanUpClass() throws InterruptedException {
deviceSimulator.shutdown();
nettyGroup.shutdownGracefully().sync();
}

private static NetconfClientConfiguration createSHHConfig(final NetconfClientSessionListener sessionListener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import io.lighty.netconf.device.notification.Main;
import io.lighty.netconf.device.utils.TimeoutUtil;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -65,21 +63,18 @@ public class NotificationTest {
private static final String EXPECTED_NOTIFICATION_PAYLOAD = "Test Notification";
private static final String GET_SCHEMAS_REQUEST_XML = "get_schemas_request.xml";
private static Main deviceSimulator;
private static NioEventLoopGroup nettyGroup;
private static NetconfClientFactory dispatcher;

@BeforeAll
public static void setupClass() {
deviceSimulator = new Main();
nettyGroup = new NioEventLoopGroup(1, new DefaultThreadFactory(NetconfClientFactory.class));
deviceSimulator.start(new String[]{DEVICE_SIMULATOR_PORT + ""}, false);
dispatcher = new NetconfClientFactoryImpl(new DefaultNetconfTimer());
}

@AfterAll
public static void cleanUpClass() throws InterruptedException {
deviceSimulator.shutdown();
nettyGroup.shutdownGracefully().sync();
}

private static NetconfClientConfiguration createSHHConfig(final NetconfClientSessionListener sessionListener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import io.lighty.netconf.device.utils.TimeoutUtil;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand All @@ -30,7 +28,6 @@
import org.junit.jupiter.api.Test;
import org.opendaylight.netconf.api.messages.NetconfMessage;
import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.client.NetconfClientFactory;
import org.opendaylight.netconf.client.NetconfClientFactoryImpl;
import org.opendaylight.netconf.client.NetconfClientSession;
import org.opendaylight.netconf.client.NetconfClientSessionListener;
Expand Down Expand Up @@ -68,21 +65,18 @@ public class ToasterDeviceTest {
public static final String GET_SCHEMAS_REQUEST_XML = "get_schemas_request.xml";

private static Main deviceSimulator;
private static NioEventLoopGroup nettyGroup;
private static NetconfClientFactoryImpl dispatcher;

@BeforeAll
public static void setUpClass() {
deviceSimulator = new Main();
deviceSimulator.start(new String[]{DEVICE_SIMULATOR_PORT + ""}, false, false);
nettyGroup = new NioEventLoopGroup(1, new DefaultThreadFactory(NetconfClientFactory.class));
dispatcher = new NetconfClientFactoryImpl(new DefaultNetconfTimer());
}

@AfterAll
public static void cleanUpClass() throws InterruptedException {
deviceSimulator.shutdown();
nettyGroup.shutdownGracefully().sync();
}

private static NetconfClientConfiguration createSHHConfig(final NetconfClientSessionListener sessionListener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import static org.testng.Assert.assertTrue;

import io.lighty.netconf.device.utils.TimeoutUtil;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -72,7 +70,6 @@ public class DeviceTest {
private static final List<SimpleNetconfClientSessionListener> SESSION_LISTENERS = new ArrayList<>();
private static final List<NetconfClientSession> NETCONF_CLIENT_SESSIONS = new ArrayList<>();
private static Main deviceSimulator;
private static NioEventLoopGroup nettyGroup;

@BeforeAll
public static void setUpClass() throws InterruptedException, ExecutionException,
Expand All @@ -82,7 +79,6 @@ public static void setUpClass() throws InterruptedException, ExecutionException,
String.valueOf(DEVICE_STARTING_PORT), "--thread-pool-size",
String.valueOf(THREAD_POOL_SIZE), "--device-count", String.valueOf(DEVICE_COUNT)},
true, false);
nettyGroup = new NioEventLoopGroup(THREAD_POOL_SIZE, new DefaultThreadFactory(NetconfClientFactory.class));
NetconfClientFactory dispatcher =
new NetconfClientFactoryImpl(new DefaultNetconfTimer());
for (int port = DEVICE_STARTING_PORT; port < DEVICE_STARTING_PORT + DEVICE_COUNT; port++) {
Expand All @@ -98,7 +94,6 @@ public static void setUpClass() throws InterruptedException, ExecutionException,
public static void cleanUpClass() throws InterruptedException {
NETCONF_CLIENT_SESSIONS.forEach(AbstractNetconfSession::close);
deviceSimulator.shutdown();
nettyGroup.shutdownGracefully().sync();
}

@Test
Expand Down

0 comments on commit c0387a8

Please sign in to comment.