summaryrefslogtreecommitdiff
path: root/python/samba/netcmd/visualize.py
AgeCommit message (Collapse)AuthorFilesLines
2020-08-11python compat: remove text_typeDouglas Bagnall1-2/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2019-03-30samba-tool: fix some typosBjörn Baumbach1-1/+1
All command descriptions have a dot '.' at the end. The ou and visualize command need this too. ... group - Group management. ldapcmp - Compare two ldap databases. ntacl - NT ACLs manipulation. ou - Organizational Units (OU) management ... user - User management. visualize - Produces graphical representations of Samba network state Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-10-18uptodateness: migrate get_kcc_and_dsas as a functionJoe Guo1-16/+4
We need to reuse it in drs cmd. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
2018-10-18uptodateness: extract get_utdv_max_distanceJoe Guo1-1/+4
To avoid returning 2 values from get_utdv_distances. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
2018-10-18uptodateness: extract function get_utdv_distancesJoe Guo1-22/+2
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
2018-10-18uptodateness: extract function get_utdv_edgesJoe Guo1-21/+2
Extract function to reuse later. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
2018-10-18netcmd/visualize: rm unused code lineJoe Guo1-2/+0
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
2018-10-18uptodateness: migrate more methods from visualizeJoe Guo1-33/+5
Move methods from cmd_uptodateness to new module. Will reuse in drs cmd later. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
2018-10-18uptodateness: add new module and migrate functions from visualizeJoe Guo1-30/+4
Both visualize and drs cmd will have uptodateness functions. Create a new module to reuse code. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
2018-09-03python/samba: changes needed for samba.tests.samba_tool.visualize PY2/PY3Noel Power1-3/+3
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-08-24PEP8: fix E265: block comment should start with '# 'Joe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E241: multiple spaces after ','Joe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E124: closing bracket does not match visual indentationJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-06-10sambatool visualize: add up-to-dateness visualizationDouglas Bagnall1-1/+137
Or more accurately, out-of-dateness visualization, which shows how far each DCs is from every other using the difference in the up-to-dateness vectors. An example usage is samba-tool visualize uptodateness -r -S -H ldap://somewhere \ -UAdministrator --color=auto --partition=DOMAIN Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-06-10samba-tool visualize ntdsconn: properly sort/group verticesDouglas Bagnall1-2/+7
The vertex is now a tuple, with the RODC state added. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-06-10samba-tool visualize: fix wrong variable name in get_partition()Douglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-06-10samba-tool visualize: separate dot options from common optionsDouglas Bagnall1-7/+10
because not all sub-commands make dot format Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-06-10samba-tool visualise: helper for getting the partitionDouglas Bagnall1-7/+14
Repeated code becomes a function. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31samba-tool visualise: --xdot option for instant graphviz visualisationDouglas Bagnall1-4/+28
This is a convenience for people who have xdot (and X11). Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31samba-tool viusalize: mark RODCs in distance matrixDouglas Bagnall1-7/+32
RODCs should not be replicating out, which means they look alarming when they are working properly. We label them as RODCs to reminds users that no outbound replication is expected. This results in slightly rejigged output formatting. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31samba-tool visualize ntdsconn: add --importldif optionDouglas Bagnall1-3/+25
This visualizes the NTDSConnections in an LDIF file exported via `samba_kcc --exportldif`. This functionality is already available in a roundabout way -- you can use `samba_kcc --import_ldif`, and use the DB that generates. This just shortens the process. The ldif import/export feature is useful for analysing AD networks offsite without exposing too much sensitive data. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31samba-tool visualize: group (and colour) DCs by siteDouglas Bagnall1-2/+15
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-12Bulk: enclose .keys() method with list where list (from python2) expectedNoel Power1-1/+1
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-12python/samba: Ensure md5 always provided with bytesNoel Power1-1/+5
To allow code run in both python3 and python2 we have to ensure that md5 always receives bytes Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-04-30samba-tool visualize: use correct DC in graph labelDouglas Bagnall1-3/+3
We have been using a random DC (depending to hash order, which was not random enough on Python 2.7 to affect the tests). Reported-by: Noel Power <noel.power@suse.com> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <noel.power@suse.com>
2018-04-13python: bulk replace dict.iteritems to items for py3Joe Guo1-13/+13
In py3, iterxxx methods are removed. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-21samba-tool visualize: fix python2.6 incompatibilityBjörn Baumbach1-1/+5
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13337 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Wed Mar 21 09:25:51 CET 2018 on sn-devel-144
2018-01-13samba-tool visualize for understanding AD DC behaviourDouglas Bagnall1-0/+574
To work out what is happening in a replication graph, it is sometimes helpful to use visualisations. We introduce a samba-tool subcommand to write Graphviz dot output and generate text-based heatmaps of the distance in hops between DCs. There are two subcommands, two graphical modes, and (roughly) two modes of operation with respect to the location of authority. `samba-tool visualize ntdsconn` looks at NTDS Connections. `samba-tool visualize reps` looks at repsTo and repsFrom objects. In '--distance' mode (default), the distances between DCs are shown in a matrix in the terminal. With '--color=yes', this is depicted as a heatmap. With '--utf8' it is a lttle prettier. In '--dot' mode, Graphviz dot output is generated. When viewed using dot or xdot, this shows the network as a graph with DCs as vertices and connections edges. Certain types of degenerate edges are shown in different colours or line-styles. Normally samba-tool talks to one database; with the '-r' (a.k.a. '--talk-to-remote') option attempts are made to contact all the DCs known to the first database. This is necessary to get sensible results from `samba-tool visualize reps` because the repsFrom/To objects are not replicated, and it can reveal replication issues in other modes. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>