X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-testtool%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Ftest%2Ftool%2FNetconfDeviceSimulator.java;h=3a52f0a85ea4af1aca3f3fb452bf1e711a2da2df;hp=b21c02ac35a24709f1e55b2a35778c26ee36212a;hb=a3ebcb3c36804de1e4c0177f3462e33958b0c216;hpb=63b36aa3537d77bd9be323e1113716ef2cd54098 diff --git a/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java b/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java index b21c02ac35..3a52f0a85e 100644 --- a/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java +++ b/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java @@ -24,7 +24,6 @@ import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.HashedWheelTimer; import java.io.Closeable; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.lang.management.ManagementFactory; import java.net.Inet4Address; @@ -42,6 +41,7 @@ import java.util.concurrent.ExecutionException; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.opendaylight.controller.netconf.api.monitoring.NetconfManagementSession; +import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer; import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher; import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory; @@ -91,7 +91,7 @@ public class NetconfDeviceSimulator implements Closeable { this.hashedWheelTimer = hashedWheelTimer; } - private NetconfServerDispatcher createDispatcher(final Map moduleBuilders) { + private NetconfServerDispatcher createDispatcher(final Map moduleBuilders, final boolean exi) { final Set capabilities = Sets.newHashSet(Collections2.transform(moduleBuilders.keySet(), new Function() { @Override @@ -108,8 +108,12 @@ public class NetconfDeviceSimulator implements Closeable { final DefaultCommitNotificationProducer commitNotifier = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer()); + final Set serverCapabilities = exi + ? NetconfServerSessionNegotiatorFactory.DEFAULT_BASE_CAPABILITIES + : Sets.newHashSet(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_0, XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1); + final NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( - hashedWheelTimer, simulatedOperationProvider, idProvider, CONNECTION_TIMEOUT_MILLIS, commitNotifier, new LoggingMonitoringService()); + hashedWheelTimer, simulatedOperationProvider, idProvider, CONNECTION_TIMEOUT_MILLIS, commitNotifier, new LoggingMonitoringService(), serverCapabilities); final NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer( serverNegotiatorFactory); @@ -147,7 +151,7 @@ public class NetconfDeviceSimulator implements Closeable { public List start(final Main.Params params) { final Map moduleBuilders = parseSchemasToModuleBuilders(params); - final NetconfServerDispatcher dispatcher = createDispatcher(moduleBuilders); + final NetconfServerDispatcher dispatcher = createDispatcher(moduleBuilders, params.exi); int currentPort = params.startingPort;