blob: 7f6688f055efb654e264c4cb24da831869452ef7 [file] [log] [blame]
morganrol52870422021-03-31 18:06:47 +02001.. This work is licensed under a
2 Creative Commons Attribution 4.0 International License.
3.. integration-tooling:
4
5.. _integration-simulators:
6
7Simulators
8==========
9
10Simulators are regularly created for use cases. The goal of this section is to:
11
12- Highlight the existing Simulators
13- Provide recommendations when starting developing a new simulator
14
15.. important::
16 Before developing a new simulator, check that it does not exist...and
17 refactor/contribute to existing simulators rather than recreating new ones.
18
19
20Existing simulators
21-------------------
22
23.. csv-table:: Simulators
24 :file: ./files/csv/simulators.csv
25 :widths: 10,50,20,20
26 :delim: ;
27 :header-rows: 1
28
29
30Recommendations
31---------------
32
33The simulator code
34..................
35
36We recommend to create a dedicated repository (ask Integration team).
37
38.. csv-table:: Simulator repositories
39 :file: ./files/csv/repo-simulators.csv
40 :widths: 30,50,20
41 :delim: ;
42 :header-rows: 1
43
44
45Dockerization
46.............
47
48From this repository, create a jenkins job to automatically build the dockers.
49
50Helm Chart
51..........
52
53It is recommended to create a helm chart in order to run the simulators.
54
55
Illia Halych87e52662021-04-12 12:04:15 +000056Wrapper for simulators
57......................
morganrol52870422021-03-31 18:06:47 +020058
Illia Halych87e52662021-04-12 12:04:15 +0000591. In order to deploy the Helm release with a simulator, place a YAML file
60describing the Helm release in src/onaptests/templates/helm_charts.
61
62 The structure of the YAML file should be like in the example below.
63 Dependencies contain all the charts that need to be pulled.
64
65 .. code-block:: YAML
66
67 # Helm release information
68 api_version: # API_VERSION
69 app_version: # APP_VERSION
70 chart_name: # SIMULATOR_NAME
71 version: # CHART_VERSION
72
73 # Helm charts that need to be pulled
74 dependencies:
75 - name: # SIMULATOR_NAME
76 version: # CHART_VERSION
77 repository: # URL
78 local_repo_name: # REPO_NAME
79
802. Install the Helm release:
81
82 .. code-block:: Python
83
84 from onaptests.steps.wrapper.helm_charts import HelmChartStep
85
86 chart = HelmChartStep(
87 cleanup = BOOLEAN,
88 chart_info_file = YAML_FILE_NAME # name, not the path
89 )
90 chart.execute()
91
923. Start the simulator via an API call:
93
94 .. code-block:: Python
95
96 start = SimulatorStartStep(
97 cleanup = BOOLEAN,
98 https = BOOLEAN,
99 host = HOSTNAME,
100 port = PORT,
101 endpoint = START_ENDPOINT, # if applicable
102 method = REQUEST_METHOD, # GET, POST etc.
103 data = PAYLOAD # {"json": {...}, ...}
104 )
105 start.execute()
106
1074. Undeploy the Helm release:
108
109 .. code-block:: Python
110
111 chart.cleanup()