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 is truncating the XML config #898

Closed
sanshitsharma opened this issue Mar 20, 2019 · 2 comments
Closed

YDK is truncating the XML config #898

sanshitsharma opened this issue Mar 20, 2019 · 2 comments
Milestone

Comments

@sanshitsharma
Copy link

When using YDK to retrieve the device configs over NSO, the XML payload get truncated and then YDK fails to extract module namespaces from XML payload

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

Expected Behavior

Entire XML payload should be returned.

Current Behavior

XML is truncated and ydk fails to extract the XML nodes from partial data.

Steps to Reproduce

Your Script


Logs

Enable logging and post the logs below

config.xml.zip

time="2019-03-06 18:44:25.438" level=DEBUG svc=ydk module=nso:378 msg="Populating new schema from payload:

    <devices xmlns="http://tail-f.com/ns/ncs">
      <device>
        <name>PE1</name>
        <config>
          <admin xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <username>
              <name>cisco</name>
              <group>
                <name>root-system</name>
              </group>
              <secret>
                <encryption>5</encryption>
                <password>$1$VSlx$0ygwKGW9yghXn0N/xSNlX.</password>
              </secret>
            </username>
            <clock>
              <timezone>
                <zone>PST</zone>
                <hours-offset>-7</hours-offset>
              </timezone>
            </clock>
          </admin>
          <hostname xmlns="http://tail-f.com/ned/cisco-ios-xr">PE1</hostname>
          <clock xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <timezone>
              <zone>PST</zone>
              <hours-offset>-7</hours-offset>
            </timezone>
          </clock>
          <banner xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <motd>
              <start-marker>"</start-marker>
              <message>Building L ASR9K Lab</message>
              <end-marker>"</end-marker>
            </motd>
          </banner>
          <vrf xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <vrf-list>
              <name>MAR07-VPN1</name>
              <vpn>
                <id>36b:3</id>
              </vpn>
              <address-family>
                <ipv4>
                  <unicast>
                    <import>
                      <route-target>
                        <address-list>
                          <name>9:1</name>
                        </address-list>
                      </route-target>
                    </import>
                    <export>
                      <route-target>
                        <address-list>
                          <name>9:1</name>
                        </address-list>
                      </route-target>
                    </export>
                  </unicast>
                </ipv4>
              </address-family>
            </vrf-list>
          </vrf>
          <pce xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <address>
              <ipv4>172.23.121.63</ipv4>
            </address>
          </pce>
          <logging xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <trap>informational</trap>
            <console>debugging</console>
            <hostnameprefix>PE1</hostnameprefix>
          </logging>
          <service xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <timestamps>
              <log>
                <datetime>
                  <localtime/>
                  <msec/>
                  <show-timezone/>
                  <year/>
                </datetime>
              </log>
            </timestamps>
          </service>
          <netconf-yang xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <agent>
              <ssh/>
            </agent>
          </netconf-yang>
          <ntp xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <server>
              <server-list>
                <name>72.163.32.44</name>
              </server-list>
            </server>
            <source>
              <MgmtEth>0/RSP0/CPU0/0</MgmtEth>
            </source>
            <update-calendar/>
          </ntp>
          <telnet xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <vrf>
              <name>default</name>
              <telnet-server-list>
                <af>ipv4</af>
                <server>
                  <max-servers>20</max-servers>
                </server>
              </telnet-server-list>
            </vrf>
          </telnet>
          <cdp xmlns="http://tail-f.com/ned/cisco-ios-xr"/>
          <line xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <console>
              <timestamp>
                <disable/>
              </timestamp>
              <exec-timeout>
                <minutes>0</minutes>
                <seconds>0</seconds>
              </exec-timeout>
            </console>
            <default>
              <exec-timeout>
                <minutes>0</minutes>
                <seconds>0</seconds>
              </exec-timeout>
              <session-timeout>
                <minutes>600</minutes>
              </session-timeout>
            </default>
            <template>
              <name>vty</name>
              <timestamp/>
              <exec-timeout>
                <minutes>0</minutes>
                <seconds>0</seconds>
              </exec-timeout>
            </template>
          </line>
          <ipv4 xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <unnumbered>
              <mpls>
                <traffic-eng>
                  <Loopback>0</Loopback>
                </traffic-eng>
              </mpls>
            </unnumbered>
          </ipv4>
          <xxml xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <tty-agent>
              <agent>
                <tty/>
              </agent>
            </tty-agent>
          </xxml>
          <snmp-server xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <ifmib>
              <ifalias>
                <long/>
              </ifalias>
              <stats>
                <cache/>
              </stats>
            </ifmib>
            <ifindex>persist</ifindex>
            <context>
              <context-list>
                <name>MLPb9</name>
              </context-list>
            </context>
            <community>
              <name>cisco</name>
              <RO/>
            </community>
            <community-map>
              <community-map-list>
                <name>public</name>
                <context>MLPb9</context>
              </community-map-list>
            </community-map>
            <queue-length>5000</queue-length>
            <contact>Mark_Hamamoto</contact>
            <location>"San Jose, CA"</location>
            <trap-source>
              <IPv4>
                <Loopback>0</Loopback>
              </IPv4>
            </trap-source>
            <mibs>
              <cbqosmib>
                <cache/>
              </cbqosmib>
            </mibs>
            <traps>
              <traps-list>
                <name>config</name>
              </traps-list>
              <traps-list>
                <name>ds3</name>
              </traps-list>
              <traps-list>
                <name>entity</name>
              </traps-list>
              <traps-list>
                <name>flash insertion</name>
              </traps-list>
              <traps-list>
                <name>flash removal</name>
              </traps-list>
              <traps-list>
                <name>ospf errors authentication-failure</name>
              </traps-list>
              <traps-list>
                <name>ospf errors bad-packet</name>
              </traps-list>
              <traps-list>
                <name>ospf errors config-error</name>
              </traps-list>
              <traps-list>
                <name>ospf errors virt-authentication-failure</name>
              </traps-list>
              <traps-list>
                <name>ospf errors virt-bad-packet</name>
              </traps-list>
              <traps-list>
                <name>ospf errors virt-config-error</name>
              </traps-list>
              <traps-list>
                <name>ospf lsa lsa-maxage</name>
              </traps-list>
              <traps-list>
                <name>ospf lsa lsa-originate</name>
              </traps-list>
              <traps-list>
                <name>ospf retransmit packets</name>
              </traps-list>
              <traps-list>
                <name>ospf retransmit virt-packets</name>
              </traps-list>
              <traps-list>
                <name>ospf state-change if-state-change</name>
              </traps-list>
              <traps-list>
                <name>ospf state-change neighbor-state-change</name>
              </traps-list>
              <traps-list>
                <name>ospf state-change virtif-state-change</name>
              </traps-list>
              <traps-list>
                <name>ospf state-change virtneighbor-state-change</name>
              </traps-list>
              <traps-list>
                <name>rf</name>
              </traps-list>
              <traps-list>
                <name>snmp</name>
              </traps-list>
              <traps-list>
                <name>sonet</name>
              </traps-list>
              <traps-list>
                <name>syslog</name>
              </traps-list>
              <traps-list>
                <name>system</name>
              </traps-list>
            </traps>
          </snmp-server>
          <ssh xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <server>
              <netconf>
                <vrf>
                  <name>default</name>
                </vrf>
              </netconf>
              <v2/>
            </server>
            <timeout>120</timeout>
          </ssh>
          <lldp xmlns="http://tail-f.com/ned/cisco-ios-xr"/>
          <flow xmlns="http://tail-f.com/ned/cisco-ios-xr">
            <exporter-map>
              <name>cariden</name>
              <version>
                <v9>
                  <template>
                    <timeout>60</timeout>
                    <data>
                      <timeout>120</timeout>
                    "
time="2019-03-06 18:44:25.438" level=DEBUG svc=ydk module=nso:378 msg="Extracting module namespaces from XML payload"
time="2019-03-06 18:44:25.439" level=ERROR svc=ydk module=nso:378 msg="Data is invalid according to the yang model. Error details: Missing closing element tag "data". Path: '/devices/device/config/flow/exporter-map/version/v9/template/data'"
time="2019-03-06 18:44:25.439" level=ERROR svc=ydk module=nso:378 msg="Parsing failed with message Missing closing element tag "data"."
time="2019-03-06 18:44:25.440" level=ERROR svc=playbook module=router_op_backup_restore_config:215 msg="An error occurred while invoking router_op_backup_restore_config 'backup' operation on 172.23.121.25 using 'nso' provider: [YCoreError: YCodecError:Missing closing element tag "data".. Path: /devices/device/config/flow/exporter-map/version/v9/template/data]"
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/nca/ansible/verbs/router_op_backup_restore_config.py", line 190, in execute
  File "build/bdist.linux-x86_64/egg/nca/util/config_util.py", line 158, in get_device_config_nso
  File "build/bdist.linux-x86_64/egg/nca/clients/nso/nso.py", line 378, in get_config
RuntimeError: YCoreError: YCodecError:Missing closing element tag "data".. Path: /devices/device/config/flow/exporter-map/version/v9/template/data

System Information

@ygorelik
Copy link
Collaborator

Duplicate of #851
Fixed in 0.7.2.post1 branch as well.

@ygorelik
Copy link
Collaborator

Results of the test, which was performed in CrossWorks environment.

test_898.py.txt
test_898.log
test_898_192.168.123.11.cfg.txt

@ghost ghost added this to the 0.8.3 milestone Apr 2, 2019
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

2 participants