Skip to content

Invalid leaf names do not trigger a YDK exception #815

@djsmith20171

Description

@djsmith20171

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

Expected Behavior

We expect YDK exception for invalid leaf names.

Current Behavior

Python programs runs successfully without exceptions - which is incorrect. Invalid leaf is silently ignored during XML encoding.

Steps to Reproduce

Easy to reproduce by mistyping a leaf name.

Your Script

from argparse import ArgumentParser
import urllib.parse
# from urlparse import urlparse

from ydk.services import CRUDService
from ydk.providers import NetconfServiceProvider
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_mpls_lsd_cfg \
    as xr_mpls_lsd_cfg
from ydk.types import Empty
import logging


def config_mpls_lsd(mpls_lsd):
    """Add config data to mpls_lsd object."""
    mpls_lsd.mpls_ip_ttl_propagate_disable = xr_mpls_lsd_cfg.MplsIpTtlPropagateDisable.all
    # mpls_lsd.app_reg_delay_disable = Empty()
 
    # Line below uses incorrect leaf name (agg_reg_delay_disable) instead of 
    # the correct leaf name above (app_reg_delay_disable).  No exception is generated when the
    # object is encoded.  
    mpls_lsd.agg_reg_delay_disable = Empty()
    mpls_lsd.ltrace_multiplier = 2
    mpls_lsd.mpls_entropy_label = Empty()

Logs

Enable logging and post the logs below

<mpls-lsd xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-mpls-lsd-cfg" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge">
  <ltrace-multiplier>2</ltrace-multiplier>
  <mpls-entropy-label/>
</mpls-lsd>

System Information

admin@controller:md-sdk$ pip list | grep ydk
ydk                     0.7.1
ydk-models-cisco-ios-xr 6.3.2
ydk-models-ietf         0.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions