remove IPMI_CC

Since IPMI_CC declared in api.h has been gradually deprecated,
this submission will use ipmi::cc in api.hpp instead.

Change-Id: Iaaca85d13ebd1e114587fe64ec169ad92efc7f9d
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 90e2ebf..4808f4b 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -160,18 +160,18 @@
     auto& sensorTree = getSensorTree();
     if (!getSensorSubtree(sensorTree) && sensorTree.empty())
     {
-        return IPMI_CC_RESPONSE_ERROR;
+        return ipmi::ccResponseError;
     }
 
     if (ctx == nullptr)
     {
-        return IPMI_CC_RESPONSE_ERROR;
+        return ipmi::ccResponseError;
     }
 
     path = getPathFromSensorNumber((ctx->lun << 8) | sensnum);
     if (path.empty())
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::ccInvalidFieldRequest;
     }
 
     for (const auto& sensor : sensorTree)
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index 856699b..1de8607 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -242,7 +242,7 @@
     auto deviceFind = deviceHashes.find(devId);
     if (deviceFind == deviceHashes.end())
     {
-        return {IPMI_CC_SENSOR_INVALID, {}};
+        return {ipmi::ccSensorInvalid, {}};
     }
 
     cacheBus = deviceFind->second.first;
@@ -548,7 +548,7 @@
 {
     if (deviceHashes.size() < index)
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::ccInvalidFieldRequest;
     }
     auto device = deviceHashes.begin() + index;
     uint16_t& bus = device->second.first;
@@ -584,7 +584,7 @@
         });
     if (fru == frus.end())
     {
-        return IPMI_CC_RESPONSE_ERROR;
+        return ipmi::ccResponseError;
     }
     std::string name;
     uint8_t entityID = 0;
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 2485071..05471b1 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -42,7 +42,7 @@
     {
         lg2::error("Error in D-Bus call: {ERROR}", "ERROR", e);
         commit<InternalFailure>();
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::ccUnspecifiedError;
     }
     return ipmi::ccSuccess;
 }
@@ -212,7 +212,7 @@
         if (iter == std::get<OffsetValueMap>(property.second).end())
         {
             lg2::error("Invalid event data");
-            return IPMI_CC_PARM_OUT_OF_RANGE;
+            return ipmi::ccParmOutOfRange;
         }
         msg.append(iter->second.assert);
     }
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index eb45900..c8d6d94 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -1179,7 +1179,7 @@
     fru = frus.find(fruID);
     if (fru == frus.end())
     {
-        return IPMI_CC_SENSOR_INVALID;
+        return ipmi::ccSensorInvalid;
     }
 
     /* Header */
@@ -1239,7 +1239,7 @@
     // Check for invalid offset size
     if (req->offset > sizeof(record))
     {
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::ccParmOutOfRange;
     }
 
     dataLength = std::min(static_cast<size_t>(req->bytes_to_read),
@@ -1273,7 +1273,7 @@
     entity = entityRecords.find(entityRecordID);
     if (entity == entityRecords.end())
     {
-        return IPMI_CC_SENSOR_INVALID;
+        return ipmi::ccSensorInvalid;
     }
 
     /* Header */
@@ -1312,7 +1312,7 @@
     // Check for invalid offset size
     if (req->offset > sizeof(record))
     {
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::ccParmOutOfRange;
     }
 
     dataLength = std::min(static_cast<size_t>(req->bytes_to_read),
@@ -1362,7 +1362,7 @@
             sensor = ipmi::sensor::sensors.find(recordID);
             if (sensor == ipmi::sensor::sensors.end())
             {
-                return IPMI_CC_SENSOR_INVALID;
+                return ipmi::ccSensorInvalid;
             }
         }
     }
@@ -1418,7 +1418,7 @@
 
     if (req->offset > sizeof(record))
     {
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::ccParmOutOfRange;
     }
 
     // data_len will ultimately be the size of the record, plus
@@ -1460,7 +1460,7 @@
     if ((paraLen < selSystemEventSizeWith1Bytes) ||
         (paraLen > selSystemEventSizeWith3Bytes))
     {
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     if (isFromSystemChannel())
@@ -1488,7 +1488,7 @@
         ((req->data[0] & byte2EnableMask) != 0 &&
          paraLen < selSystemEventSizeWith2Bytes))
     {
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     // Count bytes of Event Data
@@ -1521,7 +1521,7 @@
     catch (const sdbusplus::exception_t& e)
     {
         lg2::error("exception message: {ERROR}", "ERROR", e);
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::ccUnspecifiedError;
     }
     return ipmi::ccSuccess;
 }
diff --git a/storagehandler.cpp b/storagehandler.cpp
index a62f8f9..c13c760 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -289,7 +289,7 @@
     if (*data_len != sizeof(ipmi::sel::GetSELEntryRequest))
     {
         *data_len = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     auto requestData =
@@ -300,7 +300,7 @@
         if (!checkSELReservation(requestData->reservationID))
         {
             *data_len = 0;
-            return IPMI_CC_INVALID_RESERVATION_ID;
+            return ipmi::ccInvalidReservationId;
         }
     }
 
@@ -313,7 +313,7 @@
     if (selCacheMap.empty())
     {
         *data_len = 0;
-        return IPMI_CC_SENSOR_INVALID;
+        return ipmi::ccSensorInvalid;
     }
 
     SELCacheMap::const_iterator iter;
@@ -342,7 +342,7 @@
         if (iter == selCacheMap.end())
         {
             *data_len = 0;
-            return IPMI_CC_SENSOR_INVALID;
+            return ipmi::ccSensorInvalid;
         }
     }
 
@@ -369,7 +369,7 @@
             requestData->readLength > ipmi::sel::selRecordSize)
         {
             *data_len = 0;
-            return IPMI_CC_INVALID_FIELD_REQUEST;
+            return ipmi::ccInvalidFieldRequest;
         }
 
         auto diff = ipmi::sel::selRecordSize - requestData->offset;
diff --git a/test/oemrouter_unittest.cpp b/test/oemrouter_unittest.cpp
index 9880d72..6cdc3d9 100644
--- a/test/oemrouter_unittest.cpp
+++ b/test/oemrouter_unittest.cpp
@@ -157,19 +157,21 @@
 
     // Message too short to include whole OEN?
     dataLen = 2;
-    EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
+    EXPECT_EQ(ipmi::ccReqDataLenInvalid,
               wildHandler(ipmi::netFnOem, 0x78, msgPlain, reply, &dataLen,
                           nullptr));
 
     // Wrong specific command?
     dataLen = 3;
-    EXPECT_EQ(IPMI_CC_INVALID, wildHandler(ipmi::netFnOem, 0x89, msgPlain,
-                                           reply, &dataLen, nullptr));
+    EXPECT_EQ(ipmi::ccInvalidCommand,
+              wildHandler(ipmi::netFnOem, 0x89, msgPlain, reply, &dataLen,
+                          nullptr));
 
     // Wrong OEN?
     dataLen = 3;
-    EXPECT_EQ(IPMI_CC_INVALID, wildHandler(ipmi::netFnOem, 0x78, msgBadOen,
-                                           reply, &dataLen, nullptr));
+    EXPECT_EQ(ipmi::ccInvalidCommand,
+              wildHandler(ipmi::netFnOem, 0x78, msgBadOen, reply, &dataLen,
+                          nullptr));
 }
 
 } // namespace oem