PANTHEONtech / lighty

Lightweight OpenDaylight runtime library
https://lighty.io
Eclipse Public License 1.0
135 stars 75 forks source link

An exception occurred when putting netconf #328

Closed dizang428 closed 5 years ago

dizang428 commented 5 years ago

I want to set an ME object, but there is an exception. I don't know whether the code I set is wrong or whether the Yang structure containing list in the container is not supported. Can anyone help ME? Thx

Code: private static final InstanceIdentifier ME_IID = InstanceIdentifier.create(Me.class);

@PostMapping("/id/{netconfDeviceId}") public ResponseEntity postMeConfig(@PathVariable final String netconfDeviceId, @RequestBody final String meName, Authentication authentication) { Utils.logUserData(LOG, authentication); try (final ReadTransaction tx = dataBroker.newReadOnlyTransaction()) { final Optional netconfTopoOptional = tx.read(LogicalDatastoreType.OPERATIONAL, NETCONF_TOPOLOGY_IID).get(TIMEOUT, TimeUnit.SECONDS); if (netconfTopoOptional.isPresent() && netconfTopoOptional.get().getNode() != null) { for (Node node : netconfTopoOptional.get().getNode()) { final Optional netconfMountPoint = mountPointService.getMountPoint(NETCONF_TOPOLOGY_IID .child(Node.class, new NodeKey(node.getNodeId()))); if (netconfMountPoint.isPresent()) { final Optional netconfDataBroker = netconfMountPoint.get().getService(DataBroker.class); if (netconfDataBroker.isPresent()) { final WriteTransaction netconfWriteTx = netconfDataBroker.get().newWriteOnlyTransaction();

                        final ReadTransaction netconfReadTx =
                                netconfDataBroker.get().newReadOnlyTransaction();

                            final Optional<Me> MEData = netconfReadTx
                                .read(LogicalDatastoreType.OPERATIONAL, ME_IID).get(TIMEOUT, TimeUnit.SECONDS);

                            if(MEData.isPresent()){
                                Me meRequest = new MeBuilder().setNtpEnable(false)
                                        .setIpAddress(new Ipv4Address("192.192.4.250"))
                                        .setMask(new DottedQuad("255.255.255.0"))
                                        .setGateWay1(new Ipv4Address("192.192.4.250"))
                                        .build();

                                netconfWriteTx.put(LogicalDatastoreType.CONFIGURATION, ME_IID, meRequest);
                                try {
                                    netconfWriteTx.commit().get(TIMEOUT, TimeUnit.SECONDS);
                                    LOG.info("Post : {}", meRequest);
                                    return ResponseEntity.ok().build();
                                } catch (Exception e) {
                                    LOG.error("Post Error: {}", meRequest, e);
                                    return ResponseEntity.status(500).build();
                                }
                            }
                    }
                }
            }
        }
        return ResponseEntity.ok().build();
    }  catch (Exception ex) {
        LOG.error("Post ME Error: {}", "", ex);
        return ResponseEntity.status(500).build();
    }
}

Exception:

