Giter VIP home page Giter VIP logo

ansible-nxapi's Introduction

ABOUT

Ansible modules for Cisco Nexus 9000. Developed for Ansible 1.5. This library is not currently part of the Ansible distribution. Please refer to INSTALLATION section for setup.

OVERVIEW OF MODULES

Work in progress, please see library directory for modules. The modules are documented per-Ansible guidelines; look for the DOCSTRING within each file.

INSTALLATION

This repo assumes you have the DEPENDENCIES installed on your system. You can then git clone this repo and run the env-setup script in the repo directory:

user@ansible-nxapi> source env-setup

This will set your $ANSIBLE_LIBRARY variable to the repo location and the installed Ansible library path. For example:

[mierdin@ansible-nxapi]$ echo $ANSIBLE_LIBRARY
/home/mierdin/Ansible/ansible-nxapi/library:/usr/share/ansible

Alternatively you can copy the files in the library directory into the ansible installed directory: library/net_infrastructure

DEPENDENCIES

Thes modules require the following to be installed on the Ansible server:

ansible-nxapi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ansible-nxapi's Issues

NX-API varying fields

NXAPI will not always return the same fields. Often, if there is a null value for something, that field is just not present.

For example: the number of fields that comes in varies when it's an OSPF route vs static or direct.

So.....RULE NUMBER 1 of dealing with NX-API is that exception handling (specifically KeyError exceptions in Python) is KING.

This should get moved to the NXAPI library when you get around to it.

Static dict paths everywhere

There are a few places where statically defining dictionary keys, rather than iterating through each key for sub-dictionaries, is actually pretty safe. For instance, each response begins with the same few keys at the beginning.

However, there's a lot of places where you've defined strings of dict keys statically to get things working for a demo. For instance, you statically define OSPF process name. You've tried to place TODOs wherever possible, but the entire thing should be reviewed.

CDP Neighbor Table consistency

Regarding CDP neighbor tables -

Need to make all the arguments for neighbors similar. like neighborIPv4 vs mgmt_ipv4 - keep it consistent.

Hard-coded NXAPI calls to another switch in multiple modules.

Currently when a module running on a single switch need info from another switch, I'm hard-coding in a call to that remote switch using statically defined credentials (the IP is pulled via CDP tables, so that's still dynamic).

A concrete example is if I know a remote switch via CDP (and as a result it's management address) but I want more, like the HOST ID (show license host-id), I have to connect to that other switch via NX-API, even though my Ansible module is currently running against the local switch. As a result I have to statically define the credentials (or make the assumption that the provided credentials for the local switch will work). Not to mention this places additional work on the module, decreasing performance.

This needs to be completely re-designed. Maybe there's an Ansible way to do this better, but I've done it in multiple places now for the sake of getting a working demo together, and it's definitely not ideal.

An idea might be to use something else as a unique identifier - something that's available via CDP. This would prevent me from having to reach out to the remote switch at all - I just need to refer to it via this unique key. This assumes that another module has already gone out and pulled some facts about that remote device and mapped them to this key - a great use case for the get_facts module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.