OpenIxia / ixnetwork_restpy

The IxNetwork python client.
https://openixia.github.io/ixnetwork_restpy/#/
MIT License
29 stars 16 forks source link

Topology files changed their name #45

Open maxdevyatov opened 3 years ago

maxdevyatov commented 3 years ago

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?

ajbalogh commented 3 years ago

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?

maxdevyatov commented 3 years ago

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.

ajbalogh commented 3 years ago

Hi Max,

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

maxdevyatov commented 3 years ago

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