summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch
blob: b689748ea62b66d07344257d342ba9f51e7c834a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
From c65d6f4a6d2939335608957fba25e5c8a445813e Mon Sep 17 00:00:00 2001
From: Vikram Bodireddy <vikram.bodireddy@intel.com>
Date: Mon, 28 Jun 2021 21:56:18 +0530
Subject: [PATCH] Firmware update configuration changes

This commit will provide user to PATCH the below firmware update
attributes before uploding the firmware image.

1. This will have PATCH support for 'HttpPushUriTargets' and
'HttpPushUriTargetsBusy' attributes. These attributes enables
'HttpPushUri' to distinguish between the firmware update targets.

2. ApplyOptions are used to specify firmware update specific options
such as ClearConfig which is used while activating the updated
firmware. This setting is maintained in a local static variable
when set using PATCH method. Its used in activate image as input
parameter. This attribute is added as Oem as the default
UpdateService interface doesn't specify any relevant or appropriate
attribute for this.

Tested:
 - GET on "/redfish/v1/UpdateService", got below response
.........
  "HttpPushUriTargets": [],
  "HttpPushUriTargetsBusy": false
........

 - PATCH on "/redfish/v1/UpdateService" and works fine.
{
   "HttpPushUriTargets": ["bmc_recovery"],
   "HttpPushUriTargetsBusy": true
}

 - Did Firmware update and verified end to end functionality
   for both bmc active and backup images.

 - Tested setting ClearConfig to true or false using PATCH
   method.

 - Successfully ran redfish validater with no new errors.

Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com>
---
 redfish-core/lib/update_service.hpp           | 456 ++++++++++++++----
 static/redfish/v1/$metadata/index.xml         |   3 +
 .../JsonSchemas/OemUpdateService/index.json   |  69 +++
 .../redfish/v1/schema/OemUpdateService_v1.xml |  40 ++
 4 files changed, 481 insertions(+), 87 deletions(-)
 create mode 100644 static/redfish/v1/JsonSchemas/OemUpdateService/index.json
 create mode 100644 static/redfish/v1/schema/OemUpdateService_v1.xml

diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 663d48b..70c58d4 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -26,7 +26,9 @@
 
 namespace redfish
 {
-
+// params for multiple firmware targets
+std::vector<std::string> httpPushUriTargets;
+bool httpPushUriTargetBusy = false;
 // Match signals added on software path
 static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateMatcher;
 static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateErrorMatcher;
@@ -34,6 +36,17 @@ static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateErrorMatcher;
 static bool fwUpdateInProgress = false;
 // Timer for software available
 static std::unique_ptr<boost::asio::steady_timer> fwAvailableTimer;
+static constexpr const char* versionIntf =
+    "xyz.openbmc_project.Software.Version";
+static constexpr const char* activationIntf =
+    "xyz.openbmc_project.Software.Activation";
+static constexpr const char* reqActivationPropName = "RequestedActivation";
+static constexpr const char* reqActivationsActive =
+    "xyz.openbmc_project.Software.Activation.RequestedActivations.Active";
+static constexpr const char* reqActivationsStandBySpare =
+    "xyz.openbmc_project.Software.Activation.RequestedActivations.StandbySpare";
+static constexpr const char* activationsStandBySpare =
+    "xyz.openbmc_project.Software.Activation.Activations.StandbySpare";
 
 inline static void cleanUp()
 {
@@ -42,28 +55,120 @@ inline static void cleanUp()
     fwUpdateErrorMatcher = nullptr;
 }
 inline static void activateImage(const std::string& objPath,
-                                 const std::string& service)
+                                 const std::string& service,
+                                 const std::vector<std::string>& imgUriTargets)
 {
     BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
+    // If targets is empty, it will apply to the active.
+    if (imgUriTargets.size() == 0)
+    {
+        crow::connections::systemBus->async_method_call(
+            [](const boost::system::error_code error_code) {
+                if (error_code)
+                {
+                    BMCWEB_LOG_DEBUG
+                        << "RequestedActivation failed: error_code = "
+                        << error_code;
+                    BMCWEB_LOG_DEBUG << "error msg = " << error_code.message();
+                }
+            },
+            service, objPath, "org.freedesktop.DBus.Properties", "Set",
+            activationIntf, reqActivationPropName,
+            std::variant<std::string>(reqActivationsActive));
+        return;
+    }
+
+    // TODO: Now we support only one target becuase software-manager
+    // code support one activation per object. It will be enhanced
+    // to multiple targets for single image in future. For now,
+    // consider first target alone.
     crow::connections::systemBus->async_method_call(
-        [](const boost::system::error_code errorCode) {
-            if (errorCode)
+        [objPath, service, imgTarget{imgUriTargets[0]}](
+            const boost::system::error_code ec,
+            const crow::openbmc_mapper::GetSubTreeType& subtree) {
+            if (ec || !subtree.size())
+            {
+                return;
+            }
+
+            for (const auto& [invObjPath, invDict] : subtree)
             {
-                BMCWEB_LOG_DEBUG << "error_code = " << errorCode;
-                BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message();
+                std::size_t idPos = invObjPath.rfind("/");
+                if ((idPos == std::string::npos) ||
+                    ((idPos + 1) >= invObjPath.size()))
+                {
+                    BMCWEB_LOG_DEBUG << "Can't parse firmware ID!!";
+                    return;
+                }
+                std::string swId = invObjPath.substr(idPos + 1);
+
+                if (swId != imgTarget)
+                {
+                    continue;
+                }
+
+                if (invDict.size() < 1)
+                {
+                    continue;
+                }
+                BMCWEB_LOG_DEBUG << "Image target matched with object "
+                                 << invObjPath;
+                crow::connections::systemBus->async_method_call(
+                    [objPath,
+                     service](const boost::system::error_code error_code,
+                              const std::variant<std::string> value) {
+                        if (error_code)
+                        {
+                            BMCWEB_LOG_DEBUG
+                                << "Error in querying activation value";
+                            // not all fwtypes are updateable,
+                            // this is ok
+                            return;
+                        }
+                        std::string activationValue =
+                            std::get<std::string>(value);
+                        BMCWEB_LOG_DEBUG << "Activation Value: "
+                                         << activationValue;
+                        std::string reqActivation = reqActivationsActive;
+                        if (activationValue == activationsStandBySpare)
+                        {
+                            reqActivation = reqActivationsStandBySpare;
+                        }
+                        BMCWEB_LOG_DEBUG
+                            << "Setting RequestedActivation value as "
+                            << reqActivation << " for " << service << " "
+                            << objPath;
+                        crow::connections::systemBus->async_method_call(
+                            [](const boost::system::error_code error_code) {
+                                if (error_code)
+                                {
+                                    BMCWEB_LOG_DEBUG
+                                        << "RequestedActivation failed: ec = "
+                                        << error_code;
+                                }
+                                return;
+                            },
+                            service, objPath, "org.freedesktop.DBus.Properties",
+                            "Set", activationIntf, reqActivationPropName,
+                            std::variant<std::string>(reqActivation));
+                    },
+                    invDict[0].first,
+                    "/xyz/openbmc_project/software/" + imgTarget,
+                    "org.freedesktop.DBus.Properties", "Get", activationIntf,
+                    "Activation");
             }
         },
-        service, objPath, "org.freedesktop.DBus.Properties", "Set",
-        "xyz.openbmc_project.Software.Activation", "RequestedActivation",
-        std::variant<std::string>(
-            "xyz.openbmc_project.Software.Activation.RequestedActivations."
-            "Active"));
+        "xyz.openbmc_project.ObjectMapper",
+        "/xyz/openbmc_project/object_mapper",
+        "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/",
+        static_cast<int32_t>(0), std::array<const char*, 1>{versionIntf});
 }
 
 // Note that asyncResp can be either a valid pointer or nullptr. If nullptr
 // then no asyncResp updates will occur
 static void
     softwareInterfaceAdded(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+                           const std::vector<std::string> imgUriTargets,
                            sdbusplus::message::message& m,
                            const crow::Request& req)
 {
@@ -76,22 +181,24 @@ static void
 
     m.read(objPath, interfacesProperties);
 
-    BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
+    BMCWEB_LOG_DEBUG << "Software Interface Added. obj path = " << objPath.str;
     for (auto& interface : interfacesProperties)
     {
         BMCWEB_LOG_DEBUG << "interface = " << interface.first;
 
-        if (interface.first == "xyz.openbmc_project.Software.Activation")
+        if (interface.first == activationIntf)
         {
             // Retrieve service and activate
             crow::connections::systemBus->async_method_call(
-                [objPath, asyncResp,
+                [objPath, asyncResp, imgTargets{imgUriTargets},
                  req](const boost::system::error_code errorCode,
                       const std::vector<std::pair<
                           std::string, std::vector<std::string>>>& objInfo) {
                     if (errorCode)
                     {
-                        BMCWEB_LOG_DEBUG << "error_code = " << errorCode;
+                        BMCWEB_LOG_DEBUG
+                            << "GetSoftwareObject path failed: error_code = "
+                            << errorCode;
                         BMCWEB_LOG_DEBUG << "error msg = "
                                          << errorCode.message();
                         if (asyncResp)
@@ -118,7 +225,7 @@ static void
                     // is added
                     fwAvailableTimer = nullptr;
 
-                    activateImage(objPath.str, objInfo[0].first);
+                    activateImage(objPath.str, objInfo[0].first, imgTargets);
                     if (asyncResp)
                     {
                         std::shared_ptr<task::TaskData> task =
@@ -250,8 +357,7 @@ static void
                 "xyz.openbmc_project.ObjectMapper",
                 "/xyz/openbmc_project/object_mapper",
                 "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str,
-                std::array<const char*, 1>{
-                    "xyz.openbmc_project.Software.Activation"});
+                std::array<const char*, 1>{activationIntf});
         }
     }
 }
@@ -261,7 +367,7 @@ static void
 static void monitorForSoftwareAvailable(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const crow::Request& req, const std::string& url,
-    int timeoutTimeSeconds = 10)
+    const std::vector<std::string>& imgUriTargets, int timeoutTimeSeconds = 10)
 {
     // Only allow one FW update at a time
     if (fwUpdateInProgress != false)
@@ -301,9 +407,10 @@ static void monitorForSoftwareAvailable(
             }
         });
 
-    auto callback = [asyncResp, req](sdbusplus::message::message& m) {
+    auto callback = [asyncResp, imgTargets{imgUriTargets},
+                     req](sdbusplus::message::message& m) {
         BMCWEB_LOG_DEBUG << "Match fired";
-        softwareInterfaceAdded(asyncResp, m, req);
+        softwareInterfaceAdded(asyncResp, imgTargets, m, req);
     };
 
     fwUpdateInProgress = true;
@@ -468,12 +575,15 @@ inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app)
             std::string fwFile = imageURI.substr(separator + 1);
             BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile;
 
+            // We will pass empty targets and its handled in activation.
+            std::vector<std::string> httpUriTargets;
+
             // Setup callback for when new software detected
             // Give TFTP 10 minutes to complete
             monitorForSoftwareAvailable(
                 asyncResp, req,
                 "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate",
-                600);
+                httpUriTargets, 600);
 
             // TFTP can take up to 10 minutes depending on image size and
             // connection speed. Return to caller as soon as the TFTP operation
@@ -522,6 +632,9 @@ inline void requestRoutesUpdateService(App& app)
             asyncResp->res.jsonValue["Name"] = "Update Service";
             asyncResp->res.jsonValue["HttpPushUri"] =
                 "/redfish/v1/UpdateService";
+            asyncResp->res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets;
+            asyncResp->res.jsonValue["HttpPushUriTargetsBusy"] =
+                httpPushUriTargetBusy;
             // UpdateService cannot be disabled
             asyncResp->res.jsonValue["ServiceEnabled"] = true;
             asyncResp->res.jsonValue["FirmwareInventory"] = {
@@ -536,7 +649,8 @@ inline void requestRoutesUpdateService(App& app)
                 asyncResp->res
                     .jsonValue["Actions"]["#UpdateService.SimpleUpdate"];
             updateSvcSimpleUpdate["target"] =
-                "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate";
+                "/redfish/v1/UpdateService/Actions/"
+                "UpdateService.SimpleUpdate";
             updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] =
                 {"TFTP"};
 #endif
@@ -578,89 +692,258 @@ inline void requestRoutesUpdateService(App& app)
                 "/xyz/openbmc_project/software/apply_time",
                 "org.freedesktop.DBus.Properties", "Get",
                 "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime");
+
+            // Get the ApplyOptions value
+            crow::connections::systemBus->async_method_call(
+                [asyncResp](const boost::system::error_code ec,
+                            const std::variant<bool> applyOption) {
+                    if (ec)
+                    {
+                        BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                        messages::internalError(asyncResp->res);
+                        return;
+                    }
+
+                    const bool* b = std::get_if<bool>(&applyOption);
+
+                    if (b)
+                    {
+                        asyncResp->res
+                            .jsonValue["Oem"]["ApplyOptions"]["@odata.type"] =
+                            "#OemUpdateService.ApplyOptions";
+                        asyncResp->res
+                            .jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] =
+                            *b;
+                    }
+                },
+                "xyz.openbmc_project.Software.BMC.Updater",
+                "/xyz/openbmc_project/software",
+                "org.freedesktop.DBus.Properties", "Get",
+                "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig");
         });
