Add Guarded/Deconfigured fields to callout resolutions
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I8dcb9094a43a23c4cb7e8951a430199ddc01def5
diff --git a/analyzer/resolution.cpp b/analyzer/resolution.cpp
index bfcb800..1f105eb 100644
--- a/analyzer/resolution.cpp
+++ b/analyzer/resolution.cpp
@@ -123,6 +123,19 @@
//------------------------------------------------------------------------------
+void __calloutTarget(ServiceData& io_sd, pdbg_target* i_target,
+ const callout::Priority& i_priority, bool i_guard)
+{
+ nlohmann::json callout;
+ callout["LocationCode"] = util::pdbg::getLocationCode(i_target);
+ callout["Priority"] = i_priority.getUserDataString();
+ callout["Deconfigured"] = false;
+ callout["Guarded"] = i_guard;
+ io_sd.addCallout(callout);
+}
+
+//------------------------------------------------------------------------------
+
void __calloutBackplane(ServiceData& io_sd, const callout::Priority& i_priority)
{
// TODO: There isn't a device tree object for this. So will need to hardcode
@@ -144,15 +157,11 @@
// Get the target for the hardware callout.
auto target = __getUnitTarget(__getRootCauseChipTarget(io_sd), iv_unitPath);
- // Get the location code and entity path for this target.
- auto locCode = util::pdbg::getLocationCode(target);
+ // Get the entity path for this target.
auto entityPath = util::pdbg::getPhysDevPath(target);
// Add the actual callout to the service data.
- nlohmann::json callout;
- callout["LocationCode"] = locCode;
- callout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(callout);
+ __calloutTarget(io_sd, target, iv_priority, iv_guard);
// Add the guard info to the service data.
Guard guard = io_sd.addGuard(entityPath, iv_guard);
@@ -180,10 +189,7 @@
auto txTarget = __getConnectedTarget(rxTarget, iv_busType);
// Callout the TX endpoint.
- nlohmann::json txCallout;
- txCallout["LocationCode"] = util::pdbg::getLocationCode(txTarget);
- txCallout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(txCallout);
+ __calloutTarget(io_sd, txTarget, iv_priority, iv_guard);
// Guard the TX endpoint.
Guard txGuard =
@@ -213,16 +219,10 @@
auto txTarget = __getConnectedTarget(rxTarget, iv_busType);
// Callout the RX endpoint.
- nlohmann::json rxCallout;
- rxCallout["LocationCode"] = util::pdbg::getLocationCode(rxTarget);
- rxCallout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(rxCallout);
+ __calloutTarget(io_sd, rxTarget, iv_priority, iv_guard);
// Callout the TX endpoint.
- nlohmann::json txCallout;
- txCallout["LocationCode"] = util::pdbg::getLocationCode(txTarget);
- txCallout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(txCallout);
+ __calloutTarget(io_sd, txTarget, iv_priority, iv_guard);
// Callout everything else in between.
// TODO: For P10 (OMI bus and XBUS), the callout is simply the backplane.
diff --git a/test/resolution_test.cpp b/test/resolution_test.cpp
index e92ca9d..55be828 100644
--- a/test/resolution_test.cpp
+++ b/test/resolution_test.cpp
@@ -97,6 +97,19 @@
//------------------------------------------------------------------------------
+void __calloutTarget(ServiceData& io_sd, const std::string& i_locCode,
+ const callout::Priority& i_priority, bool i_guard)
+{
+ nlohmann::json callout;
+ callout["LocationCode"] = i_locCode;
+ callout["Priority"] = i_priority.getUserDataString();
+ callout["Deconfigured"] = false;
+ callout["Guarded"] = i_guard;
+ io_sd.addCallout(callout);
+}
+
+//------------------------------------------------------------------------------
+
void __calloutBackplane(ServiceData& io_sd, const callout::Priority& i_priority)
{
// TODO: There isn't a device tree object for this. So will need to hardcode
@@ -120,10 +133,7 @@
auto entityPath = __getUnitPath(locCode, iv_unitPath);
// Add the actual callout to the service data.
- nlohmann::json callout;
- callout["LocationCode"] = locCode;
- callout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(callout);
+ __calloutTarget(io_sd, locCode, iv_priority, iv_guard);
// Add the guard info to the service data.
Guard guard = io_sd.addGuard(entityPath, iv_guard);
@@ -151,10 +161,7 @@
auto txPath = __getConnectedPath(rxPath, iv_busType);
// Callout the TX endpoint.
- nlohmann::json txCallout;
- txCallout["LocationCode"] = std::get<1>(txPath);
- txCallout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(txCallout);
+ __calloutTarget(io_sd, std::get<1>(txPath), iv_priority, iv_guard);
// Guard the TX endpoint.
Guard txGuard = io_sd.addGuard(std::get<0>(txPath), iv_guard);
@@ -183,16 +190,10 @@
auto txPath = __getConnectedPath(rxPath, iv_busType);
// Callout the RX endpoint.
- nlohmann::json rxCallout;
- rxCallout["LocationCode"] = chipPath;
- rxCallout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(rxCallout);
+ __calloutTarget(io_sd, chipPath, iv_priority, iv_guard);
// Callout the TX endpoint.
- nlohmann::json txCallout;
- txCallout["LocationCode"] = std::get<1>(txPath);
- txCallout["Priority"] = iv_priority.getUserDataString();
- io_sd.addCallout(txCallout);
+ __calloutTarget(io_sd, std::get<1>(txPath), iv_priority, iv_guard);
// Callout everything else in between.
// TODO: For P10 (OMI bus and XBUS), the callout is simply the backplane.
@@ -308,6 +309,8 @@
j = sd1.getCalloutList();
s = R"([
{
+ "Deconfigured": false,
+ "Guarded": false,
"LocationCode": "/proc0",
"Priority": "H"
},
@@ -327,6 +330,8 @@
"Procedure": "NEXTLVL"
},
{
+ "Deconfigured": false,
+ "Guarded": true,
"LocationCode": "/proc0",
"Priority": "H"
},
@@ -358,6 +363,8 @@
j = sd.getCalloutList();
s = R"([
{
+ "Deconfigured": false,
+ "Guarded": true,
"LocationCode": "/proc0",
"Priority": "A"
}
@@ -403,14 +410,20 @@
j = sd.getCalloutList();
s = R"([
{
+ "Deconfigured": false,
+ "Guarded": true,
"LocationCode": "/proc1",
"Priority": "A"
},
{
+ "Deconfigured": false,
+ "Guarded": true,
"LocationCode": "/proc0",
"Priority": "B"
},
{
+ "Deconfigured": false,
+ "Guarded": true,
"LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
"Priority": "C"
}
@@ -471,10 +484,14 @@
j = sd.getCalloutList();
s = R"([
{
+ "Deconfigured": false,
+ "Guarded": true,
"LocationCode": "/proc0",
"Priority": "A"
},
{
+ "Deconfigured": false,
+ "Guarded": true,
"LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
"Priority": "A"
},