Use Redfish Http cache library to query Redfish service.

Signed-off-by: Nickle Wang <nick...@nvidia.com>
Cc: Abner Chang <abner.ch...@amd.com>
Cc: Igor Kulchytskyy <ig...@ami.com>
Cc: Nick Ramirez <nrami...@nvidia.com>
---
 .../ComputerSystemCollectionDxe.inf           |  2 ++
 .../ComputerSystemCollectionDxe.c             | 26 +++++++++----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.inf
 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.inf
index 107d6c07..b848f69f 100644
--- 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.inf
+++ 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.inf
@@ -3,6 +3,7 @@
 #  Redfish ComputerSystemCollection collection driver.
 #
 #  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+#  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -40,6 +41,7 @@
   UefiBootServicesTableLib
   EdkIIRedfishResourceConfigLib
   RedfishVersionLib
+  RedfishHttpCacheLib
 
 [Protocols]
   gEdkIIRedfishConfigHandlerProtocolGuid    ## CONSUMED
diff --git 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
index 74003406..05d74625 100644
--- 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
+++ 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
@@ -3,7 +3,7 @@
   Redfish feature driver implementation - ComputerSystemCollection
 
   (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
-  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -256,17 +256,17 @@ ReleaseCollectionResource (
   //
   // Release resource
   //
-  if (Private->RedResponse.Payload != NULL) {
+  if (Private->Response.Payload != NULL) {
     RedfishFreeResponse (
-      Private->RedResponse.StatusCode,
-      Private->RedResponse.HeaderCount,
-      Private->RedResponse.Headers,
-      Private->RedResponse.Payload
+      Private->Response.StatusCode,
+      Private->Response.HeaderCount,
+      Private->Response.Headers,
+      Private->Response.Payload
       );
-    Private->RedResponse.StatusCode  = NULL;
-    Private->RedResponse.HeaderCount = 0;
-    Private->RedResponse.Headers     = NULL;
-    Private->RedResponse.Payload     = NULL;
+    Private->Response.StatusCode  = NULL;
+    Private->Response.HeaderCount = 0;
+    Private->Response.Headers     = NULL;
+    Private->Response.Payload     = NULL;
   }
 
   if (Private->CollectionJson != NULL) {
@@ -298,13 +298,13 @@ CollectionHandler (
   //
   // Query collection from Redfish service.
   //
-  Status = GetResourceByUri (Private->RedfishService, Private->CollectionUri, 
&Private->RedResponse);
+  Status = RedfishHttpGetResource (Private->RedfishService, 
Private->CollectionUri, &Private->Response, TRUE);
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a: unable to get resource from: %s :%r\n", 
__func__, Private->CollectionUri, Status));
     goto ON_RELEASE;
   }
 
-  Private->CollectionPayload = Private->RedResponse.Payload;
+  Private->CollectionPayload = Private->Response.Payload;
   ASSERT (Private->CollectionPayload != NULL);
 
   Private->CollectionJson = JsonDumpString (RedfishJsonInPayload 
(Private->CollectionPayload), EDKII_JSON_COMPACT);
@@ -370,7 +370,7 @@ RedfishCollectionFeatureCallback (
   Private->InformationExchange = InformationExchange;
 
   //
-  // Find Redfish version on BMC
+  // Find Redfish version on Redfish service.
   //
   Private->RedfishVersion = RedfishGetVersion (RedfishService);
 
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113117): https://edk2.groups.io/g/devel/message/113117
Mute This Topic: https://groups.io/mt/103515961/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to