com.google.common.util.concurrent.UncheckedExecutionException: com.google.common.util.concurrent.UncheckedExecutionException: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Failed to instantiate prototype org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerPrototype as org.opendaylight.yang.gen.v1.urn.ccsa.yang.acc.devm.rev190213.me.NtpServers$StreamWriter at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache.get(LocalCache.java:3951) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3973) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4957) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4963) ~[guava-25.1-jre.jar:na] at org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry.getSerializer(BindingNormalizedNodeCodecRegistry.java:82) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry.toNormalizedNode(BindingNormalizedNodeCodecRegistry.java:117) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec.toNormalizedNode(BindingToNormalizedNodeCodec.java:162) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.adapter.AbstractWriteTransaction.toNormalized(AbstractWriteTransaction.java:58) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.adapter.AbstractWriteTransaction.put(AbstractWriteTransaction.java:37) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.adapter.BindingDOMWriteTransactionAdapter.put(BindingDOMWriteTransactionAdapter.java:28) ~[classes/:na] at io.lighty.core.controller.springboot.rest.NetconfDeviceRestService.postMeConfig(NetconfDeviceRestService.java:217) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:981) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:884) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [javax.servlet-api-3.1.0.jar:3.1.0] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:858) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:214) [websocket-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at io.lighty.core.controller.springboot.config.JCasBinFilter.doFilter(JCasBinFilter.java:61) [classes/:na] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) [spring-security-web-5.0.11.RELEASE.jar:5.0.11.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [jetty-security-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) [jetty-servlet-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.Server.handle(Server.java:502) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) [jetty-io-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [jetty-io-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) [jetty-io-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) [jetty-util-9.4.14.v20181114.jar:9.4.14.v20181114] at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) [jetty-util-9.4.14.v20181114.jar:9.4.14.v20181114] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151] Caused by: com.google.common.util.concurrent.UncheckedExecutionException: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Failed to instantiate prototype org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerPrototype as org.opendaylight.yang.gen.v1.urn.ccsa.yang.acc.devm.rev190213.me.NtpServers$StreamWriter at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache.get(LocalCache.java:3951) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3973) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4957) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4963) ~[guava-25.1-jre.jar:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.getSerializer(AbstractStreamWriterGenerator.java:107) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry$GeneratorLoader.load(BindingNormalizedNodeCodecRegistry.java:332) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry$GeneratorLoader.load(BindingNormalizedNodeCodecRegistry.java:1) ~[classes/:na] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2276) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044) ~[guava-25.1-jre.jar:na] ... 97 common frames omitted Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Failed to instantiate prototype org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerPrototype as org.opendaylight.yang.gen.v1.urn.ccsa.yang.acc.devm.rev190213.me.NtpServers$StreamWriter at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache.get(LocalCache.java:3951) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3973) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4957) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4963) ~[guava-25.1-jre.jar:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.getSerializer(AbstractStreamWriterGenerator.java:107) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.loadSerializerFor(AbstractStreamWriterGenerator.java:118) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerSource.staticInvokeEmitter(DataObjectSerializerSource.java:145) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataNodeContainerSerializerSource.emitChildInner(DataNodeContainerSerializerSource.java:164) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataNodeContainerSerializerSource.emitChild(DataNodeContainerSerializerSource.java:138) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataNodeContainerSerializerSource.emitBody(DataNodeContainerSerializerSource.java:128) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataNodeContainerSerializerSource.getSerializerBody(DataNodeContainerSerializerSource.java:80) ~[classes/:na] at org.opendaylight.yangtools.util.ClassLoaderUtils.getWithClassLoader(ClassLoaderUtils.java:102) ~[util-2.1.10.jar:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.generateEmitter0(AbstractStreamWriterGenerator.java:227) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.access$2(AbstractStreamWriterGenerator.java:215) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator$SerializerImplementationLoader.generateSerializer(AbstractStreamWriterGenerator.java:161) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator$SerializerImplementationLoader.load(AbstractStreamWriterGenerator.java:145) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator$SerializerImplementationLoader.load(AbstractStreamWriterGenerator.java:1) ~[classes/:na] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2276) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044) ~[guava-25.1-jre.jar:na] ... 108 common frames omitted Caused by: java.lang.IllegalStateException: Failed to instantiate prototype org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerPrototype as org.opendaylight.yang.gen.v1.urn.ccsa.yang.acc.devm.rev190213.me.NtpServers$StreamWriter at org.opendaylight.mdsal.binding.generator.util.JavassistUtils.instantiatePrototype(JavassistUtils.java:80) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.generateEmitter0(AbstractStreamWriterGenerator.java:231) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.access$2(AbstractStreamWriterGenerator.java:215) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator$SerializerImplementationLoader.generateSerializer(AbstractStreamWriterGenerator.java:161) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator$SerializerImplementationLoader.load(AbstractStreamWriterGenerator.java:145) ~[classes/:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator$SerializerImplementationLoader.load(AbstractStreamWriterGenerator.java:1) ~[classes/:na] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2276) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154) ~[guava-25.1-jre.jar:na] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044) ~[guava-25.1-jre.jar:na] ... 129 common frames omitted Caused by: java.lang.RuntimeException: cannot find org.opendaylight.yang.gen.v1.urn.ccsa.yang.acc.devm.rev190213.me: org.opendaylight.yang.gen.v1.urn.ccsa.yang.acc.devm.rev190213.Me found in org/opendaylight/yang/gen/v1/urn/ccsa/yang/acc/devm/rev190213/me.class at javassist.CtClassType.getClassFile3(CtClassType.java:213) ~[javassist-3.24.1-GA.jar:na] at javassist.CtClassType.makeFieldCache(CtClassType.java:970) ~[javassist-3.24.1-GA.jar:na] at javassist.CtClassType.getMembers(CtClassType.java:961) ~[javassist-3.24.1-GA.jar:na] at javassist.CtClassType.getDeclaredField2(CtClassType.java:1086) ~[javassist-3.24.1-GA.jar:na] at javassist.CtClassType.getField2(CtClassType.java:1038) ~[javassist-3.24.1-GA.jar:na] at javassist.CtClassType.getField(CtClassType.java:1019) ~[javassist-3.24.1-GA.jar:na] at javassist.CtClass.getField(CtClass.java:838) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.MemberResolver.lookupFieldByJvmName2(MemberResolver.java:292) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.fieldAccess2(TypeChecker.java:941) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:898) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atFieldRead(TypeChecker.java:831) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atExpr(TypeChecker.java:605) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Expr.accept(Expr.java:71) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:888) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atFieldRead(TypeChecker.java:831) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atExpr(TypeChecker.java:605) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Expr.accept(Expr.java:71) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:888) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atFieldRead(TypeChecker.java:831) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atExpr(TypeChecker.java:605) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Expr.accept(Expr.java:71) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:693) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:170) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.CallExpr.accept(CallExpr.java:49) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:693) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:170) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.CallExpr.accept(CallExpr.java:49) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:266) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:360) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:381) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:428) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:385) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:381) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atWhileStmnt(CodeGen.java:467) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:387) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:381) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:428) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:385) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:381) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:321) ~[javassist-3.24.1-GA.jar:na] at javassist.compiler.Javac.compileBody(Javac.java:228) ~[javassist-3.24.1-GA.jar:na] at javassist.CtBehavior.setBody(CtBehavior.java:466) ~[javassist-3.24.1-GA.jar:na] at javassist.CtBehavior.setBody(CtBehavior.java:440) ~[javassist-3.24.1-GA.jar:na] at org.opendaylight.mdsal.binding.dom.codec.gen.impl.AbstractStreamWriterGenerator.lambda$2(AbstractStreamWriterGenerator.java:242) ~[classes/:na] at org.opendaylight.mdsal.binding.generator.util.JavassistUtils.instantiatePrototype(JavassistUtils.java:73) ~[classes/:na] ... 138 common frames omitted Yang: container me { leaf name { type string{ length "1..64"; }
description "name"; } leaf uuid { type string; config false; description "Universal unique identifier, MAC address is suggested."; } leaf status { type me-status; description ""; } leaf manufacturer { mandatory true; type string{ length "1..32"; } config false; description "Manufacturer"; } leaf product-name { mandatory true; type string{ length "1..32"; } config false; description "Product name"; } leaf software-version { mandatory true; type string{ length "1..32"; } config false; description "Software version"; } leaf hardware-version { mandatory true; type string{ length "1..32"; } config false; description "Hardware version"; } leaf device-type { mandatory true; type device-type; config false; description "Device type"; } leaf-list layer-protocol-name { type identityref { base acc-type:layer-protocol-name; } min-elements 1; config false; description "Layer protocol name"; } leaf ip-address { mandatory true; type inet:ipv4-address; description "Ip address(ipv4)"; } leaf mask { mandatory true; type yang:dotted-quad; description "Mask"; } leaf ntp-enable { mandatory true; type boolean; description "Support ntp or not."; } container ntp-servers { list ntp-server { key 'name'; leaf name { type string { length "1..32"; } description "Name of ntp server."; } leaf ip-address { mandatory true; type inet:ipv4-address; description "Ip address of ntp"; } leaf port { type inet:port-number; default 123; description "Port number of ntp"; } leaf ntp-version { type string { length "1..64"; } description "Ntp version"; } leaf ntp-state { type ntp-state; config false; description "Ntp state"; } description "ntp"; } } leaf gate-way1 { mandatory true; type inet:ipv4-address; description "Gat way1(ipv4)"; } leaf gate-way2 { type inet:ipv4-address; description "Gat way2(ipv4)"; } leaf-list eq { type leafref { path '/acc-devm:eqs/acc-devm:eq/acc-devm:name'; } min-elements 1; config false; description "Eq list"; } description "me"; }

