cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
964
Views
0
Helpful
2
Replies

Possible bug with xml parsing ydk-py

I am trying to run the below query against a xrv9k machine running 6.5.1:

 

lacp_bundle = Cisco_IOS_XR_bundlemgr_oper.LacpBundles()
bundle = lacp_bundle.bundles.Bundle()
bundle.bundle_interface = "Bundle-Ether1"
member = bundle.members.Member()
member.member_interface = YFilter.read
member.bandwidth = YFilter.read
bundle.data.actor_bundle_data.mac_address = YFilter.read
bundle.data.actor_bundle_data.bundle_interface_name = YFilter.read
bundle.data.actor_bundle_data.available_bandwidth = YFilter.red
bundle.data.actor_bundle_data.available_bandwidth = YFilter.read
bundle.data.actor_bundle_data.effective_bandwidth = YFilter.read
bundle.data.actor_bundle_data.configured_bandwidth = YFilter.read
bundle.data.actor_bundle_data.minimum_active_links = YFilter.read
bundle.data.actor_bundle_data.active_member_count = YFilter.read
bundle.members.member.append(member)
lacp_bundle.bundles.bundle.append(bundle)

netconf rpc request to box:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <filter><lacp-bundles xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-bundlemgr-oper">
  <bundles>
    <bundle>
      <bundle-interface>Bundle-Ether1</bundle-interface>
      <data>
        <actor-bundle-data>
          <bundle-interface-name/>
          <available-bandwidth/>
          <effective-bandwidth/>
          <configured-bandwidth/>
          <minimum-active-links/>
          <active-member-count/>
        </actor-bundle-data>
      </data>
      <members>
        <member>
          <member-interface/>
          <bandwidth/>
        </member>
      </members>
    </bundle>
  </bundles>
</lacp-bundles></filter>
</get>
</rpc>

reply from the box:

<?xml version="1.0"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="10">
  <data>
    <lacp-bundles xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-bundlemgr-oper">
      <bundles>
        <bundle>
          <bundle-interface>Bundle-Ether1</bundle-interface>
          <data>
            <actor-bundle-data>
              <bundle-interface-name>Bundle-Ether1</bundle-interface-name>
              <available-bandwidth>0</available-bandwidth>
              <effective-bandwidth>0</effective-bandwidth>
              <configured-bandwidth>4294967295</configured-bandwidth>
              <minimum-active-links>1</minimum-active-links>
              <active-member-count>0</active-member-count>
            </actor-bundle-data>
          </data>
          <members>
            <member>
              <member-interface>GigabitEthernet0/0/0/4</member-interface>
              <bandwidth>1000000</bandwidth>
            </member>
          </members>
        </bundle>
      </bundles>
    </lacp-bundles>
  </data>
</rpc-reply>

YDK-PY while parsing the below output raises a parser error possibly due to multiple data items

 

Entity: line 15: parser error : Premature end of data in tag bundle line 4
          </data>
                 ^
Entity: line 15: parser error : Premature end of data in tag bundles line 3
          </data>
                 ^
Entity: line 15: parser error : Premature end of data in tag lacp-bundles line 2
          </data>
                 ^
Entity: line 15: parser error : Premature end of data in tag data line 1
          </data>
                 ^
Data is invalid according to the yang model. Error details: Missing closing element tag "data". Path: '/lacp-bundles/bundles/bundle/data'
Parsing failed with message Missing closing element tag "data".

The xml response seems normal to me, if i remove the data container from the netconf request, I do not get any parsing errors.

 

Thanks,

Mufaddal

1 Accepted Solution

Accepted Solutions

ygorelik
Cisco Employee
Cisco Employee

I agree with you that this is a bug in YANG model. It should not use "data" as a container name, because it is name of a tag in the RPC "get" defined in ietf-netconf.yang. I have opened a bug against XR software.

 

Unfortunately there is no workaround for this bug as it is embedded into LACP bundle model. In the meanwhile I would suggest just not to use "data" container in YDK quires.

View solution in original post

2 Replies 2

ygorelik
Cisco Employee
Cisco Employee

I agree with you that this is a bug in YANG model. It should not use "data" as a container name, because it is name of a tag in the RPC "get" defined in ietf-netconf.yang. I have opened a bug against XR software.

 

Unfortunately there is no workaround for this bug as it is embedded into LACP bundle model. In the meanwhile I would suggest just not to use "data" container in YDK quires.

Thanks,probably something to fix in the lacp model. Also saw this open issue with ydk-gen which mentions the same bug https://github.com/CiscoDevNet/ydk-gen/issues/799