morganrol | 5287042 | 2021-03-31 18:06:47 +0200 | [diff] [blame] | 1 | .. This work is licensed under a |
| 2 | Creative Commons Attribution 4.0 International License. |
| 3 | .. integration-tooling: |
| 4 | |
| 5 | .. _integration-simulators: |
| 6 | |
| 7 | Simulators |
| 8 | ========== |
| 9 | |
| 10 | Simulators 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 | |
| 20 | Existing 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 | |
| 30 | Recommendations |
| 31 | --------------- |
| 32 | |
| 33 | The simulator code |
| 34 | .................. |
| 35 | |
| 36 | We 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 | |
| 45 | Dockerization |
| 46 | ............. |
| 47 | |
| 48 | From this repository, create a jenkins job to automatically build the dockers. |
| 49 | |
| 50 | Helm Chart |
| 51 | .......... |
| 52 | |
| 53 | It is recommended to create a helm chart in order to run the simulators. |
| 54 | |
| 55 | |
Illia Halych | 87e5266 | 2021-04-12 12:04:15 +0000 | [diff] [blame] | 56 | Wrapper for simulators |
| 57 | ...................... |
morganrol | 5287042 | 2021-03-31 18:06:47 +0200 | [diff] [blame] | 58 | |
Illia Halych | 87e5266 | 2021-04-12 12:04:15 +0000 | [diff] [blame] | 59 | 1. In order to deploy the Helm release with a simulator, place a YAML file |
| 60 | describing 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 | |
| 80 | 2. 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 | |
| 92 | 3. 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 | |
| 107 | 4. Undeploy the Helm release: |
| 108 | |
| 109 | .. code-block:: Python |
| 110 | |
| 111 | chart.cleanup() |