To enable keepalive for the FastEthernet 2/0 interface using YANG data models and NETCONF in Python, the following steps are required:
interface = model.Native.Interface.FastEthernet()
This line creates an instance of the FastEthernet interface from the YANG model.
interface.name = '2/0'
This line sets the name of the interface to 2/0.
interface.FastEthernet.keepalive_settings.keepalive = True
This line enables the keepalive setting on the FastEthernet interface.
interface_data = crud.read(provider, interface)
This line reads the current configuration of the interface from the device.
crud.update(provider, interface)
This line updates the device configuration with the new settings, enabling keepalive on the specified interface.
References:
Cisco YANG Data Models: Cisco YANG Models
YANG Development Kit (YDK): YDK Documentation

Submit