Exclude not used schemas

Created a list of all used schemas, and a few being added for use in reviews
now. Exclude all other schemas.

Developers if they wish to use a new schema will have to add it to this
list and rerun update_schemas.py.

Size of obmc-phosphor-image-witherspoon-<date>.rootfs.squashfs-xz:
Before 2020.4: 19451904
With 2020.4, before this commit: 19492864
With this commit: 19275776

Tested: Validator passes.
Change-Id: I23272049aa38c51ac7af0d3b0f5b4641a349a487
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py
index 43d563a..315522c 100755
--- a/scripts/update_schemas.py
+++ b/scripts/update_schemas.py
@@ -14,6 +14,100 @@
 
 VERSION = "DSP8010_2020.4"
 
+# To use a new schema, add to list and rerun tool
+include_list = [
+    'AccountService',
+    'ActionInfo',
+    'Assembly',
+    'AttributeRegistry',
+    'Bios',
+    'Certificate',
+    'CertificateCollection',
+    'CertificateLocations',
+    'CertificateService',
+    'Chassis',
+    'ChassisCollection',
+    'ComputerSystem',
+    'ComputerSystemCollection',
+    'Drive',
+    'DriveCollection',
+    'EthernetInterface',
+    'EthernetInterfaceCollection',
+    'Event',
+    'EventDestination',
+    'EventDestinationCollection',
+    'EventService',
+    'IPAddresses',
+    'JsonSchemaFile',
+    'JsonSchemaFileCollection', #redfish/v1/JsonSchemas
+    'LogEntry',
+    'LogEntryCollection',
+    'LogService',
+    'LogServiceCollection',
+    'Manager',
+    'ManagerAccount',
+    'ManagerAccountCollection',
+    'ManagerCollection',
+    'ManagerNetworkProtocol',
+    'Memory',
+    'MemoryCollection',
+    'Message',
+    'MessageRegistry',
+    'MessageRegistryCollection',
+    'MessageRegistryFile',
+    'MessageRegistryFileCollection',
+    'MetricDefinition',
+    'MetricDefinitionCollection',
+    'MetricReport',
+    'MetricReportCollection',
+    'MetricReportDefinition',
+    'MetricReportDefinitionCollection',
+    'OperatingConfig',
+    'OperatingConfigCollection',
+    'PCIeDevice',
+    'PCIeDeviceCollection',
+    'PCIeFunction',
+    'PCIeFunctionCollection',
+    'Power',
+    'Processor',
+    'ProcessorCollection',
+    'RedfishError',
+    'RedfishExtensions',
+    'Redundancy',
+    'Resource',
+    'Role',
+    'RoleCollection',
+    'Sensor',
+    'SensorCollection',
+    'ServiceRoot',
+    'Session',
+    'SessionCollection',
+    'SessionService',
+    'Settings',
+    'SoftwareInventory',
+    'SoftwareInventoryCollection',
+    'Storage',
+    'StorageCollection',
+    'StorageController',
+    'StorageControllerCollection',
+    'Task',
+    'TaskCollection',
+    'TaskService',
+    'TelemetryService',
+    'Thermal',
+    'UpdateService',
+    'VLanNetworkInterfaceCollection',
+    'VLanNetworkInterface',
+    'VirtualMedia',
+    'VirtualMediaCollection',
+    'odata',
+    'odata-v4',
+    'redfish-error',
+    'redfish-payload-annotations',
+    'redfish-schema',
+    'redfish-schema-v1',
+]
+
 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
 
 proxies = {
@@ -69,6 +163,13 @@
                                                 "/csdl/") & (zip_filepath != VERSION +
                                                              "/csdl/"):
             filename = os.path.basename(zip_filepath)
+
+            # filename looks like Zone_v1.xml
+            filenamesplit = filename.split("_")
+            if filenamesplit[0] not in include_list:
+                print("excluding schema: " + filename)
+                continue
+
             with open(os.path.join(schema_path, filename), 'wb') as schema_file:
 
                 metadata_index.write(
@@ -146,6 +247,11 @@
     if zip_filepath.startswith(os.path.join(VERSION, 'json-schema/')):
         filename = os.path.basename(zip_filepath)
         filenamesplit = filename.split(".")
+
+        # exclude schemas again to save flash space
+        if filenamesplit[0] not in include_list:
+            continue
+
         if len(filenamesplit) == 3:
             thisSchemaVersion = schema_files.get(filenamesplit[0], None)
             if thisSchemaVersion is None: