mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
test: Always log logical-to-physical mappings
For tests using a logical topology, log the resulting mapping to the physical one. This way, we always have a record of the entire environment.
This commit is contained in:
@@ -35,6 +35,8 @@ class Env(object):
|
||||
if not self.ltop.map_to(self.ptop):
|
||||
raise tap.TestSkip()
|
||||
|
||||
print(repr(self.ltop))
|
||||
|
||||
def attach(self, node, port, factory_default=True):
|
||||
if self.ltop:
|
||||
mapping = self.ltop.mapping[node]
|
||||
|
||||
@@ -51,6 +51,22 @@ class Topology:
|
||||
attrs[dn] = dp
|
||||
self.g.add_edge(sn, dn, **attrs)
|
||||
|
||||
def __repr__(self):
|
||||
if not self.mapping:
|
||||
return ""
|
||||
|
||||
out = ""
|
||||
|
||||
for n in self.mapping:
|
||||
out += f"{n + ':':<8} {self.mapping[n][None]}\n"
|
||||
for e in self.mapping[n]:
|
||||
if not e:
|
||||
continue
|
||||
|
||||
out += f" {e + ':':<8} {self.mapping[n][e]}\n"
|
||||
|
||||
return out
|
||||
|
||||
def map_to(self, phy):
|
||||
mapper = isomorphism.MultiGraphMatcher(phy.g, self.g,
|
||||
edge_match=match_edge,
|
||||
|
||||
Reference in New Issue
Block a user