08-01-2022 12:16 AM
I'm trying to perform a 'no shutdown' on interfaces using NETCONF and YANG......
i stumbled on this post https://community.cisco.com/t5/yang-tools/interface-no-shutdown/td-p/3434869 which is obviously now outdated somewhat....
Anybody know to perform an unshut/ no shutdown of an interface using ydk models?
I've looked around but to no avail. I'm able to shutdown an interface and completely delete/remove an interface and its contents, but can't seem to filter it to just the shutdown portion.
Config:
Interface = xr_intf.InterfaceConfigurations()
interface_configuration_instance = Interface.InterfaceConfiguration()
interface_configuration_instance.interface_name = "GigabitEthernet0/0/0/2"
interface_configuration_instance.link_status = Empty()
interface_configuration_instance.active = "act"
Interface.interface_configuration.append(interface_configuration_instance)
crud_service.update(device_netconf,Interface)
Solved! Go to Solution.
08-01-2022 08:57 AM
To delete the empty leaf 'shutdown' from the configuration you nee to use YFilter.delete:
from ydk.filters import YFilter
Interfaces = xr_intf.InterfaceConfigurations()
interface_configuration_instance = Interface.InterfaceConfiguration()
interface_configuration_instance.interface_name = "GigabitEthernet0/0/0/2"
interface_configuration_instance.active = "act"
interface_configuration_instance.shutdown = Yfilter.delete
Interfaces.interface_configuration.append(interface_configuration_instance)
crud_service.update(device_netconf, Interfaces)
Yan @cisco
08-01-2022 08:57 AM
To delete the empty leaf 'shutdown' from the configuration you nee to use YFilter.delete:
from ydk.filters import YFilter
Interfaces = xr_intf.InterfaceConfigurations()
interface_configuration_instance = Interface.InterfaceConfiguration()
interface_configuration_instance.interface_name = "GigabitEthernet0/0/0/2"
interface_configuration_instance.active = "act"
interface_configuration_instance.shutdown = Yfilter.delete
Interfaces.interface_configuration.append(interface_configuration_instance)
crud_service.update(device_netconf, Interfaces)
Yan @cisco
08-01-2022 02:25 PM
urgh, you gotta be kidding me.....somewhere between all my trying I came to the wrong conclusion that .shutdown can only accept Empty() and consequently didn't try anything else...... thanks.....the YFilter.delete works like a charm.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: