Skip to main content

A comprehensive Python library to parse SPS MML configurations and generate JSON/topology data

Project description

๐Ÿ”— pysimplesps - SPS MML Configuration Parser & Topology Generator

Python 3.12+ License: MIT Code style: black

๐Ÿš€ Transform boring MML configurations into beautiful, interactive network topologies

pysimplesps is a comprehensive Python library that parses Huawei SPS (Signaling Point Systems) MML configurations and generates structured JSON data or stunning D3.js topology visualizations. Say goodbye to boring MML dumps and hello to intuitive network understanding!

โœจ Features

๐ŸŽฏ Multi-Format Support

  • Links Configuration - Diameter, M2UA, M3UA, MTP links parsing
  • DMRT - Diameter Routing configuration analysis
  • AVPMED - AVP Mediation rules and transformations

๐Ÿ“Š Output Formats

  • JSON - Structured data for programmatic analysis
  • D3.js Topology - Interactive network visualizations
  • HTML - Self-contained visualization files

๐Ÿ› ๏ธ Enterprise Features

  • Comprehensive error handling and validation
  • Rich logging with loguru
  • Extensive test coverage with pytest
  • Module execution support (python -m pysimplesps)
  • Programmatic API for integration

๐Ÿš€ Quick Start

Installation

# Install pysimplesps
pip install -e .

# Or install with development dependencies
pip install -e .[dev]

Module Execution

# Run as Python module
python -m pysimplesps links links.txt
python -m pysimplesps dmrt dmrt1.txt dmrt2.txt
python -m pysimplesps avpmed avpmed.txt

# With options
python -m pysimplesps links links.txt -o output.json
python -m pysimplesps links links.txt -f topology -o network.html
python -m pysimplesps dmrt dmrt_host.txt dmrt_id.txt -v

Programmatic Usage

from pysimplesps import SPSUnifiedLinksParser, SPSDiameterRoutingParser, SPSAVPMediationParser

# Parse links configuration
parser = SPSUnifiedLinksParser("spsdmlinks.txt")
config = parser.parse_file()
parser.print_summary()
parser.save_json("output.json")

# Parse DMRT configuration
dmrt_parser = SPSDiameterRoutingParser()
dmrt_parser.parse_file("spsdmrt_host.txt")
dmrt_parser.parse_file("spsdmrt_id.txt")
dmrt_config = dmrt_parser.get_config()

# Parse AVPMED configuration
avp_parser = SPSAVPMediationParser("spsavpmediation.txt")
avp_config = avp_parser.parse_file()

๐Ÿ“‹ Command Reference

Links Parser

python -m pysimplesps links <input_file> [OPTIONS]

Options:
  -o, --output PATH     Output file path
  -f, --format FORMAT   Output format: json|topology [default: json]
  -v, --verbose         Enable verbose logging

DMRT Parser

python -m pysimplesps dmrt <input_files>... [OPTIONS]

Options:
  -o, --output PATH     Output file path
  -f, --format FORMAT   Output format: json|topology [default: json]  
  -v, --verbose         Enable verbose logging

AVPMED Parser

python -m pysimplesps avpmed <input_file> [OPTIONS]

Options:
  -o, --output PATH     Output file path
  -v, --verbose         Enable verbose logging

๐ŸŽจ Examples

Parse SPS Links Configuration

# Basic JSON output
python -m pysimplesps links spsdmlinks.txt

# Save to file with topology visualization
python -m pysimplesps links spsdmlinks.txt -f topology -o network_topology.html

# Verbose parsing with detailed logs
python -m pysimplesps links spsdmlinks.txt -v -o detailed_links.json

Diameter Routing Analysis

# Parse multiple DMRT files
python -m pysimplesps dmrt spsdmrt_host.txt spsdmrt_id.txt spsdmrt_ip.txt

# Generate routing topology
python -m pysimplesps dmrt dmrt_config.txt -f topology -o routing_flow.html

AVP Mediation Processing

# Parse mediation rules
python -m pysimplesps avpmed spsavpmediation.txt -o mediation_config.json

๐Ÿ—๏ธ Architecture

