kcc topology generator written as python

Dave Craft wimberosa at gmail.com
Tue Nov 1 17:53:23 MDT 2011

> btw, I know you are more comfortable with C, but if you do feel like a
> python adventure then trying the samba_kcc python approach I think
> would give us the most maintainable result, as I think python is
> perfect for the sorts of topology algorithms we need, and it makes it
> really easy to develop and test (just run samba_kcc on the command
> line). It is up to you though, and if you really don't feel
> comfortable with doing it in python then option 2 above is probably
> the best choice.
> Cheers, Tridge

Tridge, et. al.

As per your suggestions I have rewritten the major portion of the
KCC in python.   The patchsets are available at:


I realize you've been out so I may have gotten a little
ahead of you here.  Two of the patches are large but actually
are self contained python scripts.


as well as a patch for updating missing flags in the
dsdb class.

The python scripts currently enumerate all steps as outlined
in the KCC technical reference.   A few of the functions are
not implemented (are no-ops) but are there to give the exact
flow that will be required for a complete run of the KCC and
update of the database.

The current code base builds all appropriate classes and methods
(mostly appearing in kcc_utils.py) such as DirectoryServiceAgent, Site,
GraphNode, NTDSConnection,  NamingContext,  NCReplica
from the database.   The kcc class appearing in kcccompute
successfully computes the graph tree for intrasite topology
and builds the new NTDSConnections in memory.    The commit
code to the database is pretty small but not done yet.

I believe this is substantively correct and follows the tech
ref pretty accurately.

I need to get some input on whether I can get this into the
code base so I can build off of it and finish the rest of the
functions.    Input requested.....

The next work items will be filling in the no-op functions
which commit the NTDSConnections and build the repsFrom
as well as maintaining failed links/connections correctly.   Lastly
there will be a callout from the samba C code to the kcccompute
command to build the topology for subsequent replication
Regards, Dave Craft
Cut the headlights and put it in neutral.

More information about the samba-technical mailing list