mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-25 18:23:01 +02:00
- Present the topologies to networkx as multigraphs, rather than
expaning each port of the record shape as a separate node.
- Create a topology mapping by locating a subgraph monomorphism of the
logical topology in the physical ditto.
This cuts down the time of finding a mapping by several orders of
magnitude. Example:
Before:
time python3 test/infamy/topology.py \
test/virt/quad/topology.dot.in \
test/infamy/topologies/ring-4-duts.dot >/dev/null
real 13m1,213s
user 13m0,112s
sys 0m0,732s
After:
time python3 test/infamy/topology.py \
test/virt/quad/topology.dot.in \
test/infamy/topologies/ring-4-duts.dot >/dev/null
real 0m0,153s
user 0m0,128s
sys 0m0,024s
20 lines
407 B
Python
Executable File
20 lines
407 B
Python
Executable File
#!/usr/bin/env -S ipython3 -i
|
|
|
|
import json
|
|
|
|
import infamy
|
|
|
|
def jq(yangdata):
|
|
print(json.dumps(yangdata, indent=True))
|
|
|
|
env = infamy.Env()
|
|
|
|
ctrl = env.ptop.get_ctrl()
|
|
infixen = env.ptop.get_infixen()
|
|
for ix in infixen:
|
|
cport, ixport = env.ptop.get_mgmt_link(ctrl, ix)
|
|
print(f"Attaching to {ix}:{ixport} via {ctrl}:{cport}")
|
|
exec(f"{ix} = env.attach(\"{ix}\", \"{ixport}\")")
|
|
|
|
print("\nGLHF")
|