Exemplo n.º 1
0
 public static Module loadYinModule(final InputStream stream)
     throws SourceException, ReactorException {
   final CrossSourceStatementReactor.BuildAction reactor =
       YangInferencePipeline.RFC6020_REACTOR.newBuild();
   addYinSources(reactor, new YinStatementSourceImpl(stream));
   EffectiveSchemaContext ctx = reactor.buildEffective();
   return ctx.getModules().iterator().next();
 }
Exemplo n.º 2
0
  public static Set<Module> loadYinModules(final List<InputStream> streams)
      throws SourceException, ReactorException {
    final CrossSourceStatementReactor.BuildAction reactor =
        YangInferencePipeline.RFC6020_REACTOR.newBuild();
    for (InputStream inputStream : streams) {
      addYinSources(reactor, new YinStatementSourceImpl(inputStream));
    }

    EffectiveSchemaContext ctx = reactor.buildEffective();
    return ctx.getModules();
  }
Exemplo n.º 3
0
  public static Set<Module> loadYinModules(final URI resourceDirectory) throws ReactorException {
    final CrossSourceStatementReactor.BuildAction reactor =
        YangInferencePipeline.RFC6020_REACTOR.newBuild();

    for (File file : new File(resourceDirectory).listFiles()) {
      addYinSources(reactor, new YinStatementSourceImpl(file.getPath(), true));
    }

    EffectiveSchemaContext ctx = reactor.buildEffective();
    return ctx.getModules();
  }
Exemplo n.º 4
0
  public static Set<Module> loadModules(final URI resourceDirectory)
      throws SourceException, ReactorException {
    final CrossSourceStatementReactor.BuildAction reactor =
        YangInferencePipeline.RFC6020_REACTOR.newBuild();
    File[] files = new File(resourceDirectory).listFiles();

    for (File file : files) {
      if (file.getName().endsWith(".yang")) {
        addSources(reactor, new YangStatementSourceImpl(file.getPath(), true));
      } else {
        LOG.info("Ignoring non-yang file {}", file);
      }
    }

    EffectiveSchemaContext ctx = reactor.buildEffective();
    return ctx.getModules();
  }