Tool: Fix default service version setting

As mentioned in FF-M, if "version" attribute is not specified,
default value is "1", if "version_policy" is not specified,
default value is "STRICT".

Change-Id: Iefc406d966a951e8e827c67abbecdf2522ba2cbb
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index 7a23621..43fca1f 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -50,6 +50,24 @@
             source = f.read()
         return source, template, False
 
+def manifest_validation(partition_manifest):
+    """
+    This function validates FF-M compliance for partition manifest, and sets
+    default values for optional attributes.
+    More validation items will be added.
+    """
+    # Service FF-M manifest validation
+    if 'services' not in partition_manifest.keys():
+        return partition_manifest
+
+    for service in partition_manifest['services']:
+        if 'version' not in service.keys():
+            service['version'] = 1
+        if 'version_policy' not in service.keys():
+            service['version_policy'] = "STRICT"
+
+    return partition_manifest
+
 def process_partition_manifests(manifest_list_files):
     """
     Parse the input manifest, generate the data base for genereated files
@@ -97,7 +115,7 @@
         # Replace environment variables in the manifest path
         manifest_path = os.path.expandvars(manifest_item['manifest'])
         file = open(manifest_path)
-        manifest = yaml.safe_load(file)
+        manifest = manifest_validation(yaml.safe_load(file))
         file.close()
 
         manifest_dir, manifest_name = os.path.split(manifest_path)