@@ -20,6 +20,7 @@ use nv_redfish::ServiceRoot;
2020use nv_redfish_core:: ODataId ;
2121use nv_redfish_tests:: ami_viking_service_root;
2222use nv_redfish_tests:: anonymous_1_9_service_root;
23+ use nv_redfish_tests:: json_merge;
2324use nv_redfish_tests:: Bmc ;
2425use nv_redfish_tests:: Expect ;
2526use nv_redfish_tests:: ODATA_ID ;
@@ -187,6 +188,58 @@ async fn anonymous_1_9_0_wrong_chassis_status_state_workaround() -> Result<(), B
187188 Ok ( ( ) )
188189}
189190
191+ #[ test]
192+ async fn nvswitch_wrong_location_part_location_type_workaround ( ) -> Result < ( ) , Box < dyn StdError > > {
193+ // Platform under test: NVSwitch (`Vendor=NVIDIA`, `Product=P3809`).
194+ // Quirk under test: invalid Location.PartLocation.LocationType="Unknown".
195+ let bmc = Arc :: new ( Bmc :: default ( ) ) ;
196+ let ids = ids ( ) ;
197+ let root = expect_nvswitch_service_root (
198+ bmc. clone ( ) ,
199+ & ids,
200+ json ! ( {
201+ "Chassis" : { ODATA_ID : & ids. chassis_collection_id }
202+ } ) ,
203+ )
204+ . await ?;
205+ bmc. expect ( Expect :: expand (
206+ & ids. chassis_collection_id ,
207+ json ! ( {
208+ ODATA_ID : & ids. chassis_collection_id,
209+ ODATA_TYPE : CHASSIS_COLLECTION_DATA_TYPE ,
210+ "Id" : "Chassis" ,
211+ "Name" : "Chassis Collection" ,
212+ "Members" : [
213+ {
214+ ODATA_ID : & ids. chassis_id
215+ }
216+ ]
217+ } ) ,
218+ ) ) ;
219+
220+ let collection = root. chassis ( ) . await ?. unwrap ( ) ;
221+ expect_chassis_get (
222+ bmc. clone ( ) ,
223+ & ids,
224+ json ! ( { // Real id: CPLD_0
225+ ODATA_ID : & ids. chassis_id,
226+ ODATA_TYPE : CHASSIS_DATA_TYPE ,
227+ "Id" : "1" ,
228+ "Name" : "Chassis" ,
229+ "ChassisType" : "Module" ,
230+ "Location" : {
231+ "PartLocation" : {
232+ "LocationType" : "Unknown"
233+ }
234+ }
235+ } ) ,
236+ ) ;
237+ let members = collection. members ( ) . await ?;
238+ assert_eq ! ( members. len( ) , 1 ) ;
239+
240+ Ok ( ( ) )
241+ }
242+
190243async fn expect_viking_service_root (
191244 bmc : Arc < Bmc > ,
192245 ids : & Ids ,
@@ -211,6 +264,34 @@ async fn expect_anonymous_1_9_service_root(
211264 ServiceRoot :: new ( bmc) . await . map_err ( Into :: into)
212265}
213266
267+ async fn expect_nvswitch_service_root (
268+ bmc : Arc < Bmc > ,
269+ ids : & Ids ,
270+ fields : Value ,
271+ ) -> Result < ServiceRoot < Bmc > , Box < dyn StdError > > {
272+ bmc. expect ( Expect :: get (
273+ & ids. root_id ,
274+ json_merge ( [
275+ & json ! ( {
276+ ODATA_ID : & ids. root_id,
277+ ODATA_TYPE : "#ServiceRoot.v1_13_0.ServiceRoot" ,
278+ "Id" : "RootService" ,
279+ "Name" : "RootService" ,
280+ "Vendor" : "NVIDIA" ,
281+ "Product" : "P3809" ,
282+ "ProtocolFeaturesSupported" : {
283+ "ExpandQuery" : {
284+ "NoLinks" : true
285+ }
286+ } ,
287+ "Links" : { }
288+ } ) ,
289+ & fields,
290+ ] ) ,
291+ ) ) ;
292+ ServiceRoot :: new ( bmc) . await . map_err ( Into :: into)
293+ }
294+
214295fn expect_chassis_collection ( bmc : Arc < Bmc > , ids : & Ids ) {
215296 bmc. expect ( Expect :: get (
216297 & ids. chassis_collection_id ,
0 commit comments