A comprehensive Python library to parse SPS MML configurations and generate JSON/topology data
Project description
๐ pysimplesps - SPS MML Configuration Parser & Topology Generator
๐ 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 peersADD DMLKS- Diameter link setsADD DMLNK- Diameter linksADD N7DSP- MTP destination pointsADD N7LKS- MTP link setsADD N7LNK- MTP links
DMRT Configuration
ADD DMROUTERESULT- Route resultsADD DMROUTEENTRANCE- Route entrancesADD DMROUTEEXIT- Route exitsADD DMROUTERULE_*- Routing rules
AVPMED Configuration
ADD MEDFILTER- Mediation filtersADD MEDACTION- Mediation actionsADD MEDRULE- Mediation rulesMOD DMPEER- Peer assignmentsMOD 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
- ๐ด Fork the repository
- ๐ Create a feature branch (
git checkout -b feature/amazing-feature) - ๐ Make your changes with tests
- โ
Run the test suite (
pytest) - ๐ Submit a pull request
๐ Documentation
- API Documentation: Coming soon
- Wiki: https://deepwiki.com/fxyzbtc/pysimplesps
- Examples: Check the
tests/directory for usage examples
๐ค Support
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ง Email: fxyzbtc@example.com
๐ 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 peersADD DMLKS- Diameter link setsADD DMLNK- Diameter linksADD N7DSP- MTP destination pointsADD N7LKS- MTP link setsADD N7LNK- MTP links
DMRT Configuration
ADD DMROUTERESULT- Route resultsADD DMROUTEENTRANCE- Route entrancesADD DMROUTEEXIT- Route exitsADD DMROUTERULE_*- Routing rules
AVPMED Configuration
ADD MEDFILTER- Mediation filtersADD MEDACTION- Mediation actionsADD MEDRULE- Mediation rulesMOD DMPEER- Peer assignmentsMOD 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
- ๐ด Fork the repository
- ๐ Create a feature branch (
git checkout -b feature/amazing-feature) - ๐ Make your changes with tests
- โ
Run the test suite (
pytest) - ๐ Submit a pull request
๐ Documentation
- API Documentation: Coming soon
- Wiki: https://deepwiki.com/fxyzbtc/pysimplesps
- Examples: Check the
tests/directory for usage examples
๐ค Support
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ง Email: fxyzbtc@example.com
๐ 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
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
568a9bae2b299dc673188461e8a5d04c5de479922cccf30310b869f1dc04b6d4
|
|
| MD5 |
40ba1ebff36ed4ab9b2482b1434e1f31
|
|
| BLAKE2b-256 |
ac4ed3c0227785e1744f67e1032612aef390fc39f6dad63a168eda1f6d0192d3
|
File details
Details for the file pysimplesps-0.2.1-py3-none-any.whl.
File metadata
- Download URL: pysimplesps-0.2.1-py3-none-any.whl
- Upload date:
- Size: 74.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
051000933dbda55ac52d8cc1f957295dc81b6389f076324926d845a8425427da
|
|
| MD5 |
3fcaac5fbb3beb7d2b610325411d566d
|
|
| BLAKE2b-256 |
937aa0aa87cfd9d433f510c78d3b71a5ebfccf6ae449dd9d1ab8345ddd0435ec
|