summaryrefslogtreecommitdiff
path: root/test/redfish-core/lib/telemetry_service_test.cpp
blob: f7c516bf5225086d8cac2fe9f2b180da7c68b420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright OpenBMC Authors
#include "telemetry_service.hpp"

#include <nlohmann/json.hpp>

#include <gtest/gtest.h>

namespace redfish
{
namespace
{

TEST(TelemetryServiceTest, TelemetryServiceStaticAttributesAreExpected)
{
    nlohmann::json json;

    setTelemetryServiceStaticAttributes(json);

    EXPECT_EQ(json.size(), 7);
    EXPECT_EQ(json["@odata.type"], "#TelemetryService.v1_2_1.TelemetryService");
    EXPECT_EQ(json["@odata.id"], "/redfish/v1/TelemetryService");
    EXPECT_EQ(json["Id"], "TelemetryService");
    EXPECT_EQ(json["Name"], "Telemetry Service");

    const nlohmann::json& metricReportDefinitions =
        json["MetricReportDefinitions"];
    EXPECT_EQ(metricReportDefinitions.size(), 1);
    EXPECT_EQ(metricReportDefinitions["@odata.id"],
              "/redfish/v1/TelemetryService/MetricReportDefinitions");

    const nlohmann::json& metricReports = json["MetricReports"];
    EXPECT_EQ(metricReports.size(), 1);
    EXPECT_EQ(metricReports["@odata.id"],
              "/redfish/v1/TelemetryService/MetricReports");

    const nlohmann::json& triggers = json["Triggers"];
    EXPECT_EQ(triggers.size(), 1);
    EXPECT_EQ(triggers["@odata.id"], "/redfish/v1/TelemetryService/Triggers");
}

} // namespace
} // namespace redfish