ixnetwork_restpy icon indicating copy to clipboard operation
ixnetwork_restpy copied to clipboard

Topology files changed their name

Open maxdevyatov opened this issue 5 years ago • 4 comments

Any reason why files here were renamed with some kind of hash at the end? https://github.com/OpenIxia/ixnetwork_restpy/tree/master/ixnetwork_restpy/testplatform/sessions/ixnetwork/topology

For instance bgpipv4peer_9dd9eddcf2bd784d82d8a016e392f035.py

Is it a permanent change or an error?

maxdevyatov avatar Dec 12 '20 06:12 maxdevyatov

Its a permanent change due to the recursive /topology/... hierarchy, reuse of object names within that hierarchy and long pathnames not supported in 2.7. The Bgpipv4peer class instance should be retrieved via dot notation from parent objects using the .find() method. Is the nested dot notation sufficient for your use cases?

ajbalogh avatar Dec 12 '20 06:12 ajbalogh

Thank you for your reply.

The Bgpipv4peer class instance should be retrieved via dot notation from parent objects using the .find() method. Is the nested dot notation sufficient for your use cases?

I don't think it will work. We use these classes mostly for type hinting.

maxdevyatov avatar Dec 18 '20 18:12 maxdevyatov

Hi Max,

If you have time would you provide a sample of how you use the class for type hinting?

ajbalogh avatar Dec 18 '20 20:12 ajbalogh

how you use the class for type hinting?

Just to show an idea. Something like

from ixnetwork_restpy.testplatform.sessions.ixnetwork.ixnetwork import Ixnetwork
from ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.topology import Topology
from ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.vport import Vport

def add_topology(vport: Vport, ixnet: Ixnetwork ) -> Topology:
    topology: "Topology" = ixnet.ixnetwork.Topology.add(
        Name="name", Ports=vport
    )
    return topology

maxdevyatov avatar Dec 18 '20 22:12 maxdevyatov