Giter VIP home page Giter VIP logo

aos's Introduction

AOS Python Module

These modules are AOS API Python scripts for demonstration.

AOS 3.2.1

Installation

Clone repo into your aos project.

git clone https://github.com/higutomo38/aos.git

Install Python 3.X on your local. Need some python modules in addition to default.

pip install requests urllib3 openpyxl netaddr

Run python file with AOS server FQDN or IP Address and Blueprint name.

e.g.

python get_hostname.py 192.168.1.1 blueprint
AOS Login
ID:admin
Password:

Use single quotation for Blueprint name if blank is in it.
e.g. python get_hostname.py 192.168.1.1 'blue print'

Module list

Category Module Description NOS
Blueprint get_hostname.py Create new CSV file lists hostnames All
patch_hostname.py Change hostnames listed in CSV All
patch_label.py Change labels listed in CSV All
patch_deploy_mode_server.py Change deploy mode Server
get_nos_config.py Save NOS configuration on local Cumulus, EOS
get_ip_sheet.py Save AOS database sheet tie to device IP Cumulus, EOS
IBA post_iba_probe.py Create all probes without AOS-CLI All
Closed-Loop configlets_intdown_flap.py Push interface down configlets triggered by IBA interface flap anomaly Cumulus

All modules should be same directory as 'common.py' otherwise you can't login to AOS.

Blueprint

Change Hostname (Spine, Leaf and Server)

First of all you need to get current hostname list as CSV. Run 'get_hostname.py' and then you can see 'hostname_label.csv' on same directory you executed the script.

ex.'hostname_label.csv'

Add new hostnames in column 'new_hostname or label' and save the CSV.

ex.'hostname_label.csv'

Run 'patch_hostname.py'.
Check 'Physical Diff' tab in 'uncommited' on AOS and then push 'commit'.

Change label (Spine, Leaf and Server)

The procedure is same as hostname. Add new labels in culumn 'new_hostname or label' and save the CSV.
Run 'patch_label.py'

Change deploy mode (Server)

You can monitor Leaf interfaces up/down facing server without aos agent when turn deploy mode of servers on.
Run 'patch_deploy_mode_server.py'

Save NOS configs on local (Spine and Leaf)

All rendered NOS configs got saved on local. The script create 'nos_config' directory automatically and put .conf into it.
Run 'get_nos_config.py'

Save AOS database sheet relating to device IP

You get AOS database related network device IP as xlsx file.

  1. Device
  2. Cabling
  3. Underlay
  4. Overlay

Run 'get_ip_sheet.py'

IBA

Create all probes without AOS-CLI

We usually use WebUI and command line interface tool AOS-CLI to create custom IBA probe.

WebUI
・Upload Custom Collector Package
・Install Custom Collector to Agent
AOS-CLI
・Import service registry
・Create probes

This python script execute batch of above using API.

Download latest AOS SDK e.g.'aos-dev-sdk-462.zip' from here.
https://portal.apstra.com/downloads/

Copy the zip into directory same as 'common.py', 'post_iba_probe.py' and 'Probes'.
Run 'post_iba_probe.py' putting the zip file name behind blueprint.

e.g.

python post_iba_probe.py 192.168.1.1 'tomo pod1' aos-dev-sdk-462.zip
AOS Login
ID:admin
Password:

All probes are created with temporary input Ex.'Match expected os version by OS family.json' use NOS 'cumulus' and version '3.7.12' as default. You can edit them on WebUI Analytics in BP - Probes - Push Edit - Select processor you want to change.

Closed-Loop

Push ifdown configlets triggered by IBA interface flap anomaly

AOS Setting

  1. Set IBA Interface Flapping with raising anomaly on 'device interface flappinng' processor.
  2. Create syslog config and turn on 'Forward Anomalies'.

Syslog Server Setting

  1. Install python and libraries as above.

  2. Turn on syslog service.

  3. Copy three files.

    • common.py
    • configlets.json
    • configlets_intdown_flap.py

if your test env is on Apstra Cloudlab

  • ahost='172.16.90.3' in 'common.py'
  • Disable urllib3 in 'common.py' and 'configlets_intdown_flap.py'
    #from requests.packages.urllib3.exceptions import InsecureRequestWarning
    #requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
    
  1. Set crontab to run 'configlets_intdown_flap.py' periodically. The script search the flap anomaly in syslog file and then push interface down configlets to the node/interface are identical with the log.
    ex.
    cp /etc/crontab /etc/cron.d/test_cron
    #/etc/cron.d/test_cron
    #Add new line here.
    * *     * * *   root    for i in `seq 0 20 59`;do (sleep ${i}; python /home/admin/configlets_intdown_flap.py) & done;
    service cron restart
    
  2. Check 'Logical Diff' tab in 'uncommited' on AOS and then push 'commit'.

aos's People

Contributors

higutomo38 avatar

Watchers

James Cloos avatar

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.