remove parallelisation to save memory
[doc.git] / docs / guides / onap-user / design / parameter_resolution / freeradius_example / before_enrichment / HEAT_freeradius / radius.yaml
1 heat_template_version: 2013-05-23\r
2 \r
3 description: Heat template to deploy a FreeRadius\r
4 \r
5 parameters:\r
6 # Metadata required by ONAP\r
7   vnf_name:\r
8     type: string\r
9     label: VM name\r
10     description: The VM name\r
11   vnf_id:\r
12     type: string\r
13     label: VNF ID\r
14     description: The VNF ID is provided by ONAP\r
15   vf_module_id:\r
16     type: string\r
17     label: VF module ID\r
18     description: The VF Module ID is provided by ONAP\r
19 \r
20 # Server parameters, naming required by ONAP\r
21   image_name:\r
22     type: string\r
23     label: Image name or ID\r
24     description: Image to be used for compute instance\r
25   flavor_name:\r
26     type: string\r
27     label: Flavor\r
28     description: Type of instance (flavor) to be used\r
29   pub_key:\r
30     type: string\r
31     label: Public key\r
32     description: Public key to be installed on the compute instance\r
33   key_name:\r
34     type: string\r
35     label: Public key name\r
36     description: Public key name to be installed on the compute instance    \r
37   freeRadius_name_0:\r
38     type: string\r
39     label: VM name\r
40     description: The VM name\r
41 \r
42 # Network parameters, naming required by ONAP\r
43   onap_private_net_id:\r
44     type: string\r
45     label: management network\r
46     description: The management network\r
47   onap_private_subnet_id:\r
48     type: string\r
49     label: management network\r
50     description: The management network\r
51   public_net_id:\r
52     type: string\r
53     label: control plane network\r
54     description: The control plane network\r
55   freeradius_ip:\r
56     type: string\r
57     label: freeradius vm ip address\r
58     description: freeradius vm ip address\r
59 \r
60 resources:\r
61   random-str:\r
62     type: OS::Heat::RandomString\r
63     properties:\r
64       length: 4\r
65       \r
66   freeRadius_key:\r
67     type: OS::Nova::KeyPair\r
68     properties:\r
69       name: { get_param: key_name } \r
70       public_key: { get_param: pub_key }\r
71       save_private_key: false\r
72 \r
73   freeRadius_oam_security_group:\r
74     type: OS::Neutron::SecurityGroup\r
75     properties:\r
76       description: security group\r
77       name:\r
78         str_replace:\r
79           template: pre_base_rand\r
80           params:\r
81             pre: oam_sg_\r
82             base: { get_param: vnf_name }\r
83             rand: { get_resource: random-str }\r
84       rules: [\r
85         {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22},\r
86         {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}]\r
87 \r
88   freeRadius_control_plane_security_group:\r
89     type: OS::Neutron::SecurityGroup\r
90     properties:\r
91       description: security group\r
92       name:\r
93         str_replace:\r
94           template: pre_base_rand\r
95           params:\r
96             pre: cp_sg_\r
97             base: { get_param: vnf_name }\r
98             rand: { get_resource: random-str }\r
99       rules: [\r
100         {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22},\r
101         {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}]\r
102 \r
103   freeRadius_0_oam_port_0:\r
104     type: OS::Neutron::Port\r
105     properties:\r
106       name:\r
107         str_replace:\r
108           template: pre_base_rand\r
109           params:\r
110             pre: oam_port_\r
111             base: { get_param: vnf_name }\r
112             rand: { get_resource: random-str }\r
113       network: { get_param: onap_private_net_id }\r
114       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: freeradius_ip }}]\r
115       security_groups: [{ get_resource: freeRadius_oam_security_group }]\r
116 \r
117   freeRadius_0_control_plane_port_0:\r
118     type: OS::Neutron::Port\r
119     properties:\r
120       name:\r
121         str_replace:\r
122           template: pre_base_rand\r
123           params:\r
124             pre: cp_port_\r
125             base: { get_param: vnf_name }\r
126             rand: { get_resource: random-str }\r
127       network: { get_param: public_net_id }\r
128       security_groups: [{ get_resource: freeRadius_control_plane_security_group }]\r
129 \r
130   freeRadius_VM_settings:\r
131     type: OS::Heat::SoftwareConfig\r
132     properties:\r
133       config: |\r
134             #!/bin/bash\r
135             apt-get update\r
136             apt-get install -y freeradius\r
137             echo -e "password\npassword" | passwd cloud\r
138             sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config \r
139             service ssh restart\r
140 \r
141 \r
142   freeRadius_server_0:\r
143     type: OS::Nova::Server\r
144     properties:\r
145       image: { get_param: image_name }\r
146       flavor: { get_param: flavor_name }\r
147       name: { get_param: freeRadius_name_0 }\r
148       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }, vnf_name: { get_param: vnf_name }}\r
149       key_name: { get_resource: freeRadius_key }\r
150       networks:\r
151         - port: { get_resource: freeRadius_0_oam_port_0 }\r
152         - port: { get_resource: freeRadius_0_control_plane_port_0 }\r
153       user_data_format: RAW\r
154       user_data: |\r
155         #!/bin/bash\r
156         echo "!!! Install FreeRadius"\r
157         apt-get update\r
158         apt-get install -y freeradius\r
159         echo "!!! Setup password authentication for user cloud"\r
160         echo -e "password\npassword" | passwd cloud\r
161         sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config \r
162         service ssh restart\r
163         echo "!!! Done"\r