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