CiscoDevNet / ydk-gen

Generate model-driven APIs from YANG models
http://ciscodevnet.github.io/ydk-gen/
Apache License 2.0
137 stars 74 forks source link

kernel segfault error #1044

Closed sunnwang closed 3 years ago

sunnwang commented 3 years ago

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

Expected Behavior

netconf.edit_config on IOS-XE

Current Behavior

system log when decode xml :
kernel: python[9781]: segfault at 2 ip 00007f784137b079 sp 00007ffe64c19260 error 4 in libc-2.17.so[7f784132e000+1c3000]

Steps to Reproduce

Your Script

#!/usr/bin/env python

from urlparse import urlparse
from ydk.services import NetconfService, Datastore, CodecService
from ydk.providers import NetconfServiceProvider, CodecServiceProvider
from ydk.models.cisco_ios_xe import Cisco_IOS_XE_native as xe_native
from ydk.types import Empty
import logging

def send_edit_config(netconf, codec, codec_provider):

    xml_string = """
    <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
      <interface>
        <Loopback>
          <name>1000</name>
          <description>PRIMARY ROUTER LOOPBACK</description>
          <ip>
            <address>
              <primary>
                <address>172.16.255.1</address>
                <mask>255.255.255.255</mask>
              </primary>
            </address>
          </ip>
        </Loopback>
      </interface>
    </native>
    """
    print '11111111111111111111111111111'
    sr = codec.decode(codec_provider, xml_string)
    print '22222222222222222222222222222222222'
    res = netconf.edit_config(provider, Datastore.candidate, sr)
    return res

if __name__ == "__main__":
    """Execute main program."""

    device = "ssh://cisco:!QAZ2wsx@10.124.3.191:830"
    device = urlparse(device)

    # log debug messages if verbose argument specified
    logger = logging.getLogger("ydk")
    logger.setLevel(logging.DEBUG)
    # logger.setLevel(logging.INFO)
    handler = logging.StreamHandler()
    formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                   "%(levelname)s - %(message)s"))
    handler.setFormatter(formatter)
    logger.addHandler(handler)

    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)

    netconf = NetconfService()
    codec = CodecService()
    codec_provider = CodecServiceProvider(type='xml')
    native=xe_native.Native()

    res= send_edit_config(netconf, codec, codec_provider)

    netconf.commit(provider)

Logs

Enable logging and post the logs below

system log :
 kernel: python[9781]: segfault at 2 ip 00007f784137b079 sp 00007ffe64c19260 error 4 in libc-2.17.so[7f784132e000+1c3000]

script log:
2021-02-03 17:30:04,887 - ydk - DEBUG - Extracting module namespaces from XML payload
2021-02-03 17:30:04,887 - ydk - DEBUG - Loading module 'Cisco-IOS-XE-native', revision ''
2021-02-03 17:30:04,888 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-native" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,891 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-native" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,891 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-native@2020-11-01.yang" file.
2021-02-03 17:30:04,892 - ydk - DEBUG - [libyang] Searching for "cisco-semver" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,894 - ydk - DEBUG - [libyang] Searching for "cisco-semver" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,895 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/cisco-semver@2019-03-20.yang" file.
2021-02-03 17:30:04,895 - ydk - DEBUG - [libyang] Module "cisco-semver@2019-03-20" successfully parsed as implemented.
2021-02-03 17:30:04,895 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-types" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,898 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-types" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,898 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-types@2020-11-01.yang" file.
2021-02-03 17:30:04,900 - ydk - DEBUG - [libyang] Resolving derived type "union" failed, it will be attempted later.
2021-02-03 17:30:04,901 - ydk - DEBUG - [libyang] Resolving "Cisco-IOS-XE-types" unresolved schema nodes and their constraints...
2021-02-03 17:30:04,901 - ydk - DEBUG - [libyang] All "Cisco-IOS-XE-types" schema nodes and constraints resolved.
2021-02-03 17:30:04,901 - ydk - DEBUG - [libyang] Module "Cisco-IOS-XE-types@2020-11-01" successfully parsed as implemented.
2021-02-03 17:30:04,902 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-features" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,904 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-features" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,905 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-features@2020-11-01.yang" file.
2021-02-03 17:30:04,905 - ydk - DEBUG - [libyang] Module "Cisco-IOS-XE-features@2020-11-01" successfully parsed as implemented.
2021-02-03 17:30:04,906 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-interface-common" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,908 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-interface-common" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,908 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-interface-common@2020-07-01.yang" file.
2021-02-03 17:30:04,910 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-interface-common:{grouping}[interface-obsolete-grouping]/interface-choice/ATM-subinterface/ATM-subinterface/ATM), inheriting.
2021-02-03 17:30:04,911 - ydk - DEBUG - [libyang] Module "Cisco-IOS-XE-interface-common@2020-07-01" successfully parsed as implemented.
2021-02-03 17:30:04,911 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-parser" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,913 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-parser" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,914 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-parser@2019-07-01.yang" file.
2021-02-03 17:30:04,914 - ydk - DEBUG - [libyang] Submodule "Cisco-IOS-XE-parser" successfully parsed.
2021-02-03 17:30:04,915 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-license" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,917 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-license" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,917 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-license@2020-11-01.yang" file.
2021-02-03 17:30:04,919 - ydk - DEBUG - [libyang] Submodule "Cisco-IOS-XE-license" successfully parsed.
2021-02-03 17:30:04,919 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-line" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,922 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-line" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,922 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-line@2020-11-01.yang" file.
2021-02-03 17:30:04,925 - ydk - DEBUG - [libyang] Submodule "Cisco-IOS-XE-line" successfully parsed.
2021-02-03 17:30:04,925 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-logging" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,928 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-logging" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,929 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-logging@2020-07-01.yang" file.
2021-02-03 17:30:04,932 - ydk - DEBUG - [libyang] Submodule "Cisco-IOS-XE-logging" successfully parsed.
2021-02-03 17:30:04,933 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-ip" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,936 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-ip" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,936 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-ip@2020-11-01.yang" file.
2021-02-03 17:30:04,948 - ydk - DEBUG - [libyang] Resolving uses "ip-route-segment-routing-grouping" failed, it will be attempted later.
2021-02-03 17:30:04,948 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[config-ip-grouping]/ip/domain-lookup/source-interface/ios-ifc:interface-grouping), inheriting.
2021-02-03 17:30:04,949 - ydk - DEBUG - [libyang] Resolving uses "ip-route-grouping" failed, it will be attempted later.
2021-02-03 17:30:04,950 - ydk - DEBUG - [libyang] Resolving uses "routes-recurse-grouping" failed, it will be attempted later.
2021-02-03 17:30:04,950 - ydk - DEBUG - [libyang] Resolving uses "routes-recurse-grouping" failed, it will be attempted later.
2021-02-03 17:30:04,950 - ydk - DEBUG - [libyang] Resolving uses "routes-recurse-grouping" failed, it will be attempted later.
2021-02-03 17:30:04,951 - ydk - DEBUG - [libyang] Resolving uses "ip-route-grouping" failed, it will be attempted later.
2021-02-03 17:30:04,951 - ydk - DEBUG - [libyang] Submodule "Cisco-IOS-XE-ip" successfully parsed.
2021-02-03 17:30:04,952 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-ipv6" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,955 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-ipv6" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,955 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-ipv6@2020-11-01.yang" file.
2021-02-03 17:30:04,957 - ydk - DEBUG - [libyang] Submodule "Cisco-IOS-XE-ipv6" successfully parsed.
2021-02-03 17:30:04,958 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-interfaces" in /usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang.
2021-02-03 17:30:04,960 - ydk - DEBUG - [libyang] Searching for "Cisco-IOS-XE-interfaces" in /home/control/cxnetconf/cxnetconf/cxtest/support_test.
2021-02-03 17:30:04,960 - ydk - DEBUG - [libyang] Loading schema from "/usr/lib64/python2.7/site-packages/ydk/models/cisco_cat8k_ios_xe_1741/_yang/Cisco-IOS-XE-interfaces@2020-11-01.yang" file.
2021-02-03 17:30:04,985 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[config-interface-grouping]/interface/TwentyFiveGigabitEthernet/obsolete-interface-common-grouping), inheriting.
2021-02-03 17:30:04,986 - ydk - DEBUG - [libyang] Resolving uses "obsolete-interface-common-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,007 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-l2protocol-forward-grouping]/l2protocol/forward/drop-threshold/obsolete-config-l2pt-threshold-grouping), inheriting.
2021-02-03 17:30:05,008 - ydk - DEBUG - [libyang] Resolving uses "obsolete-config-l2pt-threshold-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,008 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-l2protocol-forward-grouping]/l2protocol/forward/shutdown-threshold/obsolete-config-l2pt-threshold-grouping), inheriting.
2021-02-03 17:30:05,008 - ydk - DEBUG - [libyang] Resolving uses "obsolete-config-l2pt-threshold-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,009 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/backup/interface/ios-ifc:interface-obsolete-grouping), inheriting.
2021-02-03 17:30:05,009 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/l2protocol-tunnel/drop-threshold/obsolete-l2pt-choose-grouping), inheriting.
2021-02-03 17:30:05,010 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/l2protocol-tunnel/shutdown-threshold/obsolete-l2pt-choose-grouping), inheriting.
2021-02-03 17:30:05,010 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/l2protocol-tunnel/obsolete-config-l2pt-more-protocols-grouping), inheriting.
2021-02-03 17:30:05,010 - ydk - DEBUG - [libyang] Resolving uses "obsolete-interface-l2protocol-forward-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,011 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/ip/address-choice/address/address/address-choice/dhcp-case/dhcp/client-id/obsolete-ethernet-grouping), inheriting.
2021-02-03 17:30:05,011 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/redundancy/group/rg-choice/ip-case/virtual-ip/ipv4-address/rg-exclusive-decrement-options), inheriting.
2021-02-03 17:30:05,012 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/redundancy/group/rg-choice/ip-case/virtual-ip/ipv6-address/rg-exclusive-decrement-options), inheriting.
2021-02-03 17:30:05,012 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/storm-control/broadcast/obsolete-storm-control-threshold-grouping), inheriting.
2021-02-03 17:30:05,012 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/storm-control/multicast/obsolete-storm-control-threshold-grouping), inheriting.
2021-02-03 17:30:05,013 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/storm-control/unicast/obsolete-storm-control-threshold-grouping), inheriting.
2021-02-03 17:30:05,013 - ydk - DEBUG - [libyang] Missing status in obsolete subtree (/Cisco-IOS-XE-native:{grouping}[obsolete-interface-common-grouping]/storm-control/unknown-unicast/obsolete-storm-control-threshold-grouping), inheriting.
2021-02-03 17:30:05,013 - ydk - DEBUG - [libyang] Submodule "Cisco-IOS-XE-interfaces" successfully parsed.
2021-02-03 17:30:05,021 - ydk - DEBUG - [libyang] Resolving uses "domain-vrf-master-hub-class-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,022 - ydk - DEBUG - [libyang] Resolving uses "domain-vrf-master-hub-class-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,022 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-show-timezone-and-year" failed, it will be attempted later.
2021-02-03 17:30:05,023 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-msec-and-year" failed, it will be attempted later.
2021-02-03 17:30:05,023 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-msec-and-show-timezone" failed, it will be attempted later.
2021-02-03 17:30:05,023 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-show-timezone-and-year" failed, it will be attempted later.
2021-02-03 17:30:05,024 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-local-time-and-year" failed, it will be attempted later.
2021-02-03 17:30:05,024 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-local-time-and-show-timezone" failed, it will be attempted later.
2021-02-03 17:30:05,024 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-msec-and-year" failed, it will be attempted later.
2021-02-03 17:30:05,024 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-local-time-and-year" failed, it will be attempted later.
2021-02-03 17:30:05,025 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-local-time-and-msec" failed, it will be attempted later.
2021-02-03 17:30:05,025 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-msec-and-show-timezone" failed, it will be attempted later.
2021-02-03 17:30:05,025 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-local-time-and-show-timezone" failed, it will be attempted later.
2021-02-03 17:30:05,025 - ydk - DEBUG - [libyang] Resolving uses "service-timestamp-local-time-and-msec" failed, it will be attempted later.
2021-02-03 17:30:05,026 - ydk - DEBUG - [libyang] Resolving uses "config-ip-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,027 - ydk - DEBUG - [libyang] Resolving uses "config-interface-grouping" failed, it will be attempted later.
2021-02-03 17:30:05,029 - ydk - DEBUG - [libyang] Missing status in deprecated subtree (/Cisco-IOS-XE-native:native/tftp-server/name), inheriting.
2021-02-03 17:30:05,029 - ydk - DEBUG - [libyang] Missing status in deprecated subtree (/Cisco-IOS-XE-native:native/tftp-server/tftp-alias-acl-number-grouping), inheriting.
2021-02-03 17:30:05,029 - ydk - DEBUG - [libyang] Missing status in deprecated subtree (/Cisco-IOS-XE-native:native/tod-clock/input-source/ptp/domain), inheriting.
2021-02-03 17:30:05,030 - ydk - DEBUG - [libyang] Missing status in deprecated subtree (/Cisco-IOS-XE-native:native/network-clock/input-source-list/interface/ios-ifc:interface-grouping), inheriting.
2021-02-03 17:30:05,030 - ydk - DEBUG - [libyang] Missing status in deprecated subtree (/Cisco-IOS-XE-native:native/network-clock/input-source-list/ptp/domain), inheriting.
2021-02-03 17:30:05,030 - ydk - DEBUG - [libyang] Missing status in deprecated subtree (/Cisco-IOS-XE-native:native/network-clock/input-source/interface/ios-ifc:interface-grouping), inheriting.
2021-02-03 17:30:05,032 - ydk - DEBUG - [libyang] Resolving "Cisco-IOS-XE-native" unresolved schema nodes and their constraints...
2021-02-03 17:30:05,082 - ydk - DEBUG - [libyang] Invalid value "true" in "p2mp" element. Path: '/Cisco-IOS-XE-native:p2mp'
2021-02-03 17:30:05,082 - ydk - DEBUG - [libyang] Previous warning generated by XPath subexpression[8] "p2mp = 'true'".
2021-02-03 17:30:05,083 - ydk - DEBUG - [libyang] Invalid value "true" in "p2mp" element. Path: '/Cisco-IOS-XE-native:p2mp'
2021-02-03 17:30:05,083 - ydk - DEBUG - [libyang] Previous warning generated by XPath subexpression[8] "p2mp = 'true'".

System Information

python 2.7 centos 7

sunnwang commented 3 years ago

fixed on python3 with IOS-XE 16.9.3.