Giter VIP home page Giter VIP logo

sdk's Introduction

Avi SDK and Utilities

Build Status

This repository includes API documentation, SDK and sample source to integrate into Avi Solution. Here is brief description of the contents

  • doc: Avi API documentation. It includes documentation for the load balancer objects, Analytics Metrics, and Log Analytics APIs.
  • python: Source for the python SDK. The pip package can be downloaded from Releases. Here are list of important SDK directories
    • samples: Python samples are in directory python/avi/sdk/samples.
      • autoscale: Gives examples of creating control scripts for server autoscale
      • heat: Provides a heat example for pool servers that can be used with server autoscale feature and control scripts
      • virtualservice_examples_api: provides examples of programmatically creating most common VirtuaServices like basic VS, SSL VS, analytics APIs, tenant based APIs etc.
    • utils: Useful utilities for devops automation.
      • f5_converter: It is utility for converting F5 configuration into AVI configuration
      • httppolicyset_templates: Provides easy to use templates for creating HTTP request and redirect policies for most common use cases
      • Mesos: Provides CRUD apis to create Marathon App with AVI labels

Installation

Pip packages are hosted on GitHub. They can be installed simply as:

Avi SDK Install

$ pip install avisdk

Avi Migration Tools Install - installs F5 and Netscaler to avi conversion tools

$ pip install avimigrationtools

Python Virtual Environment based installation

It is recommended to use virtual env based installation if you are just experimenting with the SDK or F5 converter.

$ apt-get install python-dev python-pip python-virtualenv python-cffi libssl-dev libffi-dev
$ virtualenv avi
$ cd avi
$ source bin/activate
$ pip install avimigrationtools avisdk
$ f5_converter.py -h
$ netscaler_converter.py -h
$ deactivate

Usage

ApiSession Usage

from avi.sdk.avi_api import ApiSession
# create Avi API Session
api = ApiSession.get_session("10.10.10.42", "admin", "something", tenant="admin")

# create virtualservice using pool sample_pool
pool_obj = api.get_object_by_name('pool', 'sample_pool')
pool_ref = api.get_obj_ref(pool_obj)
services_obj = [{'port': 80, 'enable_ssl': False}]
vs_obj = {'name': 'sample_vs', 'ip_address': {'addr': '11.11.11.42', 'type': 'V4'},
         'services': services_obj, 'pool_ref': pool_ref}
resp = api.post('virtualservice', data=vs_obj)

# print list of all virtualservices
resp = api.get('virtualservice')
for vs in resp.json()['results']:
    print vs['name']

# delete virtualservice
resp = api.delete('virtualservice', 'sample_vs')

If ApiSession is invoked in the context of a control script, then token can be used for authentication. Along with that, information regarding username and tenant information can also be retrieved as follows:

token=os.environ.get('API_TOKEN')
user=os.environ.get('USER')
tenant=os.environ.get('TENANT')
api = ApiSession.get_session("localhost", user, token=token, tenant=tenant)

F5 Converter Usage

See all the F5 converter options

f5_converter.py -h

Convert bigip.conf into Avi configuration. Output is in output directory

f5_converter.py -f bigip.conf
ls output

Netscaler Converter Usage

See all the Netscaler converter options

netscaler_converter.py -h

Convert ns.conf into Avi configuration. Output is in output directory

netscaler_converter.py -f ns.conf
ls output

virtualservice_examples_api Usage

Create a basic virtualservice named basic-vs

virtualservice_examples_api.py -h
virtualservice_examples_api.py -c 10.10.25.42 -i 10.90.64.141 -o create-basic-vs -s 10.90.64.12

sdk's People

Contributors

chaitanyadeshpande avatar rishabh-baranwal avatar ypraveen avatar khaltore avatar jeyanthinath avatar squirrelala avatar nmandeyam avatar ericsysmin avatar rangar avatar adityats avatar patilshrikant786 avatar skdas avatar rameshtathe avatar patilshrikant486 avatar cjawale avatar mbarooah avatar thebertster avatar gcox1 avatar anpartha avatar chantid avatar tathe avatar sreiyer avatar bthota avatar

Watchers

Sudarshana K S 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.