Skip to content

List with identityref key is not being encoded correctly for python bundle #718

@ghost

Description

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

Expected Behavior

The object should be correctly encoded

Current Behavior

Seeing erroneous payload

Steps to Reproduce

Use the below script

Your Script

from ydk.models.openconfig import openconfig_bgp \
    as oc_bgp
from ydk.models.openconfig import openconfig_bgp_types as oc_bgp_types

def config_bgp(bgp):
    """Add config data to bgp object."""
    # global configuration
    bgp.global_.config.as_ = 65001
    afi_safi = bgp.global_.afi_safis.AfiSafi()
    afi_safi.afi_safi_name = oc_bgp_types.IPV4UNICAST()
    afi_safi.config.afi_safi_name = oc_bgp_types.IPV4UNICAST()
    afi_safi.config.enabled = True
    bgp.global_.afi_safis.afi_safi.append(afi_safi)

    # configure IBGP peer group
    peer_group = bgp.peer_groups.PeerGroup()
    peer_group.peer_group_name = "IBGP"
    peer_group.config.peer_group_name = "IBGP"
    peer_group.config.peer_as = 65001
    peer_group.transport.config.local_address = "Loopback0"
    afi_safi = peer_group.afi_safis.AfiSafi()
    afi_safi.afi_safi_name = oc_bgp_types.IPV4UNICAST()
    afi_safi.config.afi_safi_name = oc_bgp_types.IPV4UNICAST()
    afi_safi.config.enabled = True
    peer_group.afi_safis.afi_safi.append(afi_safi)
    bgp.peer_groups.peer_group.append(peer_group)

    # configure IBGP neighbor
    neighbor = bgp.neighbors.Neighbor()
    neighbor.neighbor_address = "172.16.255.2"
    neighbor.config.neighbor_address = "172.16.255.2"
    neighbor.config.peer_group = "IBGP"
    bgp.neighbors.neighbor.append(neighbor)

crud.create(provider, bgp)

Logs

Enable logging and post the logs below

2018-03-21 16:22:04,039 - ydk - DEBUG - Top container path: openconfig-bgp:bgp
2018-03-21 16:22:04,039 - ydk - DEBUG - Looking to populate schemas for afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']
2018-03-21 16:22:04,039 - ydk - DEBUG - Ready to populate schemas for afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']
2018-03-21 16:22:04,039 - ydk - DEBUG - Getting new modules for afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']
2018-03-21 16:22:04,039 - ydk - DEBUG - Getting new modules for afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']
2018-03-21 16:22:04,040 - ydk - DEBUG - Getting child schema with path 'afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']' in afi-safis
2018-03-21 16:22:04,040 - ydk - DEBUG - Getting data nodes with path 'afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']'
2018-03-21 16:22:04,040 - ydk - DEBUG - Creating new data path 'afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']' with value '' in 'afi-safis'
2018-03-21 16:22:04,040 - ydk - ERROR - Data is invalid according to the yang model. Error details: Unexpected character(s) '<' (<ydk.models.ope). Path: '/openconfig-bgp:bgp/global/afi-safis/afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']/afi-safi-name'
Traceback (most recent call last):
  File "./nc-create-oc-bgp-40-ydk.py", line 108, in <module>
    crud.create(provider, bgp)
  File "/Users//p/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 112, in helper
    return func(self, provider, entity, *args, **kwargs)
  File "/Users//p/lib/python3.6/site-packages/ydk/services/crud_service.py", line 45, in create
    return self._crud.create(provider, entity)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users//p/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error
    _raise(_exc)
  File "/Users//p/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 54, in _raise
    exec("raise exc from None")
  File "<string>", line 1, in <module>
ydk.errors.YPYModelError:  Unexpected character(s) '<' (<ydk.models.ope). Path: /openconfig-bgp:bgp/global/afi-safis/afi-safi[afi-safi-name='<ydk.models.openconfig.openconfig_bgp_types.IPV4UNICAST object at 0x1057a9468>']/afi-safi-name

System Information

Using ydk-gen master branch with openconfig 0.1.4 bundle

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions