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