2017-10-03 14 views
0

私はopendaylight.yangtoolsを使用してアプリケーションでヤンモジュールのファイルを解析していますが、いくつかの情報を取得したいだけです。yangtoolsを使用したヤンモジュールの解析が失敗しました

私は私のMavenのpom.xmlにこの依存関係を追加

<!-- opendaylight Yangtools --> 
<dependency> 
    <groupId>org.opendaylight.yangtools</groupId> 
    <artifactId>yang-parser-impl</artifactId> 
    <version>1.2.0-SNAPSHOT</version> 
    <type>jar</type> 
</dependency>   
<dependency> 
    <groupId>org.opendaylight.yangtools</groupId> 
    <artifactId>yang-parser-api</artifactId> 
    <version>1.2.0-SNAPSHOT</version> 
    <type>jar</type> 
</dependency> 
<dependency> 
    <groupId>org.opendaylight.yangtools</groupId> 
    <artifactId>yang-model-api</artifactId> 
    <version>1.2.0-SNAPSHOT</version> 
    <type>jar</type> 
</dependency> 

それから私はparse関数を実装するためのクラスを作成します。

import java.io.File; 
import java.io.IOException; 
import java.util.ArrayList; 
import java.util.List; 
import java.util.Set; 
import org.opendaylight.yangtools.yang.model.api.Module; 
import org.opendaylight.yangtools.yang.model.api.SchemaContext; 
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException; 
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; 
import org.opendaylight.yangtools.yang.parser.rfc6020.repo.YangStatementStreamSource; 
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; 
import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource; 
import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor; 
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline; 
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl; 
import org.slf4j.Logger; 
import org.slf4j.LoggerFactory; 

public class YangParser { 

    private static final Logger LOGGER = LoggerFactory.getLogger(YangParser.class); 

    public YangParser() {  
    } 

    public void parseModule(String file) throws IOException, YangSyntaxErrorException { 
     LOGGER.debug("Parse Yang module from file : " + file); 

     try { 
      File yang_file = new File(file); 
      CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();    
      reactor.addSource(YangStatementStreamSource.create(
       YangTextSchemaSource.forFile(yang_file))); 

      SchemaContext schemaContext = reactor.buildEffective();    

      Set<Module> modules = schemaContext.getModules(); 
      for (Module m : modules) { 
       LOGGER.debug("Add YANG module : " + m.getName()); 
       LOGGER.debug("Namespace : " + m.getNamespace().toString()); 
      } 

     } 
     catch (ReactorException e) { 
      throw new IllegalStateException("Parsing Yang module failed, error : " + e.getMessage()); 
     } 
    } 
} 

それから私は、POST用のコントローラでこの機能を使用しますAPIを使用してyangファイルをアップロードし、解析します。 アップロードすると、単純なヤンのようにファイル:私は成功したレスポンスボディを持つ

// Contents of "acme-system.yang" 
module acme-system { 
namespace "http://acme.example.com/system"; 
prefix "acme"; 

organization "ACME Inc."; 
contact "[email protected]"; 
description 
    "The module for entities implementing the ACME system."; 

revision 2007-06-09 { 
    description "Initial revision."; 
} 

container system { 
    leaf host-name { 
     type string; 
     description "Hostname for this system"; 
    } 

    leaf-list domain-search { 
     type string; 
     description "List of domain names to search"; 
    } 

    container login { 
     leaf message { 
      type string; 
      description 
       "Message given at start of login session"; 
     } 

     list user { 
      key "name"; 
      leaf name { 
       type string; 
      } 
      leaf full-name { 
       type string; 
      } 
      leaf class { 
       type string; 
      } 
     } 
    } 
} 
} 

<name>acme-system</name> 
<namespace>http://acme.example.com/system</namespace> 
<description>The module for entities implementing the ACME system.</description> 
<reference/> 
<organization>ACME Inc.</organization> 
<contact>[email protected]</contact> 
<revision>1181340000000</revision> 
<yangVersion>1</yangVersion> 

私はヤンは、私は、このエラーで失敗したレスポンスボディをした定義されたインポートを使用してファイルをアップロードする場合:

Parsing Yang module failed, error : Some of SOURCE_PRE_LINKAGE modifiers for statements were not resolved. 

これらはログ:

DEBUG [http-nio-8080-exec-25] s.d.s.w.PropertySourcedRequestMappingHandlerMapping.getHandlerInternal(306) | Looking up handler method for path /ems/2.0/file/parser 
DEBUG [http-nio-8080-exec-25] s.d.s.w.PropertySourcedRequestMappingHandlerMapping.lookupHandlerMethod(108) | looking up handler for path: /ems/2.0/file/parser 
DEBUG [http-nio-8080-exec-25] s.d.s.w.PropertySourcedRequestMappingHandlerMapping.getHandlerInternal(316) | Did not find handler method for [/ems/2.0/file/parser] 
DEBUG [http-nio-8080-exec-25] o.h.e.t.s.AbstractTransactionImpl.begin(160) | begin 
DEBUG [http-nio-8080-exec-25] o.h.e.j.i.LogicalConnectionImpl.obtainConnection(226) | Obtaining JDBC connection 
DEBUG [http-nio-8080-exec-25] o.h.e.j.i.LogicalConnectionImpl.obtainConnection(232) | Obtained JDBC connection 
DEBUG [http-nio-8080-exec-25] o.h.e.t.i.j.JdbcTransaction.doBegin(69) | initial autocommit status: true 
DEBUG [http-nio-8080-exec-25] o.h.e.t.i.j.JdbcTransaction.doBegin(71) | disabling autocommit 
DEBUG [http-nio-8080-exec-25] c.a.e.n.c.YangParser.parseModule(37) | Parse Yang module from file : /home/user/yang/iana-if-type.yang 
DEBUG [http-nio-8080-exec-25] o.o.y.y.p.s.r.SourceSpecificContext.startPhase(206) | Source org.opendaylig[email protected]6e5d8661 started phase SOURCE_PRE_LINKAGE 
DEBUG [http-nio-8080-exec-25] o.o.y.y.p.s.r.BuildGlobalContext.startPhase(287) | Global phase SOURCE_PRE_LINKAGE started 
ERROR [http-nio-8080-exec-25] o.o.y.y.p.s.r.BuildGlobalContext.addSourceExceptions(326) | Failed to parse YANG from source SourceSpecificContext [source=org.opendaylig[email protected]6e5d8661, current=SOURCE_PRE_LINKAGE, finished=INIT] 
org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Yang model processing phase SOURCE_PRE_LINKAGE failed [at /home/user/yang/iana-if-type.yang:1:0] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:353) ~[yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.addSourceExceptions(BuildGlobalContext.java:316) [yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.completePhaseActions(BuildGlobalContext.java:410) [yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.executePhases(BuildGlobalContext.java:218) [yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.buildEffective(BuildGlobalContext.java:229) [yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor$BuildAction.buildEffective(CrossSourceStatementReactor.java:280) [yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at com.example.common.YangParser.parseModule(YangParser.java:51) [classes/:na] 
    at com.example.controllers.services.impl.FileServiceImpl.fileYangParser(FileServiceImpl.java:210) [classes/:na] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144] 
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144] 
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) [spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) [spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) [spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at com.sun.proxy.$Proxy283.fileYangParser(Unknown Source) [na:na] 
    at com.example.controllers.FileController.FileYangParser(FileController.java:133) [classes/:na] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144] 
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144] 
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [servlet-api.jar:na] 
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [servlet-api.jar:na] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:8.5.16] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.16] 
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.5.16] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.16] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.16] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at com.example.common.MDCFilter.doFilter(MDCFilter.java:38) [classes/:na] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at com.example.security.StatelessAuthenticationFilter.doFilter(StatelessAuthenticationFilter.java:39) [classes/:na] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.16] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.16] 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.16] 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.16] 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [catalina.jar:8.5.16] 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.16] 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) [catalina.jar:8.5.16] 
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) [catalina.jar:8.5.16] 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.16] 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.16] 
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) [tomcat-coyote.jar:8.5.16] 
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.16] 
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote.jar:8.5.16] 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) [tomcat-coyote.jar:8.5.16] 
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.16] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144] 
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.16] 
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144] 
Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Imported module [ietf-interfaces] was not found. [at /home/user/yang/iana-if-type.yang:5:2] 
    at org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException.throwIf(InferenceException.java:47) ~[yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.ImportStatementDefinition$1.prerequisiteFailed(ImportStatementDefinition.java:118) ~[yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.failModifier(ModifierImpl.java:87) ~[yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:341) ~[yang-parser-impl-1.2.0-SNAPSHOT.jar:na] 
    ... 92 common frames omitted 
DEBUG [http-nio-8080-exec-25] o.h.e.t.s.AbstractTransactionImpl.rollback(205) | rolling back 
DEBUG [http-nio-8080-exec-25] o.h.e.t.i.j.JdbcTransaction.doRollback(164) | rolled JDBC Connection 
DEBUG [http-nio-8080-exec-25] o.h.e.t.i.j.JdbcTransaction.releaseManagedConnection(126) | re-enabling autocommit 
DEBUG [http-nio-8080-exec-25] o.h.e.j.i.LogicalConnectionImpl.releaseConnection(246) | Releasing JDBC connection 
DEBUG [http-nio-8080-exec-25] o.h.e.j.i.LogicalConnectionImpl.releaseConnection(264) | Released JDBC connection 
ERROR [http-nio-8080-exec-25] c.a.e.n.c.FileController.handleAllException(140) | Parsing Yang module failed, error : Some of SOURCE_PRE_LINKAGE modifiers for statements were not resolved. 
DEBUG [http-nio-8080-exec-25] c.a.e.n.c.MDCFilter.doFilter(45) | End filtering request with com.example.common.MDCFilter 
DEBUG [http-nio-8080-exec-25] c.a.e.n.s.StatelessAuthenticationFilter.doFilter(41) | End filtering request with com.example.security.StatelessAuthenticationFilter 

私を助けることができますか?

ありがとうございました。

答えて

0

私はあなたが何をしているか、次の100%ではないんだけど、私はこのメッセージがキーだと思う:

Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Imported module [ietf-interfaces] was not found. [at /home/user/yang/iana-if-type.yang:5:2] 

ですから、IANA-IF-type.yangをロードしようとしている、そしてそれは、インポートを持っていますto IETF-interfaces.yangには解決できません。しかし、私はあなたが何をしなければならないかを100%確信しているわけではありません。

ietf-interfaces.yangを/ home/user/yang /に単純に使ってみましたか?うまく動作するかどうかは十分ではありません.YANGパーサAPIに依存関係をロードする場所と方法を伝える必要があります。 ODLのRTでは、これはCPからのOSGiを介して機能します。 OILのCLI mvnバインディング生成時には、Mavenプラグインが依存するYANGモデルを見つけるためにプロジェクトCPを参照するため、これが機能します。実際には、もしあなたがlook around the source code of the yang-maven-pluginの依存関係を見つけたのであれば、そこから分かるかもしれませんか?

HTH。それ以外の場合は、https://lists.opendaylight.org/mailman/listinfo/yangtools-devのようなものについてさらにヘルプを得ることができます。

0

私はyang-maven-pluginのソースコードを見ていて、すべてのファイルをリアクタに追加するというこの問題の解決策を考え出しました。サンプルコードを見てください。

CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(); 

     for (final URL url : files) { 
      reactor.addSource(
        YangStatementStreamSource.create(
         YangTextSchemaSource.forFile(new File(url.getPath())) 
        ) 
      ); 
     } 

     SchemaContext schemaContext = reactor.buildEffective(); 
関連する問題