cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
413
Views
0
Helpful
2
Replies

ISIS Neighbour

baalagar
Level 1
Level 1

Hi Team,

         i tried to bring isis neighbour ship using ydk , Could you please help , where i wrong here ?.

>>> crud

<ydk.services.crud_service.CRUDService object at 0x2aad98d244a8>

>>> isis

<ydk.models.cisco_ios_xr.Cisco_IOS_XR_clns_isis_oper.Isis object at 0x2aad99336908>

>>>

>>> obj=crud.read(ncc,isis)

>>> obj

<ydk.models.cisco_ios_xr.Cisco_IOS_XR_clns_isis_oper.Isis object at 0x2aada85694a8>

>>> obj.instances.instance

[<ydk.models.cisco_ios_xr.Cisco_IOS_XR_clns_isis_oper.Isis.Instances.Instance object at 0x2aada85775f8>]

>>>

>>> dir(obj.instances.instance)

['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'name', 'parent', 'pop', 'remove', 'reverse', 'sort']

>>> obj.instances.instance.HostNames

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

AttributeError: 'YList' object has no attribute 'HostNames'

>>>

thanks

Bala

2 Replies 2

einarnn
Cisco Employee
Cisco Employee

Bala,

obj.instances.instance is a list (per error message). Try something like:

for inst in obj.instances.instance:

for hostname in i.host_names.host_name:

print(hostname.host_name)

Please note I may have got some of the variable names wrong, but this should give you the general idea

Cheers,

Einar

saalvare
Cisco Employee
Cisco Employee

You may find these ISIS config examples useful:

https://git.io/v9xyo

You can also find ISIS oper examples at:

https://git.io/vSGyX

A brief description of these sample apps can be found at:

https://github.com/CiscoDevNet/ydk-py-samples/tree/master/samples/

HTH.

Getting Started

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: