CiscoDevNet / ydk-gen

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

YDK-py: Segmentation fault on simple crud.read of IOS XE #1015

Closed uavsec closed 2 years ago

uavsec commented 4 years ago

Hi.

Expected Behavior

root@5a471cf8bc4a:~/ydk-py# ./test.py ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native

Current Behavior

root@5a471cf8bc4a:~/ydk-py# ./test.py Segmentation fault (core dumped)

Steps to Reproduce

Run the script towards a c9500 with IOS XE 16.12

Your Script

#!/usr/bin/env python3

import sys
import logging

from ydk.services import CRUDService
from ydk.providers import NetconfServiceProvider
# from ydk.models.openconfig import openconfig_interfaces as open_interfaces
from ydk.models.cisco_ios_xe import Cisco_IOS_XE_native as xe_native

def read(provider):
    crud = CRUDService()

    native = xe_native.Native()

    config = crud.read(provider, native)

    print(config)

if __name__ == '__main__':
    provider = NetconfServiceProvider(address='xxxxxxx', port=830, username='netconf', password='netconf', protocol='ssh')

    read(provider)

Logs

script_log.txt

System Information

Docker container: ydkdev/ydk-py

uavsec commented 4 years ago

Same thing works ok if I run it towards a CSR.

ygorelik commented 4 years ago

This is Netconf issue on c9500 with IOS XE 16.12. The YDK though could validate received RPC to avoid program crash.

111pontes commented 4 years ago

Even if router is at fault, YDK shouldn't segfault.

uavsec commented 4 years ago

Hey. Updated the box to 17.2 IOS XE and the issue is still there. segfault_17.2xe.txt