Skip to main content

CMS-NBI-CLIENT

CI Python Version License

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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

Resources

Official Calix Documentation

Authors

License

GPL-3.0

Changelog

See CHANGELOG.md for version history.

Release files for cms-nbi-client 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cms-nbi-client 2.0.0
File Size Uploaded
cms_nbi_client-2.0.0.tar.gz 57.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cms-nbi-client 2.0.0
File Interpreter ABI Platform
cms_nbi_client-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 125.9 kB

Release files / cms_nbi_client-2.0.0.tar.gz

Download URL cms_nbi_client-2.0.0.tar.gz
Size 57.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6e3f0fa0dbea52decf4cf74e8dd0661c495650e3a9d4d2d91ff41cbdb8472587
BLAKE2b-256 checksum
How to use checksums
e68a942f6a6d226a196398fc682e314110f9b1158475536b126770de72b709bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / cms_nbi_client-2.0.0-py3-none-any.whl

Download URL cms_nbi_client-2.0.0-py3-none-any.whl
Size 68.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c820c96ecf732ea8a137f5d3a306f770e173ca99d2de99df8c42dbf4e41c6935
BLAKE2b-256 checksum
How to use checksums
95c60df5f225e52f3b30f6c579447e71fe16cd933df3b2f934fee0f59c89d46e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page