Read-only MCP server for Cisco Unified CM 15 AXL — built for LLM-driven
cluster auditing, with a particular focus on the Route Plan Report:
partitions, calling search spaces, route patterns, translation patterns,
called/calling party transformations, and digit-discard instructions.
Pairs intentionally with the sibling mcp-cisco-docs server (live
cluster state + vendor docs in one LLM context).
Architecture:
- zeep SOAP client to CUCM AXL
- WSDL bootstrap from Cisco's axlsqltoolkit.zip (auto-extract on
first launch; zip is gitignored, vendor-licensed)
- SQLite response cache at ~/.cache/mcp-cucm-axl/responses/
- Schema-grounded prompts that pull chunks from the sibling
cisco-docs index (docs_loader.py)
Read-only by structural guarantee — never registers AXL write methods
(no executeSQLUpdate, no add*/update*/remove*/apply*/reset*/restart*
tools). SQL queries also client-side validated (sql_validator.py) to
begin with SELECT or WITH.
Tools exposed:
Foundational: axl_version, axl_sql, axl_list_tables,
axl_describe_table, cache_stats, cache_clear
Route plan: route_partitions, route_calling_search_spaces,
route_patterns, route_inspect_pattern,
route_lists_and_groups, route_translation_chain,
route_digit_discard_instructions
Prompts (schema-grounded):
route_plan_overview, investigate_pattern, audit_routing,
cucm_sql_help
Tests cover cache, docs_loader, normalize, sql_validator, wildcard.
71 lines
2.2 KiB
Python
71 lines
2.2 KiB
Python
"""Tests for value normalization (Informix t/f → bool, etc.)."""
|
|
|
|
import pytest
|
|
|
|
from mcp_cucm_axl.normalize import (
|
|
BOOLEAN_COLUMNS,
|
|
normalize_bool,
|
|
normalize_row,
|
|
normalize_rows,
|
|
)
|
|
|
|
|
|
class TestNormalizeBool:
|
|
def test_t_becomes_true(self):
|
|
assert normalize_bool("t") is True
|
|
|
|
def test_f_becomes_false(self):
|
|
assert normalize_bool("f") is False
|
|
|
|
def test_passthrough_other_strings(self):
|
|
assert normalize_bool("True") == "True"
|
|
assert normalize_bool("yes") == "yes"
|
|
|
|
def test_passthrough_native_types(self):
|
|
assert normalize_bool(None) is None
|
|
assert normalize_bool(0) == 0
|
|
assert normalize_bool(True) is True
|
|
assert normalize_bool([]) == []
|
|
|
|
|
|
class TestNormalizeRow:
|
|
def test_normalizes_known_boolean_columns(self):
|
|
row = {"block_enabled": "t", "name": "RP-1", "ismessagewaitingon": "f"}
|
|
result = normalize_row(row)
|
|
assert result["block_enabled"] is True
|
|
assert result["ismessagewaitingon"] is False
|
|
assert result["name"] == "RP-1" # not a boolean column, untouched
|
|
|
|
def test_unknown_column_with_t_value_unchanged(self):
|
|
# Conservative: only normalize columns we know are boolean.
|
|
# Avoids false positives on columns where 't' is meaningful (e.g.
|
|
# a single-character device class code).
|
|
row = {"unknown_field": "t"}
|
|
result = normalize_row(row)
|
|
assert result["unknown_field"] == "t"
|
|
|
|
def test_empty_row(self):
|
|
assert normalize_row({}) == {}
|
|
|
|
|
|
class TestNormalizeRows:
|
|
def test_processes_each_row(self):
|
|
rows = [
|
|
{"block_enabled": "t", "name": "RP-1"},
|
|
{"block_enabled": "f", "name": "RP-2"},
|
|
]
|
|
result = normalize_rows(rows)
|
|
assert result[0]["block_enabled"] is True
|
|
assert result[1]["block_enabled"] is False
|
|
|
|
def test_empty_list(self):
|
|
assert normalize_rows([]) == []
|
|
|
|
|
|
class TestBooleanColumnsSet:
|
|
def test_known_columns_present(self):
|
|
# Smoke test that the canonical columns are in the set
|
|
assert "block_enabled" in BOOLEAN_COLUMNS
|
|
assert "blockenable" in BOOLEAN_COLUMNS
|
|
assert "isemergencyservicenumber" in BOOLEAN_COLUMNS
|