configurationengine/doc/validation-overview.rst
author m2lahtel
Wed, 08 Sep 2010 12:20:56 +0300
changeset 4 0951727b8815
permissions -rw-r--r--
Updated to 1.2.13 release
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     1
.. _validation-overview:
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     2
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     3
Validation overview
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     4
===================
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     5
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     6
.. note::
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     7
    This page gives an overview of ConfML and ImplML validation with ConE.
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     8
    For the actual CLI action see :ref:`cli-action-validate`
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
     9
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    10
ConE supports validation of the ConfML and ImplML files in configurations
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    11
projects. This basically means that you can pass a configuration for validation
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    12
and ConE will spit out a list for *problems*, which can be errors, warnings or
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    13
informational messages associated with a file and a line number.
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    14
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    15
For example, a list of validation problems might look something like the
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    16
following:
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    17
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    18
=================================== ======  ======================================  =========== ===========================================================================
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    19
File                                Line    Type                                    Severity    Message
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    20
=================================== ======  ======================================  =========== ===========================================================================
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    21
Layer1/confml/broken.confml         1       xml.confml                              error       no element found: line 1, column 0
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    22
Layer1/confml/test.confml           11      model.confml.invalid_value.maxlength    error       Setting ValidationTest.Foo: Maximum number of characters is 3 (value has 6)
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    23
Layer1/confml/test.confml           12      model.confml.missing_feature_for_data   error       Feature 'ValidationTest.Bar' not found
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    24
Layer1/implml/00000002_foo.crml     6       model.implml.crml.invalid_ref           error       Setting 'Foo.Bar' not found in configuration
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    25
Layer1/implml/00000003_bar.crml     10      model.implml.crml.duplicate_uid         error       Duplicate key UID 0x00000001 (duplicate with keys on lines 6, 7 and 8)
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    26
Layer1/root.confml                  7       schema.confml                           error       Element 'foo': This element is not expected.
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    27
=================================== ======  ======================================  =========== ===========================================================================
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    28
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    29
From a slightly lower-level perspective validation happens on three levels:
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    30
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    31
#. XML level - Files that contain invalid XML data are caught here
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    32
#. XML Schema level - Things like missing attributes in elements are caught here
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    33
#. Model level - The rest of possible problems that the other validation levels
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    34
   cannot handle are caught here
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    35
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    36
Problem types and filtering
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    37
---------------------------
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    38
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    39
You might have noticed the *type* column in the example above. This is a
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    40
hierarchical problem type ID that can be used to filter a list of problems to
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    41
narrow it down to only problems of interest. *Hierarchical* here means that
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    42
the parts separated by commas are basically sub-IDs, the highest level sub-ID 
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    43
being the leftmost one. For example, suppose that we have a problem whose type
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    44
is ``model.implml.crml.invalid_ref``. Reading the sub-IDs from left to right
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    45
we can see that:
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    46
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    47
#. It is a problem caught during model-level validation
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    48
#. It is an ImplML problem
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    49
#. The specific ImplML in this case is CRML
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    50
#. The problem is that a CRML key references a ConfML setting that does not exist
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    51
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    52
Filtering of problems by type happens by specifying a list of *includes* and
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    53
a list of *excludes*. The output will contain only problems that match any of
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    54
the includes, but do not match any of the excludes.
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    55
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    56
If we wanted to set up a filter that shows only problems of the type in the 
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    57
example above, we could simply use a single include: ``model.implml.crml.invalid_ref``.
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    58
However, if we wanted to see all model-level CRML problems *except* that one,
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    59
we could include ``model.implml.crml`` and exclude ``model.implml.crml.invalid_ref``.
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    60
Now invalid reference errors would not show up, but duplicate UID errors
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    61
(type ``model.implml.crml.duplicate_uid``) would. Wildcards are also possible,
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    62
so including ``*.confml`` would include all ConfML problems: XML-level,
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    63
schema-level and model-level, or ``model.implml.*.invalid_ref`` would include
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    64
all ImplML errors for references to non-existent settings.
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    65
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    66
The two first sub-IDs for problem types come from the three validation
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    67
levels and the fact that ConfML and ImplML can be validated. The following
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    68
table shows the problem types for all cases:
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    69
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    70
+-------------------+--------------------+-------------------+
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    71
|                   | **ConfML**         | **ImplML**        |
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    72
+-------------------+--------------------+-------------------+
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    73
| **XML-level**     | ``xml.confml``     | ``xml.implml``    |
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    74
+-------------------+--------------------+-------------------+
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    75
| **Schema-level**  | ``schema.confml``  | ``schema.implml`` |
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    76
+-------------------+--------------------+-------------------+
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    77
| **Model-level**   | ``model.confml``   | ``model.implml``  |
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    78
+-------------------+--------------------+-------------------+
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    79
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    80
The sub-IDs after that depend on the context. For example, ImplML validation
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    81
typically has the implementation language as the next sub-ID: ``model.implml.crml``
0951727b8815 Updated to 1.2.13 release
m2lahtel
parents:
diff changeset
    82
or ``schema.implml.genconfml``.