[CONTROLLER-256] Loading YANG files from local directory when netconf server does not support netconf monitoring Created: 01/Apr/14  Updated: 25/Jul/23  Resolved: 03/Nov/14

Status: Resolved
Project: controller
Component/s: netconf
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Kanika Gupta Assignee: Maros Marsalek
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows
Platform: PC



 Description   

I have a netconf server that does not advertise any YANG files. As a result of which NetConfDevice.getInitialCapabilities() sets cachedCapabilities as [] since none of the capability has module, revision and "?" & hence FilesystemSchemaCachingProvider never loads any files from cache/schema.

IMHO it is critical since for any netconf device that doesn't support ietf monitoring, neconf southbound plugin would not be able to read the YANG model and therefore device information can not be accessed using RESTCONF.

Note: As a workaround, I have hard coded the server capabilities in odl's code to advertise the YANG files I have written to represent my device. I have put these YANG files in below location:
\\odl-controller\opendaylight\distribution\opendaylight\target\distribution.opendaylight-osgipackage\opendaylight\cache\schema



 Comments   
Comment by Tony Tkacik [ 02/Apr/14 ]

Changed to enhancement, since this is new feature.

Comment by Kanika Gupta [ 02/Apr/14 ]

Thanks Tony for having a look at it.

Would it be right to load the yang files from local directory or should the yang files be written in a separate osgi bundle.

Also, if we put the yang files in local directory, there will be no java source code generated - so in that case how to manipulate the device data?

-Kanika

Comment by Kanika Gupta [ 07/Apr/14 ]

Hi Tony,

Is it possible to reference the yang files from OSGI bundle when netconf server doesn't support ietf monitoring.

Because now i have to keep two copies of yang files:

1) OSGI bundle
2) In /cache/schema for restconf

-Kanika

Comment by Kanika Gupta [ 24/Jun/14 ]

. I have a netconf server which does not support netconf monitoring and therefore no yang files are loaded from the device. So I wrote my own yang file that represent the device and below is what I hard coded.

With recent refactoring done in this area, you might not find NetconfDevice.xtend, please look for NetconfDevice.java.

1. Placed 03-neconf-devices.xml in initial directory, updated netconf server ip, port, password, name. Started the controller and was able to see the netconf servers in opendaylight inventory (http://localhost:8080/restconf/operational/opendaylight-inventory:nodes/)
2. Wrote yang file to represent netconf server (based on get-config information received from the node using netconf rpc) and placed it in /cache/schema. But netconf plugin was not reading this yang file and I filed the bug-628 for it. However, to proceed I hardcoded server capabilities in NetconfDevice.xtend as below:
o a) Declare following variables in NetconfDevice.xtend
Set<String> newServerCapabilities
Collection<String> newCapabilities
o Add following code in NetconfDevice.xtend
private def getNewServerCapabilities()

{ newCapabilities = new java.util.ArrayList<String> (java.util.Arrays.asList("urn:ietf:params:netconf:base:1.0", "urn:ietf:params:netconf:capability:candidate:1.0", "urn:ietf:params:netconf:capability:confirmed-commit:1.0", "urn:ietf:params:netconf:capability:validate:1.0", "urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file", "urn:ietf:params:xml:ns:netconf:base:1.0", "urn:ietf:params:xml:ns:netconf:capability:candidate:1.0", "urn:ietf:params:xml:ns:netconf:capability:confirmed-commit:1.0", "urn:ietf:params:xml:ns:netconf:capability:validate:1.0", "urn:ietf:params:xml:ns:netconf:capability:url:1.0?protocol=http,ftp,file", "http://xml.server.net/xnm/1.1/xnm?module=my-config&revision=2013-08-19"));//This is the yang file I wrote = my-config.yang newServerCapabilities = Sets.newHashSet(newCapabilities); }

o Update getInitialCapabilities() method as below
def getInitialCapabilities() {
//val capabilities = client?.capabilities; //Notice this commented line
val capabilities = getNewServerCapabilities();
o From command prompt go to the location \\odl-controller\opendaylight\md-sal\sal-netconf-connector and "run mvn clean install"
o Copy sal-netconf-connector-1.1-SNAPSHOT.jar from .m2 repository to odl's plugin folder.
o Accessed device information using postman with below URL:
http://localhost:8080/restconf/config/opendaylight-inventory:nodes/opendaylight-inventory:node/node_0001/yang-ext:mount/

Comment by Ankit agarwal [ 17/Jul/14 ]

https://git.opendaylight.org/gerrit/#/c/9107/

https://git.opendaylight.org/gerrit/#/c/9107/

I have fixed the code to read the schema file from ODL local.

Comment by Ankit agarwal [ 18/Jul/14 ]

Hi I have fixed the ODL code and below mentioned gerrit code can be used for fixing the issue:

changes in MD-SAL: https://git.opendaylight.org/gerrit/#/c/9135

changes in yangtools: https://git.opendaylight.org/gerrit/#/c/9112/

Comment by Maros Marsalek [ 18/Jul/14 ]

(In reply to Ankit agarwal from comment #6)

Hi

Your commits do not solve the problem reported here. This problem says that if you put yang files into local folder for a device that does not report its modules, there is no way for netconf-connector to load them. There needs to be a mechanism to tell netconf-connector about schemas in /cache/schema folder.

You are possibly solving a problem with device reporting yang modules but without revision. Is that correct ? If so, please report a new bug and put your commits there.

Maros

Comment by Ankit agarwal [ 21/Jul/14 ]

Raised a new Bug - 1393 as suggested

Comment by Maros Marsalek [ 31/Jul/14 ]

https://git.opendaylight.org/gerrit/#/c/9490/

Comment by Rahul Swaminathan [ 03/Nov/14 ]

Hi Maros/Kanika,

I checked the above commit message https://git.opendaylight.org/gerrit/#/c/9490/ and it says "User can place yang files into cache/schema folder and set the capabilities for these modules into config attribute for netconf-connector."

I'm using the ODL's Service Provider Ubuntu VM in my testing. I've added my YANG file in controller-sp/opendaylight/cache/schema. But, I'm unable find the file where I've to add the capabilities.

Regards,
Rahul Swaminathan

Generated at Wed Feb 07 19:52:35 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.