ntc-rosetta icon indicating copy to clipboard operation
ntc-rosetta copied to clipboard

Documentation: Linting issues preventing matrix building docs from being successful

Open FragmentedPacket opened this issue 5 years ago • 1 comments

Experiencing the following exception:

(test) myohman@myohman:/c/Users/myohman/Downloads/github/ntc-rosetta$ make docs
docker run -it --rm -p 8888:8888 -v /c/Users/myohman/Downloads/github/ntc-rosetta:/ntc_rosetta ntc_rosetta-3.6:latest \
        make _docs
cd docs && make html
make[1]: Entering directory '/ntc_rosetta/docs'
cp ../CHANGELOG.rst .
cp ../CONTRIBUTING.rst .
python build_supported_models.py
Traceback (most recent call last):
  File "build_supported_models.py", line 166, in <module>
    main()
  File "build_supported_models.py", line 153, in main
    r = RootLinter.lint(getattr(d, processor_type), dm, True, set())
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 397, in lint
    res.children[child] = ContainerLinter.lint(child_obj, dm, recursive, ignore)
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 277, in lint
    cls, dm, recursive, ignore
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 334, in _process_children
    getattr(cls, child_name), dm, recursive, ignore
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 277, in lint
    cls, dm, recursive, ignore
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 334, in _process_children
    getattr(cls, child_name), dm, recursive, ignore
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 277, in lint
    cls, dm, recursive, ignore
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 334, in _process_children
    getattr(cls, child_name), dm, recursive, ignore
  File "/usr/local/lib/python3.6/site-packages/yangify/linter/__init__.py", line 257, in lint
    path = cls.Yangify.path
AttributeError: 'function' object has no attribute 'Yangify'

If you try and run make docs it errors out due to search = unneeded within the following file: https://github.com/networktocode/ntc-rosetta/blob/develop/ntc_rosetta/parsers/openconfig/junos/openconfig_system/system.py#L27

We have unneeded defined in other models, but I'm wondering if it's due to the type of node that search is:

  grouping system-dns-config {
    description "DNS / resolver related configuration data";

    leaf-list search {
      type oc-inet:domain-name;
      ordered-by user;
      description
        "An ordered list of domains to search when resolving
        a host name.";
    }
  }

Here is the ascii_tree:

   +--rw dns
   |  +--rw config
   |  |  +--rw search* <domain-name(string)>
   |  +--rw host-entries
   |  |  +--rw host-entry* [hostname]
   |  |     +--rw config
   |  |     |  +--rw alias* <string>
   |  |     |  +--rw hostname? <string>
   |  |     |  +--rw ipv4-address* <ipv4-address(string)>
   |  |     |  +--rw ipv6-address* <ipv6-address(string)>
   |  |     +--rw hostname <leafref>
   |  |     +--ro state
   |  |        +--ro alias* <string>
   |  |        +--ro hostname? <string>
   |  |        +--ro ipv4-address* <ipv4-address(string)>
   |  |        +--ro ipv6-address* <ipv6-address(string)>
   |  +--rw servers
   |  |  +--rw server* [address]
   |  |     +--rw address <leafref>
   |  |     +--rw config
   |  |     |  +--rw address? <ip-address(union)>
   |  |     |  +--rw port? <port-number(uint16)>
   |  |     +--ro state
   |  |        +--ro address? <ip-address(union)>
   |  |        +--ro port? <port-number(uint16)>
   |  +--ro state
   |     +--ro search* <domain-name(string)>

FragmentedPacket avatar Feb 15 '20 05:02 FragmentedPacket

@dbarrosop Would the appropriate fix for this to add a dummy class for leaf lists within Yangify?

e.g. yangify/parser/__init__.py

class UnneededLeafList(Parser):
    pass

OR

class UnneededLeafList(Parser):
    def Yangify(ParserData):
        pass

And then update the search to be search = UnneededLeafList?

I guess the other option is to just require and implement a class to parse those out, but I'm thinking of there are other use cases that it would be worth it to implement the above.

FragmentedPacket avatar Feb 18 '20 17:02 FragmentedPacket