Hierarchical Configuration (hier_config)

hier_config is a Python library that compares a network device's running configuration against its intended configuration and generates the exact commands needed to bring the device into compliance — without ever connecting to it. Configurations are parsed into hierarchical trees, diffed with full awareness of vendor-specific syntax rules (negation, idempotency, section exiting, command ordering), and rendered back out as minimal, ready-to-apply remediation.

Quick example

from hier_config import HConfig, Platform, WorkflowRemediation

running_config_text = """
hostname old-name
interface Vlan2
 shutdown
"""

intended_config_text = """
hostname new-name
interface Vlan2
 no shutdown
"""

running = HConfig.from_text(Platform.CISCO_IOS, running_config_text)
intended = HConfig.from_text(Platform.CISCO_IOS, intended_config_text)

workflow = WorkflowRemediation(running, intended)
for line in workflow.remediation_config.all_children_sorted():
    print(line.indented_text())
# no hostname old-name
# hostname new-name
# interface Vlan2
#   no shutdown

Where to go next

I want to generate remediation → User Guide

Install the library, walk through your first diff, and learn the everyday workflows: loading configurations from text, JSON, or XML; remediation and rollback; tag-based filtering; future-state prediction; multi-device reporting; and typed config views.

I need to tune platform behavior → Administrator Guide

Review the supported platforms and their quirks, customize driver rules (idempotency, negation, ordering, post-load callbacks), register custom drivers, or load rules from YAML files.

I want to extend hier_config → Developer Guide

Understand the architecture (tree, driver, and workflow layers), browse the driver rule reference, create a new platform driver from scratch, or contribute to the project. The full API reference documents every public class and function.


Unsure what a term means? Check the Glossary.