Add support for finding the Root Resource as specified by RFC 8040.
Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.
Expected Behavior
Correctly parse the Root Resource as specified by RESTCONF Protocol (RFC 8040) Section 3.1 from the "/.well-known/host-meta" resource when multiple <Link> elements are present. The Root Resource is determined by the <Link> element that contains "rel='restconf'" attribute.
See https://datatracker.ietf.org/doc/html/rfc8040#section-3.1
Example response from "/.well-known/host-meta" with multiple <Link>
<?xml version='1.0' encoding='UTF-8'?> <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <Property type='http://example.org/example'>Example< /Property> <Link rel='copyright' href='/copyright'/> <Link rel='restconf' type='application/yang-data+json' href='/restconf'/> </XRD>
Current Behavior
The first <Link> in the "/.well-known/host-meta" response is assumed to be the RESTCONF Root Resource without checking for the "rel='restconf'" attribute.
Steps to Reproduce
- Set up (build/install/etc) a YDK environment as specified by the documentation.
- Acquire (or configure) a RESTCONF server that contains multiple <Link> attributes where the RESTCONF <Link> is not the first in the list.
- Create an application that uses the YDK RestconfServiceProvider to connect to the server in step 2 (above).
- Notice that the Root Resource used by the YDK RestconfServiceProvider client is taken from the first <Link>, not the correct <Link> specifying the "rel='restconf'" attribute.
Your Script
from __future__ import print_function
from ydk.providers import RestconfServiceProvider
from ydk.path import Repository
from ydk.types import EncodingFormat
import ydk
if __name__ == "__main__":
provider = RestconfServiceProvider(repo=Repository(REPO_PATH), address=TARGET_IP, username=TARGET_USER, password=TARGET_PASSWORD, port=PORT, encoding=EncodingFormat.JSON)
Logs
Enable logging and post the logs below
System Information
Python 3.8.10 Ubuntu 20.04.6 LTS Intel x86_64