cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
110
Views
0
Helpful
1
Replies
Highlighted
Beginner

Interface has no attribute append

Hi!

I am trying to retrieve information on interfaces from a XR.

 

But I only get error messages..

sysView.Interfaces.Interface.append(interface)
AttributeError: type object 'Interface' has no attribute 'append'

 

The code I am trying to run:

    service = NetconfService()
    provider = NetconfServiceProvider(address=ipaddress,
                                      username=user,
                                      password=password)

    model = ifmgr_oper.InterfaceProperties()
    dataNode = ifmgr_oper.InterfaceProperties.DataNodes.DataNode()
    dataNode.data_node_name = "default"
    sysView = ifmgr_oper.InterfaceProperties.DataNodes.DataNode.SystemView()
    interface = ifmgr_oper.InterfaceProperties.DataNodes.DataNode.SystemView.Interfaces.Interface()
    interface.interface_name = "Gi0/0/0/1" 
    
    sysView.Interfaces.Interface.append(interface)
    dataNode.SystemView.append(sysView)
    model.DataNodes.DataNode.append(dataNode)
    
    interface = service.get(provider=provider, read_filter=model)
    print(interface)

My imports:

import ydk.models.cisco_ios_xr.Cisco_IOS_XR_ifmgr_oper as ifmgr_oper
from ydk.services.netconf_service import NetconfService
from ydk.providers.netconf_provider import NetconfServiceProvider

 

I followed examples from previous asked questions:

https://community.cisco.com/t5/yang-development-kit-ydk/how-to-retrieve-the-interface-configuration/td-p/3597539

 

Used the guide:
http://ydk.cisco.com/py/docs/guides/crud_guide.html#creating-a-configuration-with-a-list-and-a-presence-class

 

And read the docs:

http://ydk.cisco.com/py/docs/gen_doc_7f55e5ce98f5bdaba72a929253ec0ac5291b646a.html#ydk.models.cisco_ios_xr.Cisco_IOS_XR_ifmgr_oper.InterfaceProperties.DataNodes.DataNode.SystemView.Interfaces.Interface

 

Any clues on what I am doing wrong?

 

Kind regards,

Simon Johansen

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Beginner

1 REPLY 1
Highlighted
Beginner

This widget could not be displayed.