Add SubordinateOverrides & Fix Log_services privileges

SubordinateOverrides:
  This commit automates the creation of SubordinateOverrides privileges
  structures from the redfish privilege registry. In addition, it
  enhances the function of parse_registries.py.

  It reads SubordinateOverrides privilege registry from DMTF and
  generates const defines SubordinateOverrides for all the privilege
  registry entries in the same format that the Privileges struct
  accepts.

  Moreover, it generates unique const defines for all
  SubordinateOverrides target levels.
  Ex: EthernetInterface SubordinateOverrides has two "Targets":
      ["Manager", "EthernetInterfaceCollection"]. So
      parse_registries.py generates two unique const

      1) Subordinate override for Manager -> EthernetInterface
      2) Subordinate override for Manager ->
         EthernetInterfaceCollection ->  EthernetInterface

  Note: if SubordinateOverrides privilege gets changed, then it
  automatically updates that route privilege, but if
  SubordinateOverrides target gets changed, then the user needs to
  update that manually.

Fix Log_services privileges:
  In Log_services, some of the privileges not following the
  Redfish_1.1.0_PrivilegeRegistry registry.

  This commit contains the following LogServices privileges.

  1) POST method
```
     ComputerSystem -> LogServiceCollection -> LogService
      - POST /redfish/v1/Systems/<str>/LogServices/EventLog/Actions/LogService.ClearLog/
      - POST /redfish/v1/Systems/<str>/LogServices/Dump/Actions/LogService.CollectDiagnosticData/
      - POST /redfish/v1/Systems/<str>/LogServices/Dump/Actions/LogService.ClearLog/
      - POST /LogServices/PostCodes/Actions/LogService.ClearLog/
```

   2) DELETE method
```
     ComputerSystem -> LogServiceCollection -> LogService -> LogEntryCollection -> LogEntry
       - DELETE /redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/
```

This commit also changes the current privilege

   1) ConfigureManager to ConfigureComponents.

```
    DELETE /redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>
```

   2) ConfigureCompnents -> ConfigureManager

```
   POST /redfish/v1/Systems/<str>/LogServices/Dump/Actions/LogService.ClearLog/
   POST /redfish/v1/Systems/<str>/LogServices/EventLog/Actions/LogService.ClearLog/
   POST /redfish/v1/Systems/<str>/LogServices/Dump/Actions/LogService.CollectDiagnosticData/
```

Tested: manually tested on Witherspoon system, there is no change in
        output. Run Redfish validator, with all different Privileges;
        Error Get: UUID: String '' does not match pattern ''
        this commit doesn't affect UUID

Email sent to openbmc list:
https://lists.ozlabs.org/pipermail/openbmc/2021-August/027232.html

Change-Id: I37d8a2882f1cfaa59a482083f180fdd0805e2e7d
Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com>
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
index 041b86e..747aac1 100755
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -615,6 +615,17 @@
                     privilege_list,
                     None,
                 )
+            if "SubordinateOverrides" in mapping:
+                for subordinateOverride in mapping["SubordinateOverrides"]:
+                    for operation, privilege_list in subordinateOverride[
+                        "OperationMap"
+                    ].items():
+                        privilege_dict[
+                            get_privilege_string_from_list(privilege_list)
+                        ] = (
+                            privilege_list,
+                            None,
+                        )
         for index, key in enumerate(privilege_dict):
             (privilege_list, _) = privilege_dict[key]
             name = get_variable_name_for_privilege_set(privilege_list)
@@ -641,6 +652,32 @@
                     )
                 )
             registry.write("\n")
+            if "SubordinateOverrides" in mapping:
+                for subordinateOverrides in mapping["SubordinateOverrides"]:
+                    target_list_list = subordinateOverrides["Targets"]
+                    registry.write("// Subordinate override for ")
+                    concateVarName = ""
+                    for target in target_list_list:
+                        registry.write(target + " -> ")
+                        concateVarName += target
+                    registry.write(entity)
+                    registry.write("\n")
+                    for operation, privilege_list in subordinateOverrides[
+                        "OperationMap"
+                    ].items():
+                        privilege_string = get_privilege_string_from_list(
+                            privilege_list
+                        )
+                        operation = operation.lower()
+                        registry.write(
+                            "const static auto& {}{}SubOver{} = privilegeSet{};\n".format(
+                                operation,
+                                entity,
+                                concateVarName,
+                                privilege_dict[privilege_string][1],
+                            )
+                        )
+                    registry.write("\n")
         registry.write(
             "} // namespace redfish::privileges\n// clang-format on\n"
         )