03-22-2021 10:03 PM - edited 03-22-2021 10:04 PM
03-23-2021 11:00 AM
Provided information is not sufficient to give you definitive answer. First of all, the YANG model Cisco-IOS-XR-um-flowspec-cfg.yang is currently not available on the public GitHub repository. Could you please share this module to see clearly types of the nodes in the model.
Second, it is not clear to me what is the representation of self, please clarify. If possible, share the entire script, or at least complete part of it in relations to model building.
One error that I spot. Based on the picture of the model tree view, the node interface-all is a container and therefore, you cannot assign to it leaf values Empty() or True. In YDK all the containers in the model are instantiated with parent class container or list, except it is a presence container. If it is a presence container, you have to instantiate the class manually while building the model object. If you do not need to configure any leaf or leaf-list nodes under the container interface-all, simply remove the erroneous line.
Another error is instantiation of af object, you missed one container in the hierarchy. Also, when building model object, you always have to start from the top level container and specify all the list keys on the way down.
With these comments your script might look like this:
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_um_flowspec_cfg as flowspec_cfg
flowspec = flowspec_cfg.Flowspec() # start from top level container
af = flowspec_cfg.Flowspec.AddressFamilies.AddressFamily()
af.af_name = 'ipv4' # must specify list element key
flowspec.address_families.address_family.append(af) # append the element to the list
self.device.create(af) # not sure how that is implemented in your script
03-23-2021 10:43 PM
hi , please find the flow of the UM model below.
1)Please find the location of cafy infra code for flowspec UM model in this location
/auto/cafy-bgl/release/21.04.11/rhel7-21.04.11/lib/python3.6/site-packages/ydk/models/cisco_ios_xr
Cisco_IOS_XR_um_router_isis_cfg.py
2) Interface-all is not just a container , but also a leaf (you can see in the image shared) so value should be given. Other models like isis have worked fine by giving true/ Empty. Also have tried with is_presence = True even that is not working
3) hierarchy of local-install - > interface-all -> have declared it after address family itself . please find the code - in location - /ws/ranjns-bgl/CAFY16.16/cafykit/lib/feature_lib/bgp/flowspec_xr_ydk.py ( code written for testing)
PLease let me know your feasible and free time , would like to have a sync up in this
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide