Skip to main content

OMCI analysis and MIB diff tools

Project description

omcipcap

omcipcap is a professional Python toolkit designed for analyzing and diagnosing ITU-T G.988 OMCI (ONT Management and Control Interface) protocols. It streamlines the process of identifying non-standard Managed Entities (MEs) and provisioning failures in GPON/XGS-PON packet captures.

Key Features

  • omcipcap check: Automatically scans pcap/pcapng files to highlight:
    • Vendor-Specific MEs: Identifies MEs in reserved or proprietary ranges.
    • Provisioning Failures: Detects non-success response codes (e.g., UNKNOWN_ME, INSTANCE_EXISTS).
    • Intelligent Filtering: Quickly isolate issues using --only-vendor or --only-failed flags.
    • RTT Latency Analysis: Automatically calculates the time difference between Request and Response. Users can flag slow packets using the --rtt-threshold (default: 1s).
  • omcipcap diff: is a powerful utility for performing Differential Analysis between two MIB snapshots. It is specifically designed to help firmware engineers identify configuration drifts
    • Dynamic ME Extension: Use the --mib-json flag to dynamically load and overwrite ME definitions. This transforms raw hex data into readable fields without modifying the source code.
  • omcipcap graphic: generates an interactive, hierarchical network topology from a MIB snapshot. It is designed to visualize the complex logical relationships between Managed Entities (MEs), helping engineers verify provisioning flows from the UNI/Management side to the ANI/T-CONT side.
  • omcipcap vlan_tbl: Provides a deep-dive analysis of VLAN Tagging Filter Data and VLAN Tagging Operation Configuration Data. It decodes the complex, table-driven logic of OMCI VLAN processing into a human-readable format.
    • Logic Reconstruction: Automatically parses Filter/Treatment bit-fields to visualize how the ONU handles Untagged, Single-tagged, and Double-tagged frames.
    • Semantic Mapping: Translates raw hex values into clear actions (e.g., Insert 1 tag, Modify VID, Discard).
    • ME Association: Links VLAN rules directly to their associated Managed Entities, such as Physical Path Termination Points (PPTP) or MAC Bridge Ports, showing the exact association mode and instance IDs.
    • Detailed Bit-Field Breakdown: Includes a technical view of internal bit-fields (Filter/Treatment/Tags Removed) for senior engineers to verify exact hardware-level logic.
  • Professional Output: Features color-coded Terminal output and standardized hex formatting for Instance IDs.

Project Structure

.
├── examples                # pcap and json samples
│   ├── iphost_graphic.png
│   ├── mib_after.pcap
│   ├── mib_before.pcap
│   ├── mib_omcc_96.pcap
│   ├── mib_omcc_a0.pcap
│   ├── mib_vendor_v1.pcap
│   ├── mib_vendor_v2.pcap
│   ├── omcicheck_example.pcap
│   ├── omcicheck_example.png
│   ├── omcivlan.png
│   ├── pptp_graphic.png
│   └── vendor_355.json
├── LICENSE                 # MIT License
├── omci                    # Core package
│   ├── cli.py
│   ├── __init__.py
│   ├── omcigrapher.py
│   ├── omcimib.py
│   ├── omci.py
│   └── omcivlan.py
├── pyproject.toml          # Build system & entry points
├── README.md               # Project documentation 
└── tests                   # Test suites & pcap generators
    ├── generate_omcicheck_example.py
    ├── generate_omcidiff_example.py
    └── test_omci_exceptions.py

Installation

Option 1: Virtual Environment (Recommended for Development) Use this method to keep your system Python environment clean and isolate dependencies.

# 1. Create and activate the virtual environment
python3 -m venv venv
source venv/bin/activate

# 2. Upgrade pip and install in editable mode
pip install --upgrade pip
pip install -e .

# 3. Verify the installation
omcipcap --help

Option 2: Local Directory Installation (Permanent Use) Use this method to make the tool available across your system without activating a venv.

# 1. Install to your local directory
pip install . --prefix=${HOME}

# 2. Update your shell configuration (~/.bashrc or ~/.zshrc)
export PATH="${HOME}/local/bin:$PATH"
export PYTHONPATH="${HOME}/local/lib/python3.12/dist-packages:$PYTHONPATH"

# 3. Apply changes
source ~/.bashrc

⚡ Quick Start (No Python Required!)

Download Pre-compiled Binaries

Get ready-to-run executables for your platform:

No Python installation required!

Windows and Linux Usage

# Windows
omcipcap.exe check your_file.pcap

# Linux
chmod +x omcipcap_linux
./omcipcap_linux check your_file.pcap

Sub-Command

omcipcap check

Analyze a pcap file to display a summary of all OMCI packets:

omcipcap check examples/omcicheck_example.pcap

omcicheck

omcipcap check with --rtt-threshold argument

(venv) $omcipcap check --rtt-threshold=1500 omcicheck_example.pcap 
Analyzing: omcicheck_example.pcap

