Metadata-Version: 2.5
Name: trytond_etude_cmdb
Version: 8.0.0.2
Summary: Etude Form Server — Bridge to CMDB (asset, location and IP intake)
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: binding,cmdb,form,inventory,ipam,survey,tryton
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Requires-Python: >=3.10
Requires-Dist: trytond-cmdb-computer<8.1,>=8.0
Requires-Dist: trytond-cmdb-ipam<8.1,>=8.0
Requires-Dist: trytond-cmdb-location<8.1,>=8.0
Requires-Dist: trytond-cmdb<8.1,>=8.0
Requires-Dist: trytond-etude-bind<8.1,>=8.0
Requires-Dist: trytond-etude<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Etude CMDB Module
=================

The ``etude_cmdb`` module binds the questions of a form to the records the
CMDB suite manages: an intake form reads what the deployment already holds of a
computer template, of a location and of a subnet, and the submit writes the
asset it describes together with the address it is given out of that subnet.
It is a companion of the core module of the etude group - it depends on
``etude`` and on ``etude_bind`` and extends their definitions - and it is what
turns a form into an intake front end of the CMDB.

A record of the suite read as a text
------------------------------------

A form is answered in text where the suite is made of records, so what an
answer names is read as the record it names: the *name* of a computer
template, the *name* of a CMDB location, the *code* of a rack, the *network
address* of a subnet.  The resolution goes through the ORM, so ``ir.model
.access``, the field accesses and the record rules of the deployment apply to
it exactly as they apply to the write it feeds, and an answer that names no
record of the suite is refused rather than written as a dangling reference.
The reference is refused *before* the first record of the form is written,
because the binding layer checks the plan of the write - the capability the
running user holds on every target - and this module reads what the answers
name before the same first write: a submit that can not write one of its
records leaves none of the others behind and is rolled back with the
transaction of the caller all the same.

A record of the suite reads what it is placed in
------------------------------------------------

Every model of the suite the bridge touches answers a *context*
(``get_etude_context``): the template, the placement and the dates of a
computer, the path and the type of a location, the code and the dimensions of
a rack, the space, the site and the gateway of a subnet, the allocation state
of an address.  A rule, a preset or an integration reads where a record is
placed without walking the chain again.

The address of an asset is allocated, not typed
-----------------------------------------------

The address of a machine is the one value an intake form does not have to ask
for: a participant names the subnet the machine is placed in, and the address
it is given is read from that subnet - the first address the subnet holds
neither a record of nor a reservation for - when the designer left the address
unanswered.  An answer of the address question is never written over, because
a designer which asks for the address of a machine means the address it is
given; an address the bridge allocates is written in the state the allocation
wizard of the suite gives the addresses it hands out, and a subnet that holds
no free address refuses the submit rather than writing an address of another
subnet.

The declarations of a target are shipped, not retyped
-----------------------------------------------------

The binding of a CMDB target is read the same way on every question of a
deployment, so the module ships its declaration rather than a second copy of
it: an ``etude.cmdb.preset`` declares one binding of one target and one mode -
its field, the field an answer is matched by, its policy and the domain of its
rule - and applying it to a question writes the binding and the rule of that
question.  A preset speaks the payload the binding layer reads a definition
with, so its target is a technical model name and a field name, and a preset
whose model this deployment does not hold is refused where it is applied, with
the message of the binding layer.  Applying a preset is a capability of the
running user, because the binding it writes is validated where it is written -
a user who may not name the target is refused with the message of the whitelist
and not with a binding written half way.

What the module ships is the presets of the intake example - the computer
template, the location, the dates, the subnet, the address and the machine the
address is given to - and the declarations a rack or a location intake is built
from.  The targets the presets bind are whitelisted for the groups of the etude
deployment in ``data_whitelist.xml``; a deployment which serves a form to
another group adds the entry of that group, and the access a target itself
needs - who may read and write a record of the suite - stays in the module
which holds the model.

The worked example
------------------

What the module ships to prove the bridge is an asset intake example, and it is
*written* by a wizard (``etude.cmdb.intake``) rather than shipped as data: a
binding names a model and a field of it, and the models and the fields of a
deployment are rows of ``ir.model`` and ``ir.model.field`` which a data file
can not name by a name that survives a restore.  The bindings of the example
are therefore resolved through the pool of the deployment they are written in,
by the presets the module ships, and the wizard runs as a user of that
deployment: a binding is a capability of that user, so it is written by one who
may name the target rather than loaded by the deployment as no user at all.

What the wizard writes is one published form whose questions ask the computer
template, the location and the dates of the machine and the subnet, the address
and the name it is given; the templates, the locations and the subnets of the
deployment are offered as the choices of those questions and an answer is
checked against them, and the submit writes the computer and the address of it,
with the mappings of the form grouping the questions of the asset onto one
computer and the questions of the network onto one address.

The bridge is optional in both directions
-----------------------------------------

Nothing of the CMDB suite depends on the bridge, so a deployment which does not
install it holds and writes exactly the same records as before; and nothing of
the etude group depends on it either, so a deployment which serves other forms
binds nothing differently.  Installing the bridge adds the presets, the
whitelist entries of its targets and the example, and grants nothing on the
records of the suite: what a binding may name is the whitelist of the
deployment, and the right a target needs is the right of the module that holds
the model.

See ``doc/index.rst`` for the module documentation and ``ETUDE.md`` in
``modules-cch/`` for the architecture of the whole group.
