Genie Configuration Libraries (genie-libs-conf)

26.3 · active · verified Thu Apr 16

Genie libs Conf is a Python library within the pyATS/Genie framework, designed to configure network device topologies through Python object attributes. It provides a programmatic way to define and apply configurations, often used in network automation and testing. Version 26.3 is current, and releases typically align with the broader pyATS/Genie framework, which has a regular, frequent release cycle.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a `Genie` instance, define a `Device`, and then configure an `Interface` with IP address and description using `genie.libs.conf` objects, finally generating the CLI configuration string.

from genie.conf import Genie
from genie.libs.conf.base import Device
from genie.libs.conf.interface import Interface

# Create a new Genie configuration object
gen = Genie()

# Create a device and add it to Genie
device = Device(name='my_router', os='iosxe')
gen.add_device(device)

# Configure an interface on the device
intf = Interface(name='GigabitEthernet1', device=device)
intf.description = 'Management Interface'
intf.ip_address = '192.168.1.1/24'
intf.shutdown = False

# Build and print the configuration string
config_string = device.build_config()
print(f"Generated Configuration for {device.name}:\n{config_string}")

# Expected output might look like:
# interface GigabitEthernet1
#  description Management Interface
#  ip address 192.168.1.1 255.255.255.0
#  no shutdown

view raw JSON →