No.    ID       Action             ME Class     ME Instance  Result                         RTT          Status           ME desc                                 
------------------------------------------------------------------------------------------------------------------------
38     19       MIB_UPLOAD_NEXT    241          0x0001                                      0                             Reserved for vendor-specific managed entities
40     20       MIB_UPLOAD_NEXT    350          0x0001                                      0                             Reserved for vendor-specific use        
52     26       MIB_UPLOAD_NEXT    500          0x000a                                      0                             Reserved for future standardization     
58     29       CREATE             84           0x0001       Err: INSTANCE_EXISTS (7)       0.000033                      VLAN tagging filter data                
59     30       SET                241          0x0001                                      0                             Reserved for vendor-specific managed entities
60     30       SET                241          0x0001       Err: UNKNOWN_ME (4)            0.000032                      Reserved for vendor-specific managed entities
64     32       GET                257          0x0000                                      0            [TID_DUPLOCATE]  ONT2-G                                  
------------------------------------------------------------------------------------------------------------------------
Summary: Found 2 failures, 5 Vendor packets, 1 duplicate packets, 0 late packets

omcipcap diff

Analyze two pcap files to identify differences in MIB provisioning

# Standard comparison
omcipcap diff examples/mib_vendor_v1.pcap examples/mib_vendor_v2.pcap

# Comparison with Custom Vendor ME definitions
omcipcap diff examples/mib_vendor_v1.pcap examples/mib_vendor_v2.pcap --mib-json examples/vendor_355.json

Example Output When comparing a vendor-specific configuration (Class 355), omcidiff provides a clear view of the state change:

[*] Successfully loaded 1 custom ME specs.
[*] Analyzing MIB from examples/mib_vendor_v1.pcap...
[*] Analyzing MIB from examples/mib_vendor_v2.pcap...

ME (Class, Inst)                    | Attribute                           | Pcap 1                -> Pcap 2
------------------------------------------------------------------------------------------------------------------------
[*] Reserved for vendor-specific (355, 0) | CPE mode                            | 'HGU'                -> 'SFU'
[*] Reserved for vendor-specific (355, 0) | Support VOIP                        | 0x1                  -> 0x0
------------------------------------------------------------------------------------------------------------------------

Advanced: Custom ME JSON Format To define your own Vendor MEs for the --mib-json flag, use the following structure:

{
  "355": ["HWTC 355 ME", [
    ["CPE mode", 3, "str", False],
    ["Support VOIP", 1, "u8", False]
  ]]
}

omcipcap graphic

omcipcap graphic omci.pcap

will generate output.html in current directory PPTP IPHOST

omcipcap vlan_tbl

omcipcap vlan_tbl omci.pcap

List All ME 171 instances and detail of VLAN table omcivlan

Setup omcipcap on Windows Virtual Environment

  1. Create the Environment Open your terminal in the project root directory and run:
python -m venv venv
  1. Configure Execution Policy By default, Windows restricts running scripts like the activate file. If you see a PSSecurityException error ("scripts is disabled on this system"), run this command to allow local scripts:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Select [Y] Yes when prompted. This is a one-time configuration.

  1. Activate the Environment
.\venv\Scripts\activate
  1. Install Dependencies (Development Mode)
pip install -e .
  1. Verify the Tool
(venv) PS C:\Github\omci_utils> omcipcap -h
usage: omcipcap [-h] {check,diff,graphic,vlan_tbl} ...

OMCI PCAP Diagnostic & Analysis Tool

positional arguments:
  {check,diff,graphic,vlan_tbl}
                        Available analysis commands
    check               Analyze RTT, TID duplicates, and failures
    diff                Compare MIB snapshots between two pcaps
    graphic             Generate interactive topology HTML
    vlan_tbl            Analyze OMCI VLAN tagging logic (Table-driven)

options:
  -h, --help            show this help message and exit

License & Copyright

Copyright (c) 2026 Dong Yuan, Shih daneshih1125@gmail.com Licensed under the MIT License.

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

omcipcap-0.2.2.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

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

omcipcap-0.2.2-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file omcipcap-0.2.2.tar.gz.

File metadata

  • Download URL: omcipcap-0.2.2.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for omcipcap-0.2.2.tar.gz
Algorithm Hash digest
SHA256 838d04273c75c602899c41e1dfb6eea6fbd1cd37155ebd1eae614b7bd8100991
MD5 58d3ebdf3b55cde279e010781d164f96
BLAKE2b-256 b7601275d303f5b276b932d20fcccd6dfaabc71b19944c739cb8cb1aff5ea533

See more details on using hashes here.

Provenance

The following attestation bundles were made for omcipcap-0.2.2.tar.gz:

Publisher: release.yml on daneshih1125/omcipcap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file omcipcap-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: omcipcap-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for omcipcap-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 83836c6229329aa4e4b4607c8ab4f738f6bb7f0d4d500d43c6525cf5307b4dec
MD5 0683bab5004e0dafe80cab08ad39fb09
BLAKE2b-256 3e8ae81d74fc08d0a5fcfdcf256c3231aae1d20856404a2509a1226bd71aa9fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for omcipcap-0.2.2-py3-none-any.whl:

Publisher: release.yml on daneshih1125/omcipcap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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