mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
KCC: try graphing edges in colour for partition type
It doesn't add much. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
195b9f4c79
commit
222b8221d3
@ -23,7 +23,8 @@ import itertools
|
||||
|
||||
|
||||
def write_dot_file(basename, edge_list, vertices=None, label=None, destdir=None,
|
||||
reformat_labels=True, directed=False, debug=None):
|
||||
reformat_labels=True, directed=False, debug=None, edge_colors=None,
|
||||
edge_labels=None):
|
||||
from tempfile import NamedTemporaryFile
|
||||
if label:
|
||||
basename += '_' + label.translate(None, ', ') #fix DN, guid labels
|
||||
@ -38,12 +39,16 @@ def write_dot_file(basename, edge_list, vertices=None, label=None, destdir=None,
|
||||
if reformat_labels:
|
||||
v = v.replace(',', '\\n')
|
||||
print >>f, '"%s";' % (v,)
|
||||
for a, b in edge_list:
|
||||
print edge_colors, edge_labels
|
||||
for i, edge in enumerate(edge_list):
|
||||
a, b = edge
|
||||
if reformat_labels:
|
||||
a = a.replace(',', '\\n')
|
||||
b = b.replace(',', '\\n')
|
||||
line = '->' if directed else '--'
|
||||
print >>f, '"%s" %s "%s";' % (a, line, b)
|
||||
el = ('label="%s"' % edge_labels[i]) if edge_labels else ''
|
||||
ec = ('color="%s"' % edge_colors[i]) if edge_colors else ''
|
||||
print >>f, '"%s" %s "%s" [%s %s];' % (a, line, b, el, ec)
|
||||
print >>f, '}'
|
||||
f.close()
|
||||
|
||||
@ -278,7 +283,8 @@ def verify_graph(title, edges, vertices=None, directed=False, properties=(), fat
|
||||
|
||||
def verify_and_dot(basename, edges, vertices=None, label=None, destdir=None,
|
||||
reformat_labels=True, directed=False, properties=(), fatal=True,
|
||||
debug=None, verify=True, dot_files=False):
|
||||
debug=None, verify=True, dot_files=False, edge_colors=None,
|
||||
edge_labels=None):
|
||||
|
||||
title = '%s %s' % (basename, label or '')
|
||||
if verify:
|
||||
@ -286,7 +292,8 @@ def verify_and_dot(basename, edges, vertices=None, label=None, destdir=None,
|
||||
debug=debug)
|
||||
if dot_files:
|
||||
write_dot_file(basename, edges, vertices=vertices, label=label, destdir=destdir,
|
||||
reformat_labels=reformat_labels, directed=directed, debug=debug)
|
||||
reformat_labels=reformat_labels, directed=directed, debug=debug,
|
||||
edge_colors=edge_colors, edge_labels=edge_labels)
|
||||
|
||||
def list_verify_tests():
|
||||
for k, v in sorted(globals().items()):
|
||||
|
@ -2498,15 +2498,18 @@ class KCC(object):
|
||||
DEBUG_MAGENTA("there are %d dsa guids" % len(guid_to_dnstr))
|
||||
|
||||
dot_edges = []
|
||||
edge_colors = []
|
||||
my_dnstr = self.my_dsa.dsa_dnstr
|
||||
current_rep_table, needed_rep_table = self.my_dsa.get_rep_tables()
|
||||
for dnstr, n_rep in needed_rep_table.items():
|
||||
for reps_from in n_rep.rep_repsFrom:
|
||||
dot_edges.append((my_dnstr, guid_to_dnstr[str(reps_from.source_dsa_obj_guid)]))
|
||||
guid_str = str(reps_from.source_dsa_obj_guid)
|
||||
dot_edges.append((my_dnstr, guid_to_dnstr[guid_str]))
|
||||
edge_colors.append('#' + str(n_rep.nc_guid)[:6])
|
||||
|
||||
verify_and_dot('dsa_repsFrom_final', dot_edges, directed=True, label=self.my_dsa_dnstr,
|
||||
properties=(), debug=DEBUG, verify=opts.verify,
|
||||
dot_files=opts.dot_files)
|
||||
dot_files=opts.dot_files, edge_colors=edge_colors)
|
||||
|
||||
|
||||
dot_edges = []
|
||||
|
Loading…
Reference in New Issue
Block a user