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 | 62f78a6 | 2017-11-21 11:00:42 -0500 | [diff] [blame] | 18 | ########################################################### |
| 19 | # This Blueprint installs ONAP SO on Openstack |
| 20 | ########################################################### |
| 21 | |
| 22 | tosca_definitions_version: cloudify_dsl_1_3 |
| 23 | |
| 24 | description: > |
| 25 | This blueprint creates a ONAP service orchestrator |
| 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.1.1 |
| 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 | so_repo: |
| 77 | type: string |
| 78 | default: http://gerrit.onap.org/r/so/docker-config.git |
| 79 | |
| 80 | vm_instancename: |
| 81 | type: string |
| 82 | |
| 83 | image: |
| 84 | description: | |
| 85 | A Ubuntu 16.04 image, along with the usual |
| 86 | type: string |
| 87 | default: Ubuntu 16.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 | dsl_definitions: |
| 142 | openstack_credentials: &openstack_credentials |
| 143 | username: { get_input: openstack_username } |
| 144 | password: { get_input: openstack_password } |
| 145 | tenant_name: { get_input: openstack_tenant_name } |
| 146 | auth_url: { get_input: openstack_auth_url } |
| 147 | region: { get_input: openstack_region } |
| 148 | |
| 149 | node_templates: |
| 150 | |
| 151 | key_pair: |
| 152 | type: cloudify.openstack.nodes.KeyPair |
| 153 | properties: |
| 154 | private_key_path: { get_input: key_filename } |
| 155 | use_external_resource: true |
| 156 | resource_id: { get_input: keypair_name } |
| 157 | openstack_config: *openstack_credentials |
| 158 | |
| 159 | private_net: |
| 160 | type: cloudify.openstack.nodes.Network |
| 161 | properties: |
| 162 | use_external_resource: true |
| 163 | resource_id: { get_input: app_subnet } |
| 164 | openstack_config: *openstack_credentials |
| 165 | |
| 166 | external_network: |
| 167 | type: cloudify.openstack.nodes.Network |
| 168 | properties: |
| 169 | openstack_config: *openstack_credentials |
| 170 | use_external_resource: true |
| 171 | resource_id: { get_input: external_network} |
| 172 | |
| 173 | app_security_group: |
| 174 | type: cloudify.openstack.nodes.SecurityGroup |
| 175 | properties: |
| 176 | openstack_config: *openstack_credentials |
| 177 | use_external_resource: true |
| 178 | resource_id: { get_input: security_group } |
| 179 | |
| 180 | VM_001_fixed_ip: |
| 181 | type: cloudify.openstack.nodes.Port |
| 182 | properties: |
| 183 | openstack_config: *openstack_credentials |
| 184 | relationships: |
| 185 | - type: cloudify.relationships.contained_in |
| 186 | target: private_net |
| 187 | - type: cloudify.openstack.port_connected_to_security_group |
| 188 | target: app_security_group |
| 189 | |
| 190 | VM_001_floating_ip: |
| 191 | type: cloudify.openstack.nodes.FloatingIP |
| 192 | properties: |
| 193 | openstack_config: *openstack_credentials |
| 194 | interfaces: |
| 195 | cloudify.interfaces.lifecycle: |
| 196 | create: |
| 197 | inputs: |
| 198 | args: |
| 199 | floating_network_name: { get_input: external_network } |
| 200 | |
| 201 | VM_001: |
| 202 | type: cloudify.openstack.nodes.Server |
| 203 | properties: |
| 204 | openstack_config: *openstack_credentials |
| 205 | install_agent: false |
| 206 | image: { get_input: image } |
| 207 | flavor: { get_input: flavor } |
| 208 | resource_id: { get_input: vm_instancename } |
| 209 | management_network_name: { get_input: app_subnet } |
| 210 | ip: { get_attribute: [VM_001_floating_ip, floating_ip_address] } |
| 211 | relationships: |
| 212 | - type: cloudify.openstack.server_connected_to_floating_ip |
| 213 | target: VM_001_floating_ip |
| 214 | - type: cloudify.openstack.server_connected_to_keypair |
| 215 | target: key_pair |
| 216 | - type: cloudify.openstack.server_connected_to_port |
| 217 | target: VM_001_fixed_ip |
| 218 | |
| 219 | |
| 220 | app_001: |
| 221 | type: cloudify.nodes.SoftwareComponent |
| 222 | properties: |
| 223 | interfaces: |
| 224 | cloudify.interfaces.lifecycle: |
| 225 | start: |
| 226 | implementation: fabric.fabric_plugin.tasks.run_script |
| 227 | inputs: |
| 228 | script_path: scripts/so.sh |
| 229 | use_sudo: true |
| 230 | process: |
| 231 | args: |
| 232 | [{ get_attribute: [VM_001_floating_ip, floating_ip_address]}, |
| 233 | { get_attribute: [VM_001_fixed_ip, fixed_ip_address]}, |
| 234 | { get_input: nexus_repo }, |
| 235 | { get_input: docker_repo}, |
| 236 | { get_input: nexus_username }, |
| 237 | { get_input: nexus_password }, |
| 238 | { get_input: artifacts_version }, |
| 239 | { get_input: dns_ip}, |
| 240 | { get_input: gerrit_branch }, |
| 241 | openstack, |
| 242 | { get_input: external_dns}, |
| 243 | { get_input: dmaap_topic}, |
| 244 | { get_input: openstack_username}, |
| 245 | { get_input: openstack_tenant_name}, |
| 246 | { get_input: openstack_password}, |
| 247 | { get_input: openstack_region}, |
| 248 | { get_input: openstack_auth_url}, |
| 249 | { get_input: so_repo}, |
| 250 | { get_input: docker_version }] |
| 251 | fabric_env: |
| 252 | host_string: { get_attribute: [VM_001_floating_ip, floating_ip_address]} |
| 253 | user: { get_input: ssh_user } |
| 254 | key_filename: { get_input: key_filename } |
| 255 | relationships: |
| 256 | - type: cloudify.relationships.contained_in |
| 257 | target: VM_001 |
| 258 | - type: cloudify.relationships.depends_on |
| 259 | target: VM_001_floating_ip |
| 260 | |
| 261 | outputs: |
| 262 | ONAP_Service_Orchestrator: |
| 263 | description: informations about Service Orchestrator |
| 264 | value: |
| 265 | ip: { get_attribute: [VM_001_floating_ip, floating_ip_address] } |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |