blob: 29b8153ccdd43c6ac2bbc7e1e78b866014c0c1f1 [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
8Update aether-pod-config
Zack Williamsbcc4c2b2021-04-07 16:58:03 -07009------------------------
Charles Chan4a107222020-10-30 17:23:48 -070010
11Aether-pod-configs is a git project hosted on **gerrit.opencord.org** and we placed the following materials in it.
12
13- Terraform scripts to install TOST applications on Rancher, including ONOS, Stratum and Telegraf.
14- Customized configuration for each application (helm values).
15- Application specific configuration files, including ONOS network configuration and Stratum chassis config.
16
17Here is an example folder structure:
18
19.. code-block:: console
20
21 ╰─$ tree staging/ace-menlo/tost
22 staging/ace-menlo/tost
23 ├── app_map.tfvars
24 ├── backend.tf
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000025 ├── deepinsight
26 │   ├── README.md
27 │   ├── deepinsight-topo.json
28 │   └── deepinsight-topo.json.license
29 ├── main.tf -> ../../../common/tost/main.tf
Charles Chan4a107222020-10-30 17:23:48 -070030 ├── onos
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000031 │   ├── app_map.tfvars
32 │   ├── backend.tf
Hung-Wei Chiud06947b2021-08-10 16:10:07 -070033 │   ├── kubeconfig -> ../../../../common/tost/apps/onos/kubeconfig/
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000034 │   ├── main.tf -> ../../../../common/tost/apps/onos/main.tf
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000035 │   ├── onos.yaml
36 │   └── variables.tf -> ../../../../common/tost/apps/onos/variables.tf
Charles Chan4a107222020-10-30 17:23:48 -070037 ├── stratum
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000038 │   ├── app_map.tfvars
39 │   ├── backend.tf
40 │   ├── main.tf -> ../../../../common/tost/apps/stratum/main.tf
41 │   ├── menlo-staging-leaf-1-chassis-config.pb.txt
42 │   ├── menlo-staging-leaf-2-chassis-config.pb.txt
43 │   ├── menlo-staging-spine-1-chassis-config.pb.txt
44 │   ├── menlo-staging-spine-2-chassis-config.pb.txt
45 │   ├── stratum.yaml
46 │   ├── tost-dev-chassis-config.pb.txt
47 │   └── variables.tf -> ../../../../common/tost/apps/stratum/variables.tf
Charles Chan4a107222020-10-30 17:23:48 -070048 ├── telegraf
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +000049 │   ├── app_map.tfvars
50 │   ├── backend.tf
51 │   ├── main.tf -> ../../../../common/tost/apps/telegraf/main.tf
52 │   ├── telegraf.yaml
53 │   └── variables.tf -> ../../../../common/tost/apps/telegraf/variables.tf
54 └── variables.tf -> ../../../common/tost/variables.tf
Charles Chan4a107222020-10-30 17:23:48 -070055
56There are four Terraform scripts inside **tost** directory and are responsible for managing each service.
57
58Root folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -070059"""""""""""
60
Charles Chan4a107222020-10-30 17:23:48 -070061Terraform reads **app_map.tfvars** to know which application will be installed on Rancher
62and which version and customized values need to apply to.
63
Hyunsun Moonfc751aa2020-11-11 18:49:47 -080064Here is the example of **app_map.tfvars** which defines prerequisite apps for TOST
65as well as project and namespace in which TOST apps will be provisioned.
66Note that currently we don't have any prerequisite so we left this blank intentionally.
67It can be used to specify prerequisites in the future.
Charles Chan4a107222020-10-30 17:23:48 -070068
69.. code-block::
70
71 project_name = "tost"
72 namespace_name = "tost"
73
Charles Chan4a107222020-10-30 17:23:48 -070074
75ONOS folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -070076"""""""""""
77
Charles Chan4a107222020-10-30 17:23:48 -070078All files under **onos** directory are related to ONOS application.
Hyunsun Moonfc751aa2020-11-11 18:49:47 -080079The **app_map.tfvars** in this folder describes the information about ONOS helm chart.
Charles Chan4a107222020-10-30 17:23:48 -070080
81In this example, we specify the **onos-tost** helm chart version to **0.1.18** and load **onos.yaml**
82as custom value files.
83
84.. code-block::
85
86 apps = ["onos"]
87
88 app_map = {
89 onos = {
90 app_name = "onos-tost"
91 project_name = "tost"
92 target_namespace = "onos-tost"
93 catalog_name = "onos"
94 template_name = "onos-tost"
Hung-Wei Chiud06947b2021-08-10 16:10:07 -070095 template_version = "0.1.40"
Charles Chan4a107222020-10-30 17:23:48 -070096 values_yaml = ["onos.yaml"]
97 }
98 }
99
100**onos.yaml** used to custom your ONOS-tost Helm chart values and please pay attention to the last section, config.
101
102.. code-block:: yaml
103
104 onos-classic:
105 image:
106 tag: master
107 pullPolicy: Always
108 replicas: 1
109 atomix:
110 replicas: 1
111 logging:
112 config: |
113 # Common pattern layout for appenders
114 log4j2.stdout.pattern = %d{RFC3339} %-5level [%c{1}] %msg%n%throwable
115
116 # Root logger
117 log4j2.rootLogger.level = INFO
118
119 # OSGi appender
120 log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi
121 log4j2.appender.osgi.type = PaxOsgi
122 log4j2.appender.osgi.name = PaxOsgi
123 log4j2.appender.osgi.filter = *
124
125 # stdout appender
126 log4j2.rootLogger.appenderRef.Console.ref = Console
127 log4j2.appender.console.type = Console
128 log4j2.appender.console.name = Console
129 log4j2.appender.console.layout.type = PatternLayout
130 log4j2.appender.console.layout.pattern = ${log4j2.stdout.pattern}
131
132 # SSHD logger
133 log4j2.logger.sshd.name = org.apache.sshd
134 log4j2.logger.sshd.level = INFO
135
136 # Spifly logger
137 log4j2.logger.spifly.name = org.apache.aries.spifly
138 log4j2.logger.spifly.level = WARN
139
140 # SegmentRouting logger
141 log4j2.logger.segmentrouting.name = org.onosproject.segmentrouting
142 log4j2.logger.segmentrouting.level = DEBUG
143
144 config:
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700145 netcfg: >
146 {
147 "devices": {
148 "device:leaf1": {
149 "segmentrouting": {
150 "ipv4NodeSid": 201,
151 "ipv4Loopback": "10.128.100.38",
152 "routerMac": "00:00:0A:80:64:26",
153 "isEdgeRouter": true,
154 "adjacencySids": []
155 },
156 }
157 }
158 }
Charles Chan4a107222020-10-30 17:23:48 -0700159
Charles Chan4a107222020-10-30 17:23:48 -0700160
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700161**config.netcfg** is environment dependent and please change it to fit your environment.
Charles Chan4a107222020-10-30 17:23:48 -0700162
163..
164 TODO: Add an example based on the recommended topology
165
166Stratum folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700167""""""""""""""
168
Charles Chan4a107222020-10-30 17:23:48 -0700169Stratum uses a similar directory structure as ONOS for Terraform and its configuration files.
170
171The customize value file is named **stratum.yaml**
172
173.. code-block::
174
175 app_map = {
176 stratum= {
177 app_name = "stratum"
178 project_name = "tost"
179 target_namespace = "stratum"
180 catalog_name = "stratum"
181 template_name = "stratum"
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700182 template_version = "0.1.13"
Charles Chan4a107222020-10-30 17:23:48 -0700183 values_yaml = ["stratum.yaml"]
184 }
185 }
186
187Like ONOS, **stratum.yaml** used to customize Stratum Helm Chart and please pay attention to the config section.
188
189.. code-block:: yaml
190
191 image:
192 registry: registry.aetherproject.org
193 repository: tost/stratum-bfrt
194 tag: 9.2.0-4.14.49
195 pullPolicy: Always
196 pullSecrets:
197 - aether-registry-credential
198
199 extraParams:
200 - "-max_log_size=0"
201 - '-write_req_log_file=""'
202 - '-read_req_log_file=""'
203 - "-v=0"
204 - "-stderrthreshold=0"
205 - "-bf_switchd_background=false"
206
207 nodeSelector:
208 node-role.aetherproject.org: switch
209
210 tolerations:
211 - effect: NoSchedule
212 value: switch
213 key: node-role.aetherproject.org
214
215 config:
216 server: gerrit.opencord.org
217 repo: aether-pod-configs
218 folder: staging/ace-onf-menlo/tost/stratum
219
220Stratum has the same deployment workflow as ONOS.
221Once it is deployed to Kubernetes, it will read switch-dependent config files from the aether-pod-configs repo.
222The key folder indicates that relative path of configs.
223
224.. attention::
225
226 The switch-dependent config file should be named as **${hostname}-chassis-config.pb.txt**.
227 For example, if the host name of your Tofino switch is **my-leaf**, please name config file **my-leaf-config.pb.txt**.
228
229..
230 TODO: Add an example based on the recommended topology
231
232Telegraf folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700233"""""""""""""""
Charles Chan4a107222020-10-30 17:23:48 -0700234
235The app_map.tfvars specify the Helm Chart version and the filename of the custom Helm value file.
236
237.. code-block::
238
239 apps=["telegraf"]
Charles Chan4a107222020-10-30 17:23:48 -0700240 app_map = {
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700241 telegraf = {
242 app_name = "telegraf"
243 project_name = "tost"
244 target_namespace = "tost"
245 catalog_name = "aether"
246 template_name = "tost-telegraf"
247 template_version = "0.1.1"
248 values_yaml = ["telegraf.yaml"]
249 }
Charles Chan4a107222020-10-30 17:23:48 -0700250 }
251
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700252The **telegraf.yaml** used to override the ONOS-Telegraf Helm Chart and its environment-dependent.
Charles Chan4a107222020-10-30 17:23:48 -0700253Please pay attention to the **inputs.addresses** section.
254Telegraf will read data from stratum so we need to specify all Tofino switch’s IP addresses here.
255Taking Menlo staging pod as example, there are four switches so we fill out 4 IP addresses.
256
257.. code-block:: yaml
258
259 podAnnotations:
260 field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":9273,"schema":"HTTP"}]'
261
262 config:
263 outputs:
264 - prometheus_client:
265 metric_version: 2
266 listen: ":9273"
267 inputs:
268 - cisco_telemetry_gnmi:
269 addresses:
270 - 10.92.1.81:9339
271 - 10.92.1.82:9339
272 - 10.92.1.83:9339
273 - 10.92.1.84:9339
274 redial: 10s
275 - cisco_telemetry_gnmi.subscription:
276 name: stratum_counters
277 origin: openconfig-interfaces
278 path: /interfaces/interface[name=*]/state/counters
279 sample_interval: 5000ns
280 subscription_mode: sample
281
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000282
283Create Your Own Configs
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700284"""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000285
286The easiest way to create your own configs is running the template script.
287
288Assumed we would like to set up the **ace-example** pod in the production environment.
289
Hung-Wei Chiud06947b2021-08-10 16:10:07 -07002901. 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 +00002912. fill out all required variables
Hung-Wei Chiud06947b2021-08-10 16:10:07 -07002923. perform the makefile command to generate configuration and directory for TOST
2934. update **onos.yaml** for ONOS
2945. update **${hostname}-chassis-config.pb.txt** for Stratum
2956. commit your change and open the Gerrit patch
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000296
297.. code-block:: console
298
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700299 vim tools/ace_config.yaml
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000300 make -C tools/ tost
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700301 vim production/ace-example/tost/onos/onos.yaml
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000302 vim production/ace-example/tost/stratum/*${hostname}-chassis-config.pb.txt**
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000303 git add commit
304 git review
305
306
Charles Chan4a107222020-10-30 17:23:48 -0700307Quick recap
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700308"""""""""""
Charles Chan4a107222020-10-30 17:23:48 -0700309
310To recap, most of the files in **tost** folder can be copied from existing examples.
311However, there are a few files we need to pay extra attentions to.
312
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700313- **onos.yaml** in **onos** folder
Charles Chan4a107222020-10-30 17:23:48 -0700314- Chassis config in **stratum** folder
Zack Williams794532a2021-03-18 17:38:36 -0700315 There should be one chassis config for each switch. The file name needs to be
316 **${hostname}-chassis-config.pb.txt**
317- **telegraf.yaml** in **telegraf** folder need to be updated with all switch
318 IP addresses
Charles Chan4a107222020-10-30 17:23:48 -0700319
320Double check these files and make sure they have been updated accordingly.
321
322
323Create a review request
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700324"""""""""""""""""""""""
325
Zack Williams794532a2021-03-18 17:38:36 -0700326We also need to create a gerrit review request, similar to what we have done in
327the **Aether Runtime Deployment**.
328
329Please refer to :doc:`Aether Runtime Deployment <runtime_deployment>` to
330create a review request.
Charles Chan4a107222020-10-30 17:23:48 -0700331
332
333Create TOST deployment job in Jenkins
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700334-------------------------------------
335
Zack Williams794532a2021-03-18 17:38:36 -0700336There are three major components in the Jenkins system, the Jenkins pipeline
337and Jenkins Job Builder and Jenkins Job.
Charles Chan4a107222020-10-30 17:23:48 -0700338
Zack Williams794532a2021-03-18 17:38:36 -0700339We follow the Infrastructure as Code principle to place three major components
340in a Git repo, ``aether-ci-management``
341
342Download the ``aether-ci-management`` repository.
Charles Chan4a107222020-10-30 17:23:48 -0700343
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000344.. code-block:: shell
345
346 $ cd $WORKDIR
347 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-ci-management"
348
349
Zack Williams794532a2021-03-18 17:38:36 -0700350Here is the example of folder structure, we put everything related to three
351major components under the jjb folder.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000352
353.. code-block:: console
354
355 $ tree -d jjb
356 jjb
357 ├── ci-management
358 ├── global
359 │   ├── jenkins-admin -> ../../global-jjb/jenkins-admin
360 │   ├── jenkins-init-scripts -> ../../global-jjb/jenkins-init-scripts
361 │   ├── jjb -> ../../global-jjb/jjb
362 │   └── shell -> ../../global-jjb/shell
363 ├── pipeline
364 ├── repos
365 ├── shell
366 └── templates
Charles Chan4a107222020-10-30 17:23:48 -0700367
368
369Jenkins pipeline
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700370""""""""""""""""
371
Zack Williams794532a2021-03-18 17:38:36 -0700372Jenkins pipeline runs the Terraform scripts to install desired applications
373into the specified Kubernetes cluster.
Charles Chan4a107222020-10-30 17:23:48 -0700374
Zack Williams794532a2021-03-18 17:38:36 -0700375Both ONOS and Stratum will read configuration files (network config, chassis
376config) from aether-pod-config.
377
378The default git branch is master. For testing purpose, we also provide two
379parameters to specify the number of reviews and patchset.
380
Charles Chan4a107222020-10-30 17:23:48 -0700381We will explain more in the next section.
382
383.. note::
384
385 Currently, we don’t perform the incremental upgrade for TOST application.
386 Instead, we perform the clean installation.
Zack Williams794532a2021-03-18 17:38:36 -0700387 In the pipeline script, Terraform will destroy all existing resources and
388 then create them again.
Charles Chan4a107222020-10-30 17:23:48 -0700389
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000390
Zack Williams794532a2021-03-18 17:38:36 -0700391We put all pipeline scripts under the pipeline directory, the language of the
392pipeline script is groovy.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000393
394.. code-block:: console
395
396 $ tree pipeline
397 pipeline
398 ├── aether-in-a-box.groovy
399 ├── artifact-release.groovy
400 ├── cd-pipeline-charts-postrelease.groovy
401 ├── cd-pipeline-dockerhub-postrelease.groovy
402 ├── cd-pipeline-postrelease.groovy
403 ├── cd-pipeline-terraform.groovy
404 ├── docker-publish.groovy
405 ├── ng40-func.groovy
406 ├── ng40-scale.groovy
407 ├── reuse-scan-gerrit.groovy
408 ├── reuse-scan-github.groovy
409 ├── tost-onos.groovy
410 ├── tost-stratum.groovy
411 ├── tost-telegraf.groovy
412 └── tost.groovy
413
414Currently, we had four pipeline scripts for TOST deployment.
415
4161. tost-onos.groovy
4172. tost-stratum.groovy
4183. tost-telegraf.groovy
4194. tost.groovy
420
Zack Williams794532a2021-03-18 17:38:36 -0700421tost-[onos/stratum/telegraf].groovy are used to deploy the individual
422application respectively, and tost.groovy is a high level script, used to
423deploy the TOST application, it will execute the above three scripts in its
424pipeline script.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000425
426
Charles Chan4a107222020-10-30 17:23:48 -0700427Jenkins jobs
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700428""""""""""""
Charles Chan4a107222020-10-30 17:23:48 -0700429
430Jenkins job is the task unit in the Jenkins system. A Jenkins job contains the following information:
431
432- Jenkins pipeline
433- Parameters for Jenkins pipeline
434- Build trigger
435- Source code management
436
437We created one Jenkins job for each TOST component, per Aether edge.
Charles Chan4a107222020-10-30 17:23:48 -0700438
Zack Williams794532a2021-03-18 17:38:36 -0700439We have four Jenkins jobs (HostPath provisioner, ONOS, Stratum and Telegraf)
440for each edge as of today.
441
442There are 10+ parameters in Jenkins jobs and they can be divided into two
443parts, cluster-level and application-level.
444
Charles Chan4a107222020-10-30 17:23:48 -0700445Here is an example of supported parameters.
446
447.. image:: images/jenkins-onos-params.png
448 :width: 480px
449
450Application level
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700451'''''''''''''''''
Charles Chan4a107222020-10-30 17:23:48 -0700452
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000453- **GERRIT_CHANGE_NUMBER/GERRIT_PATCHSET_NUMBER**: tell the pipeline script to read
454 the config for aether-pod-configs repo from a specified gerrit review, instead of the
455 HEAD branch. It’s good for developer to test its change before merge.
456- **onos_user**: used to login ONOS controller
Zack Williams794532a2021-03-18 17:38:36 -0700457- **git_repo/git_server/git_user/git_password_env**: information of git
458 repository, **git_password_env** is a key for Jenkins Credential system.
Charles Chan4a107222020-10-30 17:23:48 -0700459
460Cluster level
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700461'''''''''''''
462
Zack Williams794532a2021-03-18 17:38:36 -0700463- **gcp_credential**: Google Cloud Platform credential for remote storage, used
464 by Terraform.
Charles Chan4a107222020-10-30 17:23:48 -0700465- **terraform_dir**: The root directory of the TOST directory.
466- **rancher_cluster**: target Rancher cluster name.
467- **rancher_api_env**: Rancher credential to access Rancher, used by Terraform.
Charles Chan4a107222020-10-30 17:23:48 -0700468
469.. note::
470
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000471 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 -0700472
473Jenkins Job Builder (JJB)
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700474"""""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000475
Zack Williams794532a2021-03-18 17:38:36 -0700476We prefer to apply the IaC (Infrastructure as Code) for everything. We use the
477JJB (Jenkins Job Builder) to create new Jenkins Job, including the Jenkins
478pipeline. We need to clone a set of Jenkins jobs when a new edge is deployed.
Charles Chan4a107222020-10-30 17:23:48 -0700479
Zack Williams794532a2021-03-18 17:38:36 -0700480In order to provide the flexibility and avoid re-inventing the wheel, we used
481the job template to declare your job. Thanks to the JJB, we can use the
482parameters in the job template to render different kinds of jobs easily.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000483
484All the template files are placed under templates directory.
485
486.. code-block:: console
487
488 ╰─$ tree templates
489 templates
490 ├── aether-in-a-box.yaml
491 ├── archive-artifacts.yaml
492 ├── artifact-release.yml
493 ├── cd-pipeline-terraform.yaml
494 ├── docker-publish-github.yaml
495 ├── docker-publish.yaml
496 ├── helm-lint.yaml
497 ├── make-test.yaml
498 ├── ng40-nightly.yaml
499 ├── ng40-test.yaml
500 ├── private-docker-publish.yaml
501 ├── private-make-test.yaml
502 ├── publish-helm-repo.yaml
503 ├── reuse-gerrit.yaml
504 ├── reuse-github.yaml
505 ├── sync-dir.yaml
506 ├── tost.yaml
507 ├── verify-licensed.yaml
508 └── versioning.yaml
509
Zack Williams794532a2021-03-18 17:38:36 -0700510We defined all TOST required job templates in tost.yaml and here is its partial
511content.
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000512
513.. code-block:: yaml
514
515 - job-template:
516 name: "{name}-onos"
517 id: "deploy-onos"
518 project-type: pipeline
519 dsl: !include-raw-escape: jjb/pipeline/tost-onos.groovy
520 triggers:
521 - onf-infra-tost-gerrit-trigger:
522 gerrit-server-name: '{gerrit-server-name}'
523 trigger_command: "apply"
524 pattern: "{terraform_dir}/tost/onos/.*"
525 logrotate:
526 daysToKeep: 7
527 numToKeep: 10
528 artifactDaysToKeep: 7
529 artifactNumToKeep: 10
530 parameters:
531 - string:
532 name: gcp_credential
533 default: "{google_bucket_access}"
534 - string:
535 name: rancher_cluster
536 default: "{rancher_cluster}"
537 - string:
538 name: rancher_api_env
539 default: "{rancher_api}"
540 - string:
541 name: git_repo
542 default: "aether-pod-configs"
543 - string:
544 name: git_server
545 default: "gerrit.opencord.org"
546 - string:
547 name: git_ssh_user
548 default: "jenkins"
549
550
551
552
553Once we have the job template, we need to tell the JJB, we want to use the job template to create our own jobs.
554Here comes the concept of project, you need to define job templates you want to use and the values of all parameters.
555
556
557We put all project yaml files under the repo directory and here is the example
558
559.. code-block:: console
560
561 ╰─$ tree repos 130 ↵
562 repos
563 ├── aether-helm-charts.yaml
564 ├── aether-in-a-box.yaml
565 ├── cd-pipeline-terraform.yaml
566 ├── ng40-test.yaml
567 ├── spgw.yaml
568 └── tost.yaml
569
570
571Following is the example of tost projects, we defined three projects here, and each project has different
572parameters and Jenkins jobs it wants to use.
573
574.. code-block:: yaml
575
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700576
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000577 - project:
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700578 name: deploy-tucson-pairedleaves-dev
579 rancher_cluster: "dev-pairedleaves-tucson"
580 terraform_dir: "staging/dev-pairedleaves-tucson"
581 rancher_api: "{rancher_staging_access}"
582 properties:
583 - onf-infra-onfstaff-private
584 jobs:
585 - "deploy"
586 - "deploy-onos"
587 - "deploy-stratum"
588 - "deploy-telegraf"
589 - "debug-tost"
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000590
591
592Create Your Own Jenkins Job
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700593"""""""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000594
595Basically, if you don't need to customize the Jenkins pipeline script and the job configuration, the only thing
596you need to do is modify the repos/tost.yaml to add your project.
597
598For example, we would like to deploy the TOST to our production pod, let's assume it named "tost-example".
599Add the following content into repos/tost.yaml
600
601.. code-block:: yaml
602
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000603
Hung-Wei Chiud06947b2021-08-10 16:10:07 -0700604 - project:
605 name: deploy-tost-example-production
606 rancher_cluster: "ace-test-example"
607 terraform_dir: "production/tost-example"
608 rancher_api: "{rancher_production_access}"
609 properties:
610 - onf-infra-onfstaff-private
611 jobs:
612 - "deploy"
613 - "deploy-onos"
614 - "deploy-stratum"
615 - "deploy-telegraf"
616 - "debug-tost"
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000617
618.. note::
619
620 The **terraform_dir** indicates the directory location in aether-pod-configs repo, please ensure your Terraform scripts
621 already there before running the Jenkins job.
622
Charles Chan4a107222020-10-30 17:23:48 -0700623
624Trigger TOST deployment in Jenkins
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700625----------------------------------
626
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000627Whenever a change is merged into **aether-pod-config**,
Charles Chan4a107222020-10-30 17:23:48 -0700628the Jenkins job should be triggered automatically to (re)deploy TOST.
Charles Chan4a107222020-10-30 17:23:48 -0700629
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000630You 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 -0700631
Charles Chan2cb05c72020-12-09 16:31:20 -0800632
633Verification
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700634------------
635
Charles Chan2cb05c72020-12-09 16:31:20 -0800636Fabric connectivity should be fully ready at this point.
637We should verify that **all servers**, including compute nodes and the management server,
638have an IP address and are **able to reach each other via fabric interface** before continuing the next step.
639
640This can be simply done by running a **ping** command from one server to another server's fabric IP.
641
642
Charles Chan4a107222020-10-30 17:23:48 -0700643Troubleshooting
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700644---------------
Charles Chan4a107222020-10-30 17:23:48 -0700645
646The deployment process involves the following steps:
647
6481. Jenkins Job
6492. Jenkins Pipeline
6503. Clone Git Repository
6514. Execute Terraform scripts
6525. Rancher start to install applications
6536. Applications be deployed into Kubernetes cluster
6547. ONOS/Stratum will read the configuration (network config, chassis config)
6558. Pod become running
656
657Taking ONOS as an example, here's what you can do to troubleshoot.
658
659You can see the log message of the first 4 steps in Jenkins console.
660If something goes wrong, the status of the Jenkins job will be in red.
661If Jenkins doesn't report any error message, the next step is going to Rancher's portal
662to ensure the Answers is same as the *onos.yaml* in *aether-pod-configs*.
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700663
664Accessing the Stratum CLI
665"""""""""""""""""""""""""
666
667You can login to the Stratum container running on a switch using this script:
668
669.. code-block:: sh
670
671 #!/bin/bash
672 echo 'Attaching to Stratum container. Ctrl-P Ctrl-Q to exit'
673 echo 'Press Enter to continue...'
674 DOCKER_ID=`docker ps | grep stratum-bf | awk '{print $1}'`
675 docker attach $DOCKER_ID
676
677You should then see the bf_sde prompt:
678
679.. code-block:: sh
680
681 bf_sde> pm
682 bf_sde.pm> show -a
683
684Accessing the ONOS CLI
685""""""""""""""""""""""
686
687After setting up kubectl to access the TOST pods, run:
688
689.. code-block:: sh
690
691 $ kubectl get pods -n tost
692
693Pick a TOST pod, and make a port forward to it, then login to it with the
694``onos`` CLI tool:
695
696.. code-block:: sh
697
698 $ kubectl -n tost port-forward onos-tost-onos-classic-0 8181 8101
699 $ onos karaf@localhost
700
701In some rare cases, you may need to access the ONOS master instance CLI, in
702which case you can run ``roles``:
703
704.. code-block:: sh
705
706 karaf@root > roles
707 device:devswitch1: master=onos-tost-onos-classic-1, standbys=[ onos-tost-onos-classic-0 ]
708
709Above lines show that ``onos-tost-onos-classic-1`` is the master. So switch to
710that by killing the port forward, starting a new one pointing at the master,
711then logging into that one:
712
713.. code-block:: sh
714
715 $ ps ax | grep -i kubectl
716 # returns kubectl commands running, pick the port-forward one and kill it
717 $ kill 0123
718 $ kubectl -n tost port-forward onos-tost-onos-classic-1 8181 8101
719 $ onos karaf@localhost
720