LEDS: Provide support to override the default Blink priority

In some cases, it is needed that the Solid-ON action over rules
Blink and this patch adds that support.

Change-Id: Ib0a88b11142ccef3e39ef0a7c6eb3a037c878bc2
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/group.cpp b/group.cpp
index fda5982..6c0f06a 100644
--- a/group.cpp
+++ b/group.cpp
@@ -11,17 +11,16 @@
     // Introducing these to enable gtest.
     Manager::group ledsAssert {};
     Manager::group ledsDeAssert {};
-    Manager::group ledsUpdate {};
 
     // Group management is handled by Manager. The populated leds* sets are not
     // really used by production code. They are there to enable gtest for
     // validation.
     auto result = manager.setGroupState(path, value, ledsAssert,
-                                        ledsDeAssert, ledsUpdate);
+                                        ledsDeAssert);
 
     // If something does not go right here, then there should be an sdbusplus
     // exception thrown.
-    manager.driveLEDs(ledsAssert, ledsDeAssert, ledsUpdate);
+    manager.driveLEDs(ledsAssert, ledsDeAssert);
 
     // Set the base class's asserted to 'true' since the getter
     // operation is handled there.
diff --git a/led.yaml b/led.yaml
index d1eb692..6e90c5f 100755
--- a/led.yaml
+++ b/led.yaml
@@ -1,54 +1,41 @@
 bmc_booted:
     heartbeat:
         Action: 'On'
-        DutyOn: 50
-        Period: 0
 power_on:
     power:
         Action: 'On'
-        DutyOn: 50
-        Period: 0
+        Priority: 'On'
 enclosure_fault:
-    fault_front:
+    front_fault:
         Action: 'On'
-        DutyOn: 50
-        Period: 0
-    fault_rear:
+    rear_fault:
         Action: 'On'
-        DutyOn: 50
-        Period: 0
 enclosure_identify:
     front_id:
         Action: 'Blink'
         DutyOn: 50
         Period: 1000
     rear_id:
-        DutyOn: 50
         Action: 'Blink'
+        DutyOn: 50
         Period: 1000
 fan_fault:
     front_fault:
-        Period: 0
-        DutyOn: 50
         Action: 'On'
     fan0:
-        DutyOn: 50
         Action: 'On'
-        Period: 0
     rear_fault:
-        Period: 0
-        DutyOn: 50
         Action: 'On'
 fan_identify:
     front_id:
-        Period: 1000
         Action: 'Blink'
         DutyOn: 50
+        Period: 1000
     rear_id:
+        Action: 'Blink'
+        DutyOn: 50
         Period: 1000
-        Action: 'Blink'
-        DutyOn: 50
     fan0:
-        DutyOn: 50
         Action: 'Blink'
+        DutyOn: 50
         Period: 1000
diff --git a/ledlayout.hpp b/ledlayout.hpp
index 998feb5..ca63166 100644
--- a/ledlayout.hpp
+++ b/ledlayout.hpp
@@ -2,6 +2,7 @@
 
 #include <map>
 #include <set>
+
 namespace phosphor
 {
 namespace led
@@ -30,13 +31,24 @@
         Action action;
         uint8_t dutyOn;
         uint16_t period;
+        Action priority;
 
-        // Needed for inserting elements into sets
+        // Order LEDs such that same LEDs are grouped next to
+        // each other and the same LEDs are in priority order
+        // with the highest priority coming first
         bool operator<(const LedAction& right) const
         {
             if (name == right.name)
             {
-                return action < right.action;
+                if (action == right.action)
+                {
+                    return false;
+                }
+                else if (action == priority)
+                {
+                    return true;
+                }
+                return action > right.action;
             }
             return name < right.name;
         }
diff --git a/manager.cpp b/manager.cpp
index 4ebc024..77ba546 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -11,8 +11,7 @@
 
 // Assert -or- De-assert
 bool Manager::setGroupState(const std::string& path, bool assert,
-                            group& ledsAssert, group& ledsDeAssert,
-                            group& ledsUpdate)
+                            group& ledsAssert, group& ledsDeAssert)
 {
     if (assert)
     {
@@ -34,55 +33,73 @@
         desiredState.insert(grp->cbegin(), grp->cend());
     }
 
-    // Has the LEDs that are either to be turned off -or- want a new assertion
+    // Find difference between Combined and Desired to identify
+    // which LEDs are getting altered
     group transient {};
-    std::set_difference(currentState.begin(), currentState.end(),
+    std::set_difference(combinedState.begin(), combinedState.end(),
                         desiredState.begin(), desiredState.end(),
                         std::inserter(transient, transient.begin()),
                         ledComp);
     if(transient.size())
     {
-        // We really do not want the Manager to know how a particular LED
-        // transitions from State-A --> State-B and all this must be handled by
-        // the physical LED controller implementation.
-        // So in this case, Manager really does not want to turn off the
-        // LEDs and then turning it back on and let the physical LED controller
-        // handle that.
+        // Find common LEDs between transient and Desired to know if some LEDs
+        // are changing state and not really getting DeAsserted
+        group ledsTransient {};
+        std::set_intersection(transient.begin(),transient.end(),
+                            desiredState.begin(), desiredState.end(),
+                            std::inserter(ledsTransient, ledsTransient.begin()),
+                            ledLess);
 
-        // If we previously had a FRU in ON state , and then if there was a
-        // request to make it blink, the end state would now be blink.
-        // If we either turn off blink / fault, then we need to go back to its
-        // previous state.
-        std::set_intersection(desiredState.begin(), desiredState.end(),
-                              transient.begin(), transient.end(),
-                              std::inserter(ledsUpdate, ledsUpdate.begin()),
-                              ledComp);
-
-        // These LEDs are only to be De-Asserted.
-        std::set_difference(transient.begin(), transient.end(),
-                            ledsUpdate.begin(), ledsUpdate.end(),
+        // Find difference between above 2 to identify those LEDs which are
+        // really getting DeAsserted
+        std::set_difference(transient.begin(),transient.end(),
+                            ledsTransient.begin(),ledsTransient.end(),
                             std::inserter(ledsDeAssert, ledsDeAssert.begin()),
-                            ledComp);
+                            ledLess);
 
+        // Remove the elements from Current that are being DeAsserted.
+        if(ledsDeAssert.size())
+        {
+            // Power off LEDs that are to be really DeAsserted
+            for (auto& it:ledsDeAssert)
+            {
+                // Update LEDs in "physically asserted" set by removing those
+                // LEDs which are De-Asserted
+                auto found = currentState.find(it);
+                if (found != currentState.end())
+                {
+                    currentState.erase(found);
+                }
+            }
+        }
     }
 
-    // Turn on these
-    std::set_difference(desiredState.begin(), desiredState.end(),
-                        currentState.begin(), currentState.end(),
-                        std::inserter(ledsAssert, ledsAssert.begin()),
-                        ledComp);
+    // Now LEDs that are to be Asserted. These could either be fresh asserts
+    // -or- change between [On]<-->[Blink]
+    group temp {};
+    std::unique_copy(desiredState.begin(), desiredState.end(),
+                     std::inserter(temp, temp.begin()),
+                     ledEqual);
+    if(temp.size())
+    {
+        // Find difference between [desired to be Asserted] and those LEDs
+        // that are physically asserted currently.
+        std::set_difference(temp.begin(), temp.end(),
+                            currentState.begin(), currentState.end(),
+                            std::inserter(ledsAssert, ledsAssert.begin()),
+                            ledComp);
+    }
 
-
-    // Done.. Save the latest and greatest.
-    currentState = std::move(desiredState);
+    // Update the current actual and desired(the virtual actual)
+    currentState = std::move(temp);
+    combinedState = std::move(desiredState);
 
     // If we survive, then set the state accordingly.
     return assert;
 }
 
 /** @brief Run through the map and apply action on the LEDs */
-void Manager::driveLEDs(group& ledsAssert, group& ledsDeAssert,
-                        group& ledsUpdate)
+void Manager::driveLEDs(group& ledsAssert, group& ledsDeAssert)
 {
     // Map of physical LED dbus paths to their Service providers
     populateObjectMap();
@@ -94,17 +111,6 @@
     }
 
     // This order of LED operation is important.
-    if (ledsUpdate.size())
-    {
-        std::cout << "Updating LED states between (On <--> Blink)"
-                  << std::endl;
-        for (const auto& it: ledsUpdate)
-        {
-            std::string objPath = std::string(PHY_LED_PATH) + it.name;
-            drivePhysicalLED(objPath, it.action, it.dutyOn);
-        }
-    }
-
     if (ledsDeAssert.size())
     {
         std::cout << "De-Asserting LEDs" << std::endl;
diff --git a/manager.hpp b/manager.hpp
index 1a75f8c..c96a4bc 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -4,6 +4,7 @@
 #include <set>
 #include <sdbusplus/bus.hpp>
 #include "ledlayout.hpp"
+
 namespace phosphor
 {
 namespace led
@@ -28,13 +29,44 @@
         Manager(Manager&&) = delete;
         Manager& operator=(Manager&&) = delete;
 
-        /** @brief For finding intersection */
+        /** @brief Special comparator for finding set difference */
         static bool ledComp(const phosphor::led::Layout::LedAction& left,
                             const phosphor::led::Layout::LedAction& right)
         {
+            // Example :
+            // If FIRST_1 is {fan0, 1, 1} and FIRST_2 is {fan0, 2, 2},
+            // with default priority of Blink, this comparator would return
+            // false. But considering the priority, this comparator would need
+            // to return true so that we consider appropriate set and in
+            // this case its {fan0, 1, 1}
+            if (left.name == right.name)
+            {
+                if (left.action == right.action)
+                {
+                    return false;
+                }
+                else
+                {
+                    return true;
+                }
+            }
             return left.name < right.name;
         }
 
+        /** @brief Comparator for finding LEDs to be DeAsserted */
+        static bool ledLess(const phosphor::led::Layout::LedAction& left,
+                            const phosphor::led::Layout::LedAction& right)
+        {
+            return left.name < right.name;
+        }
+
+        /** @brief Comparator for helping unique_copy */
+        static bool ledEqual(const phosphor::led::Layout::LedAction& left,
+                             const phosphor::led::Layout::LedAction& right)
+        {
+            return left.name == right.name;
+        }
+
         using group = std::set<phosphor::led::Layout::LedAction>;
         using LedLayout = std::map<std::string, group>;
 
@@ -58,28 +90,24 @@
          *
          *  @param[in]  path          -  dbus path of group
          *  @param[in]  assert        -  Could be true or false
-         *  @param[in]  ledsAssert    -  LEDs that are to be asserted newly
+         *  @param[in]  ledsAssert    -  LEDs that are to be asserted new
+         *                               or to a different state
          *  @param[in]  ledsDeAssert  -  LEDs that are to be Deasserted
-         *  @param[in]  ledsUpdate    -  LEDs that need a transition between
-         *                               different types of asserted states.
          *
          *  @return                   -  Success or exception thrown
          */
         bool setGroupState(const std::string& path, bool assert,
-                           group& ledsAssert, group& ledsDeAssert,
-                           group& ledsUpdate);
+                           group& ledsAssert, group& ledsDeAssert);
 
         /** @brief Finds the set of LEDs to operate on and executes action
          *
          *  @param[in]  ledsAssert    -  LEDs that are to be asserted newly
+         *                               or to a different state
          *  @param[in]  ledsDeAssert  -  LEDs that are to be Deasserted
-         *  @param[in]  ledsUpdate    -  LEDs that need a transition between
-         *                               different types of asserted states.
          *
          *  @return: None
          */
-        void driveLEDs(group& ledsAssert, group& ledsDeAssert,
-                       group& ledsUpdate);
+        void driveLEDs(group& ledsAssert, group& ledsDeAssert);
 
     private:
         /** @brief sdbusplus handler */
@@ -91,9 +119,14 @@
         /** @brief Pointers to groups that are in asserted state */
         std::set<const group*> assertedGroups;
 
-        /** @brief Contains the LEDs that are in asserted state */
+        /** @brief Contains the highest priority actions for all
+         *         asserted LEDs.
+         */
         group currentState;
 
+        /** @brief Contains the set of all actions for asserted LEDs */
+        group combinedState;
+
         /** @brief Returns action string based on enum
          *
          *  @param[in]  action - Action enum
diff --git a/parse_led.py b/parse_led.py
index 5afe4b0..5392e97 100755
--- a/parse_led.py
+++ b/parse_led.py
@@ -63,9 +63,10 @@
                 ofile.write('        {\"' + underscore(led_dict) + '\",')
                 ofile.write('phosphor::led::Layout::' +
                             str(list_dict.get('Action', 'Off')) + ',')
-                ofile.write(str(list_dict.get('DutyOn', 0)) + ',')
+                ofile.write(str(list_dict.get('DutyOn', 50)) + ',')
                 ofile.write(str(list_dict.get('Period', 0)) + ',')
-
+                priority = str(list_dict.get('Priority', 'Blink'))
+                ofile.write('phosphor::led::Layout::' + priority + ',')
                 ofile.write('},\n')
             ofile.write('   }},\n')
         ofile.write('};\n')
diff --git a/test/led-test-map.hpp b/test/led-test-map.hpp
index a8a62af..0b44ee3 100644
--- a/test/led-test-map.hpp
+++ b/test/led-test-map.hpp
@@ -1,7 +1,8 @@
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>> singleLedOn = {
     {   "/xyz/openbmc_project/ledmanager/groups/SingleLed",{
-            {"One",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
         }
     },
 };
@@ -9,7 +10,17 @@
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>> singleLedBlink = {
     {   "/xyz/openbmc_project/ledmanager/groups/SingleLed",{
-            {"One",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+        }
+    },
+};
+
+static const std::map<std::string,
+    std::set<phosphor::led::Layout::LedAction>> singleLedBlinkOverrideOn = {
+    {   "/xyz/openbmc_project/ledmanager/groups/SingleLed",{
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
         }
     },
 };
@@ -17,9 +28,12 @@
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>> multipleLedsOn = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLeds",{
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
 };
@@ -27,9 +41,12 @@
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>> multipleLedsBlink = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLeds",{
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink,0,
+                0, phosphor::led::Layout::Blink},
         }
     },
 };
@@ -37,11 +54,16 @@
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>> multipleLedsOnAndBlink = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsMix",{
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Four",phosphor::led::Layout::On},
-            {"Five",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::On,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On,
+                0, phosphor::led::Layout::Blink},
         }
     },
 };
@@ -49,15 +71,21 @@
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>> twoGroupsWithDistinctLEDsOn = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
         }
     },
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
-            {"Four",phosphor::led::Layout::On},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
 };
@@ -65,33 +93,65 @@
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>> twoGroupsWithOneComonLEDOn = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
-            {"Four",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
 };
 
 static const std::map<std::string,
-    std::set<phosphor::led::Layout::LedAction>>
-        twoGroupsWithOneComonLEDInDifferentState = {
+    std::set<phosphor::led::Layout::LedAction>> twoGroupsWithOneComonLEDOnOneLEDBlinkPriority = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         }
     },
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
-            {"Two",phosphor::led::Layout::Blink},
-            {"Four",phosphor::led::Layout::On},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        }
+    },
+};
+
+static const std::map<std::string,
+    std::set<phosphor::led::Layout::LedAction>> twoGroupsWithOneComonLEDOnPriority = {
+    {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+        }
+    },
+    {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
 };
@@ -100,16 +160,23 @@
     std::set<phosphor::led::Layout::LedAction>>
         twoGroupsWithMultiplComonLEDOn = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
-            {"Two",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
-            {"Seven",phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Seven",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
 };
@@ -118,36 +185,56 @@
     std::set<phosphor::led::Layout::LedAction>>
         twoGroupsWithMultipleComonLEDInDifferentState = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::On},
-            {"Four",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         }
     },
 };
 
 static const std::map<std::string,
     std::set<phosphor::led::Layout::LedAction>>
-        twoGroupsWithMultipleComonLEDInDifferentStateBlinkAgain = {
+        twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority = {
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::On},
-            {"Four",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         }
     },
     {   "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
         }
     },
 };
diff --git a/test/utest.cpp b/test/utest.cpp
index 19c54a2..ea08ea0 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -27,20 +27,19 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -59,20 +58,19 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -91,20 +89,19 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -117,16 +114,14 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         EXPECT_EQ(0, ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
     }
 }
 
@@ -138,22 +133,23 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -172,22 +168,23 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -206,22 +203,23 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -234,22 +232,23 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
         auto result = manager.setGroupState(group, false, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(false, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refDeAssert = {
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
         EXPECT_EQ(0, ledsAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refDeAssert and ledsDeAssert must be null.
         Manager::group temp {};
@@ -268,22 +267,23 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -296,22 +296,23 @@
         // DeAssert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
         auto result = manager.setGroupState(group, false, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(false, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refDeAssert = {
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
         EXPECT_EQ(0, ledsAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refDeAssert and ledsDeAssert must be null.
         Manager::group temp {};
@@ -324,15 +325,13 @@
         // DeAssert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
         auto result = manager.setGroupState(group, false, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(false, result);
         EXPECT_EQ(0, ledsDeAssert.size());
         EXPECT_EQ(0, ledsAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
     }
 }
 
@@ -344,24 +343,27 @@
         // Assert the LEDs.
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsMix";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::Blink},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Four",phosphor::led::Layout::On},
-            {"Five",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::On,
+                0, phosphor::led::Layout::Blink},
+            {"Three",phosphor::led::Layout::Blink,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -380,22 +382,23 @@
         // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -408,22 +411,23 @@
         // Assert Set-B
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"Four",phosphor::led::Layout::On},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -442,22 +446,23 @@
         // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -470,21 +475,21 @@
         // Assert Set-B
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"Four",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -495,30 +500,32 @@
     }
 }
 
-/** @brief Assert 2 groups having one of the LEDs common in different state */
-TEST_F(LedTest, assertTwoGroupsWithOneComonLEDInDifferentState)
+/** @brief Assert 2 groups having one of the LEDs common but having Blink as
+ * priority and Deassert*/
+TEST_F(LedTest, asserttwoGroupsWithOneComonLEDOnOneLEDBlinkPriorityAndDeAssertB)
 {
-    Manager manager(bus, twoGroupsWithOneComonLEDInDifferentState);
+    Manager manager(bus, twoGroupsWithOneComonLEDOnOneLEDBlinkPriority);
     {
         // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -531,23 +538,86 @@
         // Assert Set-B
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        // Does not action on [Three] since  priority is [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // De-Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsDeAssserted populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+        EXPECT_EQ(0, ledsAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        // [Three] is not touched since its already [Blink]
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+}
+
+/** @brief Assert 2 groups having one of the LEDs common but having Blink as
+ * priority and Deassert A */
+TEST_F(LedTest, asserttwoGroupsWithOneComonLEDOnOneLEDBlinkPriorityAndDeAssertA)
+{
+    Manager manager(bus, twoGroupsWithOneComonLEDOnOneLEDBlinkPriority);
+    {
+        // Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"Two",phosphor::led::Layout::Blink},
-            {"Four",phosphor::led::Layout::On},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -556,33 +626,302 @@
                             std::inserter(temp, temp.begin()));
         EXPECT_EQ(0, temp.size());
     }
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        // [Three] does not get actioned since it has Blink priority
+        std::set<Layout::LedAction> refAssert = {
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // De-Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsDeAssserted populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+
+        // Need just the ledsAssert populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp1 {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp1, temp1.begin()));
+        EXPECT_EQ(0, temp1.size());
+    }
+}
+
+/** @brief Assert 2 groups having one of the LEDs common but having ON as
+ * priority And Deassert A */
+TEST_F(LedTest, asserttwoGroupsWithOneComonLEDOnOneLEDOnPriorityAndDeAssertA)
+{
+    Manager manager(bus, twoGroupsWithOneComonLEDOnPriority);
+    {
+        // Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, true,
+                                            ledsAssert, ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        // Three is set to ON due to ON priority.
+        std::set<Layout::LedAction> refAssert = {
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+    }
+    {
+        // De-Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsDeAssserted populated with these.
+        // [Three] stays in [On] since [B] has it [On]
+        std::set<Layout::LedAction> refDeAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+        EXPECT_EQ(0, ledsAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+}
+
+/** @brief Assert 2 groups having one of the LEDs common but having ON as
+ * priority And Deassert B */
+TEST_F(LedTest, asserttwoGroupsWithOneComonLEDOnOneLEDOnPriorityAndDeAssertB)
+{
+    Manager manager(bus, twoGroupsWithOneComonLEDOnPriority);
+    {
+        // Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        // Three is set to ON due to ON priority.
+        std::set<Layout::LedAction> refAssert = {
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+    }
+    {
+        // De-Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsDeAssserted populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+
+        // Need just the ledsAssert populated with these.
+        // Since [Three] stood [On], need to go back to [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp1 {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
 }
 
 /** @brief Assert 2 groups having multiple common LEDs in Same State */
-TEST_F(LedTest, assertTwoGroupsWithMultiplComonLEDOn)
+TEST_F(LedTest, assertTwoGroupsWithMultiplComonLEDOnAndDeAssert)
 {
     Manager manager(bus, twoGroupsWithMultiplComonLEDOn);
     {
         // Assert Set-B
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"Two",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
-            {"Seven",phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Seven",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -595,20 +934,113 @@
         // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // De-Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsDeAssserted populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Seven",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+        EXPECT_EQ(0, ledsAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+
+    }
+}
+
+/** @brief Assert 2 groups having multiple LEDs common in different state */
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateBandA)
+{
+    Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these
+        // [Two] remains [On] due to higher priority.
+        // [Three] remains [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -620,96 +1052,33 @@
 }
 
 /** @brief Assert 2 groups having multiple LEDs common in different state */
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStates)
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateAtoB)
 {
     Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
     {
         // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
-        EXPECT_EQ(true, result);
-
-        // Need just the ledsAssserted populated with these.
-        std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::On},
-            {"Four",phosphor::led::Layout::On},
-        };
-        EXPECT_EQ(refAssert.size(), ledsAssert.size());
-        EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
-
-        // difference of refAssert and ledsAssert must be null.
-        Manager::group temp {};
-        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
-                            refAssert.begin(), refAssert.end(),
-                            std::inserter(temp, temp.begin()));
-        EXPECT_EQ(0, temp.size());
-    }
-    {
-        // Assert Set-B
-        Manager::group ledsAssert {};
-        Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
-
-        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
-        auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.'Two' gets to Blink
         // due to higher priority.
         std::set<Layout::LedAction> refAssert = {
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
-
-        // difference of refAssert and ledsAssert must be null.
-        Manager::group temp {};
-        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
-                            refAssert.begin(), refAssert.end(),
-                            std::inserter(temp, temp.begin()));
-        EXPECT_EQ(0, temp.size());
-    }
-}
-
-/** @brief Assert 2 groups having multiple LEDs common in Same State
- *         and then De-Assert One
- */
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDAndDeAssertOne)
-{
-    Manager manager(bus, twoGroupsWithMultiplComonLEDOn);
-    {
-        // Assert Set-A
-        Manager::group ledsAssert {};
-        Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
-
-        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
-        auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
-        EXPECT_EQ(true, result);
-
-        // Need just the ledsAssserted populated with these.
-        std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::On},
-        };
-        EXPECT_EQ(refAssert.size(), ledsAssert.size());
-        EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -722,21 +1091,25 @@
         // Assert Set-B
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
+        // [Three] remains [Blink] from previous
+        // [Two] moves to [On] from [Blink] due to [On] priority
         std::set<Layout::LedAction> refAssert = {
-            {"Six",phosphor::led::Layout::On},
-            {"Seven",phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -745,60 +1118,37 @@
                             std::inserter(temp, temp.begin()));
         EXPECT_EQ(0, temp.size());
     }
-    {
-        // DeAssert Set-A
-        Manager::group ledsAssert {};
-        Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
-
-        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
-        auto result = manager.setGroupState(group, false, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
-        EXPECT_EQ(false, result);
-
-        // Need just the ledsAssserted populated with these.
-        std::set<Layout::LedAction> refDeAssert = {
-            {"One",phosphor::led::Layout::On},
-        };
-        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
-        EXPECT_EQ(0, ledsAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
-
-        // difference of refAssert and ledsAssert must be null.
-        Manager::group temp {};
-        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
-                            refDeAssert.begin(), refDeAssert.end(),
-                            std::inserter(temp, temp.begin()));
-        EXPECT_EQ(0, temp.size());
-    }
 }
 
-/** @brief Assert 2 groups having multiple LEDs common but in
- *         different state and De-Assert one*/
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDeAssertOne)
+/** @brief Assert 2 groups having multiple LEDs common in different state
+ *  DeAssert twice
+ */
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateAtoBDeAssertTwice)
 {
     Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
     {
-        // Assert Set-B
+        // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
-        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -808,27 +1158,28 @@
         EXPECT_EQ(0, temp.size());
     }
     {
-        // Assert Set-A
+        // Assert Set-B
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
-        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
-        // Need just the ledsAssserted populated with these. 'Three` remains at
-        // Blink due to increased priority.
+        // Need just the ledsAssserted populated with these.
+        // [Two] turns [On] due to priority
+        // [Three] remains [Blink]
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Four",phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -838,75 +1189,340 @@
         EXPECT_EQ(0, temp.size());
     }
     {
+        // DeAssert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+
+        // Need just the ledsAssert populated with these.
+        // [Two] will go back to [Blink] from [On]
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp1 {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp1, temp1.begin()));
+        EXPECT_EQ(0, temp1.size());
+    }
+    {
         // DeAssert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, false, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(false, result);
 
-        // Need just the ledsUpdated populated with these.
-        std::set<Layout::LedAction> refUpdate = {
-            {"Two",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::Blink},
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
-        EXPECT_EQ(refUpdate.size(), ledsUpdate.size());
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
         EXPECT_EQ(0, ledsAssert.size());
 
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // DeAssert Set-A again and make sure we get all empty
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+        EXPECT_EQ(0, ledsDeAssert.size());
+        EXPECT_EQ(0, ledsAssert.size());
+    }
+}
+
+/** @brief Assert 2 groups having multiple LEDs common in different state and
+ *  mixed priority. DeAssert-A
+ */
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityAandB)
+{
+    Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+    {
+        // Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
-        std::set_difference(ledsUpdate.begin(), ledsUpdate.end(),
-                            refUpdate.begin(), refUpdate.end(),
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
                             std::inserter(temp, temp.begin()));
         EXPECT_EQ(0, temp.size());
+    }
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
 
-        // Need just the ledsDeAsserted populated with these.
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        // [Two] gets to [ON] due to higher priority.
+        // [Three] remains on since it never was in [Blink] before
+        // [Ten] remains [Blink] due to priority: [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // De-Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsDeAsssert populated with these.
         std::set<Layout::LedAction> refDeAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Four",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
 
+        // Need just the ledsAsssert populated with these.
+        // [Ten] Moves to [On] since there is no prior [Blink]
+        // [Three] remains [On] since it never changed state.
+        // [Two] remains [On] since it did not go back
+        std::set<Layout::LedAction> refAssert = {
+            {"Ten",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+
         // difference of refAssert and ledsAssert must be null.
-        temp.clear();
-        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
-                            refDeAssert.begin(), refDeAssert.end(),
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
                             std::inserter(temp, temp.begin()));
         EXPECT_EQ(0, temp.size());
     }
 }
 
-/** @brief Assert 2 groups having multiple LEDs common but in
- *         different state and De-Assert one and make sure the
- *         state is changed back to Blink
+/** @brief Assert 2 groups having multiple LEDs common in different state and
+ *  mixed priority. DeAssert-B
  */
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDeAssertOneGetBlink)
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityAandBDeAssertB)
 {
-    Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateBlinkAgain);
+    Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
     {
-        // Assert Set-B
+        // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
-        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
         // Need just the ledsAssserted populated with these.
         std::set<Layout::LedAction> refAssert = {
-            {"Two",phosphor::led::Layout::Blink},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Five",phosphor::led::Layout::On},
-            {"Six",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        // [Two] gets to [ON] due to higher priority.
+        // [Three] remains on since it never was in [Blink] before
+        // [Ten] remains [Blink] due to priority: [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // De-Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsDeAsssert populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+
+        // Need just the ledsAsssert populated with these.
+        // [Ten] remains [Blink] since it did not move to [On]
+        // [Three] remains [On] since it never changed state.
+        // [Two] moves to [Blink] since there is no prior [On]
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+}
+
+/** @brief Assert 2 groups having multiple LEDs common in different state and
+ *  mixed priority.
+ */
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityBandA)
+{
+    Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -919,24 +1535,67 @@
         // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
         auto result = manager.setGroupState(group, true, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
+                                            ledsDeAssert);
         EXPECT_EQ(true, result);
 
-        // Need just the ledsAssserted populated with these. 'Three` remains at
-        // Blink due to increased priority. Two is already in asserted state and
-        // it wont be asserted again.
+        // Need just the ledsAssserted populated with these.
+        // [Two] remains [ON] due to higher priority.
+        // [Three] remains on since it never was in [Blink] before
+        // [Ten] moves to [Blink] due to priority: [Blink]
         std::set<Layout::LedAction> refAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Three",phosphor::led::Layout::Blink},
-            {"Four",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
         EXPECT_EQ(refAssert.size(), ledsAssert.size());
         EXPECT_EQ(0, ledsDeAssert.size());
-        EXPECT_EQ(0, ledsUpdate.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+}
+
+/** @brief Assert 2 groups having multiple LEDs common in different state and
+ *  mixed priority and De-Assert-A
+ */
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityBandADeAssertA)
+{
+    Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
@@ -946,42 +1605,232 @@
         EXPECT_EQ(0, temp.size());
     }
     {
-        // DeAssert Set-A
+        // Assert Set-A
         Manager::group ledsAssert {};
         Manager::group ledsDeAssert {};
-        Manager::group ledsUpdate {};
 
         auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
-        auto result = manager.setGroupState(group, false, ledsAssert,
-                                            ledsDeAssert, ledsUpdate);
-        EXPECT_EQ(false, result);
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
 
-        // Need just the ledsUpdated populated with these.
-        std::set<Layout::LedAction> refUpdate = {
-            {"Three",phosphor::led::Layout::Blink},
+        // Need just the ledsAssserted populated with these.
+        // [Two] remains [ON] due to higher priority.
+        // [Three] remains on since it never was in [Blink] before
+        // [Ten] moves to [Blink] due to priority: [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
         };
-        EXPECT_EQ(refUpdate.size(), ledsUpdate.size());
-        EXPECT_EQ(0, ledsAssert.size());
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
 
         // difference of refAssert and ledsAssert must be null.
         Manager::group temp {};
-        std::set_difference(ledsUpdate.begin(), ledsUpdate.end(),
-                            refUpdate.begin(), refUpdate.end(),
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
                             std::inserter(temp, temp.begin()));
         EXPECT_EQ(0, temp.size());
+    }
+    {
+        // De-Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
 
-        // Need just the ledsDeAsserted populated with these.
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsAssserted populated with these.
+        // [Ten] remains [Blink] due to priority.
         std::set<Layout::LedAction> refDeAssert = {
-            {"One",phosphor::led::Layout::On},
-            {"Four",phosphor::led::Layout::On},
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
         };
         EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
 
+        // Need just the ledsAssserted populated with these.
+        // [Two] remains [ON] due to higher priority.
+        // [Three] remains [On] since it never was in [Blink] before
+        // [Ten] moves to [On] due to priority: [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"Ten",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+
         // difference of refAssert and ledsAssert must be null.
-        temp.clear();
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+}
+
+/** @brief Assert 2 groups having multiple LEDs common in different state and
+ *  mixed priority and then DeAssert twice.
+ */
+TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateOnBlinkPriorityBandA)
+{
+    Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+    {
+        // Assert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // Assert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, true, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(true, result);
+
+        // Need just the ledsAssserted populated with these.
+        // [Two] remains [ON] due to higher priority.
+        // [Three] remains on since it never was in [Blink] before
+        // [Ten] moves to [Blink] due to priority: [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+        EXPECT_EQ(0, ledsDeAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // DeAssert Set-B
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsAssserted populated with these.
+        // [Ten] remains [Blink] due to priority.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"Five",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Six",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
         std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
                             refDeAssert.begin(), refDeAssert.end(),
                             std::inserter(temp, temp.begin()));
         EXPECT_EQ(0, temp.size());
+
+        // Need just the ledsAssert populated with these.
+        // [Two] will move to [Blink]
+        std::set<Layout::LedAction> refAssert = {
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+        };
+        EXPECT_EQ(refAssert.size(), ledsAssert.size());
+
+        // difference of refAssert and ledsAssert must be null.
+        Manager::group temp1 {};
+        std::set_difference(ledsAssert.begin(), ledsAssert.end(),
+                            refAssert.begin(), refAssert.end(),
+                            std::inserter(temp1, temp1.begin()));
+        EXPECT_EQ(0, temp1.size());
+    }
+    {
+        // DeAssert Set-A
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+
+        // Need just the ledsAssserted populated with these.
+        std::set<Layout::LedAction> refDeAssert = {
+            {"One",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Two",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::On},
+            {"Three",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::Blink},
+            {"Four",phosphor::led::Layout::On, 0,
+                0, phosphor::led::Layout::On},
+            {"Ten",phosphor::led::Layout::Blink, 0,
+                0, phosphor::led::Layout::Blink},
+        };
+        EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
+        EXPECT_EQ(0, ledsAssert.size());
+
+        // difference of refDeAssert and ledsDeAssert must be null.
+        Manager::group temp {};
+        std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
+                            refDeAssert.begin(), refDeAssert.end(),
+                            std::inserter(temp, temp.begin()));
+        EXPECT_EQ(0, temp.size());
+    }
+    {
+        // DeAssert Set-B again and make sure we get all empty
+        Manager::group ledsAssert {};
+        Manager::group ledsDeAssert {};
+
+        auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+        auto result = manager.setGroupState(group, false, ledsAssert,
+                                            ledsDeAssert);
+        EXPECT_EQ(false, result);
+        EXPECT_EQ(0, ledsDeAssert.size());
+        EXPECT_EQ(0, ledsAssert.size());
     }
 }