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 fails process RPC payload, which contain 'data' tag #851

Closed
ygorelik opened this issue Jan 10, 2019 · 1 comment
Closed

YDK fails process RPC payload, which contain 'data' tag #851

ygorelik opened this issue Jan 10, 2019 · 1 comment

Comments

@ygorelik
Copy link
Collaborator

Expected Behavior

The YDK should correctly process all Yang models regardless of object naming.

Current Behavior

When RPC payload contains 'data' tag the YDK fails to process returned from Netconf payload and creates XML error.

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 issue appears, because 'data' tag is used by RPC schema by itself.

Steps to Reproduce

Configure LACP bundle on IOS XR router. Then try to read oper data using script:

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.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)    

Note the 'data' is name of container in the Yang model.

Logs

Reply from IOS XR device is perfectly fine:

<?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>

But the YDK gives error:

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".

System Information

YDK-0.7.3, xrv9k router running IOS XR 6.5.1.

@ygorelik
Copy link
Collaborator Author

Resolved the issue to YDK-0.8.1.

Script to Run

from __future__ import absolute_import

import sys
import unittest
import logging

from ydk.providers import NetconfServiceProvider
from ydk.services import CRUDService

from test_utils import print_entity

from ydk.models.cisco_ios_xr import Cisco_IOS_XR_bundlemgr_oper

if __name__ == '__main__':
    ncc = NetconfServiceProvider(address='10.30.110.84',
                  username='admin', password='admin', port=830)
    root_schema = ncc.get_session().get_root_schema()
    crud = CRUDService()

    bundle = Cisco_IOS_XR_bundlemgr_oper.LacpBundles.Bundles.Bundle()
    bundle.bundle_interface = "Bundle-Ether1"

    oper = crud.read(ncc, bundle)
    print_entity(oper, root_schema)

Run Results

(ydk81) yan@ubuntu-yan:~/ydk-workspace/ydk-gen$ python scripts/tests/test_851.py 

=====>  Printing DataNode: '/Cisco-IOS-XR-bundlemgr-oper:lacp-bundles'
    <bundle>
      <bundle-interface>Bundle-Ether1</bundle-interface>
      <data>
        <actor-operational-key>1</actor-operational-key>
        <partner-system-priority>0</partner-system-priority>
        <partner-system-mac-address>00:00:00:00:00:00</partner-system-mac-address>
        <partner-operational-key>0</partner-operational-key>
        <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>
          <maximum-active-links>24</maximum-active-links>
          <maximum-active-links-source>bm-which-system-actr</maximum-active-links-source>
          <minimum-bandwidth>1</minimum-bandwidth>
          <bundle-status>bm-bdl-state-down</bundle-status>
          <active-member-count>0</active-member-count>
          <standby-member-count>0</standby-member-count>
          <configured-member-count>1</configured-member-count>
          <mac-source>bm-bdl-mac-source-chassis</mac-source>
          <inter-chassis>false</inter-chassis>
          <is-active>true</is-active>
          <lacp-status>bm-feature-operational</lacp-status>
          <mlacp-status>bm-feature-not-configured</mlacp-status>
          <ipv4bfd-status>bm-feature-not-configured</ipv4bfd-status>
          <link-order-status>bm-feature-not-configured</link-order-status>
          <ipv6bfd-status>bm-feature-not-configured</ipv6bfd-status>
          <load-balance-hash-type>Default</load-balance-hash-type>
          <load-balance-locality-threshold>65</load-balance-locality-threshold>
          <suppression-timer>0</suppression-timer>
          <wait-while-timer>2000</wait-while-timer>
          <collector-max-delay>65535</collector-max-delay>
          <cisco-extensions>false</cisco-extensions>
          <lacp-nonrevertive>false</lacp-nonrevertive>
          <iccp-group-id>0</iccp-group-id>
          <active-foreign-member-count>0</active-foreign-member-count>
          <configured-foreign-member-count>0</configured-foreign-member-count>
          <switchover-type>bmd-mlacp-switchover-nonrevertive</switchover-type>
          <maximize-threshold-value-links>1</maximize-threshold-value-links>
          <maximize-threshold-value-band-width>1</maximize-threshold-value-band-width>
          <mlacp-mode>bundle-mlacp-mode-active</mlacp-mode>
          <recovery-delay>300</recovery-delay>
          <singleton>false</singleton>
          <mac-address>
            <address>00:03:e4:7d:2d:24</address>
          </mac-address>
          <bfd-config>
            <bundle-status>bmd-bfd-bdl-down</bundle-status>
            <start-timer>0</start-timer>
            <nbr-unconfig-timer>0</nbr-unconfig-timer>
            <pref-multiplier>3</pref-multiplier>
            <pref-min-interval>150</pref-min-interval>
            <pref-echo-min-interval>0</pref-echo-min-interval>
            <fast-detect>false</fast-detect>
            <mode-info>0</mode-info>
            <destination-address>
              <af>bm-af-id-ipv4</af>
              <ipv4>0.0.0.0</ipv4>
            </destination-address>
          </bfd-config>
        </actor-bundle-data>
        <bundle-system-id>
          <system-prio>32768</system-prio>
          <system-mac-addr>
            <macaddr>00:03:e4:7d:2d:25</macaddr>
          </system-mac-addr>
        </bundle-system-id>
      </data>
      <members>
        <member>
          <member-interface>GigabitEthernet0/0/0/1</member-interface>
          <interface-name>GigabitEthernet0/0/0/1</interface-name>
          <port-priority>32768</port-priority>
          <port-number>1</port-number>
          <underlying-link-id>0</underlying-link-id>
          <link-order-number>65535</link-order-number>
          <iccp-node>0</iccp-node>
          <bandwidth>1000000</bandwidth>
          <lacp-enabled>TRUE</lacp-enabled>
          <member-type>bmd-mbr-local</member-type>
          <member-name>Gi0/0/0/1</member-name>
          <counters>
            <lacpd-us-received>0</lacpd-us-received>
            <lacpd-us-transmitted>1174</lacpd-us-transmitted>
            <marker-packets-received>0</marker-packets-received>
            <marker-responses-transmitted>0</marker-responses-transmitted>
            <illegal-packets-received>0</illegal-packets-received>
            <excess-lacpd-us-received>0</excess-lacpd-us-received>
            <excess-marker-packets-received>0</excess-marker-packets-received>
            <defaulted>1</defaulted>
            <expired>1</expired>
            <last-cleared-sec>1183</last-cleared-sec>
            <last-cleared-nsec>78000000</last-cleared-nsec>
          </counters>
          <link-data>
            <interface-handle>GigabitEthernet0/0/0/1</interface-handle>
            <actor-system-priority>32768</actor-system-priority>
            <actor-system-mac-address>00:03:e4:7d:2d:25</actor-system-mac-address>
            <actor-operational-key>1</actor-operational-key>
            <partner-system-priority>0</partner-system-priority>
            <partner-system-mac-address>00:00:00:00:00:00</partner-system-mac-address>
            <partner-operational-key>0</partner-operational-key>
            <selected-aggregator-id>0</selected-aggregator-id>
            <attached-aggregator-id>0</attached-aggregator-id>
            <actor-port-id>1</actor-port-id>
            <actor-port-priority>32768</actor-port-priority>
            <partner-port-id>0</partner-port-id>
            <partner-port-priority>0</partner-port-priority>
            <actor-port-state>69</actor-port-state>
            <partner-port-state>66</partner-port-state>
          </link-data>
          <member-mux-data>
            <mux-state>detached</mux-state>
            <error>0</error>
            <member-mux-state-reason>bm-mbr-state-reason-defaulted</member-mux-state-reason>
            <member-state>bmd-mbr-state-configured</member-state>
            <mux-state-reason>bm-mux-reason-defaulted</mux-state-reason>
            <member-mux-state-reason-data>
              <reason-type>member-reason</reason-type>
              <severity>warning</severity>
            </member-mux-state-reason-data>
          </member-mux-data>
          <mac-address>
            <address>52:54:00:e8:d8:ea</address>
          </mac-address>
        </member>
      </members>
    </bundle>

Note. The XML tree contains inside the tag 'data'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant