Add ability to pass hardware metadata

Related-Prod: PRODX-00000
Change-Id: I4c377558ffe13e28f8ac5ced45262ff67556f46c
diff --git a/de/heat-templates/fragments/SrvInstancesVM.yaml b/de/heat-templates/fragments/SrvInstancesVM.yaml
index 5b1a681..fbedc71 100644
--- a/de/heat-templates/fragments/SrvInstancesVM.yaml
+++ b/de/heat-templates/fragments/SrvInstancesVM.yaml
@@ -45,6 +45,10 @@
     type: string
   docker_ee_url:
     type: string
+  hardware_metadata:
+    description: The content of lab metadata.
+    default: ''
+    type: string
 
 resources:
 
@@ -69,6 +73,27 @@
             $private_floating_network_cidr: { get_param: private_floating_network_cidr }
             $functions_override: { get_param: functions_override }
 
+  inject_files:
+    type: "OS::Heat::CloudConfig"
+    properties:
+      cloud_config:
+        write_files:
+          - path: /usr/sbin/prepare-metadata.py
+            owner: "root:root"
+            permissions: "0755"
+            content: {get_file: ../scripts/prepare-metadata.py}
+          - path: /usr/share/metadata/lab-metadata.yaml
+            owner: "root:root"
+            permissions: "0644"
+            content: { get_param: hardware_metadata}
+
+  install_config_agent:
+    type: "OS::Heat::MultipartMime"
+    properties:
+      parts:
+      - config: {get_resource: software_config}
+      - config: {get_resource: inject_files}
+
   server:
     type: OS::Nova::Server
     properties:
@@ -79,8 +104,8 @@
       networks:
         - port: { get_resource: accessible_server_port }
         - port: { get_resource: private_floating_server_port }
-      user_data_format: RAW
-      user_data: { get_resource: software_config }
+      user_data_format: SOFTWARE_CONFIG
+      user_data: { get_resource:  install_config_agent}
       metadata: { get_param: metadata }
 
   accessible_server_port:
@@ -123,3 +148,6 @@
   server_public_ip:
     description: Floating IP address of server in public network
     value: { get_attr: [ server_floating_ip, floating_ip_address ] }
+  wc_data:
+    description: Metadata from instance
+    value: { get_attr: [wait_condition, data]}