diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2012-08-17 12:55:32 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-08-27 15:14:36 -0500 |
commit | 08b394126bfa79b46042ac1c101904a9ed133cf4 (patch) | |
tree | 80e07d0cbd2c59060128fb81d3df7e6a099122d5 /src | |
parent | dd6e436cdb10ef09a73490e8ddb8df6f84d74817 (diff) | |
download | talos-hostboot-08b394126bfa79b46042ac1c101904a9ed133cf4.tar.gz talos-hostboot-08b394126bfa79b46042ac1c101904a9ed133cf4.zip |
Support resolving affinity path into a target
- Updated target service's "toTarget" API to support affinity paths
- Updated testcase to verify additional behavior
Change-Id: Ie9dc0f4796be80312fda226e6b030bbb00054681
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1554
Tested-by: Jenkins Server
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/targeting/common/targetservice.C | 17 | ||||
-rw-r--r-- | src/usr/targeting/common/test/testcommontargeting.H | 22 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/usr/targeting/common/targetservice.C b/src/usr/targeting/common/targetservice.C index d920ae07d..605933241 100644 --- a/src/usr/targeting/common/targetservice.C +++ b/src/usr/targeting/common/targetservice.C @@ -291,7 +291,22 @@ Target* TargetService::toTarget( for (uint32_t i = 0; i < iv_maxTargets; ++i) { - if (i_entityPath == (*iv_targets)[i].getAttr<ATTR_PHYS_PATH> ()) + bool found = false; + switch(i_entityPath.type()) + { + case EntityPath::PATH_PHYSICAL: + found = ( (i_entityPath) + == (*iv_targets)[i].getAttr<ATTR_PHYS_PATH>()); + break; + case EntityPath::PATH_AFFINITY: + found = ( (i_entityPath) + == (*iv_targets)[i].getAttr<ATTR_AFFINITY_PATH>()); + break; + default: + break; + } + + if (found) { l_pTarget = &(*iv_targets)[i]; break; diff --git a/src/usr/targeting/common/test/testcommontargeting.H b/src/usr/targeting/common/test/testcommontargeting.H index 13cd07418..6a0ea8d8f 100644 --- a/src/usr/targeting/common/test/testcommontargeting.H +++ b/src/usr/targeting/common/test/testcommontargeting.H @@ -166,6 +166,28 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite { TARG_TS_FAIL("Expected to get the original target"); } + + // Post init + // Tested API: Target* toTarget( + // const EntityPath& i_entityPath) const; + // Behavior: Given an arbitrary target, I should be able to take its + // affinity path and convert it to the original target + PredicateCTM mbaPredicate(CLASS_UNIT,TYPE_MBA); + TargetRangeFilter mbaFilter( + targetService().begin(), + targetService().end(), + &mbaPredicate); + for(;mbaFilter;++mbaFilter) + { + Target* pCandidate = l_targetService.toTarget( + mbaFilter->getAttr<ATTR_AFFINITY_PATH>()); + if (pCandidate != *mbaFilter) + { + TARG_TS_FAIL("Failed to convert MBA target's affinity path " + "back to original target"); + } + break; + } // Post init // Test: void getAssociated( |