summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml
blob: 5915ed2b938a6d1834043926c897ab2db9e5c1c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
heat_template_version: 2015-10-15

description: >
  Template for deploying n PROX instances. The template allows for deploying
  multiple groups of PROX VMs. You can create a first group with certain
  flavors, availability groups, etc... Another group can be created with
  different characteristics.

parameters:
  public_net_name: {description: Public network to allocate (floating) IPs to VMs', type: string, default: admin_floating_net}
  mgmt_net_name: {description: Name of PROX mgmt network to be created, type: string, default: admin_internal_net}
  PROX_image: {description: Image name to use for PROX, type: string, default: rapidVM}
  PROX_key: {description: DO NOT CHANGE THIS DEFAULT KEY NAME, type: string, default: rapid_key}
  my_availability_zone: {description: availability_zone for Hosting VMs, type: string, default: nova}
  security_group: {description: Security Group to use, type: string, default: prox_security_group}
  PROXType1VM_count: {description: Total number of testVMs to create, type: number, default: 2}
  PROXType2VM_count: {description: Total number of testVMs type 2 to create, type: number, default: 1}
  PROXType3VM_count: {description: Total number of testVMs type 3 to create, type: number, default: 1}

# The following paramters are not used, but are here in case you want to also
# create the management and dataplane networks in this template
  mgmt_net_cidr: {description: PROX mgmt network CIDR, type: string, default: 20.20.1.0/24}
  mgmt_net_gw: {description: PROX mgmt network gateway address, type: string, default: 20.20.1.1}
  mgmt_net_pool_start: {description: Start of mgmt network IP address allocation pool, type: string, default: 20.20.1.100}
  mgmt_net_pool_end: {description: End of mgmt network IP address allocation pool, type: string, default: 20.20.1.200}
  data_net_name: {description: Name of PROX private network to be created, type: string, default: dataplane-network}
  data_net_cidr: {description: PROX private network CIDR,type: string, default: 30.30.1.0/24}
  data_net_pool_start: {description: Start of private network IP address allocation pool, type: string, default: 30.30.1.100}
  data_net_pool_end: {description: End of private network IP address allocation pool, type: string, default: 30.30.1.200}
  data2_net_name: {description: Name of PROX private network 2 to be created, type: string, default: data2}
  dns:
    type: comma_delimited_list
    label: DNS nameservers
    description: Comma separated list of DNS nameservers for the management network.
    default: '8.8.8.8'

resources:
  PROXType1VMs:
    type: OS::Heat::ResourceGroup
    description: Group of PROX VMs according to specs described in this section
    properties:
      count: { get_param: PROXType1VM_count }
      resource_def:
        type: rapid-openstack-server.yaml
        properties:
          PROX_availability_zone : {get_param: my_availability_zone}
          PROX_security_group : {get_param: security_group}
          PROX_image: {get_param: PROX_image}
          PROX_key: {get_param: PROX_key}
          PROX_server_name: rapidVM-%index%
          PROX_public_net: {get_param: public_net_name}
          PROX_mgmt_net_id: {get_param: mgmt_net_name}
          PROX_data_net_id: {get_param: data_net_name}
          PROX_config: {get_resource: MyConfig}
    depends_on:
      - MyConfig
  
  PROXType2VMs:
    type: OS::Heat::ResourceGroup
    description: Group of PROX VMs according to specs described in this section
    properties:
      count: { get_param: PROXType2VM_count }
      resource_def:
        type: rapid-openstack-server-2ports.yaml
        properties:
          PROX_availability_zone : {get_param: my_availability_zone}
          PROX_security_group : {get_param: security_group}
          PROX_image: {get_param: PROX_image}
          PROX_key: {get_param: PROX_key}
          PROX_server_name: rapidType2VM-%index%
          PROX_public_net: {get_param: public_net_name}
          PROX_mgmt_net_id: {get_param: mgmt_net_name}
          PROX_data_net_id: {get_param: data_net_name}
          PROX_data2_net_id: {get_param: data2_net_name}
          PROX_config: {get_resource: MyConfig}
    depends_on:
      - MyConfig
  
  PROXType3VMs:
    type: OS::Heat::ResourceGroup
    description: Group of PROX VMs according to specs described in this section
    properties:
      count: { get_param: PROXType3VM_count }
      resource_def:
        type: rapid-openstack-server.yaml
        properties:
          PROX_availability_zone : {get_param: my_availability_zone}
          PROX_security_group : {get_param: security_group}
          PROX_image: {get_param: PROX_image}
          PROX_key: {get_param: PROX_key}
          PROX_server_name: rapidType3VM-%index%
          PROX_public_net: {get_param: public_net_name}
          PROX_mgmt_net_id: {get_param: mgmt_net_name}
          PROX_data_net_id: {get_param: data2_net_name}
          PROX_config: {get_resource: MyConfig}
    depends_on:
      - MyConfig
  
  MyConfig:
    type: OS::Heat::CloudConfig
    properties:
      cloud_config:
        users:
        - default
        - name: rapid
          groups: "users,root"
          lock-passwd: false
          passwd: 'test'
          shell: "/bin/bash"
          sudo: "ALL=(ALL) NOPASSWD:ALL"
        ssh_pwauth: true
        chpasswd:
          list:  |
              rapid:rapid
          expire: False
        write_files:
        - path: /opt/rapid/after_boot.sh
          # - path: /opt/rapid/after_boot_do_not_run.sh
          # after_boot.sh is ran by check_prox_system_setup.sh, if it exists
          # This can be used to fix some issues, like in the example below
          # Remove this section or rename the file, if you do not want to run
          # this after booting
          content: |
            OLDIFS="${IFS}"
            IFS=$'\n'
            list="$(ip route | grep via | grep -v 'dev eth0')"
            # Delete all routes using gateway on other interfaces than eth0
            for item in ${list}
              do /bin/bash -c "sudo ip route del ${item}"
            done
            /bin/bash -c "sudo ip route add default via 10.6.6.1 dev eth0"
            /bin/bash -c "echo nameserver 8.8.8.8 > /etc/resolv.conf"
            IFS="${OLDIFS}"
          permissions: '0777'

outputs:
  number_of_servers:
    description: List of number or PROX instance
    value: 
      - {get_param: PROXType1VM_count}
      - {get_param: PROXType2VM_count}
      - {get_param: PROXType3VM_count}
  server_name:
    description: List of list of names of the PROX instances
    value: 
      - {get_attr: [PROXType1VMs, name]}
      - {get_attr: [PROXType2VMs, name]}
      - {get_attr: [PROXType3VMs, name]}
  mngmt_ips:
    description: List of list of Management IPs of the VMs
    value: 
      - {get_attr: [PROXType1VMs, mngmt_ip]}
      - {get_attr: [PROXType2VMs, mngmt_ip]}
      - {get_attr: [PROXType3VMs, mngmt_ip]}
  data_plane_ips:
    description: List of list of list of DataPlane IPs of the VMs
    value: 
      - {get_attr: [PROXType1VMs, data_plane_ips]}
      - {get_attr: [PROXType2VMs, data_plane_ips]}
      - {get_attr: [PROXType3VMs, data_plane_ips]}
  data_plane_macs:
    description: List of list of list of DataPlane MACs of the VMs
    value: 
      - {get_attr: [PROXType1VMs, data_plane_mac]}
      - {get_attr: [PROXType2VMs, data_plane_mac]}
      - {get_attr: [PROXType3VMs, data_plane_mac]}