add parameter resolution (CDS) in User-Guide
[doc.git] / docs / guides / onap-user / design / parameter_resolution / freeradius_example / before_enrichment / HEAT_freeradius / radius.yaml
diff --git a/docs/guides/onap-user/design/parameter_resolution/freeradius_example/before_enrichment/HEAT_freeradius/radius.yaml b/docs/guides/onap-user/design/parameter_resolution/freeradius_example/before_enrichment/HEAT_freeradius/radius.yaml
new file mode 100755 (executable)
index 0000000..a699ca0
--- /dev/null
@@ -0,0 +1,163 @@
+heat_template_version: 2013-05-23\r
+\r
+description: Heat template to deploy a FreeRadius\r
+\r
+parameters:\r
+# Metadata required by ONAP\r
+  vnf_name:\r
+    type: string\r
+    label: VM name\r
+    description: The VM name\r
+  vnf_id:\r
+    type: string\r
+    label: VNF ID\r
+    description: The VNF ID is provided by ONAP\r
+  vf_module_id:\r
+    type: string\r
+    label: VF module ID\r
+    description: The VF Module ID is provided by ONAP\r
+\r
+# Server parameters, naming required by ONAP\r
+  image_name:\r
+    type: string\r
+    label: Image name or ID\r
+    description: Image to be used for compute instance\r
+  flavor_name:\r
+    type: string\r
+    label: Flavor\r
+    description: Type of instance (flavor) to be used\r
+  pub_key:\r
+    type: string\r
+    label: Public key\r
+    description: Public key to be installed on the compute instance\r
+  key_name:\r
+    type: string\r
+    label: Public key name\r
+    description: Public key name to be installed on the compute instance    \r
+  freeRadius_name_0:\r
+    type: string\r
+    label: VM name\r
+    description: The VM name\r
+\r
+# Network parameters, naming required by ONAP\r
+  onap_private_net_id:\r
+    type: string\r
+    label: management network\r
+    description: The management network\r
+  onap_private_subnet_id:\r
+    type: string\r
+    label: management network\r
+    description: The management network\r
+  public_net_id:\r
+    type: string\r
+    label: control plane network\r
+    description: The control plane network\r
+  freeradius_ip:\r
+    type: string\r
+    label: freeradius vm ip address\r
+    description: freeradius vm ip address\r
+\r
+resources:\r
+  random-str:\r
+    type: OS::Heat::RandomString\r
+    properties:\r
+      length: 4\r
+      \r
+  freeRadius_key:\r
+    type: OS::Nova::KeyPair\r
+    properties:\r
+      name: { get_param: key_name } \r
+      public_key: { get_param: pub_key }\r
+      save_private_key: false\r
+\r
+  freeRadius_oam_security_group:\r
+    type: OS::Neutron::SecurityGroup\r
+    properties:\r
+      description: security group\r
+      name:\r
+        str_replace:\r
+          template: pre_base_rand\r
+          params:\r
+            pre: oam_sg_\r
+            base: { get_param: vnf_name }\r
+            rand: { get_resource: random-str }\r
+      rules: [\r
+        {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22},\r
+        {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}]\r
+\r
+  freeRadius_control_plane_security_group:\r
+    type: OS::Neutron::SecurityGroup\r
+    properties:\r
+      description: security group\r
+      name:\r
+        str_replace:\r
+          template: pre_base_rand\r
+          params:\r
+            pre: cp_sg_\r
+            base: { get_param: vnf_name }\r
+            rand: { get_resource: random-str }\r
+      rules: [\r
+        {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22},\r
+        {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}]\r
+\r
+  freeRadius_0_oam_port_0:\r
+    type: OS::Neutron::Port\r
+    properties:\r
+      name:\r
+        str_replace:\r
+          template: pre_base_rand\r
+          params:\r
+            pre: oam_port_\r
+            base: { get_param: vnf_name }\r
+            rand: { get_resource: random-str }\r
+      network: { get_param: onap_private_net_id }\r
+      fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: freeradius_ip }}]\r
+      security_groups: [{ get_resource: freeRadius_oam_security_group }]\r
+\r
+  freeRadius_0_control_plane_port_0:\r
+    type: OS::Neutron::Port\r
+    properties:\r
+      name:\r
+        str_replace:\r
+          template: pre_base_rand\r
+          params:\r
+            pre: cp_port_\r
+            base: { get_param: vnf_name }\r
+            rand: { get_resource: random-str }\r
+      network: { get_param: public_net_id }\r
+      security_groups: [{ get_resource: freeRadius_control_plane_security_group }]\r
+\r
+  freeRadius_VM_settings:\r
+    type: OS::Heat::SoftwareConfig\r
+    properties:\r
+      config: |\r
+            #!/bin/bash\r
+            apt-get update\r
+            apt-get install -y freeradius\r
+            echo -e "password\npassword" | passwd cloud\r
+            sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config \r
+            service ssh restart\r
+\r
+\r
+  freeRadius_server_0:\r
+    type: OS::Nova::Server\r
+    properties:\r
+      image: { get_param: image_name }\r
+      flavor: { get_param: flavor_name }\r
+      name: { get_param: freeRadius_name_0 }\r
+      metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }, vnf_name: { get_param: vnf_name }}\r
+      key_name: { get_resource: freeRadius_key }\r
+      networks:\r
+        - port: { get_resource: freeRadius_0_oam_port_0 }\r
+        - port: { get_resource: freeRadius_0_control_plane_port_0 }\r
+      user_data_format: RAW\r
+      user_data: |\r
+        #!/bin/bash\r
+        echo "!!! Install FreeRadius"\r
+        apt-get update\r
+        apt-get install -y freeradius\r
+        echo "!!! Setup password authentication for user cloud"\r
+        echo -e "password\npassword" | passwd cloud\r
+        sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config \r
+        service ssh restart\r
+        echo "!!! Done"\r