HPENetworking/topology

Attribute injection not working when the TOPOLOGY is imported

Closed this issue · 2 comments

When a TOPOLOGY is defined in a external python module and then imported on a test, attribute injection fails with

15:47:51,0556 [topology.injection:248 ][WARNING ] Skipping node expansion for attribute injection in filename [----]/tests/test_duck.py in the lookup path as it does not contain a TOPOLOGY definition.

test file goes something like:

from topologies.duck import TOPOLOGY  # noqa

def test_duck(topology):
    pass

@dajose yes, I knew that xD

Functional missing must be added here:

https://github.com/HPENetworking/topology/blob/master/lib/topology/parser.py#L229
(From here: https://github.com/HPENetworking/topology/blob/master/lib/topology/injection.py#L242)

The issue is that the topology fetching process is AST analysis based, not import-based.

Given the fact that the given file is not necessarily and module in a package, import it can become difficult and error prone.

This will never be supported. We were discussing on adding a TOPOLOGY_NAME and a path of topologies SZN files for lookup of those topologies in the future.