CiscoDevNet / ydk-gen

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

Yang error 'no-address' child found when parsing interface config from ASR-920, OS16.7.1 #911

Closed Victorb1030 closed 5 years ago

Victorb1030 commented 5 years ago

I am using Netconf-Yang Python libraries, with a ASR-920, having an issue with yang parsing not recognizing the <no-address> tag the ASR920 sends as part of the response under tag when no ip is assigned on an interface.
ASR 920 OS version Fuji 16.7.1, (sysdescr at end of issue)

Expected Behavior

Yang parses the response and no error is thrown

Current Behavior

When RPC response received from ASR 920, an error is thrown 'Cannot find child 'no-address'

Steps to Reproduce

Using netconf-yang, run crud_service.read_config against ASR920 with OS 16.7.1

Your Script

Snippet of script that is causing the issue

 try:
      netconf = NetconfServiceProvider(
          address     = host_dict["ip_address"],
          port        = host_dict["netconf_port"],
          username    = host_dict["ssh_login"],
          password    = host_dict["ssh_password"],
          protocol    = host_dict["access_method"],
      )
    except Exception as error:
      self.log.error( "failed to connect via netconf to [%s] - exception: %s" %
        ( host_dict["ip_address"], error )
      )

    if not netconf:
      response_list = [
        408,
        ( 'Failed to connect via netconf to [%s]' % host_dict["ip_address"] ),
        {}
      ]
      return ( response_list, None )

    crud_service = CRUDService()
#test to get config fro GigabiteEthernet0/0/0 
    native = Cisco_IOS_XE_native.Native()
    gigabitethernet = native.interface.GigabitEthernet()
    gigabitethernet.name = '0/0/0'

    #self.log.info( pref + 'loading with filter: ' + dump.object( native ) )
    native.interface.gigabitethernet.append(gigabitethernet)

    loaded = None
    try:
      loaded = crud_service.read_config( netconf, native )

      self.log.info( pref + "==================" )
      self.log.info( pref + "loaded: " )
      self.log.info( pref + "------------------" )
      self.log.info( dump.line( loaded ) )
      self.log.info( pref + "==================" )

Logs

Response from ASR 920

23:10:10 - ydk - DEBUG - Netconf SSH Client: processing reply
23:10:10 - ydk - INFO - ============= Reply RPC received from device =============
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <data>
    <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
      <interface>
        <GigabitEthernet>
          <name>0/0/4</name>
          <description>*** Reserved for GLDS Configs ***</description>
          <shutdown/>
          <ip>
            <no-address>
              <address>false</address>
            </no-address>
          </ip>
          <mtu>9216</mtu>
          <negotiation xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-ethernet">
            <auto>true</auto>
          </negotiation>
          <service xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-ethernet">

Error occuring during YANG parsing

23:10:10 - ydk - DEBUG - Looking at child container '/Cisco-IOS-XE-native:native/interface/GigabitEthernet[name='0/0/4']/ip/no-address'
23:10:10 - ydk - DEBUG - Going into child no-address in parent /Cisco-IOS-XE-native:native/interface/GigabitEthernet[name='0/0/4']/ip
23:10:10 - ydk.types.Entity - DEBUG - Looking for 'no-address'
23:10:10 - ydk.types.Entity - DEBUG - Could not find child 'no-address' in 'OrderedDict([('access-group', ('access_group', <class 'ydk. models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.AccessGroup'>)), 
 ('arp', ('arp', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Arp'>)), ('vrf', ('vrf', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Vrf'>)), ('address', ('address', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Address'>)), ('directed-broadcast', ('directed_broadcast', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.DirectedBroadcast'>)), ('hello-interval', ('hello_interval', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.HelloInterval'>)), ('authentication', ('authentication', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Authentication'>)), ('hold-time', ('hold_time', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.HoldTime'>)), ('helper-address', ('helper_address', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.HelperAddress'>)), ('pim', ('pim', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Pim'>)), ('policy', ('policy', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Policy'>)), ('rip', ('rip', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Rip'>)), ('route-cache-conf', ('route_cache_conf', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.RouteCacheConf'>)), ('route-cache', ('route_cache', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.RouteCache'>)), ('router', ('router', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Router'>)), ('tcp', ('tcp', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Tcp'>)), ('virtual-reassembly', ('virtual_reassembly', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.VirtualReassembly'>)), ('dhcp', ('dhcp', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Dhcp'>)), ('summary-address', ('summary_address', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.SummaryAddress'>)), ('verify', ('verify', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Verify'>)), ('Cisco-IOS-XE-flow:flow', ('flow', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Flow'>)), ('Cisco-IOS-XE-igmp:igmp', ('igmp', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Igmp'>)), ('Cisco-IOS-XE-ospf:ospf', ('ospf', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Ospf'>)), ('Cisco-IOS-XE-lisp:lisp', ('lisp', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Lisp'>)), ('Cisco-IOS-XE-nat:nat', ('nat', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Nat'>)), ('Cisco-IOS-XE-nbar:nbar', ('nbar', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Nbar'>)), ('Cisco-IOS-XE-rsvp:rsvp', ('rsvp', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Rsvp'>)
), ('Cisco-IOS-XE-wccp:wccp', ('wccp', <class 'ydk.models.cisco_ios_xe.Cisco_IOS_XE_native.Native.Interface.GigabitEthernet.Ip.Wccp'>))])'
23:10:10 - ydk - ERROR - Couldn't fetch child entity no-address in parent /Cisco-IOS-XE-native:native/interface/GigabitEthernet[name='0/0/4']/ip!
23:10:10 - flask.app - ERROR - [YDKUtilXE][__load_data] failed to read via ydk crud_service+netconf
23:10:10 - flask.app - INFO - ydk_util returned data:
{}
23:10:10 - flask.app - ERROR - returning error: [408] [Failed to read via ydk crud_service+netconf 

System Information

Server host: Debian Buster, Python 3.7,

YDK module versions: From pip freeze:

ydk==0.8.2
ydk-models-cisco-ios-xe==16.9.3
ydk-models-cisco-ios-xr==6.5.2
ydk-models-ietf==0.1.5.post2
ydk-models-openconfig==0.1.6.post1

From sysdescr against ASR920

SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software [Fuji], ASR920 Software (PPC_LINUX_IOSD-UNIVERSALK9_NPE-M), Version 16.7.1, RELEASE SOFTWARE (fc6)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2017 by Cisco Systems, Inc.
Compiled Mon 20-Nov-17 17:29 by mcp

Thanks, VB

Victorb1030 commented 5 years ago

Found the issue with the wrong package version installed for the ASR920 OS version