pysimplesps/
โ”œโ”€โ”€ __main__.py         # ๐Ÿš€ Module execution entry point
โ”œโ”€โ”€ links2json.py       # ๐Ÿ”— Links configuration parser  
โ”œโ”€โ”€ links2topo.py       # ๐ŸŒ Links topology generator
โ”œโ”€โ”€ dmrt2json.py        # ๐Ÿ“ก DMRT configuration parser
โ”œโ”€โ”€ dmrt2topo.py        # ๐Ÿ”„ DMRT topology generator  
โ”œโ”€โ”€ avpmed2json.py      # ๐Ÿ”ง AVPMED configuration parser
โ””โ”€โ”€ __init__.py         # ๐Ÿ“ฆ Package initialization

๐Ÿงช Testing

Run the comprehensive test suite:

# Run all tests
pytest

# Run with coverage
pytest --cov=pysimplesps --cov-report=html

# Run specific test categories
pytest -m unit         # Unit tests only
pytest -m integration  # Integration tests only
pytest -v              # Verbose output

# Run test script
python run_tests.py

๐Ÿ“Š Sample Output

JSON Structure

{
  "diameter_peers": [...],
  "diameter_link_sets": [...], 
  "diameter_links": [...],
  "mtp_destination_points": [...],
  "metadata": {
    "parsed_at": "2025-08-03T...",
    "total_peers": 4,
    "total_link_sets": 6,
    "total_links": 12,
    "unique_ips": ["172.21.1.101", "172.21.1.102"],
    "unique_networks": ["172.21.1.0/24"]
  }
}

Topology Features

  • Interactive D3.js visualizations
  • Color-coded node types (Diameter, MTP, M2UA, M3UA)
  • Drag-and-drop network exploration
  • Connection details on hover
  • Responsive design

๐ŸŽฏ Supported MML Commands

Links Configuration

  • ADD DMPEER - Diameter peers
  • ADD DMLKS - Diameter link sets
  • ADD DMLNK - Diameter links
  • ADD N7DSP - MTP destination points
  • ADD N7LKS - MTP link sets
  • ADD N7LNK - MTP links

DMRT Configuration

  • ADD DMROUTERESULT - Route results
  • ADD DMROUTEENTRANCE - Route entrances
  • ADD DMROUTEEXIT - Route exits
  • ADD DMROUTERULE_* - Routing rules

AVPMED Configuration

  • ADD MEDFILTER - Mediation filters
  • ADD MEDACTION - Mediation actions
  • ADD MEDRULE - Mediation rules
  • MOD DMPEER - Peer assignments
  • MOD SFP - Software parameters

๐Ÿ”ง Development

Setup Development Environment

# Clone repository
git clone https://github.com/fxyzbtc/pysimplesps.git
cd pysimplesps

# Install in development mode
pip install -e .[dev]

# Run linting
ruff check pysimplesps/
ruff format pysimplesps/

# Type checking
mypy pysimplesps/

Contributing Guidelines

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒŸ Create a feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ“ Make your changes with tests
  4. โœ… Run the test suite (pytest)
  5. ๐Ÿš€ Submit a pull request

๐Ÿ“š Documentation

๐Ÿค Support

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with โค๏ธ for telecommunications engineers
  • Powered by Python 3.12+ and modern tooling
  • Inspired by the need to make MML configurations more accessible

โญ Star this repo if pysimplesps helps you visualize your networks! โญ

Made with ๐Ÿ”ฅ by fxyzbtc

๐ŸŽจ Examples

Parse SPS Links Configuration

# Basic JSON output
pysimplesps links spsdmlinks.txt

# Save to file with topology visualization
pysimplesps links spsdmlinks.txt -f topology -o network_topology.html

# Verbose parsing with detailed logs
pysimplesps links spsdmlinks.txt -v -o detailed_links.json

Diameter Routing Analysis

# Parse multiple DMRT files
pysimplesps dmrt spsdmrt_host.txt spsdmrt_id.txt spsdmrt_ip.txt

# Generate routing topology
pysimplesps dmrt dmrt_config.txt -f topology -o routing_flow.html

AVP Mediation Processing

# Parse mediation rules
pysimplesps avpmed spsavpmediation.txt -o mediation_config.json

๐Ÿ—๏ธ Architecture

pysimplesps/
โ”œโ”€โ”€ cli.py              # ๐ŸŽฏ Main CLI interface with Typer
โ”œโ”€โ”€ links2json.py       # ๐Ÿ”— Links configuration parser  
โ”œโ”€โ”€ links2topo.py       # ๐ŸŒ Links topology generator
โ”œโ”€โ”€ dmrt2json.py        # ๐Ÿ“ก DMRT configuration parser
โ”œโ”€โ”€ dmrt2topo.py        # ๐Ÿ”„ DMRT topology generator  
โ”œโ”€โ”€ avpmed2json.py      # ๐Ÿ”ง AVPMED configuration parser
โ”œโ”€โ”€ __main__.py         # ๐Ÿš€ Module execution entry point
โ””โ”€โ”€ __init__.py         # ๐Ÿ“ฆ Package initialization

๐Ÿงช Testing

Run the comprehensive test suite:

# Run all tests
pytest

# Run with coverage
pytest --cov=pysimplesps --cov-report=html

# Run specific test categories
pytest -m unit         # Unit tests only
pytest -m integration  # Integration tests only
pytest -v              # Verbose output

๐Ÿ“Š Sample Output

JSON Structure

{
  "diameter_peers": [...],
  "diameter_link_sets": [...], 
  "diameter_links": [...],
  "mtp_destination_points": [...],
  "metadata": {
    "parsed_at": "2025-08-03T...",
    "total_peers": 4,
    "total_link_sets": 6,
    "total_links": 12,
    "unique_ips": ["172.21.1.101", "172.21.1.102"],
    "unique_networks": ["172.21.1.0/24"]
  }
}

Topology Features

  • Interactive D3.js visualizations
  • Color-coded node types (Diameter, MTP, M2UA, M3UA)
  • Drag-and-drop network exploration
  • Connection details on hover
  • Responsive design

๐ŸŽฏ Supported MML Commands

Links Configuration

  • ADD DMPEER - Diameter peers
  • ADD DMLKS - Diameter link sets
  • ADD DMLNK - Diameter links
  • ADD N7DSP - MTP destination points
  • ADD N7LKS - MTP link sets
  • ADD N7LNK - MTP links

DMRT Configuration

  • ADD DMROUTERESULT - Route results
  • ADD DMROUTEENTRANCE - Route entrances
  • ADD DMROUTEEXIT - Route exits
  • ADD DMROUTERULE_* - Routing rules

AVPMED Configuration

  • ADD MEDFILTER - Mediation filters
  • ADD MEDACTION - Mediation actions
  • ADD MEDRULE - Mediation rules
  • MOD DMPEER - Peer assignments
  • MOD SFP - Software parameters

๐Ÿ”ง Development

Setup Development Environment

# Clone repository
git clone https://github.com/fxyzbtc/pysimplesps.git
cd pysimplesps

# Install in development mode
pip install -e .[dev]

# Run linting
ruff check pysimplesps/
ruff format pysimplesps/

# Type checking
mypy pysimplesps/

Contributing Guidelines

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒŸ Create a feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ“ Make your changes with tests
  4. โœ… Run the test suite (pytest)
  5. ๐Ÿš€ Submit a pull request

๐Ÿ“š Documentation

๐Ÿค Support

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with โค๏ธ for telecommunications engineers
  • Powered by Python 3.12+ and modern tooling
  • Inspired by the need to make MML configurations more accessible

โญ Star this repo if pysimplesps helps you visualize your networks! โญ

Made with ๐Ÿ”ฅ by fxyzbtc

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

pysimplesps-0.2.1.tar.gz (103.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysimplesps-0.2.1-py3-none-any.whl (74.1 kB view details)

Uploaded Python 3

File details

Details for the file pysimplesps-0.2.1.tar.gz.

File metadata

  • Download URL: pysimplesps-0.2.1.tar.gz
  • Upload date:
  • Size: 103.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.25

File hashes

Hashes for pysimplesps-0.2.1.tar.gz
Algorithm Hash digest
SHA256 568a9bae2b299dc673188461e8a5d04c5de479922cccf30310b869f1dc04b6d4
MD5 40ba1ebff36ed4ab9b2482b1434e1f31
BLAKE2b-256 ac4ed3c0227785e1744f67e1032612aef390fc39f6dad63a168eda1f6d0192d3

See more details on using hashes here.

File details

Details for the file pysimplesps-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pysimplesps-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 051000933dbda55ac52d8cc1f957295dc81b6389f076324926d845a8425427da
MD5 3fcaac5fbb3beb7d2b610325411d566d
BLAKE2b-256 937aa0aa87cfd9d433f510c78d3b71a5ebfccf6ae449dd9d1ab8345ddd0435ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page