Skip to content

DanGreenwell/sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Avi SDK and Utilities

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:

$ pip install https://github.com/avinetworks/sdk/releases/download/latest/avisdk-master.tar.gz

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')

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

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

About

Avi SDK and Utilities

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.8%
  • Shell 0.2%