blob: 476dbe5efa4152b7ee806273e757d476b6467059 [file] [log] [blame]
Charles Chan4a107222020-10-30 17:23:48 -07001..
2 SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
3 SPDX-License-Identifier: Apache-2.0
4
Hung-Wei Chiud06947b2021-08-10 16:10:07 -07005SDFabric Deployment
6===================
Charles Chan4a107222020-10-30 17:23:48 -07007
Zack Williams1ae109e2021-07-27 11:17:04 -07008Update aether-pod-configs
9-------------------------
Charles Chan4a107222020-10-30 17:23:48 -070010
Zack Williams1ae109e2021-07-27 11:17:04 -070011``aether-pod-configs`` is a git project hosted on **gerrit.opencord.org** and
12we placed the following materials in it.
Charles Chan4a107222020-10-30 17:23:48 -070013
14- Terraform scripts to install TOST applications on Rancher, including ONOS, Stratum and Telegraf.
15- Customized configuration for each application (helm values).
16- Application specific configuration files, including ONOS network configuration and Stratum chassis config.
17
18Here is an example folder structure:
19
20.. code-block:: console
21
22 ╰─$ tree staging/ace-menlo/tost
23 staging/ace-menlo/tost
24 ├── app_map.tfvars
25 ├── backend.tf
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000026 ├── deepinsight
27 │   ├── README.md
28 │   ├── deepinsight-topo.json
29 │   └── deepinsight-topo.json.license
30 ├── main.tf -> ../../../common/tost/main.tf
Charles Chan4a107222020-10-30 17:23:48 -070031 ├── onos
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000032 │   ├── app_map.tfvars
33 │   ├── backend.tf
Hung-Wei Chiud06947b2021-08-10 16:10:07 -070034 │   ├── kubeconfig -> ../../../../common/tost/apps/onos/kubeconfig/
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000035 │   ├── main.tf -> ../../../../common/tost/apps/onos/main.tf
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000036 │   ├── onos.yaml
37 │   └── variables.tf -> ../../../../common/tost/apps/onos/variables.tf
Charles Chan4a107222020-10-30 17:23:48 -070038 ├── stratum
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000039 │   ├── app_map.tfvars
40 │   ├── backend.tf
41 │   ├── main.tf -> ../../../../common/tost/apps/stratum/main.tf
42 │   ├── menlo-staging-leaf-1-chassis-config.pb.txt
43 │   ├── menlo-staging-leaf-2-chassis-config.pb.txt
44 │   ├── menlo-staging-spine-1-chassis-config.pb.txt
45 │   ├── menlo-staging-spine-2-chassis-config.pb.txt
46 │   ├── stratum.yaml
47 │   ├── tost-dev-chassis-config.pb.txt
48 │   └── variables.tf -> ../../../../common/tost/apps/stratum/variables.tf
Charles Chan4a107222020-10-30 17:23:48 -070049 ├── telegraf
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000050 │   ├── app_map.tfvars
51 │   ├── backend.tf
52 │   ├── main.tf -> ../../../../common/tost/apps/telegraf/main.tf
53 │   ├── telegraf.yaml
54 │   └── variables.tf -> ../../../../common/tost/apps/telegraf/variables.tf
55 └── variables.tf -> ../../../common/tost/variables.tf
Charles Chan4a107222020-10-30 17:23:48 -070056
57There are four Terraform scripts inside **tost** directory and are responsible for managing each service.
58
59Root folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -070060"""""""""""
61
Charles Chan4a107222020-10-30 17:23:48 -070062Terraform reads **app_map.tfvars** to know which application will be installed on Rancher
63and which version and customized values need to apply to.
64
Hyunsun Moonfc751aa2020-11-11 18:49:47 -080065Here is the example of **app_map.tfvars** which defines prerequisite apps for TOST
66as well as project and namespace in which TOST apps will be provisioned.
67Note that currently we don't have any prerequisite so we left this blank intentionally.
68It can be used to specify prerequisites in the future.
Charles Chan4a107222020-10-30 17:23:48 -070069
70.. code-block::
71
72 project_name = "tost"
73 namespace_name = "tost"
74
Charles Chan4a107222020-10-30 17:23:48 -070075
76ONOS folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -070077"""""""""""
78
Charles Chan4a107222020-10-30 17:23:48 -070079All files under **onos** directory are related to ONOS application.
Hyunsun Moonfc751aa2020-11-11 18:49:47 -080080The **app_map.tfvars** in this folder describes the information about ONOS helm chart.
Charles Chan4a107222020-10-30 17:23:48 -070081
82In this example, we specify the **onos-tost** helm chart version to **0.1.18** and load **onos.yaml**
83as custom value files.
84
85.. code-block::
86
87 apps = ["onos"]
88
89 app_map = {
90 onos = {
91 app_name = "onos-tost"
92 project_name = "tost"
93 target_namespace = "onos-tost"
94 catalog_name = "onos"
95 template_name = "onos-tost"
Hung-Wei Chiud06947b2021-08-10 16:10:07 -070096 template_version = "0.1.40"
Charles Chan4a107222020-10-30 17:23:48 -070097 values_yaml = ["onos.yaml"]
98 }
99 }
100
101**onos.yaml** used to custom your ONOS-tost Helm chart values and please pay attention to the last section, config.
102
103.. code-block:: yaml
104
105 onos-classic:
106 image:
107 tag: master
108 pullPolicy: Always
109 replicas: 1
110 atomix:
111 replicas: 1
112 logging:
113 config: |
114 # Common pattern layout for appenders
115 log4j2.stdout.pattern = %d{RFC3339} %-5level [%c{1}] %msg%n%throwable
116
117 # Root logger
118 log4j2.rootLogger.level = INFO
119
120 # OSGi appender
121 log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi
122 log4j2.appender.osgi.type = PaxOsgi
123 log4j2.appender.osgi.name = PaxOsgi
124 log4j2.appender.osgi.filter = *
125
126 # stdout appender
127 log4j2.rootLogger.appenderRef.Console.ref = Console
128 log4j2.appender.console.type = Console
129 log4j2.appender.console.name = Console
130 log4j2.appender.console.layout.type = PatternLayout
131 log4j2.appender.console.layout.pattern = ${log4j2.stdout.pattern}
132
133 # SSHD logger
134 log4j2.logger.sshd.name = org.apache.sshd
135 log4j2.logger.sshd.level = INFO
136
137 # Spifly logger
138 log4j2.logger.spifly.name = org.apache.aries.spifly
139 log4j2.logger.spifly.level = WARN
140
141 # SegmentRouting logger
142 log4j2.logger.segmentrouting.name = org.onosproject.segmentrouting
143 log4j2.logger.segmentrouting.level = DEBUG
144
145 config:
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700146 netcfg: >
147 {
148 "devices": {
149 "device:leaf1": {
150 "segmentrouting": {
151 "ipv4NodeSid": 201,
152 "ipv4Loopback": "10.128.100.38",
153 "routerMac": "00:00:0A:80:64:26",
154 "isEdgeRouter": true,
155 "adjacencySids": []
156 },
157 }
158 }
159 }
Charles Chan4a107222020-10-30 17:23:48 -0700160
Charles Chan4a107222020-10-30 17:23:48 -0700161
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700162**config.netcfg** is environment dependent and please change it to fit your environment.
Charles Chan4a107222020-10-30 17:23:48 -0700163
164..
165 TODO: Add an example based on the recommended topology
166
167Stratum folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700168""""""""""""""
169
Charles Chan4a107222020-10-30 17:23:48 -0700170Stratum uses a similar directory structure as ONOS for Terraform and its configuration files.
171
172The customize value file is named **stratum.yaml**
173
174.. code-block::
175
176 app_map = {
177 stratum= {
178 app_name = "stratum"
179 project_name = "tost"
180 target_namespace = "stratum"
181 catalog_name = "stratum"
182 template_name = "stratum"
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700183 template_version = "0.1.13"
Charles Chan4a107222020-10-30 17:23:48 -0700184 values_yaml = ["stratum.yaml"]
185 }
186 }
187
188Like ONOS, **stratum.yaml** used to customize Stratum Helm Chart and please pay attention to the config section.
189
190.. code-block:: yaml
191
192 image:
193 registry: registry.aetherproject.org
194 repository: tost/stratum-bfrt
195 tag: 9.2.0-4.14.49
196 pullPolicy: Always
197 pullSecrets:
198 - aether-registry-credential
199
200 extraParams:
201 - "-max_log_size=0"
202 - '-write_req_log_file=""'
203 - '-read_req_log_file=""'
204 - "-v=0"
205 - "-stderrthreshold=0"
206 - "-bf_switchd_background=false"
207
208 nodeSelector:
209 node-role.aetherproject.org: switch
210
211 tolerations:
212 - effect: NoSchedule
213 value: switch
214 key: node-role.aetherproject.org
215
216 config:
217 server: gerrit.opencord.org
218 repo: aether-pod-configs
219 folder: staging/ace-onf-menlo/tost/stratum
220
221Stratum has the same deployment workflow as ONOS.
222Once it is deployed to Kubernetes, it will read switch-dependent config files from the aether-pod-configs repo.
223The key folder indicates that relative path of configs.
224
225.. attention::
226
227 The switch-dependent config file should be named as **${hostname}-chassis-config.pb.txt**.
228 For example, if the host name of your Tofino switch is **my-leaf**, please name config file **my-leaf-config.pb.txt**.
229
230..
231 TODO: Add an example based on the recommended topology
232
233Telegraf folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700234"""""""""""""""
Charles Chan4a107222020-10-30 17:23:48 -0700235
236The app_map.tfvars specify the Helm Chart version and the filename of the custom Helm value file.
237
238.. code-block::
239
240 apps=["telegraf"]
Charles Chan4a107222020-10-30 17:23:48 -0700241 app_map = {
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700242 telegraf = {
243 app_name = "telegraf"
244 project_name = "tost"
245 target_namespace = "tost"
246 catalog_name = "aether"
247 template_name = "tost-telegraf"
248 template_version = "0.1.1"
249 values_yaml = ["telegraf.yaml"]
250 }
Charles Chan4a107222020-10-30 17:23:48 -0700251 }
252
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700253The **telegraf.yaml** used to override the ONOS-Telegraf Helm Chart and its environment-dependent.
Charles Chan4a107222020-10-30 17:23:48 -0700254Please pay attention to the **inputs.addresses** section.
255Telegraf will read data from stratum so we need to specify all Tofino switch’s IP addresses here.
256Taking Menlo staging pod as example, there are four switches so we fill out 4 IP addresses.
257
258.. code-block:: yaml
259
260 podAnnotations:
261 field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":9273,"schema":"HTTP"}]'
262
263 config:
264 outputs:
265 - prometheus_client:
266 metric_version: 2
267 listen: ":9273"
268 inputs:
269 - cisco_telemetry_gnmi:
270 addresses:
271 - 10.92.1.81:9339
272 - 10.92.1.82:9339
273 - 10.92.1.83:9339
274 - 10.92.1.84:9339
275 redial: 10s
276 - cisco_telemetry_gnmi.subscription:
277 name: stratum_counters
278 origin: openconfig-interfaces
279 path: /interfaces/interface[name=*]/state/counters
280 sample_interval: 5000ns
281 subscription_mode: sample
282
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000283
284Create Your Own Configs
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700285"""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000286
287The easiest way to create your own configs is running the template script.
288
289Assumed we would like to set up the **ace-example** pod in the production environment.
290
Hung-Wei Chiud06947b2021-08-10 16:10:07 -07002911. open the **tools/ace_config.yaml** (You should already have this file when you finish VPN bootstrap stage)
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +00002922. fill out all required variables
Hung-Wei Chiud06947b2021-08-10 16:10:07 -07002933. perform the makefile command to generate configuration and directory for TOST
2944. update **onos.yaml** for ONOS
2955. update **${hostname}-chassis-config.pb.txt** for Stratum
2966. commit your change and open the Gerrit patch
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000297
298.. code-block:: console
299
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700300 vim tools/ace_config.yaml
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000301 make -C tools/ tost
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700302 vim production/ace-example/tost/onos/onos.yaml
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000303 vim production/ace-example/tost/stratum/*${hostname}-chassis-config.pb.txt**
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000304 git add commit
305 git review
306
307
Charles Chan4a107222020-10-30 17:23:48 -0700308Quick recap
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700309"""""""""""
Charles Chan4a107222020-10-30 17:23:48 -0700310
311To recap, most of the files in **tost** folder can be copied from existing examples.
312However, there are a few files we need to pay extra attentions to.
313
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700314- **onos.yaml** in **onos** folder
Charles Chan4a107222020-10-30 17:23:48 -0700315- Chassis config in **stratum** folder
Zack Williams794532a2021-03-18 17:38:36 -0700316 There should be one chassis config for each switch. The file name needs to be
317 **${hostname}-chassis-config.pb.txt**
318- **telegraf.yaml** in **telegraf** folder need to be updated with all switch
319 IP addresses
Charles Chan4a107222020-10-30 17:23:48 -0700320
321Double check these files and make sure they have been updated accordingly.
322
323
324Create a review request
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700325"""""""""""""""""""""""
326
Zack Williams794532a2021-03-18 17:38:36 -0700327We also need to create a gerrit review request, similar to what we have done in
328the **Aether Runtime Deployment**.
329
330Please refer to :doc:`Aether Runtime Deployment <runtime_deployment>` to
331create a review request.
Charles Chan4a107222020-10-30 17:23:48 -0700332
333
334Create TOST deployment job in Jenkins
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700335-------------------------------------
336
Zack Williams794532a2021-03-18 17:38:36 -0700337There are three major components in the Jenkins system, the Jenkins pipeline
338and Jenkins Job Builder and Jenkins Job.
Charles Chan4a107222020-10-30 17:23:48 -0700339
Zack Williams794532a2021-03-18 17:38:36 -0700340We follow the Infrastructure as Code principle to place three major components
341in a Git repo, ``aether-ci-management``
342
343Download the ``aether-ci-management`` repository.
Charles Chan4a107222020-10-30 17:23:48 -0700344
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000345.. code-block:: shell
346
347 $ cd $WORKDIR
348 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-ci-management"
349
350
Zack Williams794532a2021-03-18 17:38:36 -0700351Here is the example of folder structure, we put everything related to three
352major components under the jjb folder.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000353
354.. code-block:: console
355
356 $ tree -d jjb
357 jjb
358 ├── ci-management
359 ├── global
360 │   ├── jenkins-admin -> ../../global-jjb/jenkins-admin
361 │   ├── jenkins-init-scripts -> ../../global-jjb/jenkins-init-scripts
362 │   ├── jjb -> ../../global-jjb/jjb
363 │   └── shell -> ../../global-jjb/shell
364 ├── pipeline
365 ├── repos
366 ├── shell
367 └── templates
Charles Chan4a107222020-10-30 17:23:48 -0700368
369
370Jenkins pipeline
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700371""""""""""""""""
372
Zack Williams794532a2021-03-18 17:38:36 -0700373Jenkins pipeline runs the Terraform scripts to install desired applications
374into the specified Kubernetes cluster.
Charles Chan4a107222020-10-30 17:23:48 -0700375
Zack Williams794532a2021-03-18 17:38:36 -0700376Both ONOS and Stratum will read configuration files (network config, chassis
377config) from aether-pod-config.
378
379The default git branch is master. For testing purpose, we also provide two
380parameters to specify the number of reviews and patchset.
381
Charles Chan4a107222020-10-30 17:23:48 -0700382We will explain more in the next section.
383
384.. note::
385
386 Currently, we don’t perform the incremental upgrade for TOST application.
387 Instead, we perform the clean installation.
Zack Williams794532a2021-03-18 17:38:36 -0700388 In the pipeline script, Terraform will destroy all existing resources and
389 then create them again.
Charles Chan4a107222020-10-30 17:23:48 -0700390
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000391
Zack Williams794532a2021-03-18 17:38:36 -0700392We put all pipeline scripts under the pipeline directory, the language of the
393pipeline script is groovy.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000394
395.. code-block:: console
396
397 $ tree pipeline
398 pipeline
399 ├── aether-in-a-box.groovy
400 ├── artifact-release.groovy
401 ├── cd-pipeline-charts-postrelease.groovy
402 ├── cd-pipeline-dockerhub-postrelease.groovy
403 ├── cd-pipeline-postrelease.groovy
404 ├── cd-pipeline-terraform.groovy
405 ├── docker-publish.groovy
406 ├── ng40-func.groovy
407 ├── ng40-scale.groovy
408 ├── reuse-scan-gerrit.groovy
409 ├── reuse-scan-github.groovy
410 ├── tost-onos.groovy
411 ├── tost-stratum.groovy
412 ├── tost-telegraf.groovy
413 └── tost.groovy
414
415Currently, we had four pipeline scripts for TOST deployment.
416
4171. tost-onos.groovy
4182. tost-stratum.groovy
4193. tost-telegraf.groovy
4204. tost.groovy
421
Zack Williams794532a2021-03-18 17:38:36 -0700422tost-[onos/stratum/telegraf].groovy are used to deploy the individual
423application respectively, and tost.groovy is a high level script, used to
424deploy the TOST application, it will execute the above three scripts in its
425pipeline script.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000426
427
Charles Chan4a107222020-10-30 17:23:48 -0700428Jenkins jobs
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700429""""""""""""
Charles Chan4a107222020-10-30 17:23:48 -0700430
431Jenkins job is the task unit in the Jenkins system. A Jenkins job contains the following information:
432
433- Jenkins pipeline
434- Parameters for Jenkins pipeline
435- Build trigger
436- Source code management
437
438We created one Jenkins job for each TOST component, per Aether edge.
Charles Chan4a107222020-10-30 17:23:48 -0700439
Zack Williams794532a2021-03-18 17:38:36 -0700440We have four Jenkins jobs (HostPath provisioner, ONOS, Stratum and Telegraf)
441for each edge as of today.
442
443There are 10+ parameters in Jenkins jobs and they can be divided into two
444parts, cluster-level and application-level.
445
Charles Chan4a107222020-10-30 17:23:48 -0700446Here is an example of supported parameters.
447
448.. image:: images/jenkins-onos-params.png
449 :width: 480px
450
451Application level
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700452'''''''''''''''''
Charles Chan4a107222020-10-30 17:23:48 -0700453
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000454- **GERRIT_CHANGE_NUMBER/GERRIT_PATCHSET_NUMBER**: tell the pipeline script to read
455 the config for aether-pod-configs repo from a specified gerrit review, instead of the
456 HEAD branch. It’s good for developer to test its change before merge.
457- **onos_user**: used to login ONOS controller
Zack Williams794532a2021-03-18 17:38:36 -0700458- **git_repo/git_server/git_user/git_password_env**: information of git
459 repository, **git_password_env** is a key for Jenkins Credential system.
Charles Chan4a107222020-10-30 17:23:48 -0700460
461Cluster level
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700462'''''''''''''
463
Zack Williams794532a2021-03-18 17:38:36 -0700464- **gcp_credential**: Google Cloud Platform credential for remote storage, used
465 by Terraform.
Charles Chan4a107222020-10-30 17:23:48 -0700466- **terraform_dir**: The root directory of the TOST directory.
467- **rancher_cluster**: target Rancher cluster name.
468- **rancher_api_env**: Rancher credential to access Rancher, used by Terraform.
Charles Chan4a107222020-10-30 17:23:48 -0700469
470.. note::
471
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000472 Typically, developer only focus on **GERRIT_CHANGE_NUMBER** and **GERRIT_PATCHSET_NUMBER**. The rest of them are managed by OPs.
Charles Chan4a107222020-10-30 17:23:48 -0700473
474Jenkins Job Builder (JJB)
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700475"""""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000476
Zack Williams794532a2021-03-18 17:38:36 -0700477We prefer to apply the IaC (Infrastructure as Code) for everything. We use the
478JJB (Jenkins Job Builder) to create new Jenkins Job, including the Jenkins
479pipeline. We need to clone a set of Jenkins jobs when a new edge is deployed.
Charles Chan4a107222020-10-30 17:23:48 -0700480
Zack Williams794532a2021-03-18 17:38:36 -0700481In order to provide the flexibility and avoid re-inventing the wheel, we used
482the job template to declare your job. Thanks to the JJB, we can use the
483parameters in the job template to render different kinds of jobs easily.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000484
485All the template files are placed under templates directory.
486
487.. code-block:: console
488
489 ╰─$ tree templates
490 templates
491 ├── aether-in-a-box.yaml
492 ├── archive-artifacts.yaml
493 ├── artifact-release.yml
494 ├── cd-pipeline-terraform.yaml
495 ├── docker-publish-github.yaml
496 ├── docker-publish.yaml
497 ├── helm-lint.yaml
498 ├── make-test.yaml
499 ├── ng40-nightly.yaml
500 ├── ng40-test.yaml
501 ├── private-docker-publish.yaml
502 ├── private-make-test.yaml
503 ├── publish-helm-repo.yaml
504 ├── reuse-gerrit.yaml
505 ├── reuse-github.yaml
506 ├── sync-dir.yaml
507 ├── tost.yaml
508 ├── verify-licensed.yaml
509 └── versioning.yaml
510
Zack Williams794532a2021-03-18 17:38:36 -0700511We defined all TOST required job templates in tost.yaml and here is its partial
512content.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000513
514.. code-block:: yaml
515
516 - job-template:
517 name: "{name}-onos"
518 id: "deploy-onos"
519 project-type: pipeline
520 dsl: !include-raw-escape: jjb/pipeline/tost-onos.groovy
521 triggers:
522 - onf-infra-tost-gerrit-trigger:
523 gerrit-server-name: '{gerrit-server-name}'
524 trigger_command: "apply"
525 pattern: "{terraform_dir}/tost/onos/.*"
526 logrotate:
527 daysToKeep: 7
528 numToKeep: 10
529 artifactDaysToKeep: 7
530 artifactNumToKeep: 10
531 parameters:
532 - string:
533 name: gcp_credential
534 default: "{google_bucket_access}"
535 - string:
536 name: rancher_cluster
537 default: "{rancher_cluster}"
538 - string:
539 name: rancher_api_env
540 default: "{rancher_api}"
541 - string:
542 name: git_repo
543 default: "aether-pod-configs"
544 - string:
545 name: git_server
546 default: "gerrit.opencord.org"
547 - string:
548 name: git_ssh_user
549 default: "jenkins"
550
551
552
553
554Once we have the job template, we need to tell the JJB, we want to use the job template to create our own jobs.
555Here comes the concept of project, you need to define job templates you want to use and the values of all parameters.
556
557
558We put all project yaml files under the repo directory and here is the example
559
560.. code-block:: console
561
562 ╰─$ tree repos 130 ↵
563 repos
564 ├── aether-helm-charts.yaml
565 ├── aether-in-a-box.yaml
566 ├── cd-pipeline-terraform.yaml
567 ├── ng40-test.yaml
568 ├── spgw.yaml
569 └── tost.yaml
570
571
572Following is the example of tost projects, we defined three projects here, and each project has different
573parameters and Jenkins jobs it wants to use.
574
575.. code-block:: yaml
576
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700577
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000578 - project:
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700579 name: deploy-tucson-pairedleaves-dev
580 rancher_cluster: "dev-pairedleaves-tucson"
581 terraform_dir: "staging/dev-pairedleaves-tucson"
582 rancher_api: "{rancher_staging_access}"
583 properties:
584 - onf-infra-onfstaff-private
585 jobs:
586 - "deploy"
587 - "deploy-onos"
588 - "deploy-stratum"
589 - "deploy-telegraf"
590 - "debug-tost"
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000591
592
593Create Your Own Jenkins Job
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700594"""""""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000595
596Basically, if you don't need to customize the Jenkins pipeline script and the job configuration, the only thing
597you need to do is modify the repos/tost.yaml to add your project.
598
599For example, we would like to deploy the TOST to our production pod, let's assume it named "tost-example".
600Add the following content into repos/tost.yaml
601
602.. code-block:: yaml
603
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000604
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700605 - project:
606 name: deploy-tost-example-production
607 rancher_cluster: "ace-test-example"
608 terraform_dir: "production/tost-example"
609 rancher_api: "{rancher_production_access}"
610 properties:
611 - onf-infra-onfstaff-private
612 jobs:
613 - "deploy"
614 - "deploy-onos"
615 - "deploy-stratum"
616 - "deploy-telegraf"
617 - "debug-tost"
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000618
619.. note::
620
621 The **terraform_dir** indicates the directory location in aether-pod-configs repo, please ensure your Terraform scripts
622 already there before running the Jenkins job.
623
Charles Chan4a107222020-10-30 17:23:48 -0700624
625Trigger TOST deployment in Jenkins
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700626----------------------------------
627
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000628Whenever a change is merged into **aether-pod-config**,
Charles Chan4a107222020-10-30 17:23:48 -0700629the Jenkins job should be triggered automatically to (re)deploy TOST.
Charles Chan4a107222020-10-30 17:23:48 -0700630
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000631You can also type the comment **apply** in the Gerrit patch, it will trigger Jenkins jobs to deploy TOST for you.
Charles Chan4a107222020-10-30 17:23:48 -0700632
Charles Chan2cb05c72020-12-09 16:31:20 -0800633
634Verification
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700635------------
636
Charles Chan2cb05c72020-12-09 16:31:20 -0800637Fabric connectivity should be fully ready at this point.
638We should verify that **all servers**, including compute nodes and the management server,
639have an IP address and are **able to reach each other via fabric interface** before continuing the next step.
640
641This can be simply done by running a **ping** command from one server to another server's fabric IP.
642
643
Charles Chan4a107222020-10-30 17:23:48 -0700644Troubleshooting
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700645---------------
Charles Chan4a107222020-10-30 17:23:48 -0700646
647The deployment process involves the following steps:
648
6491. Jenkins Job
6502. Jenkins Pipeline
6513. Clone Git Repository
6524. Execute Terraform scripts
6535. Rancher start to install applications
6546. Applications be deployed into Kubernetes cluster
6557. ONOS/Stratum will read the configuration (network config, chassis config)
6568. Pod become running
657
658Taking ONOS as an example, here's what you can do to troubleshoot.
659
660You can see the log message of the first 4 steps in Jenkins console.
661If something goes wrong, the status of the Jenkins job will be in red.
662If Jenkins doesn't report any error message, the next step is going to Rancher's portal
663to ensure the Answers is same as the *onos.yaml* in *aether-pod-configs*.
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700664
665Accessing the Stratum CLI
666"""""""""""""""""""""""""
667
668You can login to the Stratum container running on a switch using this script:
669
670.. code-block:: sh
671
672 #!/bin/bash
673 echo 'Attaching to Stratum container. Ctrl-P Ctrl-Q to exit'
674 echo 'Press Enter to continue...'
675 DOCKER_ID=`docker ps | grep stratum-bf | awk '{print $1}'`
676 docker attach $DOCKER_ID
677
Zack Williams1ae109e2021-07-27 11:17:04 -0700678You should then see the ``bf_sde`` prompt:
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700679
680.. code-block:: sh
681
682 bf_sde> pm
683 bf_sde.pm> show -a
684
685Accessing the ONOS CLI
686""""""""""""""""""""""
687
688After setting up kubectl to access the TOST pods, run:
689
690.. code-block:: sh
691
692 $ kubectl get pods -n tost
693
694Pick a TOST pod, and make a port forward to it, then login to it with the
695``onos`` CLI tool:
696
697.. code-block:: sh
698
699 $ kubectl -n tost port-forward onos-tost-onos-classic-0 8181 8101
700 $ onos karaf@localhost
701
702In some rare cases, you may need to access the ONOS master instance CLI, in
703which case you can run ``roles``:
704
705.. code-block:: sh
706
707 karaf@root > roles
708 device:devswitch1: master=onos-tost-onos-classic-1, standbys=[ onos-tost-onos-classic-0 ]
709
710Above lines show that ``onos-tost-onos-classic-1`` is the master. So switch to
711that by killing the port forward, starting a new one pointing at the master,
712then logging into that one:
713
714.. code-block:: sh
715
716 $ ps ax | grep -i kubectl
717 # returns kubectl commands running, pick the port-forward one and kill it
718 $ kill 0123
719 $ kubectl -n tost port-forward onos-tost-onos-classic-1 8181 8101
720 $ onos karaf@localhost
721