[NETCONF-1158] RestconfSchemaService returns 500 for device model Created: 19/Sep/23 Updated: 12/Oct/23 |
|
| Status: | Open |
| Project: | netconf |
| Component/s: | restconf-nb |
| Affects Version/s: | 7.0.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Medium |
| Reporter: | Peter Suna | Assignee: | Ivan Hrasko |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | pick-next, pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
When sending a GET request to the test-tool device with, for example, the 'toaster2' model, it responds with a 500 error when asked for the 'Accept: application/yang' header. The same request but with "Accept: application/yin+xml" header is working.
0 = {StackTraceElement@25842} "org.opendaylight.restconf.nb.rfc8040.jersey.providers.YangSchemaExportBodyWriter.writeTo(YangSchemaExportBodyWriter.java:42)"
1 = {StackTraceElement@25843} "org.opendaylight.restconf.nb.rfc8040.jersey.providers.YangSchemaExportBodyWriter.writeTo(YangSchemaExportBodyWriter.java:28)"
2 = {StackTraceElement@25844} "org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:242)"
3 = {StackTraceElement@25845} "org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:227)"
4 = {StackTraceElement@25846} "org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139)"
5 = {StackTraceElement@25847} "org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:85)"
The issue arises from the invocation of context.sourceProvider() within the YangSchemaExportBodyWriter class. This DOMYangTextSourceProvider contains controller models. Probably it will be required to explore alternative methods for generating the YangTextSchemaSource. For example, as it is done in |
| Comments |
| Comment by Peter Suna [ 11/Oct/23 ] |
|
The issue here is that we are using `DOMYangTextSourceProvider` from the controller instead of from the device in ParseIdentifier#toSchemaExportContextFromIdentifier() To obtain the `DOMYangTextSourceProvider` for the device, we need to retrieve it from the device service, which is currently empty due to missing SchemaSourceProvider in the DOMSchemaService.
final Optional<DOMSchemaService> service = point.getMountPoint().getService(DOMSchemaService.class);
service.get().getExtensions().getInstance(DOMYangTextSourceProvider.class);
When the DOMMountPoint is prepared, DOMSchemaService is created without SchemaSourceProvider. mountBuilder.addService(DOMSchemaService.class, FixedDOMSchemaService.of(() -> initialCtx)); Device SchemaSourceProvider can be obtained from DeviceSources created here.
|