Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nxos_bfd_global / NxosCmdRef initial commit #56317

Open
wants to merge 41 commits into
base: devel
from

Conversation

Projects
None yet
5 participants
@chrisvanheuveln
Copy link
Contributor

commented May 10, 2019

SUMMARY

This PR implements the nxos_bfd_global module as well as adding the NxosCmdRef class, which is a set of common utilities that will hopefully simplify nxos module creation and maintenance.

The basic cmd_ref logic is to collect all data and methods in a single cmd_ref object. The design requires that the module define an inline yaml table of commands and their associated getter / setter values, as well as default values, platform-specific defaults, and command contexts (parent configuration hierarchy).

A command module (e.g. nxos_bfd_global) only needs to define the inline yaml table and the argument_spec, initialize the cmd_ref object, and make three calls to gather state from the device and playbook and generate proposed commands. Some playbook command options may not fit the standard cmd_ref processing model so this design provides flexibility to the module to process these exceptions within the module if necessary.

The current cmd_ref implementation is a WIP. The BFD global cli does not provide usable JSON output so this initial phase was implemented with a basic screen-scrape approach. The intent is to update cmd_ref to support structured data as well. At this time it also lacks support for multiple command instances (e.g. multiple routes, multiple routing instances, etc).

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

nxos/nxos_bfd_global

ADDITIONAL INFORMATION

This code has been tested on NXOS platforms: N3K,N6K,N7K,N9K,N3K-F,N9K-F

@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 10, 2019

@chrisvanheuveln this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

chrisvanheuveln and others added some commits Apr 11, 2019

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)
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()`.

@chrisvanheuveln chrisvanheuveln force-pushed the chrisvanheuveln:nxos_bfd_global-modularized branch from d6fd037 to 6fbca37 May 13, 2019

@ansibot ansibot removed the needs_triage label May 15, 2019

chrisvanheuveln added some commits May 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.