diff options
Diffstat (limited to 'tutorials/Clearwater_vIMS/heat')
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/MANIFEST.json | 52 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/base_clearwater.env | 26 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/base_clearwater.yaml | 322 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/bono.yaml | 191 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/dns.yaml | 159 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/ellis.yaml | 242 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/homer.yaml | 190 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/homestead.yaml | 190 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/ralf.yaml | 205 | ||||
-rw-r--r-- | tutorials/Clearwater_vIMS/heat/sprout.yaml | 217 |
10 files changed, 1794 insertions, 0 deletions
diff --git a/tutorials/Clearwater_vIMS/heat/MANIFEST.json b/tutorials/Clearwater_vIMS/heat/MANIFEST.json new file mode 100644 index 00000000..f2beda9e --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/MANIFEST.json @@ -0,0 +1,52 @@ +{ + "name": "Project Clearwater", + "description": "Project Clearwater IMS", + "data": [ + { + "file": "base_clearwater.yaml", + "type": "HEAT", + "isBase": "true", + "data": [ + { + "file": "base_clearwater.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "bono.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "dns.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "ellis.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "homer.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "homestead.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "ralf.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "sprout.yaml", + "type": "HEAT", + "isBase": "false" + } + ] +} diff --git a/tutorials/Clearwater_vIMS/heat/base_clearwater.env b/tutorials/Clearwater_vIMS/heat/base_clearwater.env new file mode 100644 index 00000000..50159032 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/base_clearwater.env @@ -0,0 +1,26 @@ +parameters: + vnf_id: 123456 + vf_module_id: 654321 + public_net_id: 00000000-0000-0000-0000-000000000000 + bono_flavor_name: 4 GB General Purpose v1 + sprout_flavor_name: 4 GB General Purpose v1 + homer_flavor_name: 4 GB General Purpose v1 + homestead_flavor_name: 4 GB General Purpose v1 + ralf_flavor_name: 4 GB General Purpose v1 + ellis_flavor_name: 4 GB General Purpose v1 + dns_flavor_name: 4 GB General Purpose v1 + bono_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) + sprout_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) + homer_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) + homestead_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) + ralf_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) + ellis_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) + dns_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) + key_name: cw-key + pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/wlgLbm2LacmTRuFz32qn8hYJspsU8idZnBfX+lYjRdC5pH1UOasJPoepEAC6xfzxXyHpubWtaGZf6p19H/VkxIGxYpDV3SgrVwbyYP5BFl8gwwH/Ml/LkX2LgVeKUUelOTPbiSLktrtgAFkLIkMgXnLFnUSH65zvXW3BSBXyu5pVp95nyX9e+UBR8dAaOqosgnkKxKdPPrCnuQu3bdFL74G453pqUV8lmy5A5Obfo+hCSAagTGiz6PSgkg/+oLI0jZ6ZgbsrqLh0kJnjZBr6VuQoYwvYlBXLadfE3dWNlT+fXb2E6333EMrB1O1bgZ410o3/gA801uN1rKHrWZpB me@pc5294-dev-env.ad.datcon.co.uk + repo_url: http://repo.cw-ngv.com/stable + zone: me.cw-ngv.com + dn_range_start: "2425550000" + dn_range_length: "10000" + dnssec_key: 9FPdYTWhk5+LbhrqtTPQKw== + diff --git a/tutorials/Clearwater_vIMS/heat/base_clearwater.yaml b/tutorials/Clearwater_vIMS/heat/base_clearwater.yaml new file mode 100644 index 00000000..c41b0509 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/base_clearwater.yaml @@ -0,0 +1,322 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + Base Project Clearwater deployment on ONAP (Open Network Automation Platform) + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + bono_flavor_name: + type: string + description: VM flavor for bono VMs + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + sprout_flavor_name: + type: string + description: VM flavor for sprout VMs + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + homestead_flavor_name: + type: string + description: VM flavor for homestead VMs + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + homer_flavor_name: + type: string + description: VM flavor for homer VMs + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + ralf_flavor_name: + type: string + description: VM flavor for ralf VMs + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + ellis_flavor_name: + type: string + description: VM flavor for ellis VM + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + dns_flavor_name: + type: string + description: VM flavor for dns VM + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + bono_image_name: + type: string + description: Name of image for bono VMs + sprout_image_name: + type: string + description: Name of image for sprout VMs + homestead_image_name: + type: string + description: Name of image for homestead VMs + homer_image_name: + type: string + description: Name of image for homer VMs + ralf_image_name: + type: string + description: Name of image for ralf VMs + ellis_image_name: + type: string + description: Name of image for ellis VM + dns_image_name: + type: string + description: Name of image for dns VMs + key_name: + type: string + description: Name of keypair to create + pub_key: + type: string + label: Public key + description: Public key to be installed on all compute instances + repo_url: + type: string + description: URL for Clearwater repository + default: http://repo.cw-ngv.com/stable + zone: + type: string + description: DNS zone + default: example.com + dn_range_start: + type: string + description: First directory number in pool + default: "6505550000" + constraints: + - allowed_pattern: "[0-9]+" + description: Must be numeric + dn_range_length: + type: string + description: Number of directory numbers to add to pool + default: "1000" + constraints: + - allowed_pattern: "[0-9]+" + description: Must be numeric + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + constraints: + - allowed_pattern: "[0-9A-Za-z+/=]+" + description: Must be Base64-encoded + +resources: + cw_keypair: + type: OS::Nova::KeyPair + properties: + name: { get_param: key_name } + public_key: { get_param: pub_key } + save_private_key: false + +# security_groups: +# type: security-groups.yaml +# properties: +# name_prefix: { get_param: "OS::stack_name" } + + dns: + type: dns.yaml + properties: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + public_net_id: { get_param: public_net_id } + dns_flavor_name: { get_param: dns_flavor_name } + dns_image_name: { get_param: dns_image_name } + key_name: { get_resource: cw_keypair } +# dns_security_group: { get_attr: [ security_groups, dns ] } + zone: { get_param: zone } + dnssec_key: { get_param: dnssec_key } + + + ellis: + type: ellis.yaml + properties: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + public_net_id: { get_param: public_net_id } + ellis_flavor_name: { get_param: ellis_flavor_name } + ellis_image_name: { get_param: ellis_image_name } + key_name: { get_resource: cw_keypair } +# base_mgmt_security_group: { get_attr: [ security_groups, base_mgmt ] } +# ellis_mgmt_security_group: { get_attr: [ security_groups, ellis_mgmt ] } + repo_url: { get_param: repo_url } + zone: { get_param: zone } + dn_range_start: { get_param: dn_range_start } + dn_range_length: { get_param: dn_range_length } + dns_ip: { get_attr: [ dns, dns_ip ] } + dnssec_key: { get_param: dnssec_key } + + bono: + type: OS::Heat::ResourceGroup + properties: + count: 2 + index_var: "__index__" + resource_def: + type: bono.yaml + properties: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + public_net_id: { get_param: public_net_id } + bono_flavor_name: { get_param: bono_flavor_name } + bono_image_name: { get_param: bono_image_name } + key_name: { get_resource: cw_keypair } +# base_mgmt_security_group: { get_attr: [ security_groups, base_mgmt ] } +# bono_sig_security_group: { get_attr: [ security_groups, bono_sig ] } + repo_url: { get_param: repo_url } + zone: { get_param: zone } + dns_ip: { get_attr: [ dns, dns_ip ] } + dnssec_key: { get_param: dnssec_key } + etcd_ip: { get_attr: [ ellis, public_ip ] } + index: __index__ + + sprout: + type: OS::Heat::ResourceGroup + properties: + count: 2 + index_var: __index__ + resource_def: + type: sprout.yaml + properties: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + public_net_id: { get_param: public_net_id } + sprout_flavor_name: { get_param: sprout_flavor_name } + sprout_image_name: { get_param: sprout_image_name } + key_name: { get_resource: cw_keypair } +# base_mgmt_security_group: { get_attr: [ security_groups, base_mgmt ] } +# sprout_sig_security_group: { get_attr: [ security_groups, sprout_sig ] } +# sprout_sig2_security_group: { get_attr: [ security_groups, sprout_sig2 ] } + repo_url: { get_param: repo_url } + zone: { get_param: zone } + dns_ip: { get_attr: [ dns, dns_ip ] } + dnssec_key: { get_param: dnssec_key } + etcd_ip: { get_attr: [ ellis, public_ip ] } + index: __index__ + + homer: + type: OS::Heat::ResourceGroup + properties: + count: 2 + index_var: __index__ + resource_def: + type: homer.yaml + properties: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + public_net_id: { get_param: public_net_id } + homer_flavor_name: { get_param: homer_flavor_name } + homer_image_name: { get_param: homer_image_name } + key_name: { get_resource: cw_keypair } +# base_mgmt_security_group: { get_attr: [ security_groups, base_mgmt ] } +# homer_mgmt_security_group: { get_attr: [ security_groups, homer_mgmt ] } +# homer_sig_security_group: { get_attr: [ security_groups, homer_sig ] } + repo_url: { get_param: repo_url } + zone: { get_param: zone } + dns_ip: { get_attr: [ dns, dns_ip ] } + dnssec_key: { get_param: dnssec_key } + etcd_ip: { get_attr: [ ellis, public_ip ] } + index: __index__ + + homestead: + type: OS::Heat::ResourceGroup + properties: + count: 2 + index_var: __index__ + resource_def: + type: homestead.yaml + properties: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + public_net_id: { get_param: public_net_id } + homestead_flavor_name: { get_param: homestead_flavor_name } + homestead_image_name: { get_param: homestead_image_name } + key_name: { get_resource: cw_keypair } +# base_mgmt_security_group: { get_attr: [ security_groups, base_mgmt ] } +# homestead_mgmt_security_group: { get_attr: [ security_groups, homestead_mgmt ] } +# homestead_sig_security_group: { get_attr: [ security_groups, homestead_sig ] } + repo_url: { get_param: repo_url } + zone: { get_param: zone } + dns_ip: { get_attr: [ dns, dns_ip ] } + dnssec_key: { get_param: dnssec_key } + etcd_ip: { get_attr: [ ellis, public_ip ] } + index: __index__ + + ralf: + type: OS::Heat::ResourceGroup + properties: + count: 2 + index_var: __index__ + resource_def: + type: ralf.yaml + properties: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + public_net_id: { get_param: public_net_id } + ralf_flavor_name: { get_param: ralf_flavor_name } + ralf_image_name: { get_param: ralf_image_name } + key_name: { get_resource: cw_keypair } +# base_mgmt_security_group: { get_attr: [ security_groups, base_mgmt ] } +# ralf_sig_security_group: { get_attr: [ security_groups, ralf_sig ] } + repo_url: { get_param: repo_url } + zone: { get_param: zone } + dns_ip: { get_attr: [ dns, dns_ip ] } + dnssec_key: { get_param: dnssec_key } + etcd_ip: { get_attr: [ ellis, public_ip ] } + index: __index__ + +outputs: + zone: + description: DNS zone + value: { get_param: zone } + dns_ip: + description: IP address of DNS + value: { get_attr: [ dns, dns_ip ] } + diff --git a/tutorials/Clearwater_vIMS/heat/bono.yaml b/tutorials/Clearwater_vIMS/heat/bono.yaml new file mode 100644 index 00000000..575dbb94 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/bono.yaml @@ -0,0 +1,191 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + Clearwater Bono node + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + bono_flavor_name: + type: string + description: Flavor to use + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + bono_image_name: + type: string + description: Name of image to use + key_name: + type: string + description: Name of keypair to assign + constraints: + - custom_constraint: nova.keypair + description: Must be a valid keypair name +# base_mgmt_security_group: +# type: string +# description: ID of base security group for all Clearwater nodes (managment) +# bono_sig_security_group: +# type: string +# description: ID of security group for Bono nodes (signaling) + repo_url: + type: string + description: URL for Clearwater repository + default: http://repo.cw-ngv.com/stable + zone: + type: string + description: DNS zone + default: example.com + dns_ip: + type: string + description: IP address for DNS server on management network + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + constraints: + - allowed_pattern: "[0-9A-Za-z+/=]+" + description: Must be Base64-encoded + etcd_ip: + type: string + description: IP address of an existing member of the etcd cluster + default: "" + index: + type: number + description: Index of this Bono node in the Bono cluster + default: 0 + +resources: + server: + type: OS::Nova::Server + properties: + name: { str_replace: { params: { __index__: { get_param: index }, __zone__: { get_param: zone } }, template: bono-__index__.__zone__ } } + image: { get_param: bono_image_name } + flavor: { get_param: bono_flavor_name } + key_name: { get_param: key_name } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url__: { get_param: repo_url } + __zone__: { get_param: zone } + __dns_ip__: { get_param: dns_ip } + __dnssec_key__: { get_param: dnssec_key } + __etcd_ip__ : { get_param: etcd_ip } + __index__ : { get_param: index } + template: | + #!/bin/bash + + # Log all output to file. + exec > >(tee -a /var/log/clearwater-heat-bono.log) 2>&1 + set -x + + # Configure the APT software source. + echo 'deb __repo_url__ binary/' > /etc/apt/sources.list.d/clearwater.list + curl -L http://repo.cw-ngv.com/repo_key | apt-key add - + apt-get update + + # Get the public IP address from eth0 + sudo apt-get install ipcalc + ADDR=`ip addr show eth0 | awk '/inet /{print $2}'` + PUBLIC_ADDR=`ipcalc -n -b $ADDR | awk '/Address:/{print $2}'` + + # Configure /etc/clearwater/local_config. + mkdir -p /etc/clearwater + etcd_ip=__etcd_ip__ + [ -n "$etcd_ip" ] || etcd_ip=$PUBLIC_ADDR + cat > /etc/clearwater/local_config << EOF + management_local_ip=$PUBLIC_ADDR + local_ip=$PUBLIC_ADDR + public_ip=$PUBLIC_ADDR + public_hostname=__index__.bono.__zone__ + etcd_cluster=$etcd_ip + EOF + + # Now install the software. + DEBIAN_FRONTEND=noninteractive apt-get install bono-node --yes --force-yes + DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes + + # Function to give DNS record type and IP address for specified IP address + ip2rr() { + if echo $1 | grep -q -e '[^0-9.]' ; then + echo AAAA $1 + else + echo A $1 + fi + } + + # Update DNS + retries=0 + while ! { nsupdate -y "__zone__:__dnssec_key__" -v << EOF + server __dns_ip__ + update add bono-__index__.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add __index__.bono.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add __zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add __zone__. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.__zone__. + update add __zone__. 30 NAPTR 0 0 "s" "SIP+D2U" "" _sip._udp.__zone__. + update add _sip._tcp.__zone__. 30 SRV 0 0 5060 __index__.bono.__zone__. + update add _sip._udp.__zone__. 30 SRV 0 0 5060 __index__.bono.__zone__. + send + EOF + } && [ $retries -lt 10 ] + do + retries=$((retries + 1)) + echo 'nsupdate failed - retrying (retry '$retries')...' + sleep 5 + done + + # Use the DNS server. + echo 'nameserver __dns_ip__' > /etc/dnsmasq.resolv.conf + echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq + service dnsmasq force-reload + +outputs: + public_ip: + description: IP address in public network + value: { get_attr: [ server, accessIPv4 ] } diff --git a/tutorials/Clearwater_vIMS/heat/dns.yaml b/tutorials/Clearwater_vIMS/heat/dns.yaml new file mode 100644 index 00000000..f257d240 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/dns.yaml @@ -0,0 +1,159 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + DNS server exposing dynamic DNS using DNSSEC + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + dns_flavor_name: + type: string + description: Flavor to use + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + dns_image_name: + type: string + description: Name of image to use + key_name: + type: string + description: Name of keypair to assign + constraints: + - custom_constraint: nova.keypair + description: Must be a valid keypair name +# dns_security_group: +# type: string +# description: ID of security group for DNS nodes + zone: + type: string + description: DNS zone + default: example.com + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + +resources: + server: + type: OS::Nova::Server + properties: + name: { str_replace: { params: { __zone__: { get_param: zone } }, template: ns.__zone__ } } + image: { get_param: dns_image_name } + flavor: { get_param: dns_flavor_name } + key_name: { get_param: key_name } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __zone__: { get_param: zone } + __dnssec_key__: { get_param: dnssec_key } + template: | + #!/bin/bash + + # Log all output to file. + exec > >(tee -a /var/log/clearwater-heat-dns.log) 2>&1 + set -x + + # Install BIND. + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install bind9 --yes + + # Get the public IP address from eth0 + sudo apt-get install ipcalc + ADDR=`ip addr show eth0 | awk '/inet /{print $2}'` + PUBLIC_ADDR=`ipcalc -n -b $ADDR | awk '/Address:/{print $2}'` + + # Update BIND configuration with the specified zone and key. + cat >> /etc/bind/named.conf.local << EOF + key __zone__. { + algorithm "HMAC-MD5"; + secret "__dnssec_key__"; + }; + + zone "__zone__" IN { + type master; + file "/var/lib/bind/db.__zone__"; + allow-update { + key __zone__.; + }; + }; + EOF + + # Function to give DNS record type and IP address for specified IP address + ip2rr() { + if echo $1 | grep -q -e '[^0-9.]' ; then + echo AAAA $1 + else + echo A $1 + fi + } + + # Create basic zone configuration. + cat > /var/lib/bind/db.__zone__ << EOF + \$ORIGIN __zone__. + \$TTL 1h + @ IN SOA ns admin\@__zone__. ( $(date +%Y%m%d%H) 1d 2h 1w 30s ) + @ NS ns + ns $(ip2rr $PUBLIC_ADDR) + EOF + chown root:bind /var/lib/bind/db.__zone__ + + # Now that BIND configuration is correct, kick it to reload. + service bind9 reload + +outputs: + dns_ip: + description: IP address of DNS server + value: { get_attr: [ server, accessIPv4 ] } + zone: + description: DNS zone + value: { get_param: zone } + dnssec_key: + description: DNSSEC private key (Base64-encoded) + value: { get_param: dnssec_key } diff --git a/tutorials/Clearwater_vIMS/heat/ellis.yaml b/tutorials/Clearwater_vIMS/heat/ellis.yaml new file mode 100644 index 00000000..76e68b03 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/ellis.yaml @@ -0,0 +1,242 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + Clearwater Ellis node + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + ellis_flavor_name: + type: string + description: Flavor to use + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + ellis_image_name: + type: string + description: Name of image to use + key_name: + type: string + description: Name of keypair to assign + constraints: + - custom_constraint: nova.keypair + description: Must be a valid keypair name +# base_mgmt_security_group: +# type: string +# description: ID of base security group for all Clearwater nodes (management) +# ellis_mgmt_security_group: +# type: string +# description: ID of security group for Ellis nodes (management) + repo_url: + type: string + description: URL for Clearwater repository + default: http://repo.cw-ngv.com/stable + zone: + type: string + description: DNS zone + default: example.com + dn_range_start: + type: string + description: First directory number in pool + default: "6505550000" + constraints: + - allowed_pattern: "[0-9]+" + description: Must be numeric + dn_range_length: + type: string + description: Number of directory numbers to add to pool + default: "1000" + constraints: + - allowed_pattern: "[0-9]+" + description: Must be numeric + dns_ip: + type: string + description: IP address for DNS server + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + constraints: + - allowed_pattern: "[0-9A-Za-z+/=]+" + description: Must be Base64-encoded + etcd_ip: + type: string + description: IP address of an existing member of the etcd cluster + default: "" + index: + type: number + description: Index of this Ellis node in the Ellis cluster + default: 0 + +resources: + server: + type: OS::Nova::Server + properties: + name: { str_replace: { params: { __index__: { get_param: index }, __zone__: { get_param: zone } }, template: ellis-__index__.__zone__ } } + image: { get_param: ellis_image_name } + flavor: { get_param: ellis_flavor_name } + key_name: { get_param: key_name } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url__: { get_param: repo_url } + __zone__: { get_param: zone } + __dn_range_start__: { get_param: dn_range_start } + __dn_range_length__: { get_param: dn_range_length } + __dns_ip__: { get_param: dns_ip } + __dnssec_key__: { get_param: dnssec_key } + __etcd_ip__ : { get_param: etcd_ip } + __index__ : { get_param: index } + template: | + #!/bin/bash + + # Log all output to file. + exec > >(tee -a /var/log/clearwater-heat-ellis.log) 2>&1 + set -x + + # Configure the APT software source. + echo 'deb __repo_url__ binary/' > /etc/apt/sources.list.d/clearwater.list + curl -L http://repo.cw-ngv.com/repo_key | apt-key add - + apt-get update + + # Get the public IP address from eth0 + sudo apt-get install ipcalc + ADDR=`ip addr show eth0 | awk '/inet /{print $2}'` + PUBLIC_ADDR=`ipcalc -n -b $ADDR | awk '/Address:/{print $2}'` + + # Configure /etc/clearwater/local_config. Add xdms_hostname here to use Homer's management + # hostname instead of signaling. This will override shared_config. This works around + # https://github.com/Metaswitch/ellis/issues/153. + mkdir -p /etc/clearwater + etcd_ip=__etcd_ip__ + [ -n "$etcd_ip" ] || etcd_ip=$PUBLIC_ADDR + cat > /etc/clearwater/local_config << EOF + local_ip=$PUBLIC_ADDR + public_ip=$PUBLIC_ADDR + public_hostname=ellis-__index__.__zone__ + etcd_cluster=$etcd_ip + xdms_hostname=homer-0.__zone__:7888 + EOF + + # Now install the software. + DEBIAN_FRONTEND=noninteractive apt-get install ellis-node --yes --force-yes + DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes + + # Wait until etcd is up and running before uploading the shared_config + /usr/share/clearwater/clearwater-etcd/scripts/wait_for_etcd + + # Configure and upload /etc/clearwater/shared_config. + cat > /etc/clearwater/shared_config << EOF + # Deployment definitions + home_domain=__zone__ + sprout_hostname=sprout.__zone__ + hs_hostname=hs.__zone__:8888 + hs_provisioning_hostname=hs-prov.__zone__:8889 + ralf_hostname=ralf.__zone__:10888 + xdms_hostname=homer.__zone__:7888 + sprout_registration_store=sprout.__zone__ + ralf_session_store=ralf.__zone__ + + upstream_port=0 + + # Email server configuration + smtp_smarthost=localhost + smtp_username=username + smtp_password=password + email_recovery_sender=clearwater@example.org + + # Keys + signup_key=secret + turn_workaround=secret + ellis_api_key=secret + ellis_cookie_key=secret + EOF + sudo /usr/share/clearwater/clearwater-config-manager/scripts/upload_shared_config + + # Allocate a pool of numbers to assign to users. Before we do this, + # restart clearwater-infrastructure to make sure that + # local_settings.py runs to pick up the configuration changes. + service clearwater-infrastructure restart + service ellis stop + /usr/share/clearwater/ellis/env/bin/python /usr/share/clearwater/ellis/src/metaswitch/ellis/tools/create_numbers.py --start __dn_range_start__ --count __dn_range_length__ + + # Function to give DNS record type and IP address for specified IP address + ip2rr() { + if echo $1 | grep -q -e '[^0-9.]' ; then + echo AAAA $1 + else + echo A $1 + fi + } + + # Update DNS + retries=0 + while ! { nsupdate -y "__zone__:__dnssec_key__" -v << EOF + server __dns_ip__ + update add ellis-__index__.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add ellis.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + send + EOF + } && [ $retries -lt 10 ] + do + retries=$((retries + 1)) + echo 'nsupdate failed - retrying (retry '$retries')...' + sleep 5 + done + + # Use the DNS server. + echo 'nameserver __dns_ip__' > /etc/dnsmasq.resolv.conf + echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq + service dnsmasq force-reload + +outputs: + public_ip: + description: IP address in public network + value: { get_attr: [ server, accessIPv4 ] } diff --git a/tutorials/Clearwater_vIMS/heat/homer.yaml b/tutorials/Clearwater_vIMS/heat/homer.yaml new file mode 100644 index 00000000..cbf9733f --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/homer.yaml @@ -0,0 +1,190 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + Clearwater Homer node + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + homer_flavor_name: + type: string + description: Flavor to use + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + homer_image_name: + type: string + description: Name of image to use + key_name: + type: string + description: Name of keypair to assign + constraints: + - custom_constraint: nova.keypair + description: Must be a valid keypair name +# base_mgmt_security_group: +# type: string +# description: ID of base security group for all Clearwater nodes (management) +# homer_mgmt_security_group: +# type: string +# description: ID of security group for Homer nodes (maangement) +# homer_sig_security_group: +# type: string +# description: ID of security group for Homer nodes (signaling) + repo_url: + type: string + description: URL for Clearwater repository + default: http://repo.cw-ngv.com/stable + zone: + type: string + description: DNS zone + default: example.com + dns_ip: + type: string + description: IP address for DNS server on management network + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + constraints: + - allowed_pattern: "[0-9A-Za-z+/=]+" + description: Must be Base64-encoded + etcd_ip: + type: string + description: IP address of an existing member of the etcd cluster + default: "" + index: + type: number + description: Index of this Homer node in the Homer cluster + default: 0 + +resources: + server: + type: OS::Nova::Server + properties: + name: { str_replace: { params: { __index__: { get_param: index }, __zone__: { get_param: zone } }, template: homer-__index__.__zone__ } } + image: { get_param: homer_image_name } + flavor: { get_param: homer_flavor_name } + key_name: { get_param: key_name } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url__: { get_param: repo_url } + __zone__: { get_param: zone } + __dns_ip__: { get_param: dns_ip } + __dnssec_key__: { get_param: dnssec_key } + __etcd_ip__ : { get_param: etcd_ip } + __index__ : { get_param: index } + template: | + #!/bin/bash + + # Log all output to file. + exec > >(tee -a /var/log/clearwater-heat-homer.log) 2>&1 + set -x + + # Configure the APT software source. + echo 'deb __repo_url__ binary/' > /etc/apt/sources.list.d/clearwater.list + curl -L http://repo.cw-ngv.com/repo_key | apt-key add - + apt-get update + + # Get the public IP address from eth0 + sudo apt-get install ipcalc + ADDR=`ip addr show eth0 | awk '/inet /{print $2}'` + PUBLIC_ADDR=`ipcalc -n -b $ADDR | awk '/Address:/{print $2}'` + + # Configure /etc/clearwater/local_config. + mkdir -p /etc/clearwater + etcd_ip=__etcd_ip__ + [ -n "$etcd_ip" ] || etcd_ip=$PUBLIC_ADDR + cat > /etc/clearwater/local_config << EOF + management_local_ip=$PUBLIC_ADDR + local_ip=$PUBLIC_ADDR + public_ip=$PUBLIC_ADDR + public_hostname=homer-__index__.__zone__ + etcd_cluster=$etcd_ip + EOF + + # Now install the software. + DEBIAN_FRONTEND=noninteractive apt-get install homer-node --yes --force-yes + DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes + + # Function to give DNS record type and IP address for specified IP address + ip2rr() { + if echo $1 | grep -q -e '[^0-9.]' ; then + echo AAAA $1 + else + echo A $1 + fi + } + + # Update DNS + retries=0 + while ! { nsupdate -y "__zone__:__dnssec_key__" -v << EOF + server __dns_ip__ + update add homer-__index__.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add homer.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + send + EOF + } && [ $retries -lt 10 ] + do + retries=$((retries + 1)) + echo 'nsupdate failed - retrying (retry '$retries')...' + sleep 5 + done + + # Use the DNS server. + # Use the DNS server. + echo 'nameserver __dns_ip__' > /etc/dnsmasq.resolv.conf + echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq + service dnsmasq force-reload + +outputs: + public_ip: + description: IP address in public network + value: { get_attr: [ server, accessIPv4 ] } diff --git a/tutorials/Clearwater_vIMS/heat/homestead.yaml b/tutorials/Clearwater_vIMS/heat/homestead.yaml new file mode 100644 index 00000000..f3519bb7 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/homestead.yaml @@ -0,0 +1,190 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + Clearwater Homestead node + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + homestead_flavor_name: + type: string + description: Flavor to use + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + homestead_image_name: + type: string + description: Name of image to use + key_name: + type: string + description: Name of keypair to assign + constraints: + - custom_constraint: nova.keypair + description: Must be a valid keypair name +# base_mgmt_security_group: +# type: string +# description: ID of base security group for all Clearwater nodes (management) +# homestead_mgmt_security_group: +# type: string +# description: ID of security group for Homestead nodes (management) +# homestead_sig_security_group: +# type: string +# description: ID of security group for Homestead nodes (signaling) + repo_url: + type: string + description: URL for Clearwater repository + default: http://repo.cw-ngv.com/stable + zone: + type: string + description: DNS zone + default: example.com + dns_ip: + type: string + description: IP address for DNS server on management network + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + constraints: + - allowed_pattern: "[0-9A-Za-z+/=]+" + description: Must be Base64-encoded + etcd_ip: + type: string + description: IP address of an existing member of the etcd cluster + default: "" + index: + type: number + description: Index of this Homestead node in the Homestead cluster + default: 0 + +resources: + server: + type: OS::Nova::Server + properties: + name: { str_replace: { params: { __index__: { get_param: index }, __zone__: { get_param: zone } }, template: homestead-__index__.__zone__ } } + image: { get_param: homestead_image_name } + flavor: { get_param: homestead_flavor_name } + key_name: { get_param: key_name } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url__: { get_param: repo_url } + __zone__: { get_param: zone } + __dns_ip__: { get_param: dns_ip } + __dnssec_key__: { get_param: dnssec_key } + __etcd_ip__ : { get_param: etcd_ip } + __index__ : { get_param: index } + template: | + #!/bin/bash + + # Log all output to file. + exec > >(tee -a /var/log/clearwater-heat-homestead.log) 2>&1 + set -x + + # Configure the APT software source. + echo 'deb __repo_url__ binary/' > /etc/apt/sources.list.d/clearwater.list + curl -L http://repo.cw-ngv.com/repo_key | apt-key add - + apt-get update + + # Get the public IP address from eth0 + sudo apt-get install ipcalc + ADDR=`ip addr show eth0 | awk '/inet /{print $2}'` + PUBLIC_ADDR=`ipcalc -n -b $ADDR | awk '/Address:/{print $2}'` + + # Configure /etc/clearwater/local_config. + mkdir -p /etc/clearwater + etcd_ip=__etcd_ip__ + [ -n "$etcd_ip" ] || etcd_ip=$PUBLIC_ADDR + cat > /etc/clearwater/local_config << EOF + management_local_ip=$PUBLIC_ADDR + local_ip=$PUBLIC_ADDR + public_ip=$PUBLIC_ADDR + public_hostname=homestead-__index__.__zone__ + etcd_cluster=$etcd_ip + EOF + + # Now install the software. + DEBIAN_FRONTEND=noninteractive apt-get install homestead-node clearwater-prov-tools --yes --force-yes + DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes + + # Function to give DNS record type and IP address for specified IP address + ip2rr() { + if echo $1 | grep -q -e '[^0-9.]' ; then + echo AAAA $1 + else + echo A $1 + fi + } + + # Update DNS + retries=0 + while ! { nsupdate -y "__zone__:__dnssec_key__" -v << EOF + server __dns_ip__ + update add homestead-__index__.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add hs-prov.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add hs.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + send + EOF + } && [ $retries -lt 10 ] + do + retries=$((retries + 1)) + echo 'nsupdate failed - retrying (retry '$retries')...' + sleep 5 + done + + # Use the DNS server. + echo 'nameserver __dns_ip__' > /etc/dnsmasq.resolv.conf + echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq + service dnsmasq force-reload + +outputs: + public_ip: + description: IP address in public network + value: { get_attr: [ server, accessIPv4 ] } diff --git a/tutorials/Clearwater_vIMS/heat/ralf.yaml b/tutorials/Clearwater_vIMS/heat/ralf.yaml new file mode 100644 index 00000000..301a5619 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/ralf.yaml @@ -0,0 +1,205 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + Clearwater Ralf node + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + ralf_flavor_name: + type: string + description: Flavor to use + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + ralf_image_name: + type: string + description: Name of image to use + key_name: + type: string + description: Name of keypair to assign + constraints: + - custom_constraint: nova.keypair + description: Must be a valid keypair name +# base_mgmt_security_group: +# type: string +# description: ID of base security group for all Clearwater nodes (management) +# ralf_sig_security_group: +# type: string +# description: ID of security group for Ralf nodes (signaling) + repo_url: + type: string + description: URL for Clearwater repository + default: http://repo.cw-ngv.com/stable + zone: + type: string + description: DNS zone + default: example.com + dns_ip: + type: string + description: IP address for DNS server + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + constraints: + - allowed_pattern: "[0-9A-Za-z+/=]+" + description: Must be Base64-encoded + etcd_ip: + type: string + description: IP address of an existing member of the etcd cluster + default: "" + index: + type: number + description: Index of this Ralf node in the Ralf cluster + default: 0 + +resources: + server: + type: OS::Nova::Server + properties: + name: { str_replace: { params: { __index__: { get_param: index }, __zone__: { get_param: zone } }, template: ralf-__index__.__zone__ } } + image: { get_param: ralf_image_name } + flavor: { get_param: ralf_flavor_name } + key_name: { get_param: key_name } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url__: { get_param: repo_url } + __zone__: { get_param: zone } + __dns_ip__: { get_param: dns_ip } + __dnssec_key__: { get_param: dnssec_key } + __etcd_ip__ : { get_param: etcd_ip } + __index__ : { get_param: index } + template: | + #!/bin/bash + + # Log all output to file. + exec > >(tee -a /var/log/clearwater-heat-ralf.log) 2>&1 + set -x + + # Configure the APT software source. + echo 'deb __repo_url__ binary/' > /etc/apt/sources.list.d/clearwater.list + curl -L http://repo.cw-ngv.com/repo_key | apt-key add - + apt-get update + + # Get the public IP address from eth0 + sudo apt-get install ipcalc + ADDR=`ip addr show eth0 | awk '/inet /{print $2}'` + PUBLIC_ADDR=`ipcalc -n -b $ADDR | awk '/Address:/{print $2}'` + + # Configure /etc/clearwater/local_config. + mkdir -p /etc/clearwater + etcd_ip=__etcd_ip__ + [ -n "$etcd_ip" ] || etcd_ip=$PUBLIC_ADDR + cat > /etc/clearwater/local_config << EOF + management_local_ip=$PUBLIC_ADDR + local_ip=$PUBLIC_ADDR + public_ip=$PUBLIC_ADDR + public_hostname=ralf-__index__.__zone__ + etcd_cluster=$etcd_ip + EOF + + # Create /etc/chronos/chronos.conf. + mkdir -p /etc/chronos + cat > /etc/chronos/chronos.conf << EOF + [http] + bind-address = $PUBLIC_ADDR + bind-port = 7253 + threads = 50 + + [logging] + folder = /var/log/chronos + level = 2 + + [alarms] + enabled = true + + [exceptions] + max_ttl = 600 + EOF + + # Now install the software. + DEBIAN_FRONTEND=noninteractive apt-get install ralf-node --yes --force-yes + DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes + + # Function to give DNS record type and IP address for specified IP address + ip2rr() { + if echo $1 | grep -q -e '[^0-9.]' ; then + echo AAAA $1 + else + echo A $1 + fi + } + + # Update DNS + retries=0 + while ! { nsupdate -y "__zone__:__dnssec_key__" -v << EOF + server __dns_ip__ + update add ralf-__index__.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add ralf.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + send + EOF + } && [ $retries -lt 10 ] + do + retries=$((retries + 1)) + echo 'nsupdate failed - retrying (retry '$retries')...' + sleep 5 + done + + # Use the DNS server. + echo 'nameserver __dns_ip__' > /etc/dnsmasq.resolv.conf + echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq + service dnsmasq force-reload + +outputs: + public_ip: + description: IP address in public network + value: { get_attr: [ server, accessIPv4 ] } diff --git a/tutorials/Clearwater_vIMS/heat/sprout.yaml b/tutorials/Clearwater_vIMS/heat/sprout.yaml new file mode 100644 index 00000000..7fb9dd81 --- /dev/null +++ b/tutorials/Clearwater_vIMS/heat/sprout.yaml @@ -0,0 +1,217 @@ +# Project Clearwater - IMS in the Cloud +# Copyright (C) 2015 Metaswitch Networks Ltd +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version, along with the "Special Exception" for use of +# the program along with SSL, set forth below. This program is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +heat_template_version: 2013-05-23 + +description: > + Clearwater Sprout node + +parameters: + vnf_id: + type: string + label: VNF ID + description: The VNF ID provided by ONAP + vf_module_id: + type: string + label: VNF module ID + description: The VNF module ID provided by ONAP + public_net_id: + type: string + description: ID of public network + constraints: + - custom_constraint: neutron.network + description: Must be a valid network ID + sprout_flavor_name: + type: string + description: Flavor to use + constraints: + - custom_constraint: nova.flavor + description: Must be a valid flavor name + sprout_image_name: + type: string + description: Name of image to use + key_name: + type: string + description: Name of keypair to assign + constraints: + - custom_constraint: nova.keypair + description: Must be a valid keypair name +# base_mgmt_security_group: +# type: string +# description: ID of base security group for all Clearwater nodes (management) +# sprout_sig_security_group: +# type: string +# description: ID of security group for Sprout nodes (signaling) +# sprout_sig2_security_group: +# type: string +# description: ID of additional security group for Sprout nodes (signaling) + repo_url: + type: string + description: URL for Clearwater repository + default: http://repo.cw-ngv.com/stable + zone: + type: string + description: DNS zone + default: example.com + dns_ip: + type: string + description: IP address for DNS server on network + dnssec_key: + type: string + description: DNSSEC private key (Base64-encoded) + constraints: + - allowed_pattern: "[0-9A-Za-z+/=]+" + description: Must be Base64-encoded + etcd_ip: + type: string + description: IP address of an existing member of the etcd cluster + default: "" + index: + type: number + description: Index of this Sprout node in the Sprout cluster + default: 0 + +resources: + server: + type: OS::Nova::Server + properties: + name: { str_replace: { params: { __index__: { get_param: index }, __zone__: { get_param: zone } }, template: sprout-__index__.__zone__ } } + image: { get_param: sprout_image_name } + flavor: { get_param: sprout_flavor_name } + key_name: { get_param: key_name } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url__: { get_param: repo_url } + __zone__: { get_param: zone } + __dns_ip__: { get_param: dns_ip } + __dnssec_key__: { get_param: dnssec_key } + __etcd_ip__ : { get_param: etcd_ip } + __index__ : { get_param: index } + template: | + #!/bin/bash + + # Log all output to file. + exec > >(tee -a /var/log/clearwater-heat-sprout.log) 2>&1 + set -x + + # Configure the APT software source. + echo 'deb __repo_url__ binary/' > /etc/apt/sources.list.d/clearwater.list + curl -L http://repo.cw-ngv.com/repo_key | apt-key add - + apt-get update + + # Get the public IP address from eth0 + sudo apt-get install ipcalc + ADDR=`ip addr show eth0 | awk '/inet /{print $2}'` + PUBLIC_ADDR=`ipcalc -n -b $ADDR | awk '/Address:/{print $2}'` + + # Configure /etc/clearwater/local_config. + mkdir -p /etc/clearwater + etcd_ip=__etcd_ip__ + [ -n "$etcd_ip" ] || etcd_ip=$PUBLIC_ADDR + cat > /etc/clearwater/local_config << EOF + management_local_ip=$PUBLIC_ADDR + local_ip=$PUBLIC_ADDR + public_ip=$PUBLIC_ADDR + public_hostname=__index__.sprout.__zone__ + etcd_cluster=$etcd_ip + EOF + + # Create /etc/chronos/chronos.conf. + mkdir -p /etc/chronos + cat > /etc/chronos/chronos.conf << EOF + [http] + bind-address = $PUBLIC_ADDR + bind-port = 7253 + threads = 50 + + [logging] + folder = /var/log/chronos + level = 2 + + [alarms] + enabled = true + + [exceptions] + max_ttl = 600 + EOF + + # Now install the software. + DEBIAN_FRONTEND=noninteractive apt-get install sprout-node --yes --force-yes + DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes + + # Function to give DNS record type and IP address for specified IP address + ip2rr() { + if echo $1 | grep -q -e '[^0-9.]' ; then + echo AAAA $1 + else + echo A $1 + fi + } + + # Update DNS + retries=0 + while ! { nsupdate -y "__zone__:__dnssec_key__" -v << EOF + server __dns_ip__ + update add sprout-__index__.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add __index__.sprout.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add sprout.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add scscf.sprout.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add icscf.sprout.__zone__. 30 $(ip2rr $PUBLIC_ADDR) + update add sprout.__zone__. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.sprout.__zone__. + update add _sip._tcp.sprout.__zone__. 30 SRV 0 0 5054 __index__.sprout.__zone__. + update add icscf.sprout.__zone__. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.icscf.sprout.__zone__. + update add _sip._tcp.icscf.sprout.__zone__. 30 SRV 0 0 5052 __index__.sprout.__zone__. + update add scscf.sprout.__zone__. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.scscf.sprout.__zone__. + update add _sip._tcp.scscf.sprout.__zone__. 30 SRV 0 0 5054 __index__.sprout.__zone__. + send + EOF + } && [ $retries -lt 10 ] + do + retries=$((retries + 1)) + echo 'nsupdate failed - retrying (retry '$retries')...' + sleep 5 + done + + # Use the DNS server. + echo 'nameserver __dns_ip__' > /etc/dnsmasq.resolv.conf + echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq + service dnsmasq force-reload + +outputs: + public_ip: + description: IP address in public network + value: { get_attr: [ server, accessIPv4 ] } |