blob: 3c572d7f18e2f31826ee55ce2f4bf0fb2c1f3357 [file] [log] [blame]
Matteo Scandolo7781b5b2017-08-08 13:05:26 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Scott Baker7a327592016-06-20 17:34:06 -070017---
18- hosts: 127.0.0.1
19 connection: local
20 vars:
21 appname: {{ appname }}
22 dependencies: {{ dependencies }}
23{% if component_configs %}
24 component_configs:
25{% for component_config in component_configs %}
26 - component: {{ component_config.component }}
27 config_params: {{ component_config.config_params }}
28{% endfor %}
29{% endif %}
30{% if rest_configs %}
Sapan Bhatiaf14cf232017-02-04 08:44:37 -080031 var_rest_configs:
Scott Baker7a327592016-06-20 17:34:06 -070032{% for rest_config in rest_configs %}
33 - endpoint: {{ rest_config.endpoint }}
34 body: "{{ '{{' }} lookup('file', '{{ files_dir }}/{{ rest_config.fn }}') {{ '}}' }}"
35{% endfor %}
36{% endif %}
Scott Baker7a327592016-06-20 17:34:06 -070037 rest_hostname: {{ rest_hostname }}
38 rest_port: {{ rest_port }}
39
40 tasks:
Andy Bavier4a503b12016-06-21 11:41:29 -040041{% if install_dependencies %}
Andy Bavier4a503b12016-06-21 11:41:29 -040042 - name: Install ONOS apps by URL
Scott Baker726bfce2017-10-04 16:43:39 -070043 uri:
44 url: "http://{{ rest_hostname }}:{{ rest_port }}/{{ '{{' }} item.endpoint {{ '}}' }}"
45 body: "{{ '{{' }} item.body | to_json {{ '}}' }}"
Scott Baker0c62dfa2017-11-21 09:15:43 -080046 user: {{ rest_username }}
47 password: {{ rest_password }}
Scott Baker726bfce2017-10-04 16:43:39 -070048 body_format: json
49 method: POST
Scott Baker25cb3e92017-10-09 22:16:52 -070050 status_code: 200, 409
Andy Bavier4a503b12016-06-21 11:41:29 -040051 with_items:
52 {% for install_dependency in install_dependencies %}
53 - endpoint: "onos/v1/applications"
54 body:
55 url: "{{ install_dependency }}"
56 activate: "true"
57 {% endfor %}
58{% endif %}
59
Scott Baker7a327592016-06-20 17:34:06 -070060{% if dependencies %}
61 - name: Add dependencies to ONOS
62 uri:
Andy Bavier4a503b12016-06-21 11:41:29 -040063 url: http://{{ rest_hostname }}:{{ rest_port }}/onos/v1/applications/{{ '{{' }} item {{ '}}' }}/active
Scott Baker7a327592016-06-20 17:34:06 -070064 method: POST
65 user: karaf
66 password: karaf
67 with_items:
68 {% for dependency in dependencies %}
69 - {{ dependency }}
70 {% endfor %}
71{% endif %}
72
Scott Bakerd84abe82017-10-19 09:51:10 -070073{% if component_configs %}
74 - name: Add ONOS component configuration values
75 uri:
76 url: http://{{ rest_hostname }}:{{ rest_port }}/onos/v1/configuration/{{ '{{' }} item.component {{ '}}' }} #http://localhost:8181/onos/v1/configuration/
77 body: "{{ '{{' }} item.config_params {{ '}}' }}"
78 body_format: json
79 method: POST
80 user: karaf
81 password: karaf
82 with_items: "{{ '{{' }} component_configs {{ '}}' }}"
83{% endif %}
84
Scott Baker7a327592016-06-20 17:34:06 -070085{% if rest_configs %}
86# Do this after services have been activated, or it will cause an exception.
87# vOLT will re-read its net config; vbng may not.
88 - name: Add ONOS configuration values
89 uri:
Andy Bavier4a503b12016-06-21 11:41:29 -040090 url: http://{{ rest_hostname }}:{{ rest_port }}/{{ '{{' }} item.endpoint {{ '}}' }} #http://localhost:8181/onos/v1/network/configuration/
Scott Baker7a327592016-06-20 17:34:06 -070091 body: "{{ '{{' }} item.body {{ '}}' }}"
Zack Williamsd60c7732016-06-27 13:15:21 -070092 body_format: json
Scott Baker7a327592016-06-20 17:34:06 -070093 method: POST
94 user: karaf
95 password: karaf
Sapan Bhatiaf14cf232017-02-04 08:44:37 -080096 with_items: "{{ '{{' }} var_rest_configs {{ '}}' }}"
Scott Baker7a327592016-06-20 17:34:06 -070097{% endif %}