Metadata-Version: 2.4
Name: hier-config
Version: 4.0.0b4
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Telecommunications Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Natural Language :: English
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking
Requires-Dist: pydantic>=2.9,<3
Requires-Dist: pyyaml>=6,<7 ; extra == 'yaml'
Provides-Extra: yaml
License-File: LICENSE
Summary: A network configuration query and comparison library, used to build remediation configurations.
Author-email: Andrew Edwards <edwards.andrew@heb.com>, James Williams <james.williams@networktocode.com>, Jan Brooks <jan.brooks@rackspace.com>
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/netdevops/hier_config
Project-URL: Repository, https://github.com/netdevops/hier_config

# Hierarchical Configuration

Hierarchical Configuration, also known as `hier_config`, is a Python library designed to query and compare network devices configurations. Among other capabilities, it can compare the running config to an intended configuration to determine the commands necessary to bring a device into compliance with its intended configuration.

Hierarchical Configuration has been used extensively on:

- [x] Cisco IOS
- [x] Cisco IOSXR
- [x] Cisco NXOS
- [x] Arista EOS
- [x] Fortinet FortiOS
- [x] HP Procurve (Aruba AOSS)
- [x] HP Comware5 / H3C
- [x] Huawei VRP

In addition to the Cisco-style syntax, hier_config offers experimental support for Juniper-style configurations using set and delete commands. This allows users to remediate Junos configurations in native syntax. However, please note that Juniper syntax support is still in an experimental phase and has not been tested extensively. Use with caution in production environments.

- [x] Juniper JunOS
- [x] Nokia SRL (Service Router Linux)
- [x] Ruckus/Brocade FastIron (ICX)
- [x] VyOS

Newer drivers start life as **experimental** until they have seen wider production use — currently Aruba AOS-CX joins the list above in that status. See [Supported Platforms](https://hier-config.readthedocs.io/en/latest/admin/platforms/) for the authoritative per-platform status.

Hier Config is compatible with any NOS that utilizes a structured CLI syntax similar to Cisco IOS or Junos OS.

The code documentation can be found at: [Hier Config documentation](https://hier-config.readthedocs.io/en/latest/).

## Why hier_config?

Network devices continuously drift from their intended state — VLANs appear, ACL entries change, BGP timers shift.  hier_config solves this by parsing configuration text into a hierarchical tree and performing deterministic, line-level diffs that respect the vendor's own syntax rules.  Rather than string-matching raw text, it understands the structure of commands so that remediation output is minimal, ordered, and safe to apply.

## Highlights

- Predict the device state before deploying with [`future()`](https://hier-config.readthedocs.io/en/latest/user/future-config/) — and audit ambiguous negation resolution explicitly with `future_with_report()`.
- Build remediation workflows with deterministic diffs across [Cisco-style](https://hier-config.readthedocs.io/en/latest/admin/platforms/) and [Junos-style](https://hier-config.readthedocs.io/en/latest/user/set-style-platforms/) configuration syntaxes.
- Ingest and render structured configs: [JSON and XML loading](https://hier-config.readthedocs.io/en/latest/user/loading-configs/), NETCONF `edit-config` payloads, and gNMI-style JSON remediation.
- Tag remediation lines and filter output with [tag-based rules](https://hier-config.readthedocs.io/en/latest/user/tags/) for phased or conditional deployment.
- Extend the pipeline with [`RemediationPlugin` transforms](https://hier-config.readthedocs.io/en/latest/user/remediation-workflows/) and register [custom platform drivers](https://hier-config.readthedocs.io/en/latest/admin/custom-drivers/) at runtime.
- Aggregate and analyse changes across a fleet with [RemediationReporter](https://hier-config.readthedocs.io/en/latest/user/remediation-reporting/).
- Render structured, typed interface data with the [Config View](https://hier-config.readthedocs.io/en/latest/user/config-views/) abstraction.

See the [Architecture Overview](https://hier-config.readthedocs.io/en/latest/dev/architecture/) for how the tree, driver, and workflow layers fit together.

## Installation

### PIP

Version 4 is currently published as a prerelease; pip skips prereleases by default, so pass `--pre`:

```shell
pip install --pre hier-config
```

(The Quick Start below uses the v4 API. `pip install hier-config` without `--pre` installs the latest stable v3 release — see the [v3 documentation](https://hier-config.readthedocs.io/) for that API.)

## Quick Start

### Step 1: Import Required Classes

```python
from hier_config import WorkflowRemediation, HConfig, Platform
from hier_config.utils import read_text_from_file
```

### Step 2: Load Configurations

Load the running and intended configurations as strings:

```python
running_config_text = read_text_from_file("./tests/fixtures/running_config.conf")
generated_config_text = read_text_from_file("./tests/fixtures/generated_config.conf")
```

### Step 3: Create HConfig Objects

Specify the device platform (e.g., `Platform.CISCO_IOS`):

```python
running_config = HConfig.from_text(Platform.CISCO_IOS, running_config_text)
generated_config = HConfig.from_text(Platform.CISCO_IOS, generated_config_text)
```

### Step 4: Initialize WorkflowRemediation

Compare configurations and generate remediation steps:

```python
workflow = WorkflowRemediation(running_config, generated_config)

print("Remediation Configuration:")
print(workflow.remediation_config)
```

This guide gets you started with Hier Config in minutes! For more details, visit [Hier Config Documentation Site](https://hier-config.readthedocs.io/en/latest/).

