Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YDK netconf read fails when <data> tag has namespace prefix #799

Closed
ghost opened this issue Jun 11, 2018 · 4 comments
Closed

YDK netconf read fails when <data> tag has namespace prefix #799

ghost opened this issue Jun 11, 2018 · 4 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Jun 11, 2018

Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.

Expected Behavior

data tag with namespace prefix should work

Current Behavior

Below reply from device causes ydk.errors.YServiceProviderError: Can't find data tag in reply sent by device error

<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/15.1X49/junos" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <nc:data>
...
</nc:data>
</nc:rpc-reply>
@ghost ghost added the bug label Jun 11, 2018
@ghost
Copy link
Author

ghost commented Sep 10, 2018

Also fails if the rpc-reply for get or get-config contains <data> tag within another <data> tag

@ygorelik
Copy link
Collaborator

Opened IOS XR bug CSCvn36121 (Cisco-IOS-XR-bundlemgr-oper Yang model conflicts with IETF standard). The XR development team agreed and took it to work. Therefore closing this issue.

@ygorelik
Copy link
Collaborator

The tag within another tag issue has been fixed in YDK-0.8.1. See issue 851 for details

@ygorelik ygorelik reopened this Jan 23, 2019
ygorelik pushed a commit to ygorelik/ydk-gen that referenced this issue Apr 2, 2019
ygorelik pushed a commit to ygorelik/ydk-gen that referenced this issue Apr 2, 2019
@ygorelik
Copy link
Collaborator

ygorelik commented Apr 2, 2019

C++ Test

namespace ydk {
  namespace path {
    std::string get_netconf_output(const string & reply);
  }
}

TEST_CASE( "decode_rpc_with_nc_prefix" )
{
    auto rpc_reply = R"(
<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/15.1X49/junos" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<nc:data>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
  <interface>
    <name>GigabitEthernet0/0/0/2</name>
    <config>
      <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
      <name>GigabitEthernet0/0/0/2</name>
    </config>
  </interface>
</interfaces>
</nc:data>
</nc:rpc-reply>
)";
    auto reply_xml = ydk::path::get_netconf_output(rpc_reply);
    REQUIRE(!reply_xml.empty());

    auto rpc_reply_extracted = R"(<interfaces xmlns="http://openconfig.net/yang/interfaces">
  <interface>
    <name>GigabitEthernet0/0/0/2</name>
    <config>
      <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
      <name>GigabitEthernet0/0/0/2</name>
    </config>
  </interface>
</interfaces>)";
    REQUIRE(reply_xml == rpc_reply_extracted);
}

@ygorelik ygorelik closed this as completed Apr 2, 2019
@ghost ghost added this to the 0.8.3 milestone Apr 2, 2019
ghost pushed a commit that referenced this issue May 16, 2019
ghost pushed a commit that referenced this issue May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant