[MDSAL-833] Support setting schema source URL by YangLibraryContentBuilder Created: 19/Jul/23  Updated: 19/Jul/23

Status: Open
Project: mdsal
Component/s: yanglib
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Medium
Reporter: Ruslan Kashapov Assignee: Robert Varga
Resolution: Unresolved Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to NETCONF-668 RFC7895/RFC8525 implementation should... Resolved

 Description   

Currently there are multiple services generating yang-library content (using both new and legacy models) within NETCONF project. In order to avoid code duplication it seems reasonable to use dedicated implementation – mdsal-yanglib-rfc8525. The blocking issue is there is no way to set schema source URL for modules (submodules) when yang-library content being built. 

The expected is support for optional component (implementing predefined interface, ie SourceUrlProvider) which provides schema source URL by module/submodule QName so associated field (`schema` for legacy model, `location` for new one) values can be populated. Required is interface only, implementation is responsibility of consumer (some simple one can be used for testing). 

Expected api change like below

final var yangLibNode = yangLib.newContentBuilder()
    .defaultContext(defaultContext)
    .sourceUrlProvider(this::getUrlByQName)
    .formatYangLibraryContent(); 

Source URL is optional. If no sourceUrlProvider is defined or no URL provided then associated field should remain empty (null).


Generated at Wed Feb 07 20:11:05 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.