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 failed to generate bundle content for "grouping GROUP-IFSUB" #939

Closed xulleon closed 5 years ago

xulleon commented 5 years ago

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

Expected Behavior

matching bundle code should be generated accordingly.

Current Behavior

when generate YDK Bundle In a Yang file, ydk failed to generate content for "grouping GROUP-IFSUB" in vrf yang file.

Steps to Reproduce

Your Script

Logs

Enable logging and post the logs below

sjc-ads-3460:142> ls -al Cisco-IOS-XR-um-vrf-cfg.yang
-rwxr-xr-x 1 leoxu eng 23788 Jul 16 12:04 Cisco-IOS-XR-um-vrf-cfg.yang

grouping GROUP-IFSUB {. <<<<<<<<<<<<<<<<<< do not see this section.
    leaf vrf {
      when "../a1:interface-name[not(starts-with(text(),'tunnel-'))] and " +
           "../a1:interface-name[not(starts-with(text(),'cem'))] and " +
           "../a1:interface-name[not(starts-with(text(),'nve'))]" {
        tailf:dependency '../a1:interface-name';
      }
      type string {
        length "1..32" {
          description "VRF name";
        }
      }
      description "Set VRF in which the interface operates";
    }
    container address-family {
      when "../a1:interface-name[not(starts-with(text(),'pw-ether'))] " +
       "and ../a1:interface-name[not(starts-with(text(),'pw-iw'))] " +
       "and ../a1:interface-name[not(starts-with(text(),'cem'))]" {
        tailf:dependency '../a1:interface-name';
      }
      description "AFI/SAFI configuration";
      container ipv4 {
        description "IPv4 address family";
        container multicast {
          presence "Indicates a multicast node is configured.";
          description "Multicast topology";
          container default-topology {
            presence "Indicates a default-topology node is configured.";
            description "Multicast default topology";
          }
          container topologies {
            description "Specify a non-default topology";
            list topology {
              key "topology-name";
              description "Specify a non-default topology";
              leaf topology-name {
                type string {
                  length "1..32" {
                    description "Topology name";
                  }
                }
               description "Specify a non-default topology";
              }
            }
          }
        }
      }
      container ipv6 {
        description "IPv6 address family";
        container multicast {
          presence "Indicates a multicast node is configured.";
          description "Multicast topology";
          container default-topology {
            presence "Indicates a default-topology node is configured.";
            description "Multicast default topology";
          }
          container topologies {
            description "Specify a non-default topology";
            list topology {
              key "topology-name";
              description "Specify a non-default topology";
              leaf topology-name {
                type string {
                  length "1..32" {
                    description "Topology name";
                  }
                }
                description "Specify a non-default topology";
              }
            }
          }
        }
      }
    }
  }
[pyats] sjc-ads-3460:179> ls -al /auto/atom-yang/pyats_dev/lib/python3.6/site-packages/ydk/models/cisco_iosxr_711/Cisco_IOS_XR_um_vrf_cfg.py
-rw-r--r-- 1 leoxu eng 175380 Jul 16 10:09 /auto/atom-yang/pyats_dev/lib/python3.6/site-packages/ydk/models/cisco_iosxr_711/Cisco_IOS_XR_um_vrf_cfg.py

        class Multicast(object):
            """
            Multicast topology

            .. attribute:: topologies

               Specify a non\-default topology
               **type**\:   :py:class:`Topologies <ydk.models.cisco_iosxr_711.Cisco_IOS_XR_um_vrf_cfg.AddressFamily.Ipv4.Multicast.Topologies>`

            """

            _prefix = 'um-vrf-cfg'
            _revision = '2019-06-10'

            def __init__(self):
                self.parent = None
                self.ylist_key_names = []

                self.topologies = AddressFamily.Ipv4.Multicast.Topologies()
                self.topologies.parent = self

            class Topologies(object):
                """
                Specify a non\-default topology

                .. attribute:: topology

                              Specify a non\-default topology
                              **type**\: list of    :py:class:`Topology <ydk.models.cisco_iosxr_711.Cisco_IOS_XR_um_vrf_cfg.AddressFamily.Ipv4.Multicast.Topologies.Topology>`

System Information

ygorelik commented 5 years ago

The group GROUP-IFSUB defined in Cisco-IOS-XR-um-vrf-cfg.yang is augmented in Cisco-IOS-XR-um-interface-cfg.yang in two containers: interface and interface-preconfigure:

  augment "/a1:interfaces/a1:interface" {
    uses GROUP-IFSUB;
  }

  augment "/a1:interfaces/a1:interface-preconfigure" {
    uses GROUP-IFSUB;
  }

Therefore corresponding generated code is added in the Cisco_IOS_XR_um_interface_cfg.py. Here is snippet from that code:

            class Ipv4(object):
                """
                IPv4 address family

                .. attribute:: multicast

                              Multicast topology
                              **type**\:   :py:class:`Multicast <ydk.models.cisco_iosxr_711.Cisco_IOS_XR_um_interface_cfg.Interfaces.Interface.AddressFamily.Ipv4.Multicast>`

                              **presence node**\: True

                """

                _prefix = 'um-vrf-cfg'
                _revision = '2019-06-10'

                def __init__(self):
                    self.parent = None
                    self.ylist_key_names = []

                    self.multicast = None

                class Multicast(object):
                    """
                    Multicast topology

                    .. attribute:: default_topology

                              Multicast default topology
                              **type**\:   :py:class:`DefaultTopology <ydk.models.cisco_iosxr_711.Cisco_IOS_XR_um_interface_cfg.Interfaces.Interface.AddressFamily.Ipv4.Multicast.DefaultTopology>`

                              **presence node**\: True

                    .. attribute:: topologies

                              Specify a non\-default topology
                              **type**\:   :py:class:`Topologies <ydk.models.cisco_iosxr_711.Cisco_IOS_XR_um_interface_cfg.Interfaces.Interface.AddressFamily.Ipv4.Multicast.Topologies>`

                    .. attribute:: _is_presence

                              Is present if this instance represents presence container else not
                              **type**\: bool

                    This class is a :ref:`presence class<presence-class>`

                    """

                    _prefix = 'um-vrf-cfg'
                    _revision = '2019-06-10'

                    def __init__(self):
                        self.parent = None
                        self.ylist_key_names = []

                        self._is_presence = True
                        self.default_topology = None
                        self.topologies = Interfaces.Interface.AddressFamily.Ipv4.Multicast.Topologies()
                        self.topologies.parent = self

                    class DefaultTopology(object):
                        """
                        Multicast default topology

                        .. attribute:: _is_presence

                             Is present if this instance represents presence container else not
                             **type**\: bool

                        This class is a :ref:`presence class<presence-class>`

                        """

                        _prefix = 'um-vrf-cfg'
                        _revision = '2019-06-10'

Everything is in place where it is supposed to be.