feat(methodology): add methodology for autogen
[csit.git] / docs / report / introduction / methodology_autogen.rst
1 .. _autogen_methodology:
2
3 Suite Generation
4 ^^^^^^^^^^^^^^^^
5
6 CSIT uses robot suite files to define tests.
7 However, not all suite files available for Jenkins jobs
8 (or manually started bootstrap scripts) are present in CSIT git repository.
9 They are generated only when needed.
10
11 Autogen Library
12 ~~~~~~~~~~~~~~~
13
14 There is a code generation layer implemented as Python library called "autogen",
15 called by various bash scripts.
16
17 It generates the full extent of CSIT suites, using the ones in git as templates.
18
19 Sources
20 ~~~~~~~
21
22 The generated suites (and their contents) are affected by multiple information
23 sources, listed below.
24
25 Git Suites
26 ----------
27
28 The suites present in git repository act as templates for generating suites.
29 One of autogen design principles is that any template suite should also act
30 as a full suite (no placeholders).
31
32 In practice, autogen always re-creates the template suite with exactly
33 the same content, it is one of checks that autogen works correctly.
34
35 Regenerate Script
36 -----------------
37
38 Not all suites present in CSIT git repository act as template for autogen.
39 The distinction is on per-directory level. Directories with
40 regenerate_testcases.py script usually consider all suites as templates
41 (unless possibly not included by the glob patten in the script).
42
43 The script also specifies minimal frame size, indirectly, by specifying protocol
44 (protocol "ip4" is the default, leading to 64B frame size).
45
46 Constants
47 ---------
48
49 Values in Constants.py are taken into consideration when generating suites.
50 The values are mostly related to different NIC models and NIC drivers.
51
52 Python Code
53 -----------
54
55 Python code in resources/libraries/python/autogen contains several other
56 information sources.
57
58 Testcase Templates
59 __________________
60
61 The test case part of template suite is ignored, test case lines
62 are created according to text templates in Testcase.py file.
63
64 Testcase Argument Lists
65 _______________________
66
67 Each testcase template has different number of "arguments", e.g. values
68 to put into various placeholders. Different test types need different
69 lists of the argument values, the lists are in regenerate_glob method
70 in Regenerator.py file.
71
72 Iteration Over Values
73 _____________________
74
75 Python code detects the test type (usually by substrings of suite file name),
76 then iterates over different quantities based on type.
77 For example, only ndrpdr suite templates generate other types (mrr and soak).
78
79 Hardcoded Exclusions
80 ____________________
81
82 Some combinations of values are known not to work, so they are excluded.
83 Examples: Density tests for too much CPUs; IMIX for ASTF.
84
85 Non-Sources
86 ~~~~~~~~~~~
87
88 Some information sources are available in CSIT repository,
89 but do not affect the suites generated by autogen.
90
91 Testbeds
92 --------
93
94 Overall, no information visible in topology yaml files is taken into account
95 by autogen.
96
97 Testbed Architecture
98 ____________________
99
100 Historically, suite files are agnostic to testbed architecture, e.g. ICX or ALT.
101
102 Testbed Size
103 ____________
104
105 Historically, 2-node and 3-node suites have diferent names, and while
106 most of the code is common, the differences are not always simple enough.
107 Autogen treat 2-node and 3-node suites as independent templates.
108
109 TRex suites are intended for a 1-node circuit of otherwise 2-node or 3-node
110 testbeds, so they support all 3 robot tags.
111 They are also detected and treated differently by autogen,
112 mainly because they need different testcase arguments (no CPU count).
113 Autogen does nothing specifically related to the fact they should run
114 only in testbeds/NICs with TG-TG line available.
115
116 Other Topology Info
117 ___________________
118
119 Some bonding tests need two (parallel) links between DUTs.
120 Autogen does not care, as suites are agnostic.
121 Robot tag marks the difference, but the link presence is not explicitly checked.
122
123 Job specs
124 ---------
125
126 Information in job spec files depend on generated suites (not the other way).
127 Autogen should generate more suites, as job spec is limited by time budget.
128 More suites should be available for manually triggered verify jobs,
129 so autogen covers that.
130
131 Bootstrap Scripts
132 -----------------
133
134 Historically, bootstrap scripts perform some logic,
135 perhaps adding exclusion options to Robot invocation
136 (e.g. skipping testbed+NIC combinations for tests that need parallel links).
137
138 Once again, the logic here relies on what autogen generates,
139 autogen does not look into bootstrap scripts.