Giter Site home page Giter Site logo

aos-python_rakj's Introduction

AOS Python Module

AOS python modules for demonstration here are packaged as dockerhub repository "higutomo38/aos-python". Dockerhub builds the image automatically after github repo here goes updated.

AOS 3.3.0

Installation

Run the docker repo.

docker run --name aos-python -it -w /tmp/aos-python/library -v "$(pwd)"/:/tmp/aos-python/library/files higutomo38/aos-python:latest /bin/bash

Get latest AOS SDK from Apstra client portal and copy it to the container path "/tmp/aos-python/library/files"
(Note: Skip this step if you don't use 'post_iba_probe.py')

docker cp ./aos-dev-sdk-462.zip aos-python:/tmp/aos-python/library/files

Run python file using AOS server FQDN / IP address, blueprint name and AOS SDK.

python get_hostname.py 192.168.1.1 blueprint_name

Add aos-dev-sdk for 'post_iba_probe.py'

python post_iba_probe.py 192.168.1.1 blueprint_name aos-dev-sdk-462.zip

Use single quotation if blueprint name includes blank.
e.g. python get_hostname.py 192.168.1.1 'blueprint tomoyuki'

Modules

Category Module Description NOS
Blueprint get_hostname.py Create new CSV file lists hostnames All
get_nos_config.py Save NOS configuration on local 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
post_vn.py Post virtual network using CSV Junos
post_vn_based_server_name.py Post virtual network based on server hostname. Switch ports go selecting automatically. Except Junos
Configlets post_configlets.py Samples of configlets with Jinja and Property-set Junos
IBA post_iba_probe.py Create all probes without AOS-CLI Except NXOS

Blueprint

Change Hostname (Spine, Leaf and Server)

First of all you get current hostname list as CSV.

$ python get_hostname.py 192.168.1.1 blueprint_name

You can see 'hostname_label.csv' on same directory you run the script.

ex.'hostname_label.csv'

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

ex.'hostname_label.csv'

$ python patch_hostname.py 192.168.1.1 blueprint_name

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.

$ python patch_label.py 192.168.1.1 blueprint_name

Change deploy mode (Server)

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

$ python patch_deploy_mode_server.py 192.168.1.1 blueprint_name

Save NOS configs on local (Spine and Leaf)

All rendered NOS configs got saved on local. The script create 'nos_config' directory and zip it up.

$ python get_nos_config.py 192.168.1.1 blueprint_name

Post virtual network using CSV

Create 'post_vn.csv' on your local and write virtual network arguments to it referring to following.
Note. The directory mounted to container '/tmp/aos-python/library/csv'.

$ python post_vn.py 192.168.1.1 blueprint_name

Post virtual network based on server hostname

Switch ports go selecting automatically based server hostname when add virtual network.

$ python post_vn_based_server_name.py 192.168.1.1 blueprint_name
AOS Login
ID:
Password:
Virtual Network Name: vn131
VLAN_ID: 131
VNI: 10131
Security Zone: finance
IPv4 Subnet: 10.1.1.0/24
Virtual_Gateway_IPv4: 10.1.1.1
[?] DHCP Service ? (Y/n): y
Enter Server Hostname or "No": evpn-mlag-001-server001
Enter Server Hostname or "No": evpn-mlag-001-server002
Enter Server Hostname or "No": evpn-mlag-001-server003
Enter Server Hostname or "No": no
--- Target Server List: ['evpn-mlag-001-server001', 'evpn-mlag-001-server002', 'evpn-mlag-001-server003']

Configlets

Sample Configlets and Property-Set for Junos

$ python post_configlets.py 192.168.1.1 blueprint_name

You should edit both contents 'vrf name', 'prefix', 'ntp server' and so on after running the script.

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-XXX.zip' from here.
https://portal.apstra.com/downloads/

Copy the zip into directory same as 'shared.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 'tomoyuki 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.

aos-python_rakj's People

Contributors

higutomo38 avatar trellixvulnteam 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.