项目作者: netdevops

项目描述 :
Hierarchical Configuration
高级语言: Python
项目地址: git://github.com/netdevops/hier_config.git
创建时间: 2018-05-11T14:49:58Z
项目社区:https://github.com/netdevops/hier_config

开源协议:MIT License

下载


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:

  • Cisco IOS
  • Cisco IOSXR
  • Cisco NXOS
  • Arista EOS
  • HP Procurve (Aruba AOSS)

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.

  • Juniper JunOS
  • VyOS

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: https://hier-config.readthedocs.io/en/latest/

Installation

PIP

Install from PyPi:

  1. pip install hier-config

Quick Start

Step 1: Import Required Classes

  1. from hier_config import WorkflowRemediation, get_hconfig, Platform
  2. from hier_config.utils import read_text_from_file

Step 2: Load Configurations

Load the running and intended configurations as strings:

  1. running_config_text = read_text_from_file("./tests/fixtures/running_config.conf")
  2. 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):

  1. running_config = get_hconfig(Platform.CISCO_IOS, running_config_text)
  2. generated_config = get_hconfig(Platform.CISCO_IOS, generated_config_text)

Step 4: Initialize WorkflowRemediation

Compare configurations and generate remediation steps:

  1. workflow = WorkflowRemediation(running_config, generated_config)
  2. print("Remediation Configuration:")
  3. print(workflow.remediation_config)

This guide gets you started with Hier Config in minutes! For more details, visit Hier Config Documentation Site.