ansible-collections / community.yang

Ansible Community Collection to support Yang in network devices.
GNU General Public License v3.0
10 stars 14 forks source link

Fix find dependant imports #67

Open jksmth opened 2 years ago

jksmth commented 2 years ago
SUMMARY

Following on from #64 - match on non-whitespace characters in fetch

This PR also fixes the scenario where an import x { can be incorrectly matched in a description block causing a fetch failure, e.g. https://github.com/YangModels/yang/blob/master/vendor/cisco/xe/1671/tailf-common.yang#L1601

ISSUE TYPE
COMPONENT NAME

fetch

ADDITIONAL INFORMATION

support imports that have extra whitespace

  import ietf-yang-types         {
     prefix yang;
  }

ignores imports that are found in description blocks by removing the description block before matching

  description
     "...
      it MUST be defined in the same module as the
       tailf:unique-selector.  For example, the following is illegal:
         module y {
           ...
           import x {
             prefix x;
           }
           tailf:unique-selector '/x:server' { // illegal
             ...
           }
         }
       For each instance of the node where the selector is defined, it
       is evaluated, and for each node selected by the selector, a
      ...";

strips out all comments before looking for imports

module example {
        ...

        import test {prefix test;}
        //import ethernet {prefix eth;}
/*
Some example comment...

module example {
        ...

        import test {prefix test;}
*/
softwarefactory-project-zuul[bot] commented 2 years ago

Build succeeded (third-party-check pipeline).

softwarefactory-project-zuul[bot] commented 2 years ago

Build succeeded (third-party-check pipeline).