Add TaskEvent registry

This updates the parse registries script and
adds the task registry to be used by task service.
This templates the original Base Registry so it
can be reused for all registries.

Tested: script works, validator passes

Change-Id: Id1cf3a41fb76ccaadace114725480f410bfba3e8
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
old mode 100644
new mode 100755
index d5e83bc..df72fd9
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -14,7 +14,7 @@
 import xml.etree.ElementTree as ET
 
 REGISTRY_HEADER = '''/*
-// Copyright (c) 2019 Intel Corporation
+// Copyright (c) 2020 Intel Corporation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -53,17 +53,24 @@
     'https': os.environ.get("https_proxy", None)
 }
 
-base_file = requests.get(
-    'https://redfish.dmtf.org/registries/Base.1.4.0.json',
-    proxies=proxies)
-base_file.raise_for_status()
-base_json = json.loads(base_file.text)
-base_path = os.path.join(include_path, "base_message_registry.hpp")
 
-files = [(base_path, base_json, "base")]
+def make_getter(dmtf_name, header_name, type_name):
+    url = 'https://redfish.dmtf.org/registries/{}'.format(dmtf_name)
+    dmtf = requests.get(url, proxies=proxies)
+    dmtf.raise_for_status()
+    json_file = json.loads(dmtf.text)
+    path = os.path.join(include_path, header_name)
+    return (path, json_file, type_name, url)
+
+
+files = []
+files.append(make_getter('Base.1.4.0.json',
+                         'base_message_registry.hpp', 'base'))
+files.append(make_getter('TaskEvent.1.0.1.json',
+                         'task_event_message_registry.hpp', 'task_event'))
 
 # Remove the old files
-for file, json, namespace in files:
+for file, json, namespace, url in files:
     try:
         os.remove(file)
     except BaseException:
@@ -84,6 +91,7 @@
         registry.write("\"{}\",".format(json["OwningEntity"]))
         registry.write("};")
 
+        registry.write('constexpr const char * url = "{}";\n\n'.format(url))
         # Parse each Message entry
         registry.write("constexpr std::array<MessageEntry, {}> registry = {{".format(
             len(json["Messages"])))