cisco_xr adapter

Features

The main feature of this module is the handling of the whole configuration of cisco xr routers/switches. It uses netconf as networking management protocol and yang as high level configuration modeling language. This module can manage any configuration node defined in https://github.com/YangModels/yang/tree/main/vendor/cisco/xr and present in docs/yang_models. Instead of using the yang files directly, the module uses pre-compiled xml obtained from the yang models in docs/yang_models.

Tooling is available to convert yang configuration from the device into model code automatically (as shown below). For more information contact sales.

Environment variables

Netconf credentials can be stored in environment variables if storing them in the model is not desired. For this purpose, use username_env_var instead of username attribute of yang::Credentials entity, which is attached as yang_credentials relation to cisco_xr::NetconfDevice. The same rule applies for password - use password_env_var instead of password.

Usage example

This simple example shows how to configure a L2VPN on a device.

import cisco_xr
import cisco_xr::l2vpn
import cisco_xr::l2vpn::database
import cisco_xr::l2vpn::database::xconnect_group
import yang

device = cisco_xr::NetconfDevice(
    mgmt_ip="127.0.0.1",
    name="router",
    yang_credentials=Credentials(
        username_env_var="NETCONF_DEVICE_USER",
        password_env_var="NETCONF_DEVICE_PASSWORD",
    ),
)

cisco_xr::InterfaceConfiguration(
    device=device,
    active="act",
    interface_name="GigabitEthernet0/0/0/1.601",
)

cisco_xr::L2vpn(
    device=device,
    database=Database(
        xconnect_group=XconnectGroup(
            name="evpn-vpws",
            p2p_xconnect=P2pXconnect(
                name="xconnect-10000",
            ),
        ),
    ),
)