cisco_xe adapter

Inmanta module to manage cisco xe series router/switch configuration

Features

The main feature of this module is the handling of the whole configuration of cisco xe 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/xe 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_xe::NetconfDevice. The same rule applies for password - use password_env_var instead of password.

Usage example

This simple example shows how to configure an interface and a policy on a device.

import cisco_xe
import cisco_xe::native
import cisco_xe::native::interface
import cisco_xe::native::interface::gigabitethernet
import cisco_xe::native::interface::gigabitethernet::encapsulation
import cisco_xe::native::policy
import cisco_xe::native::policy::policy_map
import cisco_xe::native::policy::policy_map::class
import cisco_xe::native::policy::policy_map::class::action_list
import cisco_xe::native::policy::policy_map::class::action_list::police_rate_unit
import cisco_xe::native::policy::policy_map::class::action_list::police_rate_unit::police
import yang

device = cisco_xe::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_xe::Native(
    device=device,
    policy=Policy(
        policy_map=PolicyMap(
            name="policer_test_l2_connect_ep_1",
            class=Class(
                name="class-default",
                action_list=ActionList(
                    action_type="police",
                    police_rate_unit=PoliceRateUnit(
                        police=Police(
                            rate=Rate(
                                units=1000000,
                                xps="bps",
                            ),
                        ),
                    ),
                ),
            ),
        ),
    ),
    interface=Interface(
        gigabitethernet=Gigabitethernet(
            name="3.601",
            encapsulation=Encapsulation(
                dot1q=Dot1q(
                    vlan_id=601,
                    second_dot1q="any",
                ),
            ),
            xconnect=Xconnect(
                address="10.255.255.2",
                vcid=10000,
                encapsulation="mpls",
            ),
            service_policy=ServicePolicy(
                output="policer_test_l2_connect_ep_1",
            ),
        ),
    ),
)