[NETCONF-967] YangLib: Unable to get schema SourceIdentifier Created: 14/Feb/23  Updated: 17/Aug/23

Status: Confirmed
Project: netconf
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Ivan Hrasko Assignee: Ivan Hrasko
Resolution: Unresolved Votes: 0
Labels: pick-next, pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File karaf.log    
Issue Links:
Blocks
blocks NETCONF-968 YangLib: reduntant '/' for models wit... Resolved

 Description   
  1. run karaf
  2. install odl-netconf-topology odl-restconf-nb odl-yanglib
  3. connect testtool (it downloads its models to cache/schema)
  4. try to access, for example: GET: http://localhost:8181/yanglib/schemas/ietf-yang-types/2013-07-15

The requests fails with the error (see karaf.log). After restart the requests succeeds.



 Comments   
Comment by Ivan Hrasko [ 15/Feb/23 ]

The problem is that YangLibProvider#schemaSourceRegistered() method is invoked only when:

schemaListenerRegistration = schemaRepository.registerSchemaSourceListener(this);

is invoked. Currently this happens in init() method.

We can solve the issue similar way how its done in DefaultSchemaResourceManager#getSchemaResources() where repository, listeners, etc. are registered on demand.

Comment by Ivan Hrasko [ 15/Feb/23 ]

Possible there are other problems:

  • YangLibProvider is not registered in AbstractSchemaRepository's listeners field. In fact, its being registered but it looks that we have multiple AbstractSchemaRepository instances running.
  • AbstractSchemaSourceCache#schemaSourceRegistered is being invoked when new files are added dring runtime - but the method does nothing with it.
Comment by Ruslan Kashapov [ 16/Aug/23 ]
schemaRepository = new SharedSchemaRepository("yang-library", parserFactory);
final var cache = new FilesystemSchemaSourceCache<>(schemaRepository, YangTextSchemaSource.class,
    cacheFolderFile);
schemaRepository.registerSchemaSourceListener(cache);
schemaListenerRegistration = schemaRepository.registerSchemaSourceListener(this); 
  • repository uses cache to access the data and to update the data
  • cache is filled on initialization using data from dir then never read
  • cache is a listener for repository, it means cache is only updated on repository event (which never occurs)
  • for yanglib to accept changes from testtool (assuming same dir usage)
    • these components have to share same repository instance
    • or cache functionality needs update to watch the directory changes
Generated at Wed Feb 07 20:16:21 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.