Skip to content

AvizNetworks/ones-gfx-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ONES GFX SDK

Multi-language SDK for AVIZ ONES Spectrum-X tenant management API (v4.2.1).

Provides programmatic access to:

  • Tenant lifecycle management (create, read, update, delete)
  • GPU server allocation and deallocation
  • Fabric discovery and configuration
  • VPC peering setup
  • Asynchronous operation tracking (sync / async-poll / async-webhook)

Choose Your Language

Status: Production-ready (v0.1.0)

  • Requirements: Python 3.9+
  • Installation: pip install ./ones-gfx-sdk-python
  • Use Case: Data science workflows, Jupyter notebooks, automation scripts, rapid prototyping
  • Features: Full API coverage, JWT auto-refresh, timeout override, async modes

Quick Start:

from ones_gfx import ONESClient, JWTAuth

auth = JWTAuth(access_token, refresh_token, refresh_url)
client = ONESClient(base_url, auth)
tenant = client.tenants.create(fabric, "tenant1", "desc", max_gpus=8)

πŸ“– Python Documentation β†’


Status: Core library production-ready (v1.0.0), CLI in development

  • Requirements: Go 1.19+
  • Installation: go get github.com/aviznetworks/ones-gfx-sdk/ones-gfx-sdk-go
  • Use Case: Kubernetes operators, controllers, high-performance integrations, compiled binaries
  • Features: Type-safe, zero dependencies, compile-time error checking, single binary deployment

Quick Start:

import (
    "github.com/aviznetworks/ones-gfx-sdk/ones-gfx-sdk-go/ones"
    "github.com/aviznetworks/ones-gfx-sdk/ones-gfx-sdk-go/sdk"
)

auth, err := ones.NewJWTAuth(accessToken, refreshToken, refreshURL)
if err != nil {
    panic(err)
}
client := sdk.NewClient(baseURL, auth)
tenant, err := client.Tenants.Create(ctx, fabricName, req)

πŸ“– Go Documentation β†’


Feature Comparison

Feature Python Go Notes
Tenant CRUD βœ… βœ… Full parity
GPU allocation/deallocation βœ… βœ… Timeout override supported
Async modes βœ… βœ… sync / async-poll / async-webhook
JWT auto-refresh βœ… βœ… Proactive + reactive
Timeout override βœ… βœ… Per-call override for long operations
Library import βœ… βœ… Use as dependency
Type safety Runtime Compile-time Go catches errors before deployment

Installation Quick Reference

Python

# From PyPI (when published)
pip install ones-gfx-sdk

# From source
cd ones-gfx-sdk/ones-gfx-sdk-python
pip install -e .

# CLI usage
python examples/usage_examples.py --mode sync --action lifecycle

Go

# As library
go get github.com/aviznetworks/ones-gfx-sdk/ones-gfx-sdk-go

# From source
cd ones-gfx-sdk/ones-gfx-sdk-go
make build-lib

# CLI usage (coming in v1.1)
# ones-gfx-sdk-mod lifecycle --mode sync --fabric sdk

Controller Integration Examples

Python Controller (Subprocess)

import subprocess
import json

result = subprocess.run([
    "python", "examples/usage_examples.py",
    "--action", "create",
    "--tenant-name", "controller-tenant",
    "--fabric", "sdk",
    "--output", "json"
], capture_output=True, text=True)

tenant = json.loads(result.stdout)
print(f"Created tenant ID: {tenant['tenant']['id']}")

Go Controller (Library Import)

import "github.com/aviznetworks/ones-gfx-sdk/ones-gfx-sdk-go/ones"

client := sdk.NewClient(baseURL, auth)
tenant, err := client.Tenants.Create(ctx, "sdk", ones.CreateTenantRequest{
    Name: "controller-tenant", MaxGPUsAllowed: 8,
})

Repository Structure

ones-gfx-sdk/
β”œβ”€β”€ README.md                    # This file (language picker)
β”œβ”€β”€ LICENSE                      # Apache 2.0
β”œβ”€β”€ ones-gfx-sdk-python/         # Python implementation
β”‚   β”œβ”€β”€ ones_gfx/                # Core library package
β”‚   β”œβ”€β”€ examples/                # CLI with 8 commands
β”‚   β”œβ”€β”€ pyproject.toml
β”‚   └── README.md
└── ones-gfx-sdk-go/             # Go implementation
    β”œβ”€β”€ ones/                    # Core library (importable)
    β”œβ”€β”€ cmd/                     # CLI binary (v1.1)
    β”œβ”€β”€ go.mod
    └── README.md

Common Workflows

Full Tenant Lifecycle (Python)

cd ones-gfx-sdk-python
python examples/usage_examples.py --mode sync --action lifecycle --fabric sdk

Full Tenant Lifecycle (Go β€” Library)

// See ones-gfx-sdk-go/README.md for complete example
tenant, _ := client.Tenants.Create(ctx, fabricName, req)
_ = client.Tenants.AllocateGPUs(ctx, fabricName, name, servers)
_ = client.Tenants.DeallocateGPUs(ctx, fabricName, name, servers)
_ = client.Tenants.Delete(ctx, fabricName, name)

API Reference

Both SDKs wrap the same ONES Spectrum-X API. For raw curl examples, see:

πŸ“„ api_reference.txt β€” Language-agnostic API examples

Endpoints covered:

  • POST /fabrics/{fabricName}/tenants β€” Create tenant
  • GET /fabrics/{fabricName}/tenants β€” List tenants
  • GET /fabrics/{fabricName}/tenants/{name} β€” Get tenant
  • DELETE /fabrics/{fabricName}/tenants/{name} β€” Delete tenant
  • PATCH /fabrics/{fabricName}/tenants/{name} β€” Allocate/deallocate GPUs
  • GET /fabrics β€” List fabrics
  • GET /operations/{id} β€” Poll async operation
  • POST /fabrics/{fabricName}/vpcpeering β€” VPC peering

Version Compatibility

ONES API Version Python SDK Go SDK
4.2.1 βœ… v1.0.0 βœ… v1.0.0

Both SDKs target ONES 4.2.1.


Contributing

See language-specific contribution guidelines:


Support


License


Developed by AVIZ Networks
For questions or support, visit https://aviznetworks.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors