blob: 7943b0ecc0e4e5566e6320071699f6ebb514aac5 [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
Charles Chan4a107222020-10-30 17:23:48 -07005TOST Deployment
6===============
7
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
33 │   ├── main.tf -> ../../../../common/tost/apps/onos/main.tf
34 │   ├── onos-netcfg.json
35 │   ├── onos-netcfg.json.license
36 │   ├── 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
Hyunsun Moonfc751aa2020-11-11 18:49:47 -080075 app_map = {}
Charles Chan4a107222020-10-30 17:23:48 -070076
77ONOS folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -070078"""""""""""
79
Charles Chan4a107222020-10-30 17:23:48 -070080All files under **onos** directory are related to ONOS application.
Hyunsun Moonfc751aa2020-11-11 18:49:47 -080081The **app_map.tfvars** in this folder describes the information about ONOS helm chart.
Charles Chan4a107222020-10-30 17:23:48 -070082
83In this example, we specify the **onos-tost** helm chart version to **0.1.18** and load **onos.yaml**
84as custom value files.
85
86.. code-block::
87
88 apps = ["onos"]
89
90 app_map = {
91 onos = {
92 app_name = "onos-tost"
93 project_name = "tost"
94 target_namespace = "onos-tost"
95 catalog_name = "onos"
96 template_name = "onos-tost"
97 template_version = "0.1.18"
98 values_yaml = ["onos.yaml"]
99 }
100 }
101
102**onos.yaml** used to custom your ONOS-tost Helm chart values and please pay attention to the last section, config.
103
104.. code-block:: yaml
105
106 onos-classic:
107 image:
108 tag: master
109 pullPolicy: Always
110 replicas: 1
111 atomix:
112 replicas: 1
113 logging:
114 config: |
115 # Common pattern layout for appenders
116 log4j2.stdout.pattern = %d{RFC3339} %-5level [%c{1}] %msg%n%throwable
117
118 # Root logger
119 log4j2.rootLogger.level = INFO
120
121 # OSGi appender
122 log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi
123 log4j2.appender.osgi.type = PaxOsgi
124 log4j2.appender.osgi.name = PaxOsgi
125 log4j2.appender.osgi.filter = *
126
127 # stdout appender
128 log4j2.rootLogger.appenderRef.Console.ref = Console
129 log4j2.appender.console.type = Console
130 log4j2.appender.console.name = Console
131 log4j2.appender.console.layout.type = PatternLayout
132 log4j2.appender.console.layout.pattern = ${log4j2.stdout.pattern}
133
134 # SSHD logger
135 log4j2.logger.sshd.name = org.apache.sshd
136 log4j2.logger.sshd.level = INFO
137
138 # Spifly logger
139 log4j2.logger.spifly.name = org.apache.aries.spifly
140 log4j2.logger.spifly.level = WARN
141
142 # SegmentRouting logger
143 log4j2.logger.segmentrouting.name = org.onosproject.segmentrouting
144 log4j2.logger.segmentrouting.level = DEBUG
145
146 config:
147 server: gerrit.opencord.org
148 repo: aether-pod-configs
149 folder: staging/ace-menlo/tost/onos
150 file: onos-netcfg.json
151 netcfgUrl: http://onos-tost-onos-classic-hs.tost.svc:8181/onos/v1/network/configuration
152 clusterUrl: http://onos-tost-onos-classic-hs.tost.svc:8181/onos/v1/cluster
153
154Once the **onos-tost** containers are deployed into Kubernetes,
155it will read **onos-netcfg.json** file from the **aether-pod-config** and please change the folder name to different location if necessary.
156
157**onos-netcfg.json** is environment dependent and please change it to fit your environment.
158
159..
160 TODO: Add an example based on the recommended topology
161
162Stratum folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700163""""""""""""""
164
Charles Chan4a107222020-10-30 17:23:48 -0700165Stratum uses a similar directory structure as ONOS for Terraform and its configuration files.
166
167The customize value file is named **stratum.yaml**
168
169.. code-block::
170
171 app_map = {
172 stratum= {
173 app_name = "stratum"
174 project_name = "tost"
175 target_namespace = "stratum"
176 catalog_name = "stratum"
177 template_name = "stratum"
178 template_version = "0.1.9"
179 values_yaml = ["stratum.yaml"]
180 }
181 }
182
183Like ONOS, **stratum.yaml** used to customize Stratum Helm Chart and please pay attention to the config section.
184
185.. code-block:: yaml
186
187 image:
188 registry: registry.aetherproject.org
189 repository: tost/stratum-bfrt
190 tag: 9.2.0-4.14.49
191 pullPolicy: Always
192 pullSecrets:
193 - aether-registry-credential
194
195 extraParams:
196 - "-max_log_size=0"
197 - '-write_req_log_file=""'
198 - '-read_req_log_file=""'
199 - "-v=0"
200 - "-stderrthreshold=0"
201 - "-bf_switchd_background=false"
202
203 nodeSelector:
204 node-role.aetherproject.org: switch
205
206 tolerations:
207 - effect: NoSchedule
208 value: switch
209 key: node-role.aetherproject.org
210
211 config:
212 server: gerrit.opencord.org
213 repo: aether-pod-configs
214 folder: staging/ace-onf-menlo/tost/stratum
215
216Stratum has the same deployment workflow as ONOS.
217Once it is deployed to Kubernetes, it will read switch-dependent config files from the aether-pod-configs repo.
218The key folder indicates that relative path of configs.
219
220.. attention::
221
222 The switch-dependent config file should be named as **${hostname}-chassis-config.pb.txt**.
223 For example, if the host name of your Tofino switch is **my-leaf**, please name config file **my-leaf-config.pb.txt**.
224
225..
226 TODO: Add an example based on the recommended topology
227
228Telegraf folder
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700229"""""""""""""""
Charles Chan4a107222020-10-30 17:23:48 -0700230
231The app_map.tfvars specify the Helm Chart version and the filename of the custom Helm value file.
232
233.. code-block::
234
235 apps=["telegraf"]
236
237 app_map = {
238 telegraf= {
239 app_name = "telegraf"
240 project_name = "tost"
241 target_namespace = "telegraf"
242 catalog_name = "influxdata"
243 template_name = "telegraf"
244 template_version = "1.7.23"
245 values_yaml = ["telegraf.yaml"]
246 }
247 }
248
249The **telegraf.yaml** used to override the Telegraf Helm Chart and its environment-dependent.
250Please pay attention to the **inputs.addresses** section.
251Telegraf will read data from stratum so we need to specify all Tofino switch’s IP addresses here.
252Taking Menlo staging pod as example, there are four switches so we fill out 4 IP addresses.
253
254.. code-block:: yaml
255
256 podAnnotations:
257 field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":9273,"schema":"HTTP"}]'
258
259 config:
260 outputs:
261 - prometheus_client:
262 metric_version: 2
263 listen: ":9273"
264 inputs:
265 - cisco_telemetry_gnmi:
266 addresses:
267 - 10.92.1.81:9339
268 - 10.92.1.82:9339
269 - 10.92.1.83:9339
270 - 10.92.1.84:9339
271 redial: 10s
272 - cisco_telemetry_gnmi.subscription:
273 name: stratum_counters
274 origin: openconfig-interfaces
275 path: /interfaces/interface[name=*]/state/counters
276 sample_interval: 5000ns
277 subscription_mode: sample
278
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000279
280Create Your Own Configs
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700281"""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000282
283The easiest way to create your own configs is running the template script.
284
285Assumed we would like to set up the **ace-example** pod in the production environment.
286
2871. open the **tools/ace_env**
2882. fill out all required variables
2893. import the environment variables from **tools/ace_env**
2904. perform the makefile command to generate configuration and directory for TOST
2915. update **onos-netcfg.json** for ONOS
2926. update **${hostname}-chassis-config.pb.txt** for Stratum
2937. update all switch IPs in **telegraf.yaml**
2948. commit your change and open the Gerrit patch
295
296.. code-block:: console
297
298 vim tools/ace_env
299 source tools/ace_env
300 make -C tools/ tost
301 vim production/ace-example/tost/onos/onos-netcfg.json
302 vim production/ace-example/tost/stratum/*${hostname}-chassis-config.pb.txt**
303 vim production/ace-example/tost/telegraf/telegraf.yam
304 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
314- **onos-netcfg.json** in **onos** folder
315- 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
577 - project:
578 name: deploy-menlo-tost-dev
579 rancher_cluster: "menlo-tost-dev"
580 terraform_dir: "testing/menlo-tost"
581 rancher_api: "{rancher_testing_access}"
582 jobs:
583 - "deploy"
584 - "deploy-onos"
585 - "deploy-stratum"
586 - "deploy-telegraf"
587 - project:
588 name: deploy-menlo-tost-staging
589 rancher_cluster: "ace-menlo"
590 terraform_dir: "staging/ace-menlo"
591 rancher_api: "{rancher_staging_access}"
592 jobs:
593 - "deploy"
594 - "deploy-onos"
595 - "deploy-stratum"
596 - "deploy-telegraf"
597 - project:
598 name: deploy-menlo-production
599 rancher_cluster: "ace-menlo"
600 terraform_dir: "production/ace-menlo"
601 rancher_api: "{rancher_production_access}"
602 jobs:
603 - "deploy"
604 - "deploy-onos"
605 - "deploy-stratum"
606 - "deploy-telegraf"
607
608
609Create Your Own Jenkins Job
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700610"""""""""""""""""""""""""""
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000611
612Basically, if you don't need to customize the Jenkins pipeline script and the job configuration, the only thing
613you need to do is modify the repos/tost.yaml to add your project.
614
615For example, we would like to deploy the TOST to our production pod, let's assume it named "tost-example".
616Add the following content into repos/tost.yaml
617
618.. code-block:: yaml
619
620 - project:
621 name: deploy-tost-example-production
622 rancher_cluster: "ace-test-example"
623 terraform_dir: "production/tost-example"
624 rancher_api: "{rancher_production_access}"
625 jobs:
626 - "deploy"
627 - "deploy-onos"
628 - "deploy-stratum"
629 - "deploy-telegraf"
630
631
632.. note::
633
634 The **terraform_dir** indicates the directory location in aether-pod-configs repo, please ensure your Terraform scripts
635 already there before running the Jenkins job.
636
Charles Chan4a107222020-10-30 17:23:48 -0700637
638Trigger TOST deployment in Jenkins
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700639----------------------------------
640
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000641Whenever a change is merged into **aether-pod-config**,
Charles Chan4a107222020-10-30 17:23:48 -0700642the Jenkins job should be triggered automatically to (re)deploy TOST.
Charles Chan4a107222020-10-30 17:23:48 -0700643
Hung-Wei Chiuf7cadb32020-11-19 04:49:35 +0000644You 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 -0700645
Charles Chan2cb05c72020-12-09 16:31:20 -0800646
647Verification
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700648------------
649
Charles Chan2cb05c72020-12-09 16:31:20 -0800650Fabric connectivity should be fully ready at this point.
651We should verify that **all servers**, including compute nodes and the management server,
652have an IP address and are **able to reach each other via fabric interface** before continuing the next step.
653
654This can be simply done by running a **ping** command from one server to another server's fabric IP.
655
656
Charles Chan4a107222020-10-30 17:23:48 -0700657Troubleshooting
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700658---------------
Charles Chan4a107222020-10-30 17:23:48 -0700659
660The deployment process involves the following steps:
661
6621. Jenkins Job
6632. Jenkins Pipeline
6643. Clone Git Repository
6654. Execute Terraform scripts
6665. Rancher start to install applications
6676. Applications be deployed into Kubernetes cluster
6687. ONOS/Stratum will read the configuration (network config, chassis config)
6698. Pod become running
670
671Taking ONOS as an example, here's what you can do to troubleshoot.
672
673You can see the log message of the first 4 steps in Jenkins console.
674If something goes wrong, the status of the Jenkins job will be in red.
675If Jenkins doesn't report any error message, the next step is going to Rancher's portal
676to ensure the Answers is same as the *onos.yaml* in *aether-pod-configs*.
Zack Williamsbcc4c2b2021-04-07 16:58:03 -0700677
678Accessing the Stratum CLI
679"""""""""""""""""""""""""
680
681You can login to the Stratum container running on a switch using this script:
682
683.. code-block:: sh
684
685 #!/bin/bash
686 echo 'Attaching to Stratum container. Ctrl-P Ctrl-Q to exit'
687 echo 'Press Enter to continue...'
688 DOCKER_ID=`docker ps | grep stratum-bf | awk '{print $1}'`
689 docker attach $DOCKER_ID
690
691You should then see the bf_sde prompt:
692
693.. code-block:: sh
694
695 bf_sde> pm
696 bf_sde.pm> show -a
697
698Accessing the ONOS CLI
699""""""""""""""""""""""
700
701After setting up kubectl to access the TOST pods, run:
702
703.. code-block:: sh
704
705 $ kubectl get pods -n tost
706
707Pick a TOST pod, and make a port forward to it, then login to it with the
708``onos`` CLI tool:
709
710.. code-block:: sh
711
712 $ kubectl -n tost port-forward onos-tost-onos-classic-0 8181 8101
713 $ onos karaf@localhost
714
715In some rare cases, you may need to access the ONOS master instance CLI, in
716which case you can run ``roles``:
717
718.. code-block:: sh
719
720 karaf@root > roles
721 device:devswitch1: master=onos-tost-onos-classic-1, standbys=[ onos-tost-onos-classic-0 ]
722
723Above lines show that ``onos-tost-onos-classic-1`` is the master. So switch to
724that by killing the port forward, starting a new one pointing at the master,
725then logging into that one:
726
727.. code-block:: sh
728
729 $ ps ax | grep -i kubectl
730 # returns kubectl commands running, pick the port-forward one and kill it
731 $ kill 0123
732 $ kubectl -n tost port-forward onos-tost-onos-classic-1 8181 8101
733 $ onos karaf@localhost
734