[ONOS-4636]YANG Grouping linking bug fix + YANG Code review comment fix

Change-Id: I68ee8dd08266a02593e217cef1a9bb010037d673
diff --git a/utils/yangutils/src/test/resources/interfileietf/ietf-network-topology.yang b/utils/yangutils/src/test/resources/interfileietf/ietf-network-topology.yang
new file mode 100644
index 0000000..10c8fb9
--- /dev/null
+++ b/utils/yangutils/src/test/resources/interfileietf/ietf-network-topology.yang
@@ -0,0 +1,260 @@
+ module ietf-network-topology {
+   yang-version 1;
+   namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+   prefix lnk;
+
+   import ietf-inet-types {
+     prefix inet;
+   }
+   import ietf-network {
+     prefix nd;
+   }
+
+   organization
+     "IETF I2RS (Interface to the Routing System) Working Group";
+
+   contact
+     "WG Web:    <http://tools.ietf.org/wg/i2rs/>
+      WG List:   <mailto:i2rs@ietf.org>
+
+      WG Chair:  Susan Hares
+                 <mailto:shares@ndzh.com>
+
+      WG Chair:  Jeffrey Haas
+                 <mailto:jhaas@pfrc.org>
+
+      Editor:    Alexander Clemm
+                 <mailto:alex@cisco.com>
+
+      Editor:    Jan Medved
+                 <mailto:jmedved@cisco.com>
+
+      Editor:    Robert Varga
+                 <mailto:rovarga@cisco.com>
+
+      Editor:    Tony Tkacik
+                 <mailto:ttkacik@cisco.com>
+
+      Editor:    Nitin Bahadur
+                 <mailto:nitin_bahadur@yahoo.com>
+
+      Editor:    Hariharan Ananthakrishnan
+                 <mailto:hari@packetdesign.com>";
+
+   description
+     "This module defines a common base model for network topology,
+      augmenting the base network model with links to connect nodes,
+      as well as termination points to terminate links on nodes.
+
+      Copyright (c) 2015 IETF Trust and the persons identified as
+      authors of the code.  All rights reserved.
+
+      Redistribution and use in source and binary forms, with or
+      without modification, is permitted pursuant to, and subject
+      to the license terms contained in, the Simplified BSD License
+      set forth in Section 4.c of the IETF Trust's Legal Provisions
+      Relating to IETF Documents
+      (http://trustee.ietf.org/license-info).
+
+      This version of this YANG module is part of
+      draft-ietf-i2rs-yang-network-topo-02;
+      see the RFC itself for full legal notices.
+
+      NOTE TO RFC EDITOR: Please replace above reference to
+      draft-ietf-i2rs-yang-network-topo-02 with RFC
+      number when published (i.e. RFC xxxx).";
+
+   revision 2015-12-08 {
+     description
+       "Initial revision.
+        NOTE TO RFC EDITOR: Please replace the following reference
+        to draft-ietf-i2rs-yang-network-topo-02 with
+        RFC number when published (i.e. RFC xxxx).";
+     reference
+       "draft-ietf-i2rs-yang-network-topo-02.";
+   }
+
+   typedef link-id {
+     type inet:uri;
+     description
+       "An identifier for a link in a topology.
+        The identifier SHOULD be chosen such that the same link in a
+        real network topology will always be identified through the
+        same identifier, even if the model is instantiated in
+            separate datastores. An implementation MAY choose to capture
+        semantics in the identifier, for example to indicate the type
+        of link and/or the type of topology that the link is a part
+        of.";
+   }
+
+   typedef tp-id {
+     type inet:uri;
+     description
+       "An identifier for termination points on a node.
+        The identifier SHOULD be chosen such that the same TP in a
+        real network topology will always be identified through the
+        same identifier, even if the model is instantiated in
+        separate datastores. An implementation MAY choose to capture
+        semantics in the identifier, for example to indicate the type
+        of TP and/or the type of node and topology that the TP is a
+        part of.";
+   }
+   grouping link-ref {
+     description
+       "References a link in a specific network.";
+     leaf link-ref {
+       type link-id;
+       description
+         "A type for an absolute reference a link instance.
+          (This type should not be used for relative references.
+          In such a case, a relative path should be used instead.)";
+     }
+     uses nd:network-ref;
+   }
+
+   grouping tp-ref {
+     description
+       "References a termination point in a specific node.";
+     leaf tp-ref {
+       type tp-id;
+       description
+         "A type for an absolute reference to a termination point.
+          (This type should not be used for relative references.
+          In such a case, a relative path should be used instead.)";
+     }
+     uses nd:node-ref;
+   }
+
+   augment "/nd:networks/nd:network" {
+     description
+       "Add links to the network model.";
+     list link {
+       key "link-id";
+       description
+         "A Network Link connects a by Local (Source) node and
+          a Remote (Destination) Network Nodes via a set of the
+          nodes' termination points.
+          As it is possible to have several links between the same
+          source and destination nodes, and as a link could
+          potentially be re-homed between termination points, to
+          ensure that we would always know to distinguish between
+          links, every link is identified by a dedicated link
+          identifier.
+          Note that a link models a point-to-point link, not a
+          multipoint link.
+          Layering dependencies on links in underlay topologies are
+          not represented as the layering information of nodes and of
+          termination points is sufficient.";
+       container source {
+         description
+           "This container holds the logical source of a particular
+            link.";
+         leaf source-node {
+           type nd:node-id;
+           mandatory true;
+           description
+             "Source node identifier, must be in same topology.";
+         }
+         leaf source-tp {
+           type tp-id;
+           description
+             "Termination point within source node that terminates
+              the link.";
+         }
+       }
+       container destination {
+         description
+           "This container holds the logical destination of a
+            particular link.";
+         leaf dest-node {
+           type nd:node-id;
+           mandatory true;
+           description
+             "Destination node identifier, must be in the same
+              network.";
+         }
+         leaf dest-tp {
+           type tp-id;
+           description
+             "Termination point within destination node that
+              terminates the link.";
+         }
+       }
+       leaf link-id {
+         type link-id;
+         description
+           "The identifier of a link in the topology.
+            A link is specific to a topology to which it belongs.";
+       }
+       list supporting-link {
+         key "network-ref link-ref";
+         description
+           "Identifies the link, or links, that this link
+            is dependent on.";
+         leaf network-ref {
+           type nd:network-id;
+           description
+             "This leaf identifies in which underlay topology
+              supporting link is present.";
+         }
+         leaf link-ref {
+           type link-id;
+           description
+             "This leaf identifies a link which is a part
+              of this link's underlay. Reference loops, in which
+              a link identifies itself as its underlay, either
+              directly or transitively, are not allowed.";
+         }
+       }
+     }
+   }
+   augment "/nd:networks/nd:network/nd:node" {
+     description
+       "Augment termination points which terminate links.
+        Termination points can ultimately be mapped to interfaces.";
+     list termination-point {
+       key "tp-id";
+       description
+         "A termination point can terminate a link.
+          Depending on the type of topology, a termination point
+          could, for example, refer to a port or an interface.";
+       leaf tp-id {
+         type tp-id;
+         description
+           "Termination point identifier.";
+       }
+       list supporting-termination-point {
+         key "network-ref node-ref tp-ref";
+         description
+           "The leaf list identifies any termination points that
+            the termination point is dependent on, or maps onto.
+            Those termination points will themselves be contained
+            in a supporting node.
+            This dependency information can be inferred from
+            the dependencies between links.  For this reason,
+            this item is not separately configurable.  Hence no
+            corresponding constraint needs to be articulated.
+            The corresponding information is simply provided by the
+            implementing system.";
+         leaf network-ref {
+           type nd:network-id;
+           description
+             "This leaf identifies in which topology the
+              supporting termination point is present.";
+         }
+         leaf node-ref {
+           type nd:node-id;
+           description
+             "This leaf identifies in which node the supporting
+              termination point is present.";
+         }
+         leaf tp-ref {
+           type tp-id;
+           description
+             "Reference to the underlay node, must be in a
+              different topology";
+         }
+       }
+     }
+   }
+ }