RFA - Use EM name property of Satellite config as prefix
The name property of EM satellite config will be used as prefix for
aggregation. This can help when we have multi satmc configuration and
RFA has to handle multiple prefixes
Tested
EM Configs
```
{
"Hostname": "10.0.2.2",
"Port": "8000",
"Name": "sat0",
"Type": "SatelliteController",
"AuthType": "None"
}
```
Aggregation Responses
```
curl -k -u root:0penBmc https://localhost:2443/redfish/v1/AggregationService/AggregationSources/
{
"@odata.id": "/redfish/v1/AggregationService/AggregationSources",
"@odata.type": "#AggregationSourceCollection.AggregationSourceCollection",
"Members": [
{
"@odata.id": "/redfish/v1/AggregationService/AggregationSources/sat0"
}
],
"Members@odata.count": 1,
"Name": "Aggregation Source Collection"
}
```
Resource Aggregation
```
curl -k -u root:0penBmc https://localhost:2443/redfish/v1/Systems
{
"@odata.id": "/redfish/v1/Systems",
"@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system"
},
{
"@odata.id": "/redfish/v1/Systems/sat0_system1"
}
],
"Members@odata.count": 2,
"Name": "Computer System Collection"
}
```
Change-Id: I2e64436c9e1858825dc71fad66293144fa55f83e
Signed-off-by: Rohit PAI <ropai@nvidia.com>
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 96be7e9..00c6e55 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -459,10 +459,7 @@
return;
}
- // For now assume there will only be one satellite config.
- // Assign it the name/prefix "5B247A"
- addSatelliteConfig("5B247A", interface.second,
- satelliteInfo);
+ addSatelliteConfig(interface.second, satelliteInfo);
}
}
}
@@ -471,11 +468,11 @@
// Parse the properties of a satellite config object and add the
// configuration if the properties are valid
static void addSatelliteConfig(
- const std::string& name,
const dbus::utility::DBusPropertiesMap& properties,
std::unordered_map<std::string, boost::urls::url>& satelliteInfo)
{
boost::urls::url url;
+ std::string prefix;
for (const auto& prop : properties)
{
@@ -529,29 +526,46 @@
}
url.set_scheme("http");
}
+ else if (prop.first == "Name")
+ {
+ const std::string* propVal =
+ std::get_if<std::string>(&prop.second);
+ if (propVal != nullptr && !propVal->empty())
+ {
+ prefix = *propVal;
+ BMCWEB_LOG_DEBUG("Using Name property {} as prefix",
+ prefix);
+ }
+ else
+ {
+ BMCWEB_LOG_DEBUG(
+ "Invalid or empty Name property, invalid satellite config");
+ return;
+ }
+ }
} // Finished reading properties
// Make sure all required config information was made available
if (url.host().empty())
{
- BMCWEB_LOG_ERROR("Satellite config {} missing Host", name);
+ BMCWEB_LOG_ERROR("Satellite config {} missing Host", prefix);
return;
}
if (!url.has_port())
{
- BMCWEB_LOG_ERROR("Satellite config {} missing Port", name);
+ BMCWEB_LOG_ERROR("Satellite config {} missing Port", prefix);
return;
}
if (!url.has_scheme())
{
- BMCWEB_LOG_ERROR("Satellite config {} missing AuthType", name);
+ BMCWEB_LOG_ERROR("Satellite config {} missing AuthType", prefix);
return;
}
std::string resultString;
- auto result = satelliteInfo.insert_or_assign(name, std::move(url));
+ auto result = satelliteInfo.insert_or_assign(prefix, std::move(url));
if (result.second)
{
resultString = "Added new satellite config ";
@@ -561,7 +575,7 @@
resultString = "Updated existing satellite config ";
}
- BMCWEB_LOG_DEBUG("{}{} at {}://{}", resultString, name,
+ BMCWEB_LOG_DEBUG("{}{} at {}://{}", resultString, prefix,
result.first->second.scheme(),
result.first->second.encoded_host_and_port());
}