Hong Guan | 9000c85 | 2018-05-02 13:25:14 -0400 | [diff] [blame] | 1 | # ============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 | |
Hong Guan | ec17544 | 2017-11-20 16:46:51 -0500 | [diff] [blame] | 18 | ########################################################### |
| 19 | # This Blueprint installs ONAP appc on Openstack |
| 20 | ########################################################### |
| 21 | |
| 22 | tosca_definitions_version: cloudify_dsl_1_3 |
| 23 | |
| 24 | description: > |
| 25 | This blueprint creates a ONAP APP-C |
| 26 | |
| 27 | imports: |
| 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 | |
| 33 | inputs: |
| 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.2.0 |
| 64 | |
| 65 | gerrit_branch: |
| 66 | type: string |
| 67 | default: master |
| 68 | |
| 69 | external_dns: |
| 70 | type: string |
| 71 | |
| 72 | dmaap_topic: |
| 73 | type: string |
| 74 | default: AUTO |
| 75 | |
| 76 | appc_repo: |
| 77 | type: string |
| 78 | default: http://gerrit.onap.org/r/appc/deployment.git |
| 79 | |
| 80 | vm_instancename: |
| 81 | type: string |
| 82 | |
| 83 | image: |
| 84 | description: | |
| 85 | A Ubuntu 14.04 image, along with the usual |
| 86 | type: string |
| 87 | default: Ubuntu 14.04 LTS Generic |
| 88 | |
| 89 | flavor: |
| 90 | description: > |
| 91 | A machine type with more than 2 CPUs, 4096 GB RAM, and 8 GB of disk space. |
| 92 | You might want to use 4 CPUs, 8192 MB RAM for the master. |
| 93 | type: string |
| 94 | default: m1.xlarge |
| 95 | |
| 96 | ssh_user: |
| 97 | description: | |
| 98 | User for connecting to agent VM |
| 99 | type: string |
| 100 | default: ubuntu |
| 101 | |
| 102 | security_group: |
| 103 | description: openstack security_group |
| 104 | type: string |
| 105 | |
| 106 | keypair_name: |
| 107 | description: | |
| 108 | OpenStack keypair name |
| 109 | type: string |
| 110 | |
| 111 | key_filename: |
| 112 | type: string |
| 113 | |
| 114 | external_network: |
| 115 | type: string |
| 116 | |
| 117 | app_subnet: |
| 118 | type: string |
| 119 | |
| 120 | |
| 121 | openstack_username: |
| 122 | type: string |
| 123 | description: username to authenticate to OpenStack |
| 124 | |
| 125 | openstack_password: |
| 126 | type: string |
| 127 | description: OpenStack tenant password for openstack_username user |
| 128 | |
| 129 | openstack_tenant_name: |
| 130 | type: string |
| 131 | description: OpenStack tenant for VM deploy |
| 132 | |
| 133 | openstack_auth_url: |
| 134 | type: string |
| 135 | description: Authentication URL for OpenStack |
| 136 | |
| 137 | openstack_region: |
| 138 | type: string |
| 139 | description: OpenStack region |
| 140 | |
| 141 | dgbuilder_docker: |
| 142 | type: string |
| 143 | default: v0.1.0 |
| 144 | |
| 145 | dsl_definitions: |
| 146 | openstack_credentials: &openstack_credentials |
| 147 | username: { get_input: openstack_username } |
| 148 | password: { get_input: openstack_password } |
| 149 | tenant_name: { get_input: openstack_tenant_name } |
| 150 | auth_url: { get_input: openstack_auth_url } |
| 151 | region: { get_input: openstack_region } |
| 152 | |
| 153 | node_templates: |
| 154 | |
| 155 | key_pair: |
| 156 | type: cloudify.openstack.nodes.KeyPair |
| 157 | properties: |
| 158 | private_key_path: { get_input: key_filename } |
| 159 | use_external_resource: true |
| 160 | resource_id: { get_input: keypair_name } |
| 161 | openstack_config: *openstack_credentials |
| 162 | |
| 163 | private_net: |
| 164 | type: cloudify.openstack.nodes.Network |
| 165 | properties: |
| 166 | use_external_resource: true |
| 167 | resource_id: { get_input: app_subnet } |
| 168 | openstack_config: *openstack_credentials |
| 169 | |
| 170 | external_network: |
| 171 | type: cloudify.openstack.nodes.Network |
| 172 | properties: |
| 173 | openstack_config: *openstack_credentials |
| 174 | use_external_resource: true |
| 175 | resource_id: { get_input: external_network} |
| 176 | |
| 177 | app_security_group: |
| 178 | type: cloudify.openstack.nodes.SecurityGroup |
| 179 | properties: |
| 180 | openstack_config: *openstack_credentials |
| 181 | use_external_resource: true |
| 182 | resource_id: { get_input: security_group } |
| 183 | |
| 184 | VM_001_fixed_ip: |
| 185 | type: cloudify.openstack.nodes.Port |
| 186 | properties: |
| 187 | openstack_config: *openstack_credentials |
| 188 | relationships: |
| 189 | - type: cloudify.relationships.contained_in |
| 190 | target: private_net |
| 191 | - type: cloudify.openstack.port_connected_to_security_group |
| 192 | target: app_security_group |
| 193 | |
| 194 | VM_001_floating_ip: |
| 195 | type: cloudify.openstack.nodes.FloatingIP |
| 196 | properties: |
| 197 | openstack_config: *openstack_credentials |
| 198 | interfaces: |
| 199 | cloudify.interfaces.lifecycle: |
| 200 | create: |
| 201 | inputs: |
| 202 | args: |
| 203 | floating_network_name: { get_input: external_network } |
| 204 | |
| 205 | VM_001: |
| 206 | type: cloudify.openstack.nodes.Server |
| 207 | properties: |
| 208 | openstack_config: *openstack_credentials |
| 209 | install_agent: false |
| 210 | image: { get_input: image } |
| 211 | flavor: { get_input: flavor } |
| 212 | resource_id: { get_input: vm_instancename } |
| 213 | management_network_name: { get_input: app_subnet } |
| 214 | ip: { get_attribute: [VM_001_floating_ip, floating_ip_address] } |
| 215 | relationships: |
| 216 | - type: cloudify.openstack.server_connected_to_floating_ip |
| 217 | target: VM_001_floating_ip |
| 218 | - type: cloudify.openstack.server_connected_to_keypair |
| 219 | target: key_pair |
| 220 | - type: cloudify.openstack.server_connected_to_port |
| 221 | target: VM_001_fixed_ip |
| 222 | |
| 223 | |
| 224 | app_001: |
| 225 | type: cloudify.nodes.SoftwareComponent |
| 226 | properties: |
| 227 | interfaces: |
| 228 | cloudify.interfaces.lifecycle: |
| 229 | start: |
| 230 | implementation: fabric.fabric_plugin.tasks.run_script |
| 231 | inputs: |
| 232 | script_path: scripts/appc.sh |
| 233 | use_sudo: true |
| 234 | process: |
| 235 | args: |
| 236 | [{ get_attribute: [VM_001_floating_ip, floating_ip_address]}, |
| 237 | { get_attribute: [VM_001_fixed_ip, fixed_ip_address]}, |
| 238 | { get_input: nexus_repo }, |
| 239 | { get_input: docker_repo}, |
| 240 | { get_input: nexus_username }, |
| 241 | { get_input: nexus_password }, |
| 242 | { get_input: artifacts_version }, |
| 243 | { get_input: dns_ip}, |
| 244 | { get_input: gerrit_branch }, |
| 245 | openstack, |
| 246 | { get_input: external_dns}, |
| 247 | { get_input: dmaap_topic}, |
| 248 | { get_input: openstack_username}, |
| 249 | { get_input: openstack_tenant_name}, |
| 250 | { get_input: openstack_password}, |
| 251 | { get_input: openstack_region}, |
| 252 | { get_input: openstack_auth_url}, |
| 253 | { get_input: appc_repo}, |
| 254 | { get_input: docker_version }, |
| 255 | { get_input: dgbuilder_docker}] |
| 256 | fabric_env: |
| 257 | host_string: { get_attribute: [VM_001_floating_ip, floating_ip_address]} |
| 258 | user: { get_input: ssh_user } |
| 259 | key_filename: { get_input: key_filename } |
| 260 | relationships: |
| 261 | - type: cloudify.relationships.contained_in |
| 262 | target: VM_001 |
| 263 | - type: cloudify.relationships.depends_on |
| 264 | target: VM_001_floating_ip |
| 265 | |
| 266 | outputs: |
| 267 | ONAP_Appc: |
| 268 | description: informations about app-c |
| 269 | value: |
| 270 | ip: { get_attribute: [VM_001_floating_ip, floating_ip_address] } |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |