From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.63]) by mx.groups.io with SMTP id smtpd.web09.30336.1660748963245368955 for ; Wed, 17 Aug 2022 08:09:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=M36p31BA; 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.95.63, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Khxfb8RdEXetqP9nlQwpe5dqYULegJQIf40kOZg/nb/oG4dJ8fDPppZwN23qZo5hacCn9mM0JpGXkEuGjKwc7+eEtsCbUUkPQDWsU3uKxpisea47y+SDN1z1HS8N6EHjiUrWgdXlxZsRxHCfYByVgUsQ/m/Vvlr7qJoZe4C68XyO52ddTgyTkYXfVBA23eFLDebN4toNeGECpS9jy8agWFDBq03MGGeKFmNWBjvY5s7Ilf2Il3VEDb6XG79uiga9O2GRRvWfg5tgRvS09K0kVlRV4Ig9UfhZ1qD9UsysR/QQBeOr8TNJB8BLIzR7TcHJu5PnH0HjgA0wi+wAlzM/Lw== 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=pdrgfInvg7Rh7dBX/hC5CrF6z2kEEF5o4PWghn79To0=; b=anMN33iPkIFzZDnTXLIZ8qZOIuBqJA6b/eSJci7134wOC78STAgE9qap+zJzlczt2NgYaBDz290FGgpIUV9980QIkJtnMAmRhgsr4eeFKT2GhXnAywd0KOUBQ51ULRQyMU/vvc7IKfdsXtq3qGJNLiWQWITyqI0c2PxFs6nTPLcUgyAXU1yhjccyqWDbwNtWlk8KSX6N3MVFkaEtfUnqkDRPRLsQZZPL8KMTt3Ts0SoLHadycRiTAHvjDRgAv9kDZvSWo7StuKtU9rAVKT4Dq7xNktXkxct1rIIxFUCebtu59LVqcmbU87dP/EM3qRrwr3XiJ+4JkV7hYzCHN0UgRA== 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=pdrgfInvg7Rh7dBX/hC5CrF6z2kEEF5o4PWghn79To0=; b=M36p31BAXscHWif5dTL43JQ/ROAmqggqjV9yV7jFfwZtxPIGHO5MsVbSPnihisuy8/TjHi2SVrzvalv0XFQ0fCNInhq93iE9990V/srBq99H06n2SuqhaDAiL3MphRvLp8f9dyOTxDCWXxvlvYzAqj6k6PMbpkxxQ4Tn9ZwFwbE= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by SA1PR12MB6677.namprd12.prod.outlook.com (2603:10b6:806:250::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.19; Wed, 17 Aug 2022 15:09:20 +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:09:20 +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/TCAABbEgA== Date: Wed, 17 Aug 2022 15:09:20 +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_SetDate=2022-08-17T15:09:17Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=dff407b2-a3df-4e95-bdd5-3eada9bc61c5; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 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: 965aa921-c223-409a-bcbd-08da80627616 x-ms-traffictypediagnostic: SA1PR12MB6677:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: f//SfifhGXlTzMGvIIQ+eFAAJvTcZiAmpRgZUPwxfAzoDSrNrSzx9ko6raMxy/NJe+pEpdYzlXcRdVDITOzoD2iFbSDZaaulYNSEY1xDij3WXKI1cZ7Nsw3cvt2SxQQPE8k8cvHAv4G8cq72S6j+1/t3qCnIv13QA8wbSrXMMZ0/n5fyQy9svf8t0NmZs6ptkTyOqXDp/OF2BLBnu1Adx/OeBAfzgL7gS/9Sjq0ctN426LxhRhsZztf/11CcIDwxNikRiw9vgP8wSxtwhBYrRTWRKXm79rV7V12Tj2W9oTnR1enzoIvX3LUj9jHbavBZLFGMyDD4+xcSgv5HpDtYZszwUZgf3KfI4RPizqiIGpdAPIVWsYtgkuDubyY+V6dpJZFfEFwyyA5A4P8vSvCDDLHpe8qBgaoNo67UhPTGKY4UFHzP9Wzvq+F1Z7OOtCGEFSiEhBdAYlI+PTqCKynIodxi95knOt5JTR5Ir99gIefDXXrpu7xi3P7W6a8ynf+3GhOIeq/ZAjQxbo7GOYX+L0hmuEhozqnw8fcEzKcG7uVqVPwQ29uCoFa4aZ1Fe8Mcd/cuq4HxBkryEfhoSeRyBpWqPM2cAHLSN+iVwgyc/psiXsAOsXxC+ykJy75O3aNT23LOm2ob7+tbO5JkukIwIciA3flFH6muhb/zbqmnXUjZq8++WnJb+PtoK89Vv3gPzXgD/nOEzFNDIjTu5f4O7nKTvkrIkd9cqXSie+z8/oF0wJ/h0C993Mapy26z7At4UFuJbixxJhrydFTxAb/FnFQwD7O7QyhuB/YE+Xz14oeOwHBriniRbI385+2C9CDe 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)(396003)(346002)(366004)(39860400002)(136003)(376002)(7696005)(66446008)(8676002)(66556008)(66476007)(64756008)(4326008)(66946007)(122000001)(38100700002)(2906002)(38070700005)(76116006)(5660300002)(30864003)(52536014)(8936002)(186003)(478600001)(83380400001)(71200400001)(53546011)(26005)(41300700001)(9686003)(316002)(6506007)(110136005)(55016003)(33656002)(86362001)(40140700001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?KaS76cycSzeuVVq8jjClp2mP6OaKupUqCp2I+apxzkfk2+WlBEUQwsnApWEn?= =?us-ascii?Q?ceAWofXK3eJ3+zz173ACDx1505Q2JpftkxcM+1xQ3HyUbxNuYeNPQI4iIYcV?= =?us-ascii?Q?/vJguzNVyDRML11PEVXS9jSKKbASCMsous1RDiZ8v445KAWFUopDAeOFLWqe?= =?us-ascii?Q?hz2XCYSrpzOYSom675mtRnBT5Uc3zHdz77c0RUMgCQHS5nARo8023wQumnl+?= =?us-ascii?Q?7N0VA8jYo7gkY+zaZPQLP890hioXzfVr4EDbgrCw62tCz0B+vgWe4sF/Ji1t?= =?us-ascii?Q?ouvXdnJzHSbL0i+4Z0WTAgRmeH2M54WdAyY6u5j91FMRvmYO1DNwfepAgMl+?= =?us-ascii?Q?XM0odkfiRgn7AvloViRfjrMphYtm1NtDd8lo7ehRBQMDFSkneC1uFM+f35G9?= =?us-ascii?Q?eXaLe8/RMNY02o4BZuKGZdPvzh+hJvyA8VAoPMYQftOdDf/kqerHGU6v2ewF?= =?us-ascii?Q?6RYE1l6RkkX2zRG6nrxo6RAT3ox68rZ8yQ4SMkoQbV2sg+dUSh+/2+Aqp1VA?= =?us-ascii?Q?ZysT44IXyJ2S5QMnYZVPwT0zu7ffeCPoR7MPg79m3ta+AMgfzb9X2OqzXYRa?= =?us-ascii?Q?eiFrQbd5MgkT971xG2NVJP4Vq/xteu9CosMV+yhcPM5jjxqmwX4Abw/a07zO?= =?us-ascii?Q?b4tf6PYgfoBGBTRMiwi5mtpZuP5VVJKaPzz/QHHQNV6jOMGKa4YArv5C0IHr?= =?us-ascii?Q?yOu5M4/lI+Fo25U6Dm5dx5bgIpRDVWx2IoMddGtQjFn07reehAUjzUNLLN/K?= =?us-ascii?Q?ubU5q8vFGYY4SH4BKESEbljQdf5y29Mg9lV9NShNbwhPSejDVQqJiOlbpgaa?= =?us-ascii?Q?hbeR+oFLbcRnBTGHM1kVv6tkU3P68WPlNFALPyNHxFAnon8/EDrMJrWBdsUI?= =?us-ascii?Q?VYTlijjU6eGMwLnrjGCdcvCRrLSPvNIkdiD+iSo4G9GgNvbYWFkudsvDgNkQ?= =?us-ascii?Q?QmzU/pWUvIu0L7AyIpSUcgdlEd03dYGAeMxzQLPA87u2IgFqA/0YncZ7cq2H?= =?us-ascii?Q?47pZxm8zZ4rArvfXgej2xSkaRFQegv56gD9qSOG5952lfmbCsvgjwAXq/+ql?= =?us-ascii?Q?ckxOhYdGLIRbd0L/BMhTrqJahGTgqCyb7XY4ucd4SvFzSv1RbWZPLdCgWZo/?= =?us-ascii?Q?LpPlm0wb3T3PJnl3NbJwgefiHMcNFfRic22qVqClxLBsPLdxHqMEBBxk7aSt?= =?us-ascii?Q?j6MwJlTuYsfysSWUpZiz6Ms3Z/uZ3wIAUtVyIhJgEivgmyJHf4eKYOAn3N8B?= =?us-ascii?Q?Is4ruQuvkdgxP+Xrzl1HdYGDyJ9KKxIHEWE95uwTeLd4i4532vbFD77f4mWM?= =?us-ascii?Q?PmC4UeitKkwr3pUKzqyS4l4xyi4QuAEwlrGksT2Wb8qYTCcDAH99aw0hf6c+?= =?us-ascii?Q?vBAGF1bVCE/QqkGII8ddVrT8A8/vT6qG4eiLx4OLowC5NTAq19FTH3cixsOB?= =?us-ascii?Q?ObJaYUi87G/MCruk3Mkl4DWJ8adZFfXc9Zw0eFhspm9WdqlIT+/nAchIq+6n?= =?us-ascii?Q?xFyFgt2iGrdt/8C4pwMSaRjRXS7bKO7U3/AGF30RRNyAU3fJ9MOgYK/bbijK?= =?us-ascii?Q?06VgSIbWwm+s2LLrhpBv2UDXgYxZ+SuEw341rmmf?= 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: 965aa921-c223-409a-bcbd-08da80627616 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2022 15:09:20.2229 (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: vjOEG2SV3PC8dp1MVwpdiR3HGK4tR9YyZsqY3ZQMAfyoPDX9wwIbO03AaLqQudKbZiMGQ/8LdcCTAz1Ej2x0iA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6677 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [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 >=20 > [CAUTION: External Email] >=20 > 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 >=20 > -----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 >=20 >=20 > **CAUTION: The e-mail below is from an external source. Please exercise > caution before opening attachments, clicking links, or following guidance= .** >=20 > [AMD Official Use Only - General] >=20 > Hi Igor, > One question in line. >=20 > > -----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 >=20 > > + 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.