PeterSuna commented 5 years ago

Hi dizang428, thank you for your report. We will be looking for problem, and let you know as soon as possible. May you please share steps to reproduce this issue, your version of Java and version of tested lighty.io? Just for check.

Thank you, Peter

dizang428 commented 5 years ago

java version jdk 1.8.0_151 lighty.io

io.lighty
<artifactId>lighty-aggregator</artifactId>
<version>10.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>lighty-core</name> 

I used lighty-core/lighty-examples/lighty-controller-springboot-netconf/ to connect to the netconf device and was able to connect the device and get correctly, but this exception occurred when I wanted to set up an ME object. I set the steps based on the documentation in lighty-controller-springboot-netconf. Thank you

dizang428 commented 5 years ago

I am using Windows, Java version 1.8.0_151 lighty - core - 10.1 x

I used the lighty-core project's example project to test it, but set it up with an exception. So far I've found this problem when I use the following structure in the Yang file. container xx{ container yy{ } } or container xx{ list yy{ } } I'm going to write it like this project : lighty-core/lighty-examples/lighty-controller-springboot-netconf/ The code looks like this:

private static final InstanceIdentifier TOASTER_IID = InstanceIdentifier.create(Toaster.class); Toaster toaster = new ToasterBuilder().setDarknessFactor(2L).build(); netconfWriteTx.merge(LogicalDatastoreType.CONFIGURATION, TOASTER_IID, toaster);

