You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/nxos_bfd_global/tasks/nxapi.yaml

34 lines
944 B
YAML

nxos_bfd_global / NxosCmdRef initial commit (#56317) * nxos_bfd_global: initial commit This is an initial POC with just a few commands included. The code has been written somewhat generically so that it can act as a best practices template for re-use in future modules. The implementation follows the yaml cmd_ref style to define each command's getter/setter/type/default. It supports platform-specific defaults. The basic logic is to collect all relevant data in a `cmd_ref` dict and pass that around to various methods. In the BFD case the devices don't provide JSON output so we have to screen-scrape with show runs. BFD does not support present/absent states so there is no state param. BFD has three different property types to handle. We can add add'l types as needed: - int - int_list (list of ints) - str (needs support for 'no' keyword) * Use get_capabilities to find platform type * PR comment fixes, round 1 * Minor cleanups * nxos_bfd_global: create NxosCmdRef in module_utils This commit just takes the latest bfd global code and moves the bulk of the code into new `class NxosCmdRef` in `module_utils/nxos/nxos.py`. The only remaining code in `nxos_bfd_global.py` are the calls from `main()`. * Add remaining command properties and documentation * update argument_spec * Add check for _exclude; add sanity test * Add targets files for bfd * Context and state absent updates * Add dict support to cmd_ref * Changed remaining list commands to dict usage * Add idempotence check for dict * Fix existing overwrite bug * Move pattern matching logic into its own method * add support for 'command: absent' * Add `get_platform_shortname`; update BFD platform-specific settings * /absent/deleted/ * /sh/show/ in prepare_nxos_tests * add dict check to get_platform_shortname * Add normalize_defaults() * UTs for bfd_global * support yaml for both py2/py3 * update cmd_ref doc header * Fix python2.6 incompatibility with dict comprehensions * Fix bfd_global doc header (yaml syntax fail) * more shippable fixes * yet more shippable fixes * shippable: remove r' ' wrappers * docfix - remove ':' * escape regex ctl chars in yaml table * remove extra blank lines * Fix str(None) issue * Command context updates * import PY2,PY3 instead of import sys * fix ordereddict import & parent_context * try/except for yaml import * fix import issue for ordereddict * remove epdb * nxosCmdRef_import_check() workaround for shippable * fix PEP ws errors
6 years ago
---
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
connection: local
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=httpapi)
include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test cases (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run