From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.42]) by mx.groups.io with SMTP id smtpd.web12.30121.1660749660320086850 for ; Wed, 17 Aug 2022 08:21:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=P1LbDrAa; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.101.42, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DAX0Iq9kfOAa7OBL1swRfp95PN90dCyEZNnHdrgwZAwBV4UP5hJ1HGvxx5D4t1GwqVixE023Jv6ot3XSsvAPoN2dCL2hZfnPMtC9Tm77a7B8/nQv/QhbnDs1B9b0xoxMfWkAxIVWr+8DvRahvCnaBA9ZUp5BO/MLQQ2cnK5QdY24VV0B9DJieY/q17LN3AGnmheTghVVAQ4UCxuzruF+Wnfes9J5FfUZSY2D4j9lrFzee1+ChEhi7C+ZS79+wfp9mAj89vj3UfTfu3CwdVzN2Ky0yTR0mIyiCXpdIQjrk8Ko9Zpf2TMbqOa+VpbYX+8AdXWw42A3IjwK3LtDsOcNaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dljaiDmjl20QfTD+JbN1vM/nO+kRFABau8SC9zx5Xko=; b=J+TvWIQK32/jGBBIqh8ftBKHZ7i57WbwCiQ8JeHzCiTdrzCISl4ppN+sGuDvn1KwIqeGcmjDhnCeoFKR6Uq0aH3eUWXGcctxCc/DRFvKKI3fmFGk4Z/NKUzVA+euDQMJ0TQapj+LK5UjvA7eLKrMvKga2FG2IUFx4DN07wBFCyVM69MZtlqAF3Wbr2nW+2bDj8PFigrnwG8jWjDiwF6crbAEF8CsMzjbEwhHylM7yEWm10v/Fm8nzxInQ09RUFet0m9ovgms7+/LWj7w3AYk0BIbmcf4cSyn0eSGszfmZ3HJr/vBSFLnn2SSYPri0tz2RU1ZEJb3vA4dNSAvrta2aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dljaiDmjl20QfTD+JbN1vM/nO+kRFABau8SC9zx5Xko=; b=P1LbDrAaJ6FMZXdX7PVB1a1G70k0OkyQmWMba/euHhKGBCVQ2GaCtvkP+zqhjyQ6rOI3HLfR9j0SM+IXRznvnuuabJ3icRXEFZLpt7WGaIBVrev2uJGlRbUT7nrWM/8IUXoB9ACGAHALNt9ClEKj2FH93DsR8g5phV/jTJ+AaPI= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by MWHPR12MB1568.namprd12.prod.outlook.com (2603:10b6:301:e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11; Wed, 17 Aug 2022 15:20:54 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::e850:8264:41be:cb1f]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::e850:8264:41be:cb1f%4]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:20:54 +0000 From: "Chang, Abner" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: "nickle.wang@hpe.com" Subject: Re: [PATCH 3/3] RedfishPkg: The functions for Redfish requests do not fully complied with specification Thread-Topic: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg: The functions for Redfish requests do not fully complied with specification Thread-Index: AQHYsQ8HXswPiaN2H0Ouzm4TF4OdNK2yeF1AgACj/TCAABbEgIAABFVn Date: Wed, 17 Aug 2022 15:20:54 +0000 Message-ID: References: <1660613098-15792-1-git-send-email-igork@ami.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=True;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-08-17T15:09:17.0000000Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5bf4a4e2-e4db-4177-b02f-08da806413cf x-ms-traffictypediagnostic: MWHPR12MB1568:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: a/YRPX43dRK7RDpazV/iMjzOzPdn2omLjqPMHCf16m7b/duj587c3a4tZBoryZBzsHYJO4hmG6IyrTfEL/i7daSwzXvnhghQGaY/GoUSndborsQU35WJOByhuzs9AqPGASNvNooqKAI4JABvvMsRvXA45/Iaea3eN5qr2ITApP1AwwHxKDjzqszSBBHXLqVp/gRdM8vSX9OJIqxcCqW+ezl5fhN0uEmXDSO0lrKtdjHAzb7SGAk3Sc33z8L3UIuDQeLhXs+6SH98fb+HZEgk6J70P91ec2ml4uaaXdrpKrjA8RuK8zE4Q7QqD+RQZO449huYX/OPRMpUcLUaaeJJ26cKQVPTbcueHv96fPvASBIeZKEBtTyzYzWLaBhTwYnt4Q5cx6Q6ICK2Kh7ktJXpxGztpSjYhVoRYXzhghiRi6LiCx1077HP0wbSMJL2fDK0ha/X5wUZtl7jowcWQYIAdDrf8hnmX9cYbe5wTFXbZkfcnE/KBd9MFF2HhpgJTdYQ1eOq9aQklsyfVARH2X3RsmUlbCAP5lZSXiZyASdVbu3991C3T6aoD7t3isUzt8oC5Sb5YF3slmkTP8piiUl5o8lIYkkvWswZj0Lf7dRAii5WL4C1hkzQ0jbi2m8NPIhYQV9KD8vcMoJJ+agQK+jNYrsnRE4zFD3vaQL+je4fvxIJnrCLT5bhDvvPBW1W4Es+CADAkIpBOR03Xoyi2fdwkbcCdoHpAx37X5Cf04PtHkZ+aU7VfInVq/u5qj5O2KM1fkdku0Bl+6pv1B8BLipyjfd6vl1jyAqGKg1oCdLJO3rxmF+1wqSXU1/5wMNq32EIkYk1WwPc3PXWJKAYBa27Fg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(396003)(39860400002)(376002)(136003)(346002)(91956017)(71200400001)(53546011)(2940100002)(6506007)(55016003)(186003)(86362001)(7696005)(9686003)(26005)(83380400001)(110136005)(40140700001)(45080400002)(316002)(4326008)(76116006)(41300700001)(66946007)(66476007)(66446008)(33656002)(66556008)(52536014)(30864003)(478600001)(5660300002)(2906002)(166002)(8676002)(38070700005)(64756008)(8936002)(122000001)(38100700002)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?OkmMeV6uW/uCQgUuaWUOFhPbe7amzll48nga0TXJfzUpe0ORvGXcnBnNQPHW?= =?us-ascii?Q?IbAkvxi8De+gwcHn9IyNIG1jF8l05iVpW/41eNRsUWyLmpHp+CtlC+CmJKb8?= =?us-ascii?Q?DrrEtmRbBKW4/bt9QBidEyJzXO+0OYsp4aTHuCM0o1yFgvQXDswPBIrPXoOL?= =?us-ascii?Q?Cy4RWTOMLxos7TYTXbpzR6j9ucBNZZidIV6m/u8zsUBJgZOp0jtEsvRZIp4G?= =?us-ascii?Q?GOtE3gcNWb9q+y/RJJyuKte4mITrJqQhCHAllwvD/xB/NO8Hol/AXk74sFS+?= =?us-ascii?Q?/F6p/vity/T0BORbApmjwKsS1oIiXBceCDIra7SmCo3qz4nTrBsGQYPQZzP+?= =?us-ascii?Q?aVbBmSARsmCyoPUt/LdqWMoabNsYWodXsVh9GK0nUIV+QZ/oCg1SGhonHh0L?= =?us-ascii?Q?gZBwoDdt6HPZ8NTGQrL8mGwsZ39t/SXZbYsO4e1WN7B26bS3KXZlFMk9U145?= =?us-ascii?Q?P85/B2viMeJVE2psa+zyQ9m6+7X/zv0JMtFhw32jfdL0qS2fUK/Tx94wv/5w?= =?us-ascii?Q?7rQmQNHFgWH6IFCbG6tljkt4vPog7LiS0v8STbj/doOo1qfJhfzamaDkskCM?= =?us-ascii?Q?8C2/QXxQc3VdsQO0htzQI0lmDo43rk4X3Z2EDVpIYbPkjXOzyDVKgFWeD/ZM?= =?us-ascii?Q?6ZXnul20GHZiwqeclQUsXkGfzJ8pPBi0DrD1tAm8WpqUTfscvCPYkRs2fSmo?= =?us-ascii?Q?k8lB3beJ5VGRvlt/a15nixEpM6cgMhkBNQJj0DWwV+KSP1IhDNJYfohn+NfH?= =?us-ascii?Q?14rUP6bTRchHLYXeleVIQeuV49pYhfDcoATTyf+DMDbotg3vLk68bJyO6zU4?= =?us-ascii?Q?89d22nFlQ9XljFzmg7OeieywTOpN2BtkNJIL+Lw7Xe4UGnWqVEIxvdxRYmch?= =?us-ascii?Q?e4a9/wItfy7BMhrfW8Q8Ux2+2i82qfl5MJroDd8YnpV3eMa7J8CvC97NuABN?= =?us-ascii?Q?DXG05mpO2n6/s8VOO1xCD3mEGjcICdsTmJyojA+GJ2Uc/A1yQDulfPUhg+2a?= =?us-ascii?Q?FIr9BMBNpjeNl3Mv7uHsawUw6QqXlIb8AFJmXU0/z0V3bZ2HpEU75n5LnCGb?= =?us-ascii?Q?aGwCsmN5KYH6Y/GH/3bJrbP9itOHByBTg7eQfH+HfUU5VQy9e0XnCKHHjdeA?= =?us-ascii?Q?bBBmKjYw8GL1BavhXwWSAG0lJLyfLALhoVS1/C91446qSSXHn1CWWZ66+1qJ?= =?us-ascii?Q?L561UjoH7BNTJbyPFS5hYcZ1pqt+pybB/PPOpF5vqFNmDvHCncV4hd44YJPe?= =?us-ascii?Q?nEqrLvwYKqOTMNkCIfcNujQwoDh4a4OZ/R6idFD7ef6pOmJuUZHe1KvodePp?= =?us-ascii?Q?HpIgykKPDKlFn1/+41zV6WXOniVEV9kAInAHwkaFi8Z+j4DEg35/iPR6I0Co?= =?us-ascii?Q?G/0LfaXLHI75YctNgxWUzYi5Af/Wq6krWM0qXFZdy1WGOIGGvERGqsrV/9mZ?= =?us-ascii?Q?s0LJCi14HNCQpWRqPmU89u0B2+ZE6wq7eo61mu3ACLEsrftcVchyFt/bxkRq?= =?us-ascii?Q?5Y9RFE//57wUhHvL0LAQTohZZ8O5aYQJcz8Hf6Dyqvh7/sYCS2+ZBrqMSqGk?= =?us-ascii?Q?jQYpgj0c53kGAza6bcjJe+JxGeVARwQyoN9tCBrn?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bf4a4e2-e4db-4177-b02f-08da806413cf X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2022 15:20:54.3340 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vwDx/BTZ/Vl0sToZyRGzm1NvasaZsZliEcI9hGNS8JIrcW68gywHnxItWCrOE2VxHSjGgjWwgL9TBSGl7HfvCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1568 Content-Language: zh-CN Content-Type: multipart/alternative; boundary="_000_MN2PR12MB39664A12C48FDF756A38A916EA6A9MN2PR12MB3966namp_" --_000_MN2PR12MB39664A12C48FDF756A38A916EA6A9MN2PR12MB3966namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sorry, it's a typo. I mean use RedfishPostToUri() makes more sense to me. Abner Get Outlook for Android ________________________________ From: Chang, Abner Sent: Wednesday, August 17, 2022, 11:09 PM To: Igor Kulchytskyy ; devel@edk2.groups.io Cc: nickle.wang@hpe.com Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg: The functions for Redfi= sh requests do not fully complied with specification [AMD Official Use Only - General] Yes, I think we can remove 'Ex' because there is no RedfishPostToUri () in = RedfishLib.c. Also, RedfishPostToUriEx() has the same parameters as postUri= FromService() in service.c. Using RedfishPostToUriEx () makes more sense to= me. Thanks Abner > -----Original Message----- > From: Igor Kulchytskyy > Sent: Wednesday, August 17, 2022 10:35 PM > To: Chang, Abner ; devel@edk2.groups.io > Cc: nickle.wang@hpe.com > Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg: The functions for > Redfish requests do not fully complied with specification > > [CAUTION: External Email] > > Hi Abner, > I just thought that since I'm adding new functions (extending API) I call= those > functions with Ex suffix. > But if you think it is better to have the name without Ex, I can change i= t and > resubmit. > Thank you, > Igor > > -----Original Message----- > From: Chang, Abner > Sent: Wednesday, August 17, 2022 12:00 AM > To: Igor Kulchytskyy ; devel@edk2.groups.io > Cc: nickle.wang@hpe.com > Subject: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg: The functions for Redfish > requests do not fully complied with specification > > > **CAUTION: The e-mail below is from an external source. Please exercise > caution before opening attachments, clicking links, or following guidance= .** > > [AMD Official Use Only - General] > > Hi Igor, > One question in line. > > > -----Original Message----- > > From: Igor Kulchytskyy > > Sent: Tuesday, August 16, 2022 9:25 AM > > To: devel@edk2.groups.io > > Cc: Chang, Abner ; nickle.wang@hpe.com; Igor > > Kulchytskyy ; Chang, Abner > > Subject: [PATCH 3/3] RedfishPkg: The functions for Redfish requests do > > not fully complied with specification > > > > [CAUTION: External Email] > > > > There is no function to send POST request with the Content type which > > is different from "application/json". > > There is no function to send DELETE request with the body. > > > > Cc: Abner Chang > > Cc: Nickle Wang > > Signed-off-by: Igor Kulchytskyy > > --- > > RedfishPkg/Include/Library/RedfishLib.h | 80 +++++++++ > > RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c | 189 > > +++++++++++++++++++++ > > .../edk2libredfish/include/redfishService.h | 8 + > > .../RedfishLib/edk2libredfish/src/service.c | 43 ++++- > > 4 files changed, 317 insertions(+), 3 deletions(-) > > > > diff --git a/RedfishPkg/Include/Library/RedfishLib.h > > b/RedfishPkg/Include/Library/RedfishLib.h > > index b2488ab..d4b3246 100644 > > --- a/RedfishPkg/Include/Library/RedfishLib.h > > +++ b/RedfishPkg/Include/Library/RedfishLib.h > > @@ -380,6 +380,49 @@ RedfishPatchToPayload ( > > OUT REDFISH_RESPONSE *RedResponse > > ); > > > > + > > +/** > > + Use HTTP POST to create new Redfish resource in the Resource > Collection. > > + > > + The POST request should be submitted to the Resource Collection in > > + which the new resource is to belong. The Resource Collection is > > + addressed by URI. The Redfish may ignore any service controlled > > + properties. The corresponding redfish response will returned, > > + including HTTP > > StatusCode, Headers and Payload which record any HTTP response > messages. > > + > > + Callers are responsible for freeing the HTTP StatusCode, Headers > > + and Payload returned in redfish response data. > > + > > + @param[in] RedfishService The Service to access the Redfis= h > resources. > > + @param[in] Uri Relative path to address the res= ource. > > + @param[in] Content JSON represented properties to b= e update. > > + @param[in] ContentSize Size of the Content to be send t= o Redfish > > service > > + @param[in] ContentType Type of the Content to be send t= o > Redfish > > service > > + @param[out] RedResponse Pointer to the Redfish response = data. > > + > > + @retval EFI_SUCCESS The opeartion is successful, indicat= es the > HTTP > > StatusCode is not > > + NULL and the value is 2XX. The > > + Redfish resource will be > > returned > > + in Payload within RedResponse if > > + server send it back in the > > HTTP > > + response message body. > > + @retval EFI_INVALID_PARAMETER RedfishService, Uri, Content, or > > RedResponse is NULL. > > + @retval EFI_DEVICE_ERROR An unexpected system or network erro= r > > occurred. Callers can get > > + more error info from returned HTTP > > + StatusCode, Headers > > and Payload > > + within RedResponse: > > + 1. If the returned StatusCode is > > + NULL, indicates any error > > happen. > > + 2. If the returned StatusCode is > > + not NULL and the value is > > not 2XX, > > + indicates any error happen. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RedfishPostToUriEx ( > Why not just name this function RedfishPostToUri without "Ex". There is n= o > PostToUri function currently provided by RedfishLib.c yet. > I also see some trailing spaces in this source file by the way. > Abner > > > + IN REDFISH_SERVICE RedfishService, > > + IN CONST CHAR8 *Uri, > > + IN CONST CHAR8 *Content, > > + IN UINTN ContentSize, > > + IN CONST CHAR8 *ContentType, > > + OUT REDFISH_RESPONSE *RedResponse > > + ); > > + > > + > > /** > > Use HTTP POST to create a new resource in target payload. > > > > @@ -451,6 +494,43 @@ RedfishDeleteByUri ( > > ); > > > > /** > > + Use HTTP DELETE to remove a resource. > > + > > + This function uses the RedfishService to remove a Redfish resource > > + which is addressed by input Uri (only the relative path is required)= . > > + The corresponding redfish response will returned, including HTTP > > + StatusCode, Headers and Payload which record any HTTP response > messages. > > + > > + Callers are responsible for freeing the HTTP StatusCode, Headers > > + and Payload returned in redfish response data. > > + > > + @param[in] RedfishService The Service to access the Redfis= h > resources. > > + @param[in] Uri Relative path to address the res= ource. > > + @param[in] Content JSON represented properties to b= e deleted. > > + @param[out] RedResponse Pointer to the Redfish response = data. > > + > > + @retval EFI_SUCCESS The opeartion is successful, indicat= es the > HTTP > > StatusCode is not > > + NULL and the value is 2XX, the > > + Redfish resource has been > > removed. > > + If there is any message returned > > + from server, it will be > > returned > > + in Payload within RedResponse. > > + @retval EFI_INVALID_PARAMETER RedfishService, Uri, or RedResponse > is > > NULL. > > + @retval EFI_DEVICE_ERROR An unexpected system or network erro= r > > occurred. Callers can get > > + more error info from returned HTTP > > + StatusCode, Headers > > and Payload > > + within RedResponse: > > + 1. If the returned StatusCode is > > + NULL, indicates any error > > happen. > > + 2. If the returned StatusCode is > > + not NULL and the value is > > not 2XX, > > + indicates any error happen. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RedfishDeleteByUriEx ( > > + IN REDFISH_SERVICE RedfishService, > > + IN CONST CHAR8 *Uri, > > + IN CONST CHAR8 *Content, > > + OUT REDFISH_RESPONSE *RedResponse > > + ); > > + > > +/** > > Dump text in fractions. > > > > @param[in] String ASCII string to dump. > > diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c > > b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c > > index 9f9d377..c52a518 100644 > > --- a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c > > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c > > @@ -583,6 +583,104 @@ RedfishPatchToPayload ( > > return EFI_SUCCESS; > > } > > > > + > > +/** > > + Use HTTP POST to create new Redfish resource in the Resource > Collection. > > + > > + The POST request should be submitted to the Resource Collection in > > + which the new resource is to belong. The Resource Collection is > > + addressed by URI. The Redfish may ignore any service controlled > > + properties. The corresponding redfish response will returned, > > + including HTTP > > StatusCode, Headers and Payload which record any HTTP response > messages. > > + > > + Callers are responsible for freeing the HTTP StatusCode, Headers > > + and Payload returned in redfish response data. > > + > > + @param[in] RedfishService The Service to access the Redfis= h > resources. > > + @param[in] Uri Relative path to address the res= ource. > > + @param[in] Content JSON represented properties to b= e update. > > + @param[in] ContentSize Size of the Content to be send t= o Redfish > > service > > + @param[in] ContentType Type of the Content to be send t= o > Redfish > > service > > + @param[out] RedResponse Pointer to the Redfish response = data. > > + > > + @retval EFI_SUCCESS The opeartion is successful, indicat= es the > HTTP > > StatusCode is not > > + NULL and the value is 2XX. The > > + Redfish resource will be > > returned > > + in Payload within RedResponse if > > + server send it back in the > > HTTP > > + response message body. > > + @retval EFI_INVALID_PARAMETER RedfishService, Uri, Content, or > > RedResponse is NULL. > > + @retval EFI_DEVICE_ERROR An unexpected system or network erro= r > > occurred. Callers can get > > + more error info from returned HTTP > > + StatusCode, Headers > > and Payload > > + within RedResponse: > > + 1. If the returned StatusCode is > > + NULL, indicates any error > > happen. > > + 2. If the returned StatusCode is > > + not NULL and the value is > > not 2XX, > > + indicates any error happen. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RedfishPostToUriEx ( > > + IN REDFISH_SERVICE RedfishService, > > + IN CONST CHAR8 *Uri, > > + IN CONST CHAR8 *Content, > > + IN UINTN ContentSize, > > + IN CONST CHAR8 *ContentType, > > + OUT REDFISH_RESPONSE *RedResponse > > + ) > > +{ > > + EFI_STATUS Status; > > + EDKII_JSON_VALUE JsonValue; > > + > > + Status =3D EFI_SUCCESS; > > + JsonValue =3D NULL; > > + > > + if ((RedfishService =3D=3D NULL) || (Uri =3D=3D NULL) || (Content = =3D=3D NULL) > > + || > > (RedResponse =3D=3D NULL)) { > > + return EFI_INVALID_PARAMETER; > > + } > > + > > + ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE)); > > + > > + JsonValue =3D (EDKII_JSON_VALUE)postUriFromService ( > > + RedfishService, > > + Uri, > > + Content, > > + ContentSize, > > + ContentType, > > + &(RedResponse->StatusCode) > > + ); > > + > > + // > > + // 1. If the returned StatusCode is NULL, indicates any error happen= . > > + // > > + if (RedResponse->StatusCode =3D=3D NULL) { > > + Status =3D EFI_DEVICE_ERROR; > > + goto ON_EXIT; > > + } > > + > > + // > > + // 2. If the returned StatusCode is not NULL and the value is not > > + 2XX, indicates > > any error happen. > > + // NOTE: If there is any error message returned from server, it w= ill be > > returned in > > + // Payload within RedResponse. > > + // > > + if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \ > > + (*(RedResponse->StatusCode) > > HTTP_STATUS_206_PARTIAL_CONTENT)) > > + { > > + Status =3D EFI_DEVICE_ERROR; > > + } > > + > > +ON_EXIT: > > + if (JsonValue !=3D NULL) { > > + RedResponse->Payload =3D createRedfishPayload (JsonValue, > RedfishService); > > + if (RedResponse->Payload =3D=3D NULL) { > > + // > > + // Ignore the error when create RedfishPayload, just free the > > +JsonValue > > since it's not what > > + // we care about if the returned StatusCode is 2XX. > > + // > > + JsonValueFree (JsonValue); > > + } > > + } > > + > > + return Status; > > +} > > + > > + > > /** > > Use HTTP POST to create a new resource in target payload. > > > > @@ -738,6 +836,97 @@ ON_EXIT: > > return Status; > > } > > > > + > > +/** > > + Use HTTP DELETE to remove a resource. > > + > > + This function uses the RedfishService to remove a Redfish resource > > + which is addressed by input Uri (only the relative path is required)= . > > + The corresponding redfish response will returned, including HTTP > > + StatusCode, Headers and Payload which record any HTTP response > messages. > > + > > + Callers are responsible for freeing the HTTP StatusCode, Headers > > + and Payload returned in redfish response data. > > + > > + @param[in] RedfishService The Service to access the Redfis= h > resources. > > + @param[in] Uri Relative path to address the res= ource. > > + @param[in] Content JSON represented properties to b= e deleted. > > + @param[out] RedResponse Pointer to the Redfish response = data. > > + > > + @retval EFI_SUCCESS The opeartion is successful, indicat= es the > HTTP > > StatusCode is not > > + NULL and the value is 2XX, the > > + Redfish resource has been > > removed. > > + If there is any message returned > > + from server, it will be > > returned > > + in Payload within RedResponse. > > + @retval EFI_INVALID_PARAMETER RedfishService, Uri, or RedResponse > is > > NULL. > > + @retval EFI_DEVICE_ERROR An unexpected system or network erro= r > > occurred. Callers can get > > + more error info from returned HTTP > > + StatusCode, Headers > > and Payload > > + within RedResponse: > > + 1. If the returned StatusCode is > > + NULL, indicates any error > > happen. > > + 2. If the returned StatusCode is > > + not NULL and the value is > > not 2XX, > > + indicates any error happen. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RedfishDeleteByUriEx ( > > + IN REDFISH_SERVICE RedfishService, > > + IN CONST CHAR8 *Uri, > > + IN CONST CHAR8 *Content, > > + OUT REDFISH_RESPONSE *RedResponse > > + ) > > +{ > > + EFI_STATUS Status; > > + EDKII_JSON_VALUE JsonValue; > > + > > + Status =3D EFI_SUCCESS; > > + JsonValue =3D NULL; > > + > > + if ((RedfishService =3D=3D NULL) || (Content =3D=3D NULL) || (Uri = =3D=3D NULL) > > + || > > (RedResponse =3D=3D NULL)) { > > + return EFI_INVALID_PARAMETER; > > + } > > + > > + ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE)); > > + > > + JsonValue =3D (EDKII_JSON_VALUE)deleteUriFromServiceEx ( > > + RedfishService, > > + Uri, > > + Content, > > + &(RedResponse->StatusCode) > > + ); > > + > > + // > > + // 1. If the returned StatusCode is NULL, indicates any error happen= . > > + // > > + if (RedResponse->StatusCode =3D=3D NULL) { > > + Status =3D EFI_DEVICE_ERROR; > > + goto ON_EXIT; > > + } > > + > > + // > > + // 2. If the returned StatusCode is not NULL and the value is not > > + 2XX, indicates > > any error happen. > > + // NOTE: If there is any error message returned from server, it w= ill be > > returned in > > + // Payload within RedResponse. > > + // > > + if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \ > > + (*(RedResponse->StatusCode) > > HTTP_STATUS_206_PARTIAL_CONTENT)) > > + { > > + Status =3D EFI_DEVICE_ERROR; > > + } > > + > > +ON_EXIT: > > + if (JsonValue !=3D NULL) { > > + RedResponse->Payload =3D createRedfishPayload (JsonValue, > RedfishService); > > + if (RedResponse->Payload =3D=3D NULL) { > > + // > > + // Ignore the error when create RedfishPayload, just free the > > +JsonValue > > since it's not what > > + // we care about if the returned StatusCode is 2XX. > > + // > > + JsonValueFree (JsonValue); > > + } > > + } > > + > > + return Status; > > +} > > + > > /** > > Dump text in fractions. > > > > diff --git > > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/redfishS > > ervice.h > > b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/redfishS > > ervice.h > > index 5c13b68..75afadc 100644 > > --- > > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/redfishS > > ervice.h > > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/redf > > +++ is > > +++ hService.h > > @@ -129,6 +129,14 @@ deleteUriFromService ( > > EFI_HTTP_STATUS_CODE **StatusCode > > ); > > > > +json_t * > > +deleteUriFromServiceEx ( > > + redfishService *service, > > + const char *uri, > > + const char *content, > > + EFI_HTTP_STATUS_CODE **StatusCode > > + ); > > + > > redfishPayload * > > getRedfishServiceRoot ( > > redfishService *service, > > diff --git > > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service.c > > b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service.c > > index afa172b..b8bfabe 100644 > > --- > > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service.c > > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service. > > +++ c > > @@ -923,10 +923,12 @@ ON_EXIT: > > return ret; > > } > > > > + > > json_t * > > -deleteUriFromService ( > > +deleteUriFromServiceEx ( > > redfishService *service, > > const char *uri, > > + const char *content, > > EFI_HTTP_STATUS_CODE **StatusCode > > ) > > { > > @@ -937,6 +939,8 @@ deleteUriFromService ( > > EFI_HTTP_REQUEST_DATA *RequestData =3D NULL; > > EFI_HTTP_MESSAGE *RequestMsg =3D NULL; > > EFI_HTTP_MESSAGE ResponseMsg; > > + CHAR8 ContentLengthStr[80]; > > + size_t contentLength; > > > > ret =3D NULL; > > > > @@ -956,7 +960,7 @@ deleteUriFromService ( > > // > > // Step 1: Create HTTP request message with 4 headers: > > // > > - HttpIoHeader =3D HttpIoCreateHeader ((service->sessionToken || > > service- > > >basicAuthStr) ? 5 : 4); > > + HttpIoHeader =3D HttpIoCreateHeader ((service->sessionToken || > > + service->basicAuthStr) ? 8 : 7); > > if (HttpIoHeader =3D=3D NULL) { > > ret =3D NULL; > > goto ON_EXIT; > > @@ -979,6 +983,23 @@ deleteUriFromService ( > > Status =3D HttpIoSetHeader (HttpIoHeader, "Connection", "Keep-Alive"= ); > > ASSERT_EFI_ERROR (Status); > > > > + Status =3D HttpIoSetHeader (HttpIoHeader, "Content-Type", > > + "application/json"); ASSERT_EFI_ERROR (Status); > > + > > + if(content !=3D NULL){ > > + contentLength =3D strlen (content); > > + AsciiSPrint ( > > + ContentLengthStr, > > + sizeof (ContentLengthStr), > > + "%lu", > > + (UINT64)contentLength > > + ); > > + Status =3D HttpIoSetHeader (HttpIoHeader, "Content-Length", > > ContentLengthStr); > > + ASSERT_EFI_ERROR (Status); > > + Status =3D HttpIoSetHeader (HttpIoHeader, "OData-Version", "4.0"= ); > > + ASSERT_EFI_ERROR (Status); > > + } > > + > > // > > // Step 2: build the rest of HTTP request info. > > // > > @@ -1003,7 +1024,12 @@ deleteUriFromService ( > > RequestMsg->Data.Request =3D RequestData; > > RequestMsg->HeaderCount =3D HttpIoHeader->HeaderCount; > > RequestMsg->Headers =3D HttpIoHeader->Headers; > > - > > + > > + if(content !=3D NULL){ > > + RequestMsg->BodyLength =3D contentLength; > > + RequestMsg->Body =3D (VOID *)content; > > + } > > + > > ZeroMem (&ResponseMsg, sizeof (ResponseMsg)); > > > > // > > @@ -1057,6 +1083,17 @@ ON_EXIT: > > return ret; > > } > > > > +json_t * > > +deleteUriFromService ( > > + redfishService *service, > > + const char *uri, > > + EFI_HTTP_STATUS_CODE **StatusCode > > + ) > > +{ > > + return deleteUriFromServiceEx(service, uri, NULL, StatusCode); } > > + > > + > > redfishPayload * > > getRedfishServiceRoot ( > > redfishService *service, > > -- > > 2.6.1.windows.1 > > -The information contained in this message may be confidential and > > proprietary to American Megatrends (AMI). This communication is > > intended to be read only by the individual or entity to whom it is > > addressed or by their designee. If the reader of this message is not > > the intended recipient, you are on notice that any distribution of > > this message, in any form, is strictly prohibited. Please promptly > > notify the sender by reply e-mail or by telephone at 770-246-8600, and > then delete or destroy all copies of the transmission. > -The information contained in this message may be confidential and > proprietary to American Megatrends (AMI). This communication is intended > to be read only by the individual or entity to whom it is addressed or by= their > designee. If the reader of this message is not the intended recipient, yo= u are > on notice that any distribution of this message, in any form, is strictly > prohibited. Please promptly notify the sender by reply e-mail or by > telephone at 770-246-8600, and then delete or destroy all copies of the > transmission. --_000_MN2PR12MB39664A12C48FDF756A38A916EA6A9MN2PR12MB3966namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Sorry, it's a typo. I mean use RedfishPostToUri() makes more sense to me.

Abner

Get Outlook for Android


From:= Chang, Abner <Abner.Chang@amd.com>
Sent: Wednesday, August 17, 2022, 11:09 PM
To: Igor Kulchytskyy <igork@ami.com>; devel@edk2.gro= ups.io <devel@edk2.groups.io>
Cc: nickle.wang@hpe.com <nickle.wang@hpe.com>
Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg: The fu= nctions for Redfish requests do not fully complied with specification

[AMD Official Use Only - General]

Yes, I think we can remove 'Ex' because there is no RedfishPostToUri () in = RedfishLib.c. Also, RedfishPostToUriEx() has the same parameters as postUri= FromService() in service.c. Using RedfishPostToUriEx () makes more sense to= me.
Thanks
Abner

> -----Original Message-----
> From: Igor Kulchytskyy <igork@ami.com>
> Sent: Wednesday, August 17, 2022 10:35 PM
> To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> Cc: nickle.wang@hpe.com
> Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg: The functions for<= br> > Redfish requests do not fully complied with specification
>
> [CAUTION: External Email]
>
> Hi Abner,
> I just thought that since I'm adding new functions (extending API) I c= all those
> functions with Ex suffix.
> But if you think it is better to have the name without Ex, I can chang= e it and
> resubmit.
> Thank you,
> Igor
>
> -----Original Message-----
> From: Chang, Abner <Abner.Chang@amd.com>
> Sent: Wednesday, August 17, 2022 12:00 AM
> To: Igor Kulchytskyy <igork@ami.com>; devel@edk2.groups.io
> Cc: nickle.wang@hpe.com
> Subject: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg: The functions for Redf= ish
> requests do not fully complied with specification
>
>
> **CAUTION: The e-mail below is from an external source. Please exercis= e
> caution before opening attachments, clicking links, or following guida= nce.**
>
> [AMD Official Use Only - General]
>
> Hi Igor,
> One question in line.
>
> > -----Original Message-----
> > From: Igor Kulchytskyy <igork@ami.com>
> > Sent: Tuesday, August 16, 2022 9:25 AM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner <Abner.Chang@amd.com>; nickle.wang@hpe.com= ; Igor
> > Kulchytskyy <igork@ami.com>; Chang, Abner <Abner.Chang@a= md.com>
> > Subject: [PATCH 3/3] RedfishPkg: The functions for Redfish reques= ts do
> > not fully complied with specification
> >
> > [CAUTION: External Email]
> >
> > There is no function to send POST request with the Content type w= hich
> > is different from "application/json".
> > There is no function to send DELETE request with the body.
> >
> > Cc: Abner Chang <abner.chang@amd.com>
> > Cc: Nickle Wang <nickle.wang@hpe.com>
> > Signed-off-by: Igor Kulchytskyy <igork@ami.com>
> > ---
> >  RedfishPkg/Include/Library/RedfishLib.h   &n= bsp;        |  80 +++++++++
> >  RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c  | 1= 89
> > +++++++++++++++++++++
> >  .../edk2libredfish/include/redfishService.h  &nbs= p;     |   8 +
> >  .../RedfishLib/edk2libredfish/src/service.c  &nbs= p;     |  43 ++++-
> >  4 files changed, 317 insertions(+), 3 deletions(-)
> >
> > diff --git a/RedfishPkg/Include/Library/RedfishLib.h
> > b/RedfishPkg/Include/Library/RedfishLib.h
> > index b2488ab..d4b3246 100644
> > --- a/RedfishPkg/Include/Library/RedfishLib.h
> > +++ b/RedfishPkg/Include/Library/RedfishLib.h
> > @@ -380,6 +380,49 @@ RedfishPatchToPayload (
> >    OUT    REDFISH_RESPONSE  *R= edResponse
> >    );
> >
> > +
> > +/**
> > +  Use HTTP POST to create new Redfish resource in the Resou= rce
> Collection.
> > +
> > +  The POST request should be submitted to the Resource Coll= ection in
> > + which the new resource  is to belong. The Resource Collect= ion is
> > + addressed by URI. The Redfish may  ignore any service cont= rolled
> > + properties. The corresponding redfish response will returned, > > + including HTTP
> > StatusCode, Headers and Payload which record any HTTP response > messages.
> > +
> > +  Callers are responsible for freeing the HTTP StatusCode, = Headers
> > + and Payload returned in  redfish response data.
> > +
> > +  @param[in]    RedfishService  &n= bsp;     The Service to access the Redfish
> resources.
> > +  @param[in]    Uri    &= nbsp;           &nbs= p;  Relative path to address the resource.
> > +  @param[in]    Content   &nb= sp;           JSON repres= ented properties to be update.
> > +  @param[in]    ContentSize   = ;        Size of the Content to be send = to Redfish
> > service
> > +  @param[in]    ContentType   = ;        Type of the Content to be send = to
> Redfish
> > service
> > +  @param[out]   RedResponse   &nbs= p;       Pointer to the Redfish response data= .
> > +
> > +  @retval EFI_SUCCESS      &n= bsp;      The opeartion is successful, indicates t= he
> HTTP
> > StatusCode is not
> > +          &nbs= p;            &= nbsp;          NULL and the va= lue is 2XX. The
> > + Redfish resource will be
> > returned
> > +          &nbs= p;            &= nbsp;          in Payload with= in RedResponse if
> > + server send it back in the
> > HTTP
> > +          &nbs= p;            &= nbsp;          response messag= e body.
> > +  @retval EFI_INVALID_PARAMETER   RedfishService,= Uri, Content, or
> > RedResponse is NULL.
> > +  @retval EFI_DEVICE_ERROR     &nb= sp;  An unexpected system or network error
> > occurred. Callers can get
> > +          &nbs= p;            &= nbsp;          more error info= from returned HTTP
> > + StatusCode, Headers
> > and Payload
> > +          &nbs= p;            &= nbsp;          within RedRespo= nse:
> > +          &nbs= p;            &= nbsp;          1. If the retur= ned StatusCode is
> > + NULL, indicates any error
> > happen.
> > +          &nbs= p;            &= nbsp;          2. If the retur= ned StatusCode is
> > + not NULL and the value is
> > not 2XX,
> > +          &nbs= p;            &= nbsp;           &nbs= p; indicates any error happen.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +RedfishPostToUriEx (
> Why not just name this function RedfishPostToUri without "Ex"= ;. There is no
> PostToUri function currently provided by RedfishLib.c yet.
> I also see some trailing spaces in this source file by the way.
> Abner
>
> > +  IN     REDFISH_SERVICE   Re= dfishService,
> > +  IN     CONST CHAR8   &= nbsp;   *Uri,
> > +  IN     CONST CHAR8   &= nbsp;   *Content,
> > +  IN     UINTN    &= nbsp;        ContentSize,
> > +  IN     CONST CHAR8   &= nbsp;   *ContentType,
> > +  OUT    REDFISH_RESPONSE  *RedResponse=
> > +  );
> > +
> > +
> >  /**
> >    Use HTTP POST to create a new resource in targe= t payload.
> >
> > @@ -451,6 +494,43 @@ RedfishDeleteByUri (
> >    );
> >
> >  /**
> > +  Use HTTP DELETE to remove a resource.
> > +
> > +  This function uses the RedfishService to remove a Redfish= resource
> > + which is addressed  by input Uri (only the relative path i= s required).
> > + The corresponding redfish response will  returned, includi= ng HTTP
> > + StatusCode, Headers and Payload which record any HTTP response<= br> > messages.
> > +
> > +  Callers are responsible for freeing the HTTP StatusCode, = Headers
> > + and Payload returned in  redfish response data.
> > +
> > +  @param[in]    RedfishService  &n= bsp;     The Service to access the Redfish
> resources.
> > +  @param[in]    Uri    &= nbsp;           &nbs= p;  Relative path to address the resource.
> > +  @param[in]    Content   &nb= sp;           JSON repres= ented properties to be deleted.
> > +  @param[out]   RedResponse   &nbs= p;       Pointer to the Redfish response data= .
> > +
> > +  @retval EFI_SUCCESS      &n= bsp;      The opeartion is successful, indicates t= he
> HTTP
> > StatusCode is not
> > +          &nbs= p;            &= nbsp;          NULL and the va= lue is 2XX, the
> > + Redfish resource has been
> > removed.
> > +          &nbs= p;            &= nbsp;          If there is any= message returned
> > + from server, it will be
> > returned
> > +          &nbs= p;            &= nbsp;          in Payload with= in RedResponse.
> > +  @retval EFI_INVALID_PARAMETER   RedfishService,= Uri, or RedResponse
> is
> > NULL.
> > +  @retval EFI_DEVICE_ERROR     &nb= sp;  An unexpected system or network error
> > occurred. Callers can get
> > +          &nbs= p;            &= nbsp;          more error info= from returned HTTP
> > + StatusCode, Headers
> > and Payload
> > +          &nbs= p;            &= nbsp;          within RedRespo= nse:
> > +          &nbs= p;            &= nbsp;          1. If the retur= ned StatusCode is
> > + NULL, indicates any error
> > happen.
> > +          &nbs= p;            &= nbsp;          2. If the retur= ned StatusCode is
> > + not NULL and the value is
> > not 2XX,
> > +          &nbs= p;            &= nbsp;           &nbs= p; indicates any error happen.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +RedfishDeleteByUriEx (
> > +  IN     REDFISH_SERVICE   Re= dfishService,
> > +  IN     CONST CHAR8   &= nbsp;   *Uri,
> > +  IN     CONST CHAR8   &= nbsp;   *Content,
> > +  OUT    REDFISH_RESPONSE  *RedResponse=
> > +  );
> > +
> > +/**
> >    Dump text in fractions.
> >
> >    @param[in]  String   ASCII strin= g to dump.
> > diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c > > b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > index 9f9d377..c52a518 100644
> > --- a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > @@ -583,6 +583,104 @@ RedfishPatchToPayload (
> >    return EFI_SUCCESS;
> >  }
> >
> > +
> > +/**
> > +  Use HTTP POST to create new Redfish resource in the Resou= rce
> Collection.
> > +
> > +  The POST request should be submitted to the Resource Coll= ection in
> > + which the new resource  is to belong. The Resource Collect= ion is
> > + addressed by URI. The Redfish may  ignore any service cont= rolled
> > + properties. The corresponding redfish response will returned, > > + including HTTP
> > StatusCode, Headers and Payload which record any HTTP response > messages.
> > +
> > +  Callers are responsible for freeing the HTTP StatusCode, = Headers
> > + and Payload returned in  redfish response data.
> > +
> > +  @param[in]    RedfishService  &n= bsp;     The Service to access the Redfish
> resources.
> > +  @param[in]    Uri    &= nbsp;           &nbs= p;  Relative path to address the resource.
> > +  @param[in]    Content   &nb= sp;           JSON repres= ented properties to be update.
> > +  @param[in]    ContentSize   = ;        Size of the Content to be send = to Redfish
> > service
> > +  @param[in]    ContentType   = ;        Type of the Content to be send = to
> Redfish
> > service
> > +  @param[out]   RedResponse   &nbs= p;       Pointer to the Redfish response data= .
> > +
> > +  @retval EFI_SUCCESS      &n= bsp;      The opeartion is successful, indicates t= he
> HTTP
> > StatusCode is not
> > +          &nbs= p;            &= nbsp;          NULL and the va= lue is 2XX. The
> > + Redfish resource will be
> > returned
> > +          &nbs= p;            &= nbsp;          in Payload with= in RedResponse if
> > + server send it back in the
> > HTTP
> > +          &nbs= p;            &= nbsp;          response messag= e body.
> > +  @retval EFI_INVALID_PARAMETER   RedfishService,= Uri, Content, or
> > RedResponse is NULL.
> > +  @retval EFI_DEVICE_ERROR     &nb= sp;  An unexpected system or network error
> > occurred. Callers can get
> > +          &nbs= p;            &= nbsp;          more error info= from returned HTTP
> > + StatusCode, Headers
> > and Payload
> > +          &nbs= p;            &= nbsp;          within RedRespo= nse:
> > +          &nbs= p;            &= nbsp;          1. If the retur= ned StatusCode is
> > + NULL, indicates any error
> > happen.
> > +          &nbs= p;            &= nbsp;          2. If the retur= ned StatusCode is
> > + not NULL and the value is
> > not 2XX,
> > +          &nbs= p;            &= nbsp;           &nbs= p; indicates any error happen.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +RedfishPostToUriEx (
> > +  IN     REDFISH_SERVICE   Re= dfishService,
> > +  IN     CONST CHAR8   &= nbsp;   *Uri,
> > +  IN     CONST CHAR8   &= nbsp;   *Content,
> > +  IN     UINTN    &= nbsp;        ContentSize,
> > +  IN     CONST CHAR8   &= nbsp;   *ContentType,
> > +  OUT    REDFISH_RESPONSE  *RedResponse=
> > +  )
> > +{
> > +  EFI_STATUS        Stat= us;
> > +  EDKII_JSON_VALUE  JsonValue;
> > +
> > +  Status    =3D EFI_SUCCESS;
> > +  JsonValue =3D NULL;
> > +
> > +  if ((RedfishService =3D=3D NULL) || (Uri =3D=3D NULL) || = (Content =3D=3D NULL)
> > + ||
> > (RedResponse =3D=3D NULL)) {
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> > +
> > +  JsonValue =3D (EDKII_JSON_VALUE)postUriFromService (
> > +          &nbs= p;            &= nbsp;          RedfishService,=
> > +          &nbs= p;            &= nbsp;          Uri,
> > +          &nbs= p;            &= nbsp;          Content,
> > +          &nbs= p;            &= nbsp;          ContentSize, > > +          &nbs= p;            &= nbsp;          ContentType, > > +          &nbs= p;            &= nbsp;          &(RedRespon= se->StatusCode)
> > +          &nbs= p;            &= nbsp;          );
> > +
> > +  //
> > +  // 1. If the returned StatusCode is NULL, indicates any e= rror happen.
> > +  //
> > +  if (RedResponse->StatusCode =3D=3D NULL) {
> > +    Status =3D EFI_DEVICE_ERROR;
> > +    goto ON_EXIT;
> > +  }
> > +
> > +  //
> > +  // 2. If the returned StatusCode is not NULL and the valu= e is not
> > + 2XX, indicates
> > any error happen.
> > +  //    NOTE: If there is any error message = returned from server, it will be
> > returned in
> > +  //          = Payload within RedResponse.
> > +  //
> > +  if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_O= K) || \
> > +      (*(RedResponse->StatusCode) &g= t;
> HTTP_STATUS_206_PARTIAL_CONTENT))
> > + {
> > +    Status =3D EFI_DEVICE_ERROR;
> > +  }
> > +
> > +ON_EXIT:
> > +  if (JsonValue !=3D NULL) {
> > +    RedResponse->Payload =3D createRedfishPayl= oad (JsonValue,
> RedfishService);
> > +    if (RedResponse->Payload =3D=3D NULL) { > > +      //
> > +      // Ignore the error when create R= edfishPayload, just free the
> > +JsonValue
> > since it's not what
> > +      // we care about if the returned = StatusCode is 2XX.
> > +      //
> > +      JsonValueFree (JsonValue);
> > +    }
> > +  }
> > +
> > +  return Status;
> > +}
> > +
> > +
> >  /**
> >    Use HTTP POST to create a new resource in targe= t payload.
> >
> > @@ -738,6 +836,97 @@ ON_EXIT:
> >    return Status;
> >  }
> >
> > +
> > +/**
> > +  Use HTTP DELETE to remove a resource.
> > +
> > +  This function uses the RedfishService to remove a Redfish= resource
> > + which is addressed  by input Uri (only the relative path i= s required).
> > + The corresponding redfish response will  returned, includi= ng HTTP
> > + StatusCode, Headers and Payload which record any HTTP response<= br> > messages.
> > +
> > +  Callers are responsible for freeing the HTTP StatusCode, = Headers
> > + and Payload returned in  redfish response data.
> > +
> > +  @param[in]    RedfishService  &n= bsp;     The Service to access the Redfish
> resources.
> > +  @param[in]    Uri    &= nbsp;           &nbs= p;  Relative path to address the resource.
> > +  @param[in]    Content   &nb= sp;           JSON repres= ented properties to be deleted.
> > +  @param[out]   RedResponse   &nbs= p;       Pointer to the Redfish response data= .
> > +
> > +  @retval EFI_SUCCESS      &n= bsp;      The opeartion is successful, indicates t= he
> HTTP
> > StatusCode is not
> > +          &nbs= p;            &= nbsp;          NULL and the va= lue is 2XX, the
> > + Redfish resource has been
> > removed.
> > +          &nbs= p;            &= nbsp;          If there is any= message returned
> > + from server, it will be
> > returned
> > +          &nbs= p;            &= nbsp;          in Payload with= in RedResponse.
> > +  @retval EFI_INVALID_PARAMETER   RedfishService,= Uri, or RedResponse
> is
> > NULL.
> > +  @retval EFI_DEVICE_ERROR     &nb= sp;  An unexpected system or network error
> > occurred. Callers can get
> > +          &nbs= p;            &= nbsp;          more error info= from returned HTTP
> > + StatusCode, Headers
> > and Payload
> > +          &nbs= p;            &= nbsp;          within RedRespo= nse:
> > +          &nbs= p;            &= nbsp;          1. If the retur= ned StatusCode is
> > + NULL, indicates any error
> > happen.
> > +          &nbs= p;            &= nbsp;          2. If the retur= ned StatusCode is
> > + not NULL and the value is
> > not 2XX,
> > +          &nbs= p;            &= nbsp;           &nbs= p; indicates any error happen.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +RedfishDeleteByUriEx (
> > +  IN     REDFISH_SERVICE   Re= dfishService,
> > +  IN     CONST CHAR8   &= nbsp;   *Uri,
> > +  IN     CONST CHAR8   &= nbsp;   *Content,
> > +  OUT    REDFISH_RESPONSE  *RedResponse=
> > +  )
> > +{
> > +  EFI_STATUS        Stat= us;
> > +  EDKII_JSON_VALUE  JsonValue;
> > +
> > +  Status    =3D EFI_SUCCESS;
> > +  JsonValue =3D NULL;
> > +
> > +  if ((RedfishService =3D=3D NULL) || (Content =3D=3D NULL)= || (Uri =3D=3D NULL)
> > + ||
> > (RedResponse =3D=3D NULL)) {
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> > +
> > +  JsonValue =3D (EDKII_JSON_VALUE)deleteUriFromServiceEx (<= br> > > +          &nbs= p;            &= nbsp;          RedfishService,=
> > +          &nbs= p;            &= nbsp;          Uri,
> > +          &nbs= p;            &= nbsp;          Content,
> > +          &nbs= p;            &= nbsp;          &(RedRespon= se->StatusCode)
> > +          &nbs= p;            &= nbsp;          );
> > +
> > +  //
> > +  // 1. If the returned StatusCode is NULL, indicates any e= rror happen.
> > +  //
> > +  if (RedResponse->StatusCode =3D=3D NULL) {
> > +    Status =3D EFI_DEVICE_ERROR;
> > +    goto ON_EXIT;
> > +  }
> > +
> > +  //
> > +  // 2. If the returned StatusCode is not NULL and the valu= e is not
> > + 2XX, indicates
> > any error happen.
> > +  //    NOTE: If there is any error message = returned from server, it will be
> > returned in
> > +  //          = Payload within RedResponse.
> > +  //
> > +  if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_O= K) || \
> > +      (*(RedResponse->StatusCode) &g= t;
> HTTP_STATUS_206_PARTIAL_CONTENT))
> > + {
> > +    Status =3D EFI_DEVICE_ERROR;
> > +  }
> > +
> > +ON_EXIT:
> > +  if (JsonValue !=3D NULL) {
> > +    RedResponse->Payload =3D createRedfishPayl= oad (JsonValue,
> RedfishService);
> > +    if (RedResponse->Payload =3D=3D NULL) { > > +      //
> > +      // Ignore the error when create R= edfishPayload, just free the
> > +JsonValue
> > since it's not what
> > +      // we care about if the returned = StatusCode is 2XX.
> > +      //
> > +      JsonValueFree (JsonValue);
> > +    }
> > +  }
> > +
> > +  return Status;
> > +}
> > +
> >  /**
> >    Dump text in fractions.
> >
> > diff --git
> > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/red= fishS
> > ervice.h
> > b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/red= fishS
> > ervice.h
> > index 5c13b68..75afadc 100644
> > ---
> > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include/red= fishS
> > ervice.h
> > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/include= /redf
> > +++ is
> > +++ hService.h
> > @@ -129,6 +129,14 @@ deleteUriFromService (
> >    EFI_HTTP_STATUS_CODE  **StatusCode
> >    );
> >
> > +json_t *
> > +deleteUriFromServiceEx (
> > +  redfishService        = *service,
> > +  const char        = ;    *uri,
> > +  const char        = ;    *content,
> > +  EFI_HTTP_STATUS_CODE  **StatusCode
> > +  );
> > +
> >  redfishPayload *
> >  getRedfishServiceRoot (
> >    redfishService     &nb= sp;  *service,
> > diff --git
> > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service= .c
> > b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service= .c
> > index afa172b..b8bfabe 100644
> > ---
> > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service= .c
> > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/ser= vice.
> > +++ c
> > @@ -923,10 +923,12 @@ ON_EXIT:
> >    return ret;
> >  }
> >
> > +
> >  json_t *
> > -deleteUriFromService (
> > +deleteUriFromServiceEx (
> >    redfishService     &nb= sp;  *service,
> >    const char      &= nbsp;     *uri,
> > +  const char        = ;    *content,
> >    EFI_HTTP_STATUS_CODE  **StatusCode
> >    )
> >  {
> > @@ -937,6 +939,8 @@ deleteUriFromService (
> >    EFI_HTTP_REQUEST_DATA  *RequestData =3D NU= LL;
> >    EFI_HTTP_MESSAGE     &= nbsp; *RequestMsg  =3D NULL;
> >    EFI_HTTP_MESSAGE     &= nbsp; ResponseMsg;
> > +  CHAR8        &nbs= p;         ContentLengthStr[80]; > > +  size_t        &nb= sp;        contentLength;
> >
> >    ret =3D NULL;
> >
> > @@ -956,7 +960,7 @@ deleteUriFromService (
> >    //
> >    // Step 1: Create HTTP request message with 4 h= eaders:
> >    //
> > -  HttpIoHeader =3D HttpIoCreateHeader ((service->session= Token ||
> > service-
> > >basicAuthStr) ? 5 : 4);
> > +  HttpIoHeader =3D HttpIoCreateHeader ((service->session= Token ||
> > + service->basicAuthStr) ? 8 : 7);
> >    if (HttpIoHeader =3D=3D NULL) {
> >      ret =3D NULL;
> >      goto ON_EXIT;
> > @@ -979,6 +983,23 @@ deleteUriFromService (
> >    Status =3D HttpIoSetHeader (HttpIoHeader, "= ;Connection", "Keep-Alive");
> >    ASSERT_EFI_ERROR (Status);
> >
> > +  Status =3D HttpIoSetHeader (HttpIoHeader, "Content-T= ype",
> > + "application/json");  ASSERT_EFI_ERROR (Status);=
> > +
> > +  if(content !=3D NULL){
> > +      contentLength =3D strlen (content= );
> > +      AsciiSPrint (
> > +        ContentLengthStr,
> > +        sizeof (ContentLength= Str),
> > +        "%lu",
> > +        (UINT64)contentLength=
> > +        );
> > +      Status =3D HttpIoSetHeader (HttpI= oHeader, "Content-Length",
> > ContentLengthStr);
> > +      ASSERT_EFI_ERROR (Status);
> > +      Status =3D HttpIoSetHeader (HttpI= oHeader, "OData-Version", "4.0");
> > +      ASSERT_EFI_ERROR (Status);
> > +  }
> > +
> >    //
> >    // Step 2: build the rest of HTTP request info.=
> >    //
> > @@ -1003,7 +1024,12 @@ deleteUriFromService (
> >    RequestMsg->Data.Request =3D RequestData; > >    RequestMsg->HeaderCount  =3D HttpIoHead= er->HeaderCount;
> >    RequestMsg->Headers    &= nbsp; =3D HttpIoHeader->Headers;
> > -
> > +
> > +  if(content !=3D NULL){
> > +      RequestMsg->BodyLength &n= bsp; =3D contentLength;
> > +      RequestMsg->Body  &n= bsp;      =3D (VOID *)content;
> > +  }
> > +
> >    ZeroMem (&ResponseMsg, sizeof (ResponseMsg)= );
> >
> >    //
> > @@ -1057,6 +1083,17 @@ ON_EXIT:
> >    return ret;
> >  }
> >
> > +json_t *
> > +deleteUriFromService (
> > +  redfishService        = *service,
> > +  const char        = ;    *uri,
> > +  EFI_HTTP_STATUS_CODE  **StatusCode
> > +  )
> > +{
> > +  return deleteUriFromServiceEx(service, uri, NULL, StatusC= ode); }
> > +
> > +
> >  redfishPayload *
> >  getRedfishServiceRoot (
> >    redfishService     &nb= sp;  *service,
> > --
> > 2.6.1.windows.1
> > -The information contained in this message may be confidential an= d
> > proprietary to American Megatrends (AMI). This communication is > > intended to be read only by the individual or entity to whom it i= s
> > addressed or by their designee. If the reader of this message is = not
> > the intended recipient, you are on notice that any distribution o= f
> > this message, in any form, is strictly prohibited. Please promptl= y
> > notify the sender by reply e-mail or by telephone at 770-246-8600= , and
> then delete or destroy all copies of the transmission.
> -The information contained in this message may be confidential and
> proprietary to American Megatrends (AMI). This communication is intend= ed
> to be read only by the individual or entity to whom it is addressed or= by their
> designee. If the reader of this message is not the intended recipient,= you are
> on notice that any distribution of this message, in any form, is stric= tly
> prohibited. Please promptly notify the sender by reply e-mail or by > telephone at 770-246-8600, and then delete or destroy all copies of th= e
> transmission.

--_000_MN2PR12MB39664A12C48FDF756A38A916EA6A9MN2PR12MB3966namp_--