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