+
     BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/")
         .privileges(redfish::privileges::patchUpdateService)
-        .methods(boost::beast::http::verb::patch)(
-            [](const crow::Request& req,
-               const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
-                BMCWEB_LOG_DEBUG << "doPatch...";
+        .methods(
+            boost::beast::http::verb::
+                patch)([](const crow::Request& req,
+                          const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+            BMCWEB_LOG_DEBUG << "doPatch...";
+
+            std::optional<nlohmann::json> pushUriOptions;
+            std::optional<std::vector<std::string>> imgTargets;
+            std::optional<bool> imgTargetBusy;
+            std::optional<nlohmann::json> oemProps;
+            if (!json_util::readJson(req, asyncResp->res, "HttpPushUriOptions",
+                                     pushUriOptions, "HttpPushUriTargets",
+                                     imgTargets, "HttpPushUriTargetsBusy",
+                                     imgTargetBusy, "Oem", oemProps))
+            {
+                BMCWEB_LOG_DEBUG
+                    << "UpdateService doPatch: Invalid request body";
+                return;
+            }
+
+            if (oemProps)
+            {
+                std::optional<nlohmann::json> applyOptions;
+
+                if (!json_util::readJson(*oemProps, asyncResp->res,
+                                         "ApplyOptions", applyOptions))
+                {
+                    return;
+                }
+
+                if (applyOptions)
+                {
+                    std::optional<bool> clearConfig;
+                    if (!json_util::readJson(*applyOptions, asyncResp->res,
+                                             "ClearConfig", clearConfig))
+                    {
+                        return;
+                    }
 
-                std::optional<nlohmann::json> pushUriOptions;
-                if (!json_util::readJson(req, asyncResp->res,
-                                         "HttpPushUriOptions", pushUriOptions))
+                    if (clearConfig)
+                    {
+                        // Set the requested image apply time value
+                        crow::connections::systemBus->async_method_call(
+                            [asyncResp](const boost::system::error_code ec) {
+                                if (ec)
+                                {
+                                    BMCWEB_LOG_ERROR
+                                        << "D-Bus responses error: " << ec;
+                                    messages::internalError(asyncResp->res);
+                                    return;
+                                }
+                                messages::success(asyncResp->res);
+                            },
+                            "xyz.openbmc_project.Software.BMC.Updater",
+                            "/xyz/openbmc_project/software",
+                            "org.freedesktop.DBus.Properties", "Set",
+                            "xyz.openbmc_project.Software.ApplyOptions",
+                            "ClearConfig", std::variant<bool>{*clearConfig});
+                    }
+                }
+            }
+            if (pushUriOptions)
+            {
+                std::optional<nlohmann::json> pushUriApplyTime;
+                if (!json_util::readJson(*pushUriOptions, asyncResp->res,
+                                         "HttpPushUriApplyTime",
+                                         pushUriApplyTime))
                 {
                     return;
                 }
 
-                if (pushUriOptions)
+                if (pushUriApplyTime)
                 {
-                    std::optional<nlohmann::json> pushUriApplyTime;
-                    if (!json_util::readJson(*pushUriOptions, asyncResp->res,
-                                             "HttpPushUriApplyTime",
-                                             pushUriApplyTime))
+                    std::optional<std::string> applyTime;
+                    if (!json_util::readJson(*pushUriApplyTime, asyncResp->res,
+                                             "ApplyTime", applyTime))
                     {
                         return;
                     }
 
-                    if (pushUriApplyTime)
+                    if (applyTime)
                     {
-                        std::optional<std::string> applyTime;
-                        if (!json_util::readJson(*pushUriApplyTime,
-                                                 asyncResp->res, "ApplyTime",
-                                                 applyTime))
+                        std::string applyTimeNewVal;
+                        if (applyTime == "Immediate")
+                        {
+                            applyTimeNewVal =
+                                "xyz.openbmc_project.Software.ApplyTime."
+                                "RequestedApplyTimes.Immediate";
+                        }
+                        else if (applyTime == "OnReset")
                         {
+                            applyTimeNewVal =
+                                "xyz.openbmc_project.Software.ApplyTime."
+                                "RequestedApplyTimes.OnReset";
+                        }
+                        else
+                        {
+                            BMCWEB_LOG_INFO
+                                << "ApplyTime value is not in the list of "
+                                   "acceptable values";
+                            messages::propertyValueNotInList(
+                                asyncResp->res, *applyTime, "ApplyTime");
                             return;
                         }
 
-                        if (applyTime)
+                        // Set the requested image apply time value
+                        crow::connections::systemBus->async_method_call(
+                            [asyncResp](const boost::system::error_code ec) {
+                                if (ec)
+                                {
+                                    BMCWEB_LOG_ERROR
+                                        << "D-Bus responses error: " << ec;
+                                    messages::internalError(asyncResp->res);
+                                    return;
+                                }
+                                messages::success(asyncResp->res);
+                            },
+                            "xyz.openbmc_project.Settings",
+                            "/xyz/openbmc_project/software/apply_time",
+                            "org.freedesktop.DBus.Properties", "Set",
+                            "xyz.openbmc_project.Software.ApplyTime",
+                            "RequestedApplyTime",
+                            std::variant<std::string>{applyTimeNewVal});
+                    }
+                }
+            }
+            if (imgTargetBusy)
+            {
+                if ((httpPushUriTargetBusy) && (*imgTargetBusy))
+                {
+                    BMCWEB_LOG_DEBUG
+                        << "Other client has reserved the HttpPushUriTargets "
+                           "property for firmware updates.";
+                    messages::resourceInUse(asyncResp->res);
+                    return;
+                }
+
+                if (imgTargets)
+                {
+                    if (!(*imgTargetBusy))
+                    {
+                        BMCWEB_LOG_DEBUG
+                            << "UpdateService doPatch: httpPushUriTargetBusy "
+                               "should be "
+                               "true before setting httpPushUriTargets";
+                        messages::invalidObject(asyncResp->res,
+                                                "HttpPushUriTargetsBusy");
+                        return;
+                    }
+                    if ((*imgTargets).size() != 0)
+                    {
+                        // TODO: Now we support max one target becuase
+                        // software-manager code support one activation per
+                        // object. It will be enhanced to multiple targets for
+                        // single image in future. For now, consider first
+                        // target alone.
+                        if ((*imgTargets).size() != 1)
                         {
-                            std::string applyTimeNewVal;
-                            if (applyTime == "Immediate")
-                            {
-                                applyTimeNewVal =
-                                    "xyz.openbmc_project.Software.ApplyTime."
-                                    "RequestedApplyTimes.Immediate";
-                            }
-                            else if (applyTime == "OnReset")
-                            {
-                                applyTimeNewVal =
-                                    "xyz.openbmc_project.Software.ApplyTime."
-                                    "RequestedApplyTimes.OnReset";
-                            }
-                            else
-                            {
-                                BMCWEB_LOG_INFO
-                                    << "ApplyTime value is not in the list of "
-                                       "acceptable values";
-                                messages::propertyValueNotInList(
-                                    asyncResp->res, *applyTime, "ApplyTime");
-                                return;
-                            }
+                            messages::invalidObject(asyncResp->res,
+                                                    "HttpPushUriTargets");
+                            return;
+                        }
+                        crow::connections::systemBus->async_method_call(
+                            [asyncResp, uriTargets{*imgTargets},
+                             targetBusy{*imgTargetBusy}](
+                                const boost::system::error_code ec,
+                                const std::vector<std::string> swInvPaths) {
+                                if (ec)
+                                {
+                                    return;
+                                }
 
-                            // Set the requested image apply time value
-                            crow::connections::systemBus->async_method_call(
-                                [asyncResp](
-                                    const boost::system::error_code ec) {
-                                    if (ec)
+                                bool swInvObjFound = false;
+                                for (const std::string& path : swInvPaths)
+                                {
+                                    std::size_t idPos = path.rfind("/");
+                                    if ((idPos == std::string::npos) ||
+                                        ((idPos + 1) >= path.size()))
                                     {
-                                        BMCWEB_LOG_ERROR
-                                            << "D-Bus responses error: " << ec;
                                         messages::internalError(asyncResp->res);
+                                        BMCWEB_LOG_DEBUG
+                                            << "Can't parse firmware ID!!";
                                         return;
                                     }
-                                    messages::success(asyncResp->res);
-                                },
-                                "xyz.openbmc_project.Settings",
-                                "/xyz/openbmc_project/software/apply_time",
-                                "org.freedesktop.DBus.Properties", "Set",
-                                "xyz.openbmc_project.Software.ApplyTime",
-                                "RequestedApplyTime",
-                                std::variant<std::string>{applyTimeNewVal});
-                        }
+                                    std::string swId = path.substr(idPos + 1);
+
+                                    if (swId == uriTargets[0])
+                                    {
+                                        swInvObjFound = true;
+                                        break;
+                                    }
+                                }
+                                if (!swInvObjFound)
+                                {
+                                    messages::invalidObject(
+                                        asyncResp->res, "HttpPushUriTargets");
+                                    return;
+                                }
+                                httpPushUriTargetBusy = targetBusy;
+                                httpPushUriTargets = uriTargets;
+                            },
+                            "xyz.openbmc_project.ObjectMapper",
+                            "/xyz/openbmc_project/object_mapper",
+                            "xyz.openbmc_project.ObjectMapper",
+                            "GetSubTreePaths", "/", static_cast<int32_t>(0),
+                            std::array<const char*, 1>{versionIntf});
+                    }
+                    else
+                    {
+                        httpPushUriTargetBusy = *imgTargetBusy;
+                        httpPushUriTargets = *imgTargets;
                     }
                 }
-            });
+                else
+                {
+                    httpPushUriTargetBusy = *imgTargetBusy;
+                }
+            }
+        });
+
     BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/")
         .privileges(redfish::privileges::postUpdateService)
         .methods(boost::beast::http::verb::post)(
@@ -670,7 +953,8 @@ inline void requestRoutesUpdateService(App& app)
 
                 // Setup callback for when new software detected
                 monitorForSoftwareAvailable(asyncResp, req,
-                                            "/redfish/v1/UpdateService");
+                                            "/redfish/v1/UpdateService",
+                                            httpPushUriTargets);
 
                 std::string filepath("/tmp/images/" +
                                      boost::uuids::to_string(
@@ -683,7 +967,7 @@ inline void requestRoutesUpdateService(App& app)
                 out.close();
                 BMCWEB_LOG_DEBUG << "file upload complete!!";
             });
-}
+} // namespace redfish
 
 inline void requestRoutesSoftwareInventoryCollection(App& app)
 {
@@ -746,8 +1030,7 @@ inline void requestRoutesSoftwareInventoryCollection(App& app)
                     "/xyz/openbmc_project/object_mapper",
                     "xyz.openbmc_project.ObjectMapper", "GetSubTree",
                     "/xyz/openbmc_project/software", static_cast<int32_t>(0),
-                    std::array<const char*, 1>{
-                        "xyz.openbmc_project.Software.Version"});
+                    std::array<const char*, 1>{versionIntf});
             });
 }
 /* Fill related item links (i.e. bmc, bios) in for inventory */
@@ -911,7 +1194,7 @@ inline void requestRoutesSoftwareInventory(App& app)
                             },
                             obj.second[0].first, obj.first,
                             "org.freedesktop.DBus.Properties", "GetAll",
-                            "xyz.openbmc_project.Software.Version");
+                            versionIntf);
                     }
                     if (!found)
                     {
@@ -935,8 +1218,7 @@ inline void requestRoutesSoftwareInventory(App& app)
                 "/xyz/openbmc_project/object_mapper",
                 "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/",
                 static_cast<int32_t>(0),
-                std::array<const char*, 1>{
-                    "xyz.openbmc_project.Software.Version"});
+                std::array<const char*, 1>{versionIntf});
         });
 }
 
diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml
index eba38bf..876ebfb 100644
--- a/static/redfish/v1/$metadata/index.xml
+++ b/static/redfish/v1/$metadata/index.xml
@@ -2346,6 +2346,9 @@
     <edmx:Reference Uri="/redfish/v1/schema/OemComputerSystem_v1.xml">
         <edmx:Include Namespace="OemComputerSystem"/>
     </edmx:Reference>
+    <edmx:Reference Uri="/redfish/v1/schema/OemUpdateService_v1.xml">
+        <edmx:Include Namespace="OemUpdateService"/>
+    </edmx:Reference>
     <edmx:Reference Uri="/redfish/v1/schema/OemVirtualMedia_v1.xml">
         <edmx:Include Namespace="OemVirtualMedia"/>
         <edmx:Include Namespace="OemVirtualMedia.v1_0_0"/>
diff --git a/static/redfish/v1/JsonSchemas/OemUpdateService/index.json b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json
new file mode 100644
index 0000000..74e39cd
--- /dev/null
+++ b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json
@@ -0,0 +1,69 @@
+{
+    "$id": "http://redfish.dmtf.org/schemas/v1/OemUpdateService.json",
+    "$schema": "http://redfish.dmtf.org/schemas/v1/redfish-schema-v1.json",
+    "copyright": "Copyright 2014-2019 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright",
+    "definitions": {
+        "ApplyOptions": {
+            "additionalProperties": false,
+            "description": "An indication by boolean value whether to update firmware configuration along with firmware image update.",
+            "patternProperties": {
+                "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": {
+                    "description": "This property shall specify a valid odata or Redfish property.",
+                    "type": [
+                        "array",
+                        "boolean",
+                        "integer",
+                        "number",
+                        "null",
+                        "object",
+                        "string"
+                    ]
+                }
+            },
+            "properties": {
+                "ClearConfig": {
+                    "description": "This indicates whether to update firmware configuration or not.",
+                    "longDescription": "The value of this property is used to indicate the firmware configuration update.",
+                    "readonly": false,
+                    "type": [
+                        "boolean",
+                        "null"
+                    ]
+                }
+            },
+            "type": "object"
+        },
+        "Oem": {
+            "additionalProperties": true,
+            "description": "OemUpdateService Oem properties.",
+            "patternProperties": {
+                "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": {
+                    "description": "This property shall specify a valid odata or Redfish property.",
+                    "type": [
+                        "array",
+                        "boolean",
+                        "integer",
+                        "number",
+                        "null",
+                        "object",
+                        "string"
+                    ]
+                }
+            },
+            "properties": {
+                "ApplyOptions": {
+                    "anyOf": [
+                        {
+                            "$ref": "#/definitions/ApplyOptions"
+                        },
+                        {
+                            "type": "null"
+                        }
+                    ]
+                }
+            },
+            "type": "object"
+        }
+    },
+    "title": "#OemUpdateService"
+}
diff --git a/static/redfish/v1/schema/OemUpdateService_v1.xml b/static/redfish/v1/schema/OemUpdateService_v1.xml
new file mode 100644
index 0000000..cbb7aa4
--- /dev/null
+++ b/static/redfish/v1/schema/OemUpdateService_v1.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
+    <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/csd01/complete/vocabularies/Org.OData.Core.V1.xml">
+        <edmx:Include Namespace="Org.OData.Core.V1" Alias="OData" />
+    </edmx:Reference>
+    <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RedfishExtensions_v1.xml">
+        <edmx:Include Namespace="Validation.v1_0_0" Alias="Validation"/>
+        <edmx:Include Namespace="RedfishExtensions.v1_0_0" Alias="Redfish"/>
+    </edmx:Reference>
+    <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/UpdateService_v1.xml">
+        <edmx:Include Namespace="UpdateService"/>
+        <edmx:Include Namespace="UpdateService.v1_4_0"/>
+    </edmx:Reference>
+    <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Resource_v1.xml">
+        <edmx:Include Namespace="Resource"/>
+        <edmx:Include Namespace="Resource.v1_0_0"/>
+    </edmx:Reference>
+
+    <edmx:DataServices>
+        <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="OemUpdateService">
+            <ComplexType Name="Oem" BaseType="Resource.OemObject">
+                <Annotation Term="OData.AdditionalProperties" Bool="true" />
+                <Annotation Term="OData.Description" String="OemUpdateService Oem properties." />
+                <Annotation Term="OData.AutoExpand"/>
+                <Property Name="ApplyOptions" Type="OemUpdateService.ApplyOptions"/>
+            </ComplexType>
+
+            <ComplexType Name="ApplyOptions" BaseType="Resource.OemObject">
+                <Annotation Term="OData.AdditionalProperties" Bool="false" />
+                <Annotation Term="OData.Description" String="An indication by boolean value whether to update firmware configuration along with firmware image update." />
+                <Property Name="ClearConfig" Type="Edm.Boolean">
+                    <Annotation Term="OData.Permissions" EnumMember="OData.Permission/ReadWrite"/>
+                    <Annotation Term="OData.Description" String="This indicates whether to update firmware configuration or not."/>
+                    <Annotation Term="OData.LongDescription" String="The value of this property is used to indicate the firmware configuration update."/>
+                </Property>
+            </ComplexType>
+
+        </Schema>
+    </edmx:DataServices>
+</edmx:Edmx>
-- 
2.17.1