private static final Logger LOG = LoggerFactory.getLogger(Main.class);
- static class Params {
+ public static class Params {
@Arg(dest = "schemas-dir")
public File schemasDir;
@Arg(dest = "debug")
public boolean debug;
+ @Arg(dest = "notification-file")
+ public File notificationFile;
+
static ArgumentParser getParser() {
final ArgumentParser parser = ArgumentParsers.newArgumentParser("netconf testool");
.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)
void validate() {
checkArgument(deviceCount > 0, "Device count has to be > 0");
- checkArgument(startingPort > 1024, "Starting port has to be > 1024");
+ checkArgument(startingPort > 1023, "Starting port has to be > 1023");
if(schemasDir != null) {
checkArgument(schemasDir.exists(), "Schemas dir has to exist");
final NetconfDeviceSimulator netconfDeviceSimulator = new NetconfDeviceSimulator();
try {
final List<Integer> openDevices = netconfDeviceSimulator.start(params);
+ if (openDevices.size() == 0) {
+ LOG.error("Failed to start any simulated devices, exiting...");
+ System.exit(1);
+ }
if(params.distroFolder != null) {
final ConfigGenerator configGenerator = new ConfigGenerator(params.distroFolder, openDevices);
final List<File> generated = configGenerator.generate(params.ssh, params.generateConfigBatchSize, params.generateConfigsTimeout, params.generateConfigsAddress);