BUG-3335 Disable keepalives in netconf testtool
[controller.git] / opendaylight / netconf / netconf-testtool / src / main / java / org / opendaylight / controller / netconf / test / tool / Main.java
index e52fce7ae03372cb676b7ed6b9fe813682ef34c3..e273254e0ed3bc8520cdcaf910957b982958f3b9 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.netconf.test.tool;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
 
 import ch.qos.logback.classic.Level;
 import com.google.common.base.Charsets;
@@ -78,6 +77,9 @@ public final class Main {
         @Arg(dest = "debug")
         public boolean debug;
 
+        @Arg(dest = "notification-file")
+        public File notificationFile;
+
         static ArgumentParser getParser() {
             final ArgumentParser parser = ArgumentParsers.newArgumentParser("netconf testool");
 
@@ -95,6 +97,11 @@ public final class Main {
                     .help("Directory containing yang schemas to describe simulated devices. Some schemas e.g. netconf monitoring and inet types are included by default")
                     .dest("schemas-dir");
 
+            parser.addArgument("--notification-file")
+                    .type(File.class)
+                    .help("Xml file containing notifications that should be sent to clients after create subscription is called")
+                    .dest("notification-file");
+
             parser.addArgument("--starting-port")
                     .type(Integer.class)
                     .setDefault(17830)
@@ -207,11 +214,7 @@ public final class Main {
     }
 
     private static class ConfigGenerator {
-        public static final String NETCONF_CONNECTOR_XML = "/initial/99-netconf-connector.xml";
-        public static final String NETCONF_CONNECTOR_NAME = "controller-config";
-        public static final String NETCONF_CONNECTOR_PORT = "1830";
-        public static final String NETCONF_CONNECTOR_ADDRESS = "127.0.0.1";
-        public static final String NETCONF_USE_SSH = "false";
+        public static final String NETCONF_CONNECTOR_XML = "/99-netconf-connector-simulated.xml";
         public static final String SIM_DEVICE_SUFFIX = "-sim-device";
 
         private static final String SIM_DEVICE_CFG_PREFIX = "simulated-devices_";
@@ -253,15 +256,6 @@ public final class Main {
                 checkNotNull(stream, "Cannot load %s", NETCONF_CONNECTOR_XML);
                 String configBlueprint = CharStreams.toString(new InputStreamReader(stream, Charsets.UTF_8));
 
-                checkState(configBlueprint.contains(NETCONF_CONNECTOR_NAME));
-                checkState(configBlueprint.contains(NETCONF_CONNECTOR_PORT));
-                checkState(configBlueprint.contains(NETCONF_USE_SSH));
-                checkState(configBlueprint.contains(NETCONF_CONNECTOR_ADDRESS));
-                configBlueprint = configBlueprint.replace(NETCONF_CONNECTOR_NAME, "%s");
-                configBlueprint = configBlueprint.replace(NETCONF_CONNECTOR_ADDRESS, "%s");
-                configBlueprint = configBlueprint.replace(NETCONF_CONNECTOR_PORT, "%s");
-                configBlueprint = configBlueprint.replace(NETCONF_USE_SSH, "%s");
-
                 final String before = configBlueprint.substring(0, configBlueprint.indexOf("<module>"));
                 final String middleBlueprint = configBlueprint.substring(configBlueprint.indexOf("<module>"), configBlueprint.indexOf("</module>"));
                 final String after = configBlueprint.substring(configBlueprint.indexOf("</module>") + "</module>".length());