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

Should `file` for config and get be a list? #30

Closed cidrblock closed 4 years ago

cidrblock commented 4 years ago
  - name: Get the config
    community.yang.get:
      file: "{{ yang_path }}/*int*.yang"
      filter: "{{ filter|to_xml }}"
      source: running
    register: interface_config

after fetching all models from eos, the following is passed to pyang


 0.0s json_to_xml: 
      entry='/home/bthornto/github/yang/yang_models/arista/eos/4.21.1.1F/openconfig-ospfv2-area-interface.yang' (file:///tmp/q52759906.txt)
 0.0s json_to_xml: 
      entry='/home/bthornto/github/yang/yang_models/arista/eos/4.21.1.1F/ietf-interfaces.yang'
 0.0s json_to_xml: 
      entry='/home/bthornto/github/yang/yang_models/arista/eos/4.21.1.1F/arista-intf-deviations.yang' (file:///tmp/q57145812.txt)
 0.0s json_to_xml: 
      entry='/home/bthornto/github/yang/yang_models/arista/eos/4.21.1.1F/openconfig-interfaces.yang' (file:///tmp/q68435686.txt)
 0.0s json_to_xml: 
      entry='/home/bthornto/github/yang/yang_models/arista/eos/4.21.1.1F/openconfig-pf-interfaces.yang' (file:///tmp/q63685671.txt)
 0.0s json_to_xml: 
      entry='/home/bthornto/github/yang/yang_models/arista/eos/4.21.1.1F/arista-intf-augments.yang' (file:///tmp/q35792329.txt)

I'm certain I need the openconfig-interfaces.yang, arista-intf-augments.yang and arista-intf-deviations.yang models but not sure about the others.

Having file be files instead would allow the list to be fine tuned better.

Ideally we'd have a filter plugin that could guess at the list based on a dependency tree....but that might be for another day