I want to know if I wrote the code incorrectly or something else. Thank you

At 2019-09-06 18:57:40, "Peter Šuňa" notifications@github.com wrote:

Hi dizang428, thank you for your report. We will be looking for problem, and let you know as soon as possible. May you please share steps to reproduce this issue, your version of Java and version of tested lighty.io? Just for check.

Thank you, Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

RottingApple commented 5 years ago

Hello, seems like you have a trouble to instantiate the yang model, make sure you have

since you didn't provide full yang model I can't reproduce the exception you have, I have tried adding new yang model from lighty-models/lighty-test-models. Have made new post request similar to what you did and it worked just fine.

dizang428 commented 5 years ago

Hello, Sir I can confirm that I configured my Yang file according to the requirements of the example project. successfully build yang model ✔ added model dependency to controller pom ✔ added yang model path to mavenModelPaths variable in config/LightyConfiguration file ✔ added yang file to cache/schema in springboot-netconf project path, if may have to create the folders ✔ added yang file to root cache/schema in lighty-core project path (I copied the folder to this path : \lighty-core-10.1.x\lighty-core-10.1.x\lighty-core\cache\schema,Is that right?) Now I use the Yang file of toaster@2009-11-20.yang in the sample project to do the test. I try to add a container testcon in the container to, and then I cannot set it down, reporting the same error as before. And I can set it up successfully without adding the container

container toaster { presence "Indicates the toaster service is available"; description "Top-level container for all toaster database objects."; leaf toasterManufacturer { type DisplayString; config false; mandatory true; description "The name of the toaster's manufacturer. For instance, Microsoft Toaster."; }

  leaf toasterModelNumber {
    type DisplayString;
    config false;
    mandatory true;
    description
      "The name of the toaster's model. For instance,
           Radiant Automatic.";
  }

  leaf toasterStatus {
    type enumeration {
      enum "up" {
        value 1;
        description
          "The toaster knob position is up.
                  No toast is being made now.";
      }
      enum "down" {
        value 2;
        description
          "The toaster knob position is down.
                  Toast is being made now.";
      }
    }
    config false;
    mandatory true;
    description
      "This variable indicates the current state of 
           the toaster.";
  }

  leaf darknessFactor {
    type uint32;
    config true;
    default 1000;
    description
      "The darkness factor. Basically, the number of ms to multiple the doneness value by.";
  }

container testcon { leaf name{ type string; } } } // container toaster

My code:

Toaster toaster = new ToasterBuilder().setDarknessFactor(2L).build(); netconfWriteTx.merge(LogicalDatastoreType.CONFIGURATION, TOASTER_IID, toaster);

At 2019-09-24 16:07:18, "Peter Válka" notifications@github.com wrote:

Hello, seems like you have a trouble to instantiate the yang model, make sure you have

successfully build yang model added model dependency to controller pom added yang model path to mavenModelPaths variable in config/LightyConfiguration file added yang file to cache/schema in springboot-netconf project path, if may have to create the folders added yang file to root cache/schema in lighty-core project path

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

RottingApple commented 5 years ago

Hello, first are you using your own netconf device or are you using our private device, this public lighty project doesn't have a published netconf device to use atm. Also I forgot to add, netconf device also needs to have the yang file in its pom dependencies and also added it in the Set when starting. Seem's like the device has yang models, but when you make a change or add new model the device wont recognize it. Also I want to clarify the cache schema for the yang file is in path: root folder lighty-core not in lighty-core/lighty-core. Hopefully it will work, because I can't reproduce your issue, custom yang is correctly working in the example

mmiklus commented 5 years ago

@dizang428, any updates on this issue ?

mmiklus commented 5 years ago

closed: unable to reproduce