blob: 76ff563084e859eca4bca9282fd5349850c14e3a [file] [log] [blame]
Hong Guan9000c852018-05-02 13:25:14 -04001# ============LICENSE_START==========================================
2# ===================================================================
3# Copyright (c) 2017 AT&T
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#============LICENSE_END============================================
17
Jun Hu07f67512017-11-17 14:13:49 -050018###########################################################
19# This Blueprint installs ONAP policy on Openstack
20###########################################################
21
22tosca_definitions_version: cloudify_dsl_1_3
23
24description: >
25 This blueprint creates a ONAP policy
26
27imports:
28 - http://www.getcloudify.org/spec/cloudify/4.1/types.yaml
29 - http://cloudify.co/spec/openstack-plugin/2.2.0/plugin.yaml
30 - http://cloudify.co/spec/fabric-plugin/1.5/plugin.yaml
31 - http://www.getcloudify.org/spec/diamond-plugin/1.3.3/plugin.yaml
32
33inputs:
34 nexus_repo:
35 type: string
36 default: https://nexus.onap.org/content/sites/raw
37
38 docker_repo:
39 type: string
40 default: nexus3.onap.org:10001
41
42 nexus_username:
43 type: string
44 default: docker
45
46 nexus_password:
47 type: string
48 default: docker
49
50 artifacts_version:
51 type: string
52 default: 1.1.0-SNAPSHOT
53
54 dns_ip:
55 type: string
56
57 cloud_env:
58 type: string
59 default: openstack
60
61 docker_version:
62 type: string
63 default: v1.1.1
64
65 gerrit_branch:
66 type: string
67 default: master
68
69 external_dns:
70 type: string
71
72 policy_repo:
73 type: string
74 default: http://gerrit.onap.org/r/policy/docker.git
75
76 vm_instancename:
77 type: string
78
79 image:
80 description: |
81 A Ubuntu 14.04 image, along with the usual
82 type: string
83 default: Ubuntu 16.04 LTS Generic
84
85 flavor:
86 description: >
87 A machine type with more than 2 CPUs, 4096 GB RAM, and 8 GB of disk space.
88 You might want to use 4 CPUs, 8192 MB RAM for the master.
89 type: string
90 default: m1.xlarge
91
92 ssh_user:
93 description: |
94 User for connecting to agent VM
95 type: string
96 default: ubuntu
97
98 security_group:
99 description: openstack security_group
100 type: string
101
102 keypair_name:
103 description: |
104 OpenStack keypair name
105 type: string
106
107 key_filename:
108 type: string
109
110 external_network:
111 type: string
112
113 app_subnet:
114 type: string
115
116
117 openstack_username:
118 type: string
119 description: username to authenticate to OpenStack
120
121 openstack_password:
122 type: string
123 description: OpenStack tenant password for openstack_username user
124
125 openstack_tenant_name:
126 type: string
127 description: OpenStack tenant for VM deploy
128
129 openstack_auth_url:
130 type: string
131 description: Authentication URL for OpenStack
132
133 openstack_region:
134 type: string
135 description: OpenStack region
136
137dsl_definitions:
138 openstack_credentials: &openstack_credentials
139 username: { get_input: openstack_username }
140 password: { get_input: openstack_password }
141 tenant_name: { get_input: openstack_tenant_name }
142 auth_url: { get_input: openstack_auth_url }
143 region: { get_input: openstack_region }
144
145node_templates:
146
147 key_pair:
148 type: cloudify.openstack.nodes.KeyPair
149 properties:
150 private_key_path: { get_input: key_filename }
151 use_external_resource: true
152 resource_id: { get_input: keypair_name }
153 openstack_config: *openstack_credentials
154
155 private_net:
156 type: cloudify.openstack.nodes.Network
157 properties:
158 use_external_resource: true
159 resource_id: { get_input: app_subnet }
160 openstack_config: *openstack_credentials
161
162 external_network:
163 type: cloudify.openstack.nodes.Network
164 properties:
165 openstack_config: *openstack_credentials
166 use_external_resource: true
167 resource_id: { get_input: external_network}
168
169 app_security_group:
170 type: cloudify.openstack.nodes.SecurityGroup
171 properties:
172 openstack_config: *openstack_credentials
173 use_external_resource: true
174 resource_id: { get_input: security_group }
175
176 VM_001_fixed_ip:
177 type: cloudify.openstack.nodes.Port
178 properties:
179 openstack_config: *openstack_credentials
180 relationships:
181 - type: cloudify.relationships.contained_in
182 target: private_net
183 - type: cloudify.openstack.port_connected_to_security_group
184 target: app_security_group
185
186 VM_001_floating_ip:
187 type: cloudify.openstack.nodes.FloatingIP
188 properties:
189 openstack_config: *openstack_credentials
190 interfaces:
191 cloudify.interfaces.lifecycle:
192 create:
193 inputs:
194 args:
195 floating_network_name: { get_input: external_network }
196
197 VM_001:
198 type: cloudify.openstack.nodes.Server
199 properties:
200 openstack_config: *openstack_credentials
201 install_agent: false
202 image: { get_input: image }
203 flavor: { get_input: flavor }
204 resource_id: { get_input: vm_instancename }
205 management_network_name: { get_input: app_subnet }
206 ip: { get_attribute: [VM_001_floating_ip, floating_ip_address] }
207 relationships:
208 - type: cloudify.openstack.server_connected_to_floating_ip
209 target: VM_001_floating_ip
210 - type: cloudify.openstack.server_connected_to_keypair
211 target: key_pair
212 - type: cloudify.openstack.server_connected_to_port
213 target: VM_001_fixed_ip
214
215
216 app_001:
217 type: cloudify.nodes.SoftwareComponent
218 properties:
219 interfaces:
220 cloudify.interfaces.lifecycle:
221 start:
222 implementation: fabric.fabric_plugin.tasks.run_script
223 inputs:
224 script_path: scripts/policy.sh
225 use_sudo: true
226 process:
227 args:
228 [{ get_attribute: [VM_001_floating_ip, floating_ip_address]},
229 { get_attribute: [VM_001_fixed_ip, fixed_ip_address]},
230 { get_input: nexus_repo },
231 { get_input: docker_repo},
232 { get_input: nexus_username },
233 { get_input: nexus_password },
234 { get_input: artifacts_version },
235 { get_input: dns_ip},
236 { get_input: docker_version },
237 { get_input: gerrit_branch },
238 openstack,
239 { get_input: external_dns},
240 { get_input: policy_repo}]
241 fabric_env:
242 host_string: { get_attribute: [VM_001_floating_ip, floating_ip_address]}
243 user: { get_input: ssh_user }
244 key_filename: { get_input: key_filename }
245 relationships:
246 - type: cloudify.relationships.contained_in
247 target: VM_001
248 - type: cloudify.relationships.depends_on
249 target: VM_001_floating_ip
250
251outputs:
252 ONAP_Policy:
253 description: informations about Policy
254 value:
255 ip: { get_attribute: [VM_001_floating_ip, floating_ip_address] }
256
257
258
259
260
261
262
263