Hello,
Can you give me some guidance on ydk.filters ?
I would like to figure out the principle that how to use ydk.filters ?
Below are some examples from Python YDK API document.
I have some findings from below examples but I am not sure if I am correct and I am sure it is only part of it not full. Can you please give me full overview how to use ydk.filter.?
Thanks a lot
1 if attribute is a leaf we could use
ins.running = YFilter.read (running is a leaf) read one specific leaf
cdp.timer = YFilter.delete (timeer is a leaf) delete one specific leaf
2 if attribute is a list or container
bgp.global_.config.yfilter = YFilter.replace (config is container)
route.yfilter = YFilter.read (route is list)
ins.yfilter = YFilter.delete (ins is list)
from ydk.filters import YFilter
1st
# First create the top-level Isis() object
isis = Cisco_IOS_XR_clns_isis_cfg.Isis()
# Create the list instance
ins = Cisco_IOS_XR_clns_isis_cfg.Isis.Instances.Instance()
ins.instance_name = 'default'
# Set the yfilter attribute of the leaf called 'running' to YFilter.read
ins.running = YFilter.read
2nd
# First create the top-level Isis() object
isis = Cisco_IOS_XR_clns_isis_cfg.Isis()
# Create the list instance
ins = Cisco_IOS_XR_clns_isis_cfg.Isis.Instances.Instance()
ins.instance_name = 'xyz'
# Set the yfilter attribute of the leaf called 'running' to YFilter.delete
ins.yfilter = YFilter.delete
# Append the instance to the parent
3rd
# First create the top-level Cdp() object
cdp = Cisco_IOS_XR_cdp_cfg.Cdp()
# Set a dummy value to the leaf
cdp.timer = 5
# Assign YFilter.delete to the 'timer' leaf
cdp.timer = YFilter.delete
4th
# First create the top-level Isis() object
isis = Cisco_IOS_XR_clns_isis_cfg.Isis()
# Create the list instance
ins = Cisco_IOS_XR_clns_isis_cfg.Isis.Instances.Instance()
ins.instance_name = 'default'
# Assign YFilter.delete to the 'running' leaf
ins.running = YFilter.delete
# Append the instance to the parent
isis.instances.instance.append(ins)
isis.instances.instance.append(ins)
3rd
Jacky Zhang
Global Telecom