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