Modern async Python client for Calix Management System NBI
Project description
CMS-NBI-CLIENT
Modern async Python client for Calix Management System (CMS) Northbound Interface (NBI) with full HTTPS support, connection pooling, circuit breakers, and structured logging.
Note: This package is not owned, supported, or endorsed by Calix. It's an independent implementation for interacting with CMS NBIs.
Features
- Modern Async/Await: Built on aiohttp for high-performance async operations
- HTTPS Support: Full TLS/SSL support with certificate validation
- Connection Pooling: Reuse connections for better performance
- Circuit Breaker: Automatic failure detection and recovery
- Structured Logging: Rich logs with structlog for better debugging
- Type Safety: Full type hints and Pydantic validation
- Secure Storage: Encrypted credential storage using system keyring
- XML Security: Protection against XXE and other XML attacks
- Comprehensive Testing: High test coverage with pytest
- Backward Compatible: Sync wrapper for legacy code
Quick Start
Installation
pip install cms-nbi-client
Basic Usage
import asyncio
from cmsnbiclient import CMSClient, Config
# Modern async usage
async def main():
config = Config(
credentials={
"username": "your_username",
"password": "your_password"
},
connection={
"host": "cms.example.com"
}
)
async with CMSClient(config) as client:
# Create ONT
result = await client.e7.create_ont(
network_name="NTWK-1",
ont_id="123",
admin_state="enabled"
)
print(result)
# Run async code
asyncio.run(main())
# Synchronous usage (backward compatible)
with CMSClient.sync(config) as client:
result = client.e7.query_ont(
network_name="NTWK-1",
ont_id="123"
)
print(result)
Configuration
Configuration can be provided via:
- Direct instantiation
- Environment variables
- Configuration files (JSON/YAML)
# Environment variables
export CMS_USERNAME=your_username
export CMS_PASSWORD=your_password
export CMS_CONNECTION__HOST=cms.example.com
export CMS_CONNECTION__VERIFY_SSL=true
# From file
config = Config.from_file("config.yaml")
Advanced Features
Connection Pooling
config = Config(
performance={
"connection_pool_size": 100,
"max_concurrent_requests": 50
}
)
Circuit Breaker
config = Config(
performance={
"enable_circuit_breaker": True,
"circuit_breaker_threshold": 5,
"circuit_breaker_timeout": 60
}
)
Structured Logging
from cmsnbiclient import setup_logging
# JSON logs for production
setup_logging(log_level="INFO", json_logs=True)
# Pretty logs for development
setup_logging(log_level="DEBUG", json_logs=False)
Documentation
For detailed documentation and examples, see the /Examples folder.
Available Operations
E7 Operations
- Create: ONT, VLAN, VLAN Members, Ethernet Services
- Delete: ONT, VLAN, VLAN Members, Ethernet Services
- Query: System info, ONT profiles, VLANs, DHCP leases
- Update: ONT configuration, Ethernet services
REST Operations
- Device queries
- System information
Development
Setup Development Environment
# Install poetry
pip install poetry
# Install dependencies
poetry install
# Run tests
poetry run pytest
# Run linting
poetry run black .
poetry run isort .
poetry run flake8
poetry run mypy .
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
Resources
Official Calix Documentation
- Calix Management System (CMS) R14.1 Northbound Interface API Guide
- Calix E-Series (E7 OS R2.5) Engineering and Planning Guide
- Paul Clark's website contains a good amount of Calix docs
- FOR CURRENT CALIX DOCUMENTATION YOU WILL NEED A CALIX ACCOUNT TO GAIN ACCESS TO THEIR LIBRARY
Authors
License
Changelog
See CHANGELOG.md for version history.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cms_nbi_client-2.0.0.tar.gz.
File metadata
- Download URL: cms_nbi_client-2.0.0.tar.gz
- Upload date:
- Size: 57.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e3f0fa0dbea52decf4cf74e8dd0661c495650e3a9d4d2d91ff41cbdb8472587
|
|
| MD5 |
0ae5511fbb36c82caeaa41728eb01acb
|
|
| BLAKE2b-256 |
e68a942f6a6d226a196398fc682e314110f9b1158475536b126770de72b709bb
|
File details
Details for the file cms_nbi_client-2.0.0-py3-none-any.whl.
File metadata
- Download URL: cms_nbi_client-2.0.0-py3-none-any.whl
- Upload date:
- Size: 68.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c820c96ecf732ea8a137f5d3a306f770e173ca99d2de99df8c42dbf4e41c6935
|
|
| MD5 |
413f90fd0c5ec164d679f167303425c3
|
|
| BLAKE2b-256 |
95c60df5f225e52f3b30f6c579447e71fe16cd933df3b2f934fee0f59c